Introducing pyTower, a python based Sim Tower clone. This is a new project I started, after finding the existing clones lacking. So far it’s in a really useless stage of development, but I wanted to show if what I had done so far.
I’m building it on the pygame library, which is a low level wrapper around SDL. I have to say, I am incredibly impressed with this library. You can get started really, really fast. Just focus on surfaces, rectangles, events and blitting. Ta-da, you have the basic tools for a game.
Anyway, the dev work is at github for your enjoyment.
One of the (I think) cool things I am doing is implementing the menu system in Qt4. Menu’s are hard in pygame, IMHO, so I went around them. This gives it a bit of an MDI feel, but I like it so far. If things go well I might find a way to move the mini box into another window. I think this will be beneficial long-term because I’m planning on making the technology tree really flexible and extensible.
Anyway, here are the totally not-cool looking screen shots I have so far. Art is hard.

The game space, with mini map!
“Watching someone else use your computer is like watching a drunk orangutan solve a Rubix cube.
- Matthew Inman, The Three Phases of Owning a Computer
Posted December 31st, 2009 - Permalink
“It is better to destroy, than to create what is meaningless.”
- Every Time I Die,
Imitation Is The Sincerest Form Of Battery
on The Big Dirty
Update: 2009-12-30
I put a bunch of scripts together into a collection on github, called pyUSB7. Check that out for lots of this sort of thing.
I recently dug out my USB7 and thought I would play with it. I don’t know if it has to do with my distro (sidux), or the kernel development in general, but the USB7 works on plug in, contrary to what the product site says.
Anyway, once I got tired of echoing numbers to the USB7, I thought I’d try writing something with pySerial, which I had looked at a long time ago, but never tried.
It is remarkably easy once you get the settings right. Here is a little clock program that I wrote which counts up the elapsed seconds in the day, and also has an hour/minutes/seconds layout. These toggle back and forth every 10 seconds.
# -*- coding: utf-8 -*- import serial from time import sleep, mktime from datetime import datetime, date ser = serial.Serial('/dev/ttyACM0', 9600, timeout=0) try: swap = True while True: now = datetime.now().timetuple() now_t = mktime( now ) then_t = mktime(date.today().timetuple() ) diff = int( now_t - then_t ) if 0 == diff % 10: swap = not swap if swap: ser.write( "%d\n" % diff ) else: ser.write( "%02.0d.%02.0d.%02.0d\n" % ( now[3], now[4], now[5] ) ) sleep( 1 ) except: ser.close()
Need to get the exact time that you visited a page in Firefox? I couldn’t find an easy way to look this up in the History interface, or anywhere else for that matter. I did however know that Firefox stores this kind of thing in sqlite3 databases. Here’s how I got what I needed.
First you have to find the sqlite databases, I’m on Linux so that would be in my home directory. The database you want is places.sqlite. Crack that open in sqlite3. Your command will differ as this is based on your profile name, mine is “gmail” so I ended up with g69ap5lc.gmail.
$ sqlite3 ~/.mozilla/firefox/g69ap5lc.gmail/places.sqlite
Be aware you have to shut down the Firefox instance first, because it locks the file. Make sure your privacy settings won’t erase it all when you shut it down! I had to change mine to “Remember history” first.
Next you need to find and grab the timestamp. This can be a chore if you don’t have the full URL. I was looking for the one from spiffie.org below.
sqlite>.headers on sqlite>select * from moz_places; id|url|title|rev_host|visit_count|hidden|typed|favicon_id|frecency|last_visit_date 1|http://www.mozilla.com/en-US/firefox/central/|/en-US/firefox/central/|moc.allizom.www.|0|0|0||140| ... 1366|http://spiffie.org/kits/usb7/driver_linux.shtml|Linux USB7 Driver|gro.eiffips.|1|0|0||100|1261169238197827
The column we are interested in is last_visit_date which is 1261169238197827 in our case. You can also list all the recent visits from the moz_historyvisits table with the id column.
sqlite> select * from moz_historyvisits where place_id = '1366'; id|from_visit|place_id|visit_date|visit_type|session 200|199|1366|1261169238197827|6|42
Now we need to convert that timestamp into something we can read (unless you are a super UNIX geek and can read timestamps). This instance is too precise for the date command, so lop off the first 10 digits and use that, so in the example we use 1261169238.
$ date -d @1261169238 Fri Dec 18 14:47:18 CST 2009
Not short and sweet, but it works.
Posted December 18th, 2009 - Permalink