This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JsonFactory fac = Util.getJsonFactory(); // recycle JsonFactory | |
// JsonFactory fac = new JsonFactory(); // or just use once. | |
JsonParser jp = null; | |
try { | |
jp = fac.createJsonParser(json); | |
jp.nextValue(); // responseData | |
jp.nextValue(); // null | |
jp.nextValue(); // results | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class PathFileObserver extends FileObserver{ | |
static final String TAG="FILEOBSERVER"; | |
/** | |
* should be end with File.separator | |
*/ | |
String rootPath; | |
static final int mask = (FileObserver.CREATE | | |
FileObserver.DELETE | | |
FileObserver.DELETE_SELF | | |
FileObserver.MODIFY | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FileObserver f; | |
f = createWatchList("/sdcard/"); | |
f.startWatching(); | |
watchList.add(f); | |
f = createWatchList("/sdcard/tmp"); | |
f.startWatching(); | |
watchList.add(f); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static DefaultHttpClient mHttpClient = null; | |
final static int RETRY_COUNT = 2; | |
static SchemeRegistry mSchemeRegistry = null; | |
public static void createConnManager(){ | |
mSchemeRegistry = new SchemeRegistry(); | |
mSchemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); | |
mSchemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StocksDb { | |
private static final String DB_NAME = "stocks.db"; | |
private static final int DB_VERSION = 1; | |
private static final String TABLE_NAME = "stock"; | |
private static final String CREATE_TABLE = "CREATE TABLE " + | |
TABLE_NAME + " (id INTEGER PRIMARY KEY, symbol TEXT, max_price DECIMAL(8,2), " + | |
"min_price DECIMAL(8,2), price_paid DECIMAL(8,2), " + | |
"quantity INTEGER)"; | |
private static final String INSERT_SQL = "INSERT INTO " + TABLE_NAME + | |
" (symbol, max_price, min_price, price_paid, quantity) " + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import Environment | |
env = Environment(extensions=['jinja2.ext.i18n']) | |
template = env.get_template('foo.html') | |
template.render() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jinja2==2.5.5 | |
PIL==1.1.7 | |
Pygments==1.3.1 | |
Sphinx==1.0.5 | |
blockdiag==0.5.2 | |
docutils==0.7 | |
funcparserlib==0.3.4 | |
reportlab==2.5 | |
rst2pdf==0.16 | |
sphinxcontrib-blockdiag==0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, re | |
_split = re.compile(r'[\0%s]' % re.escape(''.join( | |
[os.path.sep, os.path.altsep or '']))) | |
def secure_filename(path): | |
return _split.sub('', path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jinja2 | |
PIL | |
Pygments | |
Sphinx | |
blockdiag | |
docutils | |
funcparserlib | |
reportlab | |
rst2pdf | |
sphinxcontrib-blockdiag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; ikazuchi-mode.el --- ikazuchi, translate using web APIs, minor mode. | |
;;; | |
;;; Currently can use only Google. | |
;;; | |
(provide 'ikazuchi-mode) | |
;; set path to ikazuchi if you have not set PATH. | |
(defvar ikazuchi-path "ikazuchi") |