January 22nd, 2010
I recently grew quite frustrated when I had to update Emend’s Twitter bot to use OAuth.
There are, of course, readily available implementations of OAuth in python, even some specifically engineered for App Engine with lovely persistence and caching and KILL ME NOW.
I gave up after a couple hours of staring at this nonsense. I grew so displeased because my app doesn’t need 95% of what these libraries offer. I only need to sign requests with a fixed oauth_consumer_key, oauth_consumer_secret, oauth_token, and oauth_token_secret. However, this simple task would require me to subclass or instantiate several object with Culver’s library, and I can’t even begin to fathom what I’d need to do with Knapp’s offering.
(Aside: if you want to authorize and build access tokens for your app, I highly recommend this excellent OAuth test client)
I finally teased apart the core function of signing requests, thanks in large part to the great reference example. If all you need is to access a protected resource, this will get the job done with a single function call, no object-orientation required.
Source code and unit test of short and sweet OAuth.
Tags: oauth, python
Posted in Code, Web | No Comments »
December 14th, 2009
There are a couple posts out there that discuss stripping tags with html5lib, but they seem intent on preserving the “acceptable elements” such as <span> and <code>.
This is fine unless you really want to friggin’ strip out the tags, like I needed for Emend. The following is my solution.
Source code for stripping tags with html5lib and unit test.
For example,
>>> from strip_tags import strip_tags
>>> strip_tags('<p>foo</p> <script>bar</script>')
u'foo bar'
Thanks go to Edward O’Connor for pointing me towards html5lib in the first place. It’s a huge improvement over HTMLParser.
Tags: html5lib, python
Posted in Code | No Comments »
October 6th, 2009
I present the IPA (International Phonetic Alphabet) TTS (text-to-speech) bookmarklet. (Source)
Bookmarklet: IPA TTS (drag to your bookmark bar)
How to use: select any text that contains IPA and click on the bookmarklet. Wait a second for the iframe at the bottom of the page to load.
Try these examples: /ˌɪntəˈnæʃnəl/, /ˌɪntɚˈnæʃnəl/
Tags: bookmarklet, ipa, tts
Posted in Code, Web | 3 Comments »
July 23rd, 2009
Today’s guest post is by Chris Jagalla.
“You cannot build character and courage by taking away man’s initiative and independence.”
–Abraham Lincoln
The foremost subject on which today’s babies lack direction is the ability to direct themselves. Too long have we coddled, pampered, and babied our nations babies. After all, if you give a baby a bottle, the baby will drink for a day, but if you teach the baby how to open up a miniature refrigerator, that very same baby will also drink for a day but also allow you to watch re-runs of Seinfeld in peace.
I present to you, the baby crib refrigerator! (US Patent Application No. 11/248,929)

From the Abstract
Before the parent goes to sleep for the night, they can prepare a snack, and store it overnight in the snack box. When the infant wakes up in the morning, they can retrieve the snack by themselves, after a few days’ training, without crying. This will permit the parent to sleep longer, because they will not have to wake up prematurely for delivering the morning snack, and then wait until it is consumed.
Status of this patent
Still pending, it has been rejected multiple times and is now awaiting appeal. The patent examiner cited the following two patents as prior art: US Patent Application No. 10/044,362—Juvenile Stroller with Cooler and US Patent No. 4,545,211—Cold Box for Motor Vehicles
Verdict
Spare the fridge, spoil the child?
Tags: babies, patents
Posted in Guest | 1 Comment »
June 25th, 2009

M and I performed a double-blind study of four kinds of water. Our preferences agreed, in order: purified water, filtered tap water, natural spring water, and unfiltered tap water.
(I know the labels here don’t make sense. They were the first four Greek letters I could recall.)
Tags: science, water
Posted in Ideas | 2 Comments »
March 28th, 2009
Tags: catan, vineyards
Posted in Ideas | 1 Comment »
March 26th, 2009
Working on a variation of Settlers of Catan called Vineyards of Catan.
Mayfair Games has blank tiles and replacement card packs. Current plan is to print out vineyard tiles and wine cards on sticker paper to stick on the blank tiles and replacement cards.
Progress updates to follow.
Tags: catan, vineyards
Posted in Ideas | No Comments »
September 26th, 2008
Found this fun bug in IE6 today. If you have a text input and submit input unassociated with a form, then submitting the text input (by hitting return or enter when focused) will cause a click event on the submit input.
The solution is simple and intuitive: eliminate unassociated submit inputs and submit buttons.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/DTD/strict.dtd">
<input type="text"/>
<input type="submit" onclick="this.value='clicked';" />
Demo (IE only)
Tags: IE6, Javascript
Posted in Code | 1 Comment »
September 9th, 2008
Tags: biscotti, cookies, desserts
Posted in Food | No Comments »
August 11th, 2008
Tags: desserts, tarts
Posted in Food | 2 Comments »