Sean O'Donnells Weblog
After playing with smack.py and enjoying thumping my laptop to switch desktops, I began thinking of other uses for the smacking interface. One finally hit me. Depending on my mood I sometimes play music on my Thinkpad while I work , however if I get bored, or annoyed by a song I have 2 choices. Be irritated, or break my flow while I maximize XMMS and move on in my playlist.
It just seems so perfect, dont like the music? Smack the screen and move on! So I adapted the original smack.py script and here you are, xmms-smack.py. Once its running, if you thump your Thinkpad XMMS will move on to the next song on your playlist. xmms-smack.py requires that you have HDAPS on your Thinkpad, and you have PyXMMS ("sudo apt-get install python-xmms" on debian/ubuntu) installed as well as Python. To start it just run "python xmms-smack.py".
While I was at it I decided to make future smack based scripts a little easier to get up and running. I created the smacker class. To create a left/right based smacker just extend the Smacker class like so.
class TestSmack(Smacker): """an example smacker implementation""" def on_left(self): print "left" def on_right(self): print "right"
I may adapt Smacker to also handle forward/back tilting and anything else thats handy as the need arises. If anyone wants to try it before I do, Ill be happy to take their patches.
Well the scum bag spammers finally made me do it. I added captchas to the comments plugin in Vellum tonight. Up until now I had been using a simple blacklist of forbidden phrases and urls, and it had killed the majority of the spam quite nicely. Until Mr. "I'm not up to much today" started spamming the blog on a daily basis, always with different text, different ips and different urls to different scum bag products. So a black list was not going to cut it with him. manual removal didn't work , as the blog was always spammed again in a matter of hours. So hopefully the captchas will put paid to him. Time will tell. I apologize if the captchas annoy or inconvenience anyone, I'm not their greatest fan myself. But it was this or spend time everyday wiping off the spam.
I've been working on an application that needs to convert old fashioned HTML to XHTML. Almost all of the libraries I have come across that do a good job are just wrappers around HTMLTidy, and very few of them can simply be installed with a simple apt get. I did not feel particularly good requiring them as a result. I hate to think of someone tearing their hair out just trying to get my stuff installed before they can use it.
Check out the following example
>>> from twisted.web import microdom
>>> x = microdom.parseString("<div>hello<br>world</DIV>",beExtremelyLenient=1)
'<?xml version="1.0"?><div>hello<br />world</div>'