Jeff’s Brain Dump

Sometimes the first duty of intelligent men is the restatement of the obvious.

Cigarette Lighter Adapter in Europe

Posted by Jeff October 05, 2007

We’ll be driving from Florence->Siena->Ravello in Italy. That means laptop and GPS, and therefore a power inverter. This thread says cars have 12V cigarette lighter adapters. Elana will worry about navigation, while I worry about driving in Italy — and driving stick.

, , , ,

Learning Dvorak on Honeymoon

Posted by Jeff September 30, 2007

I’ve long wanted to learn the Dvorak keyboard. This QWERTY alternative offers more efficient design, less finger movement, greater speed, less RSI. Problem is: when to learn it? There isn’t a day when I’m not on the computer writing or coding. Our upcoming two-week honeymoon in Italy will be such a time. I’ll have no internet connection, a true rarity, and won’t be working.

Some resources I’ve found:

DVZine: “The Dvorak Zine” is a 24 page zine that uses the power of Comics to promote the Dvorak Simplified Keyboard Layout. Here you will find all the information you’ll need to start typing Dvorak today! We’re changing the world… one keyboard at a time!! - very funny and well done.

DVAssist: turn off Windows’ brain-dead per window keyboard setting. Also has a floating cheat sheet.
Enabling on Ubuntu - once Ubuntu is installed, you can change the keyboard layouts by going to System > Preferences > Keyboard on the GNOME panel, then click on the Layouts tab and you can change your layouts there. This is important for me, as I run Synergy on an Ubuntu server. It will ’speak’ Dvorak, then send keystrokes to any slave machines.

A Basic Course in Dvorak - Structured learning. but no no interactivity/WPM measures.

Typing Lessons for Dvorak - interactive Flash lessons.

KP Typing Tutor - Shareware Typing Tutor. I’ll use this for drill.

TypeFaster - Great tutor/drill program. Killer Feature: Tracks your slowest / most inaccurate keys.  Free, cross platform.
The Step-by-Step Guide to Switching to Dvorak

Goals/Plan
* Print out DVORAK layout, have in GTD book for reference.
* Starting 10/6 and during honeymoon, practice at least 30 mins/day. Record WPM daily (can I do without ‘net connection?).
* test WPM on QWERTY before beginning training. According to this, my speeds are 69-80 WPM.
* Goal: 50% of QWERTY speed after 1 week, 75 % after 2 weeks, 90% after a month, 110% after 2 months.
* Learn and practice common Copy/Paste shortcuts
* Install easy way to toggle keyboard layout for when others use laptop.
* Use DVORAK only after honeymoon, two-week period

We’ll see how well I do sticking to this plan with many competing and fun pastimes :)





, , , , ,

MS SyncToy

Posted by Jeff September 10, 2007

Problem: I’m copying 1.2 gigs of data from a home computer over a Windows file share. The transfer will take hours, lots of small files.

Predictably, the transfer failed 4 hours in when the WIFI dropped. The directories and files are half-copied. It’s a big job to figure out what’s what.

I need something that will:
- Preserve existing files
- Be able to restart in case I switch networks again
- Verify file integrity

So I install the free MS SyncToy project.

You create a Folder Pair, and choose a direction. Unfortunately the terminology (Synchronize/Echo/Contribute/Subscribe/Combine) is confusing, with no graphics to make clear what’s going on. Any Deletions are made using the Recycle bin, in case you mess up.

User interface complaints aside, it works well. You get an overall progress bar, and it recovers nicely.  You can relax knowing that if you switch networks  or drop connection, it’ll recover and get the job done without worrying about the details.

, , ,

Parsing BookMooch’s Asins.xml with a SAX parser

Posted by Jeff May 01, 2007

I’ve been playing with BookMooch’s API recently. They have data files for:

  • Inventory : how many copies of each book are moochable
  • Wishlists: How many people want each book.
  • ASIN’s : full details for each book.

My initial goal is the availability (Inventory-Wishlist) of each book. Examples:

Availability Title
-210 Omnivore’s Dilemma
-172 The God Delusion
115 The Da Vinci Code
122 Jurassic Park


Omnivore’s Dilemma is in heavy demand; Jurassic Park is a stale meme. The value of a book decreases over time; it makes sense to trade in current books while you can.

