The Foursquare Blog

recording discoveries along the pathway of life

Entries from June 2006.

25th June 2006
fxn:

Advogato also has XMLRPC, with which you can do programmatic access to your diary. I do this in the hope that it saves advogato bandwidth.

Below is a small python beginner script that I cooked up just for this task. It checks the dates of the posts and saves the new ones as individual files.

If someone finds it useful, please feel free to use it.


#!/usr/bin/python

import xmlrpclib import os import difflib

def Download(filename, entry): print "Downloading: " + filename out = open(filename, "w") create, update = server.diary.getDates("cdfrey", entry) out.write("%s\n" % update) out.write(server.diary.get("cdfrey", entry)) out.close()

def GetTimestamp(filename): inf = open(filename, "r") s = inf.readline() inf.close() return s[0:len(s)-1]

def Update(filename, entry): print "Updating: " + filename filetime = GetTimestamp(filename) webcreated, webupdated = server.diary.getDates("cdfrey", entry) if( filetime != webupdated ): print "Entry %d is out of date" % entry if os.access(filename + ".bak", 0): os.unlink(filename + ".bak") os.rename(filename, filename + ".bak") Download(filename, entry)

oldf = open(filename + ".bak", "r") newf = open(filename, "r") oldl = oldf.readlines() newl = newf.readlines() print ''.join(difflib.unified_diff(oldl, newl))

path = "/home/cdfrey/text/advogato/posts/" server = xmlrpclib.Server("http://www.advogato.org/XMLRPC")

entryCount = server.diary.len("cdfrey")

for entry in range(entryCount): filename = path + "advogato.%03d" % entry if os.access(filename, 0): Update(filename, entry) else: Download(filename, entry)

Tags: advogato-old, code, programming.
21st June 2006
fzort:

Thanks for sharing the link to those chess problems. It reminds me of a paperback book I picked up last year called Bobby Fischer Teaches Chess. It's full of problems like that, taking the reader from beginning backrank mates to more complex combinations. It's a very fun book to read, especially the second half, as you hold the book upside down.

The thing I've found is that chess problems, and the Bobby Fischer book, only helped my end game, and the planning, if I remember to do that. It is the opening that can make or break a game, and I've had many games broken by a bad opening.

I'm experimenting with lightening games lately, and while I lose almost all of them on time, I find it is a good way to practice openings, and to force my brain to work faster.

Maybe I'll see you on freechess.org. I have the same handle there. I'm still very much an amateur.

Tags: advogato-old, chess.
1st June 2006
The last month has been kind of a mental lull for me. Slow progress everywhere.

But alas, I'm finally back on the Barry project after a few months' detour on other critical issues.

The libusb project has undergone an API redesign over the last few months too. It's all in the devel tree. If you're following libusb, and wondering why things are not being updated, make sure you're looking at the SVN repository, not CVS as its website says. :-)

Since Barry depends on the devel tree of libusb, there has been some porting needed in Barry, and some hacking needed on libusb. The last little while I've been reading through the libusb code, and adding libusb_wait(), libusb_poll(), and libusb_abort() support, which are critical if you want to use async calls and still avoid a threading library.

Still lots of work needed in Barry. It will be nice to have a working libusb and test setup again soon.

[Edited to fix broken link]

Tags: advogato-old, barry.

RSS Feed

Created by Chronicle v4.6