Random ...
 
March 2010
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Tags ...
Links



Life and all the rest:::: paging appengine query results
Posted at 28.Feb,2010 19:59  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

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.


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/246/tbping 

Life and all the rest:::: long weekends = FB teka-teki app
Posted at 24.Feb,2010 20:35  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

'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?

Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/245/tbping 

Linux++:::: Bits and Pieces: stuff for ref later
Posted at 28.Jan,2010 13:03  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

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)


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/244/tbping 

Life and all the rest:::: W0W!
Posted at 26.Jan,2010 22:18  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

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.


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/243/tbping 

Linux++:::: Chromium on fedora 11
Posted at 25.Jul,2009 20:42  Comments 2 / Trackbacks 0 / Like this post!
Technorati tag(s):

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.

screenshot

And yeah, it's fast. Compared to ff3.5? no idea yet.

Resource hog? no idea yet.


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/242/tbping 

Linux++:::: Fedora 10 -> 11: not in a jiffy
Posted at 24.Jul,2009 15:08  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

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.


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/241/tbping