ASINS.xml is 983MB; a DOM parser requires far too much memory. A SAX parser is required to handle a file this size.

My requirements are to produce a CSV file mapping ISBN to Title. A pickled version of a python map would also be useful.

ASIN Detail

See example here.

SAX ContentHandler

A ContentHandler is supplied as a callback. The parser calls startElement, characters,and stopElement and as it walks the XML input stream.  Since the id element repeats, examining the tag name is insufficient to know the location in the tree. Instead, a list of containing elements makes sense:

class asinHandler(ContentHandler):
def __init__(self):
self.curElements=[] # Will have the path to the current location.
def startElement(self, name, attrs):
self.curElements.append(name)
def endElement(self, name):
self.curElements.pop()

Capturing ID, Title

My only interest is in the title and ID of each book.
    def characters(self,ch):
        if len(self.curElements) ==3:
            if self.curElements == ‘id’:
                self.isbn = self.isbn + ch
            elif self.curElements[2] == ‘Title’:
                self.title = self.title + ch
    def startElement(self, name, attrs):
        if name==’asin’:
            self.isbn = ‘’
            self.title = ‘’       
    def endElement(self, name):
        if name==’asin’:
                self.br.record ( self.isbn.strip(), self.title.strip() )

Full Program

# IN: asins_fixed.xml
# OUT: isbns.txt, isbns.pickle

# http://www.devarticles.com/c/a/XML/Parsing-XML-with-SAX-and-Python/
import codecs,pickle
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
BOOKNUM = 0

