Thursday, September 27, 2007

Wednesday, September 19, 2007

If sailor tales to sailor tunes,

Storm and adventure, heat and cold,

If schooners, islands, and maroons,

And buccaneers, and buried gold,

And all the old romance, retold

Exactly in the ancient way,

Can please, as me they pleased of old,

The wiser youngsters of today:

--So be it, and fall on! If not,

If studious youth no longer crave,

His ancient appetites forgot,

Kingston, or Ballantyne the brave,

Or Cooper of the wood and wave:

So be it, also! And may I

And all my pirates share the grave

Where these and their creations lie!

Robert Louis Stevenson

Happy TLAP day.

Friday, September 14, 2007

More digging through the crates to put music up at Bebo.

Soft Soul Down (return of the Gay Old Snake!)

Monday, September 10, 2007

Has Facebook (or the internet) finally melted down with too much traffic?

Update : Basically, I'm somewhat miffed that, having got an evening free to work on my Facebook app. it keeps giving me this message :

Errors while loading page from application

The URL http://myappurl did not respond.

There are still a few kinks Facebook and the makers of My App
are trying to iron out. We appreciate your patience as we try to fix
these issues. Your problem has been logged - if it persists, please
come back in a few days. Thanks!

That's not true. The URL in question, on my server, responds perfectly well. It's Facebook which is running slow and (probably) timing-out.
Oh, and as part of the ongoing (and accelerating, I hope) revamp of my site, I've put the whole Great Grimpen Mire up for your listening pleasure.
I should point out that one of the coolest things on earth, without which I would be totally lost, is Subversion version control system, and TortoiseSVN clients. I now have two SVN servers, one on the web and one on a pen-drive for more private stuff, and have pretty much all my personal work on them.
OK, I've just released a new build of GeekWeaver.

Full story over at Smart Disorganized, but basically OPML + domain specific language = cool way of defining complex web-site.

Saturday, September 08, 2007

Maybe ... just maybe ... I'm starting to see what Python decorators are all about.

Have a look at this example :

log1 = []
log2 = []

def declogFactory(l) :
def declog(f) :
def new(*args, **kws) :
return f(*args, **kws)
return new
return declog

declog = declogFactory(log1)

def add(x,y) :
return x + y

def times(x,y) :
return x * y

print add(1,2)
print log1, log2
print times(4,5)
print log1, log2

log1 and log2 are lists representing two alternative logs

declogFactory is actually a routine which is going to return a closure which is a python decorator.

so declogFactory receives a list as an argument and returns a decorator with the variable l bound to that list.

we assign that decorator to "declog" in the main program.

but what is declog?

decorators are functions which transform other functions, and are invoked with the @ syntax before the function they transform.

So this :

def add(x,y) :
return x + y

is applying the new decorator "declog" to the function "add".

Let's look inside the definition of the decorator

def declog(f) :
def new(*args, **kws) :
return f(*args, **kws)
return new

this decorator also takes one argument : f that will be the function to be decorated.

we, in turn define function new. All it does is append the name of the function f it receives, with the first two arguments, to the log. Then it calls f.

effectively we've wrapped a call to f inside another routine which updates the log first.

however, we don't need to do this explicitly. You'll see that, although the routines add and times have been decorated, the calls to them look exactly the same as a call to a non-decorated version.

the simple occurance of the decorator line @declog before each definition is sufficient to turn each routine into a logged routine, as we see from the output

[('add', 1, 2)] []
[('add', 1, 2), ('times', 4, 5)] []

both add and times are decorated.

note, as well, that the decorator was itself parameterized with which log. it's sufficient to change the line defining the decorator to

declog = declogFactory(log2)

to have the logging from all the functions redirected to log2 instead of log1
Doh! Of course Fuzzwich already is a Facebook app.

Friday, September 07, 2007

Paul Graham's gang Bang the Rocks Together and come up with the micro-chunkiest online video-making application yet.

Dumb but fun. When's it gonna be Facebook Application?