Here's how to page reults from appengine query:
- get pager helper file
- i had to comment out the check for is issubclass since there's no db.polymodel.Polymodel. I haven't checked out whether there exists polymodel. It works for me since I subclass db.Model
- add these in my request handler:
tt_query = PagerQuery(TekaTeki).order('-dcreated') prev, results, next = tt_query.fetch(1, bookmark) template_values = {'entry': results[0], 'next': next, 'prev': prev } path = os.path.join(os.path.dirname(__file__), 'index.html') self.response.out.write(template.render(path, template_values)) - and in my index.html:
{% if prev %}<a href="/?bookmark={{ prev }}">prev</a> {% endif %}| {% if next %} <a href="/?bookmark={{ next }}">next</a>{% endif %}
and we can now page through" the results accordingly.
Trackback is http://myzope.kedai.com.my/blogs/kedai/246/tbping
'Twas a long weekend. Used to have a site that collects teka-teki or riddles since I don't know when. (98?)
Thought it'd be a great time to brush up on fb api and app engine.
So, did a model for teka-teki, and coded the handlers for all requests.
The end result? Have a look see , add more teka-teki or share funny ones with your friends.
To do:
- rating?
- voting?
Trackback is http://myzope.kedai.com.my/blogs/kedai/245/tbping
Installing new paravirtualize guest on xen host:
virt-install -p --accelerate --name x --ram 1000 --file /home/x/x.img --file-size 80 --nographics --location http://192.168.1.10/iso
Reading excel files:
from xlrd import open_workbook
wb = open_workbook('nyxls.xls')
sheets = wb.sheets()
sheet1 = sheets[0]
sheet1.nrows #number of rows avail
sheet1.ncols #number of columns
#and lots more methods that will help in reading xls
#for writing xls, get xlwr
Gammu works with Huawei E220.
Here's my .gammurc:
[gammu] port =/dev/ttyUSB0 connection = at #connection = fbus #synchronizetime = yes logfile = logformat = nothing #use_locking = yes gammuloc =
Now we can do stuff with E220; e.g gammu --identify
But more fun to script things in python, so get python-gammu
Here's how to send sms:
import gammu, time
sm=gammu.StateMachine ()
sm.ReadConfig ()
sm.Init()
smsc=sm.GetSMSC()
msg='msg in a bottle'
d={}
d['Text'] = msg
d['SMSC'] = smsc
f=open('/tmp/numbers').read().split('\n')
for i in f:
d['Number']=i
time.sleep(1)
Trackback is http://myzope.kedai.com.my/blogs/kedai/244/tbping
Well, thought of moving to posterous, then tumbler, but I think why move.
So, back to where it all started.
Briefly:
- now on f12. upgraded from f11 without any problem
- chrome on linux (beta)
- zope2
- nginx
- new sites with fb connect. soon add gfc?
- raiders still suck, well jaMarcus sucks. and vikings and farve lost nfc championship.
More to come.
p/s - probably will move to a new server soonish.
Trackback is http://myzope.kedai.com.my/blogs/kedai/243/tbping
Here's how to get chromium on fedora 11 (or other distros)
Follow the steps here
in a nutshell:
- get the latest build
- unzip, mkdir lib
- symlink a few libs
- export LD_LIBRARY_PATH=path/to/chrome/lib:$LD_LIBRARY_PATH
- ./chrome
we're done.
And yeah, it's fast. Compared to ff3.5? no idea yet.
Resource hog? no idea yet.
Trackback is http://myzope.kedai.com.my/blogs/kedai/242/tbping
Got some time to myself and decided to upgrade my fedora 10 to fedora 11.
Big mistake. Upgrade has not been good for me; from f9 to f10. And now from f10 to f11.
The upgrade from dvd process went well. It's what happened after rebooting.
X don't work. So thought I'd do a yum update. Met ith "cannot import yum module".
Great. Realized that there were two python versions and python2.5 has everything intact. So:
export PYTHONPATH=/usr/lib/python2.5/site-packages
Now yum worked. yum update pulled in 900+ packages ! (well that was my fault for installing lotsa stuff)
When yum finished, rebooted and was met with a blank screen.
Dang. Guessed that grub was screwed. Booted to rescue mode, ran grub-install, and rebooted again.
At last. Now everything works (I hope).
So, fresh install next time? I doubt it ;D
p/s - f11 dual monitor setup works :
xrandr --output VGA1 --left-of LVDS1
Haven't yet booted with bootchart to compare boot time between f10 and f11.
Trackback is http://myzope.kedai.com.my/blogs/kedai/241/tbping
