FacebookStatusUpdater

June 7, 2007
0 comments Linux

FacebookStatusUpdater This is silly but fun. I can with one command on the command line start updating my Facebook profile. It's not using the Facebook Developer API but a PHP script I copied from some other blog I can't find right now. Here's how I use it:


peterbe@trillian:~ $ FacebookStatusUpdater 
Peter is happily blogged about his latest facebook status updater
Updating Facebook...

It's an interactive prompt and starts with "Peter is " and then I write till I hit the Return and it gets uploaded and saved. See attached screenshot.

Truncated! Read the rest by clicking the link below.

Playing with filestream_iterator

May 30, 2007
0 comments Zope

There are several ways of serving static files from Zope. The simplest way is to just do something like this:


size = os.stat(file_path)[stat.ST_SIZE]
REQUEST.RESPONSE.setHeader('Content-Type','image/jpeg')
REQUEST.RESPONSE.setHeader('Content-length',int(size))
return open(file_path, 'rb').read()

The disadvantage with this is if the file is say >1Mb, the whole 1Mb needs to be loaded into RAM before it can be sent. This is surely garbage collected afterwards but if you serve many of these at the same time, there's obviously the risk that the RAM gets too full.

The alternative is to use filestream_iterator from the ZPublisher which is an iterator that sends out chunks of the file at a time. Note that to use the filestream_iterator you must set the Content-Length header first. Here's how to use it:


from ZPublisher.Iterators import filestream_iterator
...
size = os.stat(file_path)[stat.ST_SIZE]
REQUEST.RESPONSE.setHeader('Content-Type','image/jpeg')
REQUEST.RESPONSE.setHeader('Content-length',int(size))
return filestream_iterator(file_path, 'rb')

Truncated! Read the rest by clicking the link below.

American foreign policy

May 25, 2007
0 comments Politics

There's a really interesting blog article on Think Moderate worth a read. Clearly some moron commented on it which caused the author to append this update to it:

I am NOT saying that murdering innocent American citizens is justifiable, as some commentors have suggested. I am also fully aware that many of our foreign enemies disagree with our lifestyle as well as our foreign policy, but as one commentor has said: "which one do you think motivated twenty people to come half-way across the world and kill themselves just to strike a blow against America? The fact that you're directly responsible for their countries being shit-holes and the deaths of friends, family-members and groups they identify with, or the fact that our women wear revealing tops?"

Read the whole article for a refreshing yet brute article on american political introspection.

On the subject of bombing civilians as a counter action to the injustice the die hard arabs feel; I think it's the wrong action to take. They should have their revenge in some other way that doesn't cause further death and despair. However, "we" (by that I generalise us as being all europeans) don't hate your freedom either dear US. But we do hate your foreign policy. Europeans are fortunately treated well by the americans and our neighbouring enemies don't get $illions of dollars in montary aid. If you did, perhaps we'd become "freedom haters" too.

Time in the Stone - Emily Young exhibition

May 21, 2007
0 comments Art

Time in the Stone - Emily Young exhibition Last week I went to the Time in the Stone exhibition near Euston station (London) so see some amazing "stone art". My friend Sid Dawe is one of the artists who help Emily carve these big and beautiful stones. I know very little about stone but these aren't the regular kind of rocks, they're (to a layman) some sort of marble.

The exhibition is open for several more weeks and is very accessible since half the art is exhibited outside in the courtyard outside a church and the remaining other half is under the church.

Truncated! Read the rest by clicking the link below.

No, I'm not going to freeze your account

May 16, 2007
2 comments This site

Yesterday I got another one of these:


dear sir,

yesterday some body stolen my cell cell number 9848133384 
please search for the  same and freeze my account so that 
no body can use it 

thank you 

yours faithfully

kgdeekshitulu

It seems that a lot of people in India lose their mobile phones these days and that a lot of people in India think that by emailing me about it that I can do something about it.

I'm just a blogger. I don't have a machine that can cancel mobile SIMs.

Miami Vice party photos

May 14, 2007
0 comments Photos

Miami Vice party photos I've now uploaded a selection of photos from the Miami Vice party we had on Saturday.

For those who got the invite but didn't come: look what you missed! We even had a live performance gig in the house which was cool. Thank you those of you who did it.

The theme was Miami Vice and like those parties where people dress like the opposite sex, there was actually more options for the guys than the girls. I went for the mint-green t-shirt with extra padded shoulders in a grey jacket with rolled up sleeves.

What does $456 billion buy?

May 7, 2007
2 comments Politics

What does $456 billion buy? "Including the $124.2 billion bill, the total cost of the Iraq war may reach $456 billion in September, according to the National Priorities Project, an organization that tracks public spending.

The amount got us wondering: What would $456 billion buy?"

This is an amazing slideshow article made by boston.com about what the Americans could have done instead of spending $456 billion on the Iraq war. Granted, the republicans objective was to go in an exploit the country for oil which they saw as an investment whereas investing in health and life in Africa would be too far fetched for the shortsighted morons in Washington.

Ok. Suppose George and co. would have been successful in Iraq and with that, move in a few lucrative industrial deals for oil and reconstruction. I wonder how many thousands of years it would take to get return on that investment if the input is $456 billion.