摘要:
notesCursor = mDbHelper.fetchAllNotes(); startManagingCursor(notesCursor); String[] from = new String[]{NotepadDBAdapter.KEY_TITLE}; int[] to = new int[]{R.id.list_title}; notes = new SimpleCursorAdapter(this, R.layout.notes_row, notesCursor, from, to); se... 阅读全文
摘要:
Toast.makeText(getApplicationContext(), "OK!", Toast.LENGTH_LONG).show(); 阅读全文
摘要:
Bundle b = new Bundle(); b.putString("itemID", v); Intent i1 = new Intent(); i1.setClass(this, NoteEdit.class); i1.putExtras(b); startActivity(i1); i1.putExtra(mDbHelper.KEY_ROWID, keyRowId); i1.putExtra(mDbHelper.KEY_TITLE, keyTitle); i1.putExtra(mDb... 阅读全文
摘要:
package com.notepadClass;import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database.SQLException;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteOpenHelper;import android.util.Log;public class NotepadD 阅读全文
摘要:
Intent i = new Intent();i.setClass(this, children.class);startActivty(i); 阅读全文
摘要:
itertools – Iterator functions for efficient loopinghttp://www.doughellmann.com/PyMOTW/itertools/index.html Purpose:The itertools module includes a set of functions for working with iterable (sequence-like) data sets.Available In:2.3The functions provided are inspired by similar features of the “la. 阅读全文
摘要:
jpypepackage demo.jpype;public class JpypeDemo{ public String sayHello(String user) { return "hello " + user; } public int calc(int a,int b) { return a+b; }}-----------------------------------------------------from jpype import *import osstartJVM("%s/jre/bin/client/jvm.dll"%(os.e 阅读全文
摘要:
导入数据到obj.pkl文件try: import cPickle as Pickleexcept ImportError: import pickle as Pickleoutfile = open("obj.pkl","wb")data = {"a":"aaaaa"}Pickle.dump(data, outfile)outfile.close()读取数据try: import cPickle as Pickleexcept ImportError: import pickle as Picklereadfil 阅读全文
摘要:
安装 libeventapt-get install libevent-dev安装python-devapt-get install python-dev安装greenleteasy_install greenlet安装geventeasy_install gevent一个小测试测试gevent 的任务池from gevent import poolg = pool.Pool()def a(): for i in xrange(100): g.spawn(b)def b(): print 'b'g.spawn(a)g.join() 阅读全文
摘要:
在chinaunix上问了很久没找到解决方案自己动手丰衣足食脚本如下#!/bin/bashc=$(ps -ef|grep python |grep -v "grep"|wc -l)if [ $c -lt 1 ]then python /home/spider/spider.py &fi保存文件名为 xxx.sh运行命令 :crontab -e在 nano里面 添加*/分钟 * * * * sh 文件的路径ctrl+xY回车/etc/init.d/cron restart 阅读全文