Skip to content

Instantly share code, notes, and snippets.

@cofearabi
cofearabi / andViewMdb
Created October 19, 2014 23:29
Android Application code referring to Access Database (mdb file)
package com.example.andviewmdb;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.view.Menu;
import android.widget.LinearLayout;
@cofearabi
cofearabi / andAddMdb
Created October 19, 2014 23:51
Android appli sample code which add a field of Access mdb database, needs three edittext fileds and two buttons.
package com.example.andaddmdb;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import android.support.v7.app.ActionBarActivity;
import android.text.SpannableStringBuilder;
import android.os.Bundle;
import android.os.Environment;
@cofearabi
cofearabi / AndroidManifest.xml
Created October 28, 2014 23:29
Android application which get the price of the stock written in Excel file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.andexcelread"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
@cofearabi
cofearabi / getkabu.py
Created May 30, 2012 22:34
(python) get stock price data from stocks.finance.yahoo.co.jp
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import urllib2
import re
def getkabuka(code):
url='http://stocks.finance.yahoo.co.jp/stocks/detail/?code='+str(code)+'.T&d=1y'
f=urllib2.urlopen(url)
txt=f.read()
@cofearabi
cofearabi / getYahoo.py
Created May 30, 2012 22:39
(python) get monthly stock data from yahoo and make csv file.
import jsm
c = jsm.QuotesCsv()
c.save_historical_prices('4689.csv',4689)
@cofearabi
cofearabi / worksheet.py
Created May 30, 2012 22:47
(python) make excel worksheet
from pyExcelerator import *
wb = Workbook()
ws = wb.add_sheet('0')
for row in xrange(100):
for col in xrange(10):
ws.write(row, col, '%d, %d' % (row, col))
wb.save(r'test01.xls')
@cofearabi
cofearabi / sample.py
Created May 30, 2012 23:00
(python)get stock price data ( daily weekly monthly ) and write temp file.
# coding=utf-8
import jsm
if __name__ == "__main__":
import tempfile
q = jsm.Quotes()
c = jsm.QuotesCsv()
for range in (jsm.DAILY, jsm.WEEKLY, jsm.MONTHLY):
print(q.get_historical_prices(4689, range))
c.save_historical_prices(tempfile.mktemp(dir='/tmp/'), 4689, range)
@cofearabi
cofearabi / mysql.php
Created October 3, 2012 05:47
(php) connect mysql database and display all fields and records of table.cgi-program
<html>
<head>
<META HTTP-EQUIV="content-type" CONTENT="text/html;
charset=utf-8">
</head>
<?php
$server = '127.0.0.1';
$username = 'root';
$password = 'root';
@cofearabi
cofearabi / Acce.pl
Created October 4, 2012 10:13
(perl script)connect Access mdb database through ODBC
#!/usr/local/bin/perl
use Win32::ODBC;
print "Content-type: text/html\n\n";
print "<html>";
print "<body>";
$db= new Win32::ODBC("DSN=passwd");
@cofearabi
cofearabi / scra.pl
Created December 11, 2012 06:34
(perl script) get a stock price data from stocks.finance.yahoo.co.jp
#!/usr/bin/perl
use strict;
use warnings;
use Web::Scraper;
use URI;
use Encode;
my $scraper = scraper {
process '//dl[@class="stocksInfo"]/dt[1]','numb' => 'TEXT';