class bookRecorder:
    def __init__(self):
        # *Very Important* to open in the right encoding!
        self.f = codecs.open (’isbns.txt’,'w’, ‘iso-8859-1′)
        self.dict = {}
    def record(self,isbn,title):
        self.f.write(unicode (isbn+’,’ +  title +’\r\n’))
        self.dict [isbn]=title
    def close(self):
        self.f.close()
        p=open(’isbns.pickle’,'w’,200000)
        pickle.dump (self.dict,p)
        p.close()

class asinHandler(ContentHandler):
    def __init__(self):
        self.br=bookRecorder()
        self.curElements=[] # Will have the path to the current location.       
    def characters(self,ch):
        if len(self.curElements) ==3:
            if self.curElements == ‘id’:
                self.isbn = self.isbn + ch
            elif self.curElements[2] == ‘Title’:
                self.title = self.title + ch
    def close(self):
        self.br.close()  
    def startElement(self, name, attrs):
        self.curElements.append(name)
        if name==’asin’:
            self.isbn = ‘’
            self.title = ‘’
            global BOOKNUM
            BOOKNUM = BOOKNUM + 1
            if BOOKNUM % 5000 == 0:
                 print BOOKNUM       
    def endElement(self, name):
        if name==’asin’:
                self.br.record ( self.isbn.strip(), self.title.strip() )
        self.curElements.pop()

parser = make_parser()  
curHandler = asinHandler()
parser.setContentHandler(curHandler)
parser.parse(open(’asins_fixed.xml’))
curHandler.close()

, ,

Eclipse automatically run Junit tests

Posted by Jeff April 19, 2007

I’m getting google hits for the phrase “eclipse automatically run junit tests”… but that’s to Nosy, which is for python code.

For java/junit code, use the ct-eclipse plugin. It runs your tests, in the IDE, whenever your code changes. At the current time it only supports Eclipse 3.1 (!):

CT-Eclipse (Continuous Testing for Eclipse) builds on the automated developer support in Eclipse to make it even easier to keep your Java code well-tested, if you have a JUnit test suite. With CT-Eclipse enabled, as you edit your code, Eclipse runs your tests quietly in the background, and notifies you if any of them fail or cause errors. It is most useful in situations where you would already have a test suite while you are changing code: when performing maintenance, refactoring, or using test-first development.

It’s all about quick feedback loops.

, , , ,

The most useful GMail keyboard shorcuts

Posted by Jeff April 19, 2007

Alt-Enter: Send msg
g i    Goto inbox
c    Compose
/    Search
#    delete
r    Reply
a    Reply All
f    Forward

The  whole list is here. It’s a shame that ‘#’ is difficult to type, requiring the Shift key. Presumably using the ‘d’ key was too dangerous.

Demitri Martin, JoesGoals and Seth Roberts

Posted by Jeff April 17, 2007

I was reading an interview with the comedian Demitri Martin, and it turns out he’s a deep thinker–

At some point I created a point system, like breaking my life down into categories, and then in each category trying to achieve certain things in a week’s time. Every Sunday night I would tally up what I had achieved, for a total possible of 35 points. It was mind, body, career, personal management/relationship contribution. It was pretty funny. It was really ambitious in retrospect. The stuff I set out to do each week was pretty much impossible. I kept track of it for 27 weeks. I had a binder in which I actually was consistent for half a year. Every week I’d carry it around with me. I never got 35 points. I never even got close. Years later I found it, and I was like, “Oh my god, this is crazy.” 4 points was my lowest week, and I think 24 was my highest. When I made the system I figured I’d be topping out in the 30s, and once I’m close to my maximum, I’ll just bump up each category, I’ll just make the goals a little harder. And then that way I can develop a balanced set with the different things that I’m trying to learn how to do. I averaged 11 points out of my own system. So I failed kind of miserably. But the cool thing is that ever since then I haven’t really ever been bored. I haven’t watched TV since then, and I just never really feel like there isn’t something to do. That changed my perspective. So it’s like, draw a picture if you’re sitting somewhere, or write something down, or write a palindrome. It’s just about all the different opportunities in one moment. It changed my perspective on time and creating things.

This made me laugh because it’s exactly the kind of system I imagine building. Turns out someone else has built it - it’s called joesgoals. JoesGoals sports a stunningly intuitive and friendly user interface, which you can play with on the site:

joesgoals UI

This is friendly data collection — like a CRF in a clinical trial. What can you do with the data? Determine cause and effect (causal analysis)? One person found a correlation between cycling and migraine relief:

Bradley has been using Joe’s Goals to track his migraine attacks (-1 point), the times he has to take medication (-1 point), his cycling activity (+1 point), and when he wakes up in the morning (+1 point). Printing out the 30 day report he took it too his neurologist and the results surprised both of them. After reviewing the results the neurologist looked up and said “Why would you ever stop cycling?”

Like most geeks, I have an interest in self-experimentation, but not the discipline to gather data reliably. Seth Roberts discovered the Shangri La diet via self-experimentation. The spirit of curiosity and observation persists in his readers - see this post on the effects of DHA omega-3 oil. His seminal paper Self-experimentation as a source of new ideas describes his 12 years of self-experimentation as a basis for idea generation. It’s basically R&D, finding unexpected correlations.

JoesGoals is myware and a way of turning mundane tasks into a game. The simple data model is blessing and curse. It lacks numeric variables. This means you can’t record interesting variables such as weight, mood or sleep. Hopefully it’ll move in that direction in the future. The creator has a real knack for good UI. With a simple CSV download and good analysis software, users might discover other unexpected and helpful correlations.

, , , , ,

Ricky Gervais meets Christopher Guest

Posted by Jeff February 24, 2007

If you’re a Spinal Tap fan like me, these are gold. Ricky Gervais is a huge Spinal Tap geek. He and Guest talk about the history and style of Guest’s improvisational movies. The Office uses this style.  Parts II, III, IV, V are on YouTube.

Guest is plugging For Your Consideration.. which we watched tonight and pretty much sucked. Far too broad and sloppy. Oh well.

, , , , , , ,

Crazy Bread Professor on Conan O’Brien

Posted by Jeff February 24, 2007

Steven Kaplan, author of “Good Bread is Back”, an ode to French bread.

, , ,

WeTube / WiiTube

Posted by Jeff December 23, 2006

So the Wii supports Flash in the Opera browser, and it’s not half bad. This also opens the door to Flash games, see WiiCade.
We had 8 people over last night who hadn’t seen Dick in a Box. I hooked the laptop up to the receiver but didn’t have an SVideo cable for video out. The Wii seems perfect for social viewing of vids– especially since Opera does pan and zoom.

I love the idea of sharing vids with a large group without having to wrangle A/V equipment. XBMC is great, but the Wii is a Trojan Horse with a lot of future possibilities.

Edit: SofaTube gives the Fisher Price UI needed for video selection. I’m so getting a Wii as soon as I can pay retail..

, , ,

« Older blog posts • Newer blog posts »