Archive | Tech

In Praise of Emacs

Sep 28th, 2006No Comments

In what other editor or IDE do you have:

Neal Stephenson said it best:

In other words, the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text. . . .Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish.

Unit Testing a Floating Point Result

Sep 27th, 2006No Comments

I’m mucking around with CppUnit again and kept getting caught with testing a floating point result. After scratching my head some, I figured out that duh I had a ton of precision from function, and there was no way that I could enter that exact number in.  So instead of this:

CPPUNIT_ASSERT(distance>121.815123542);

I just did:

CPPUNIT_ASSERT(distance>121.815 && distance<121.816);

What’s Your Command?

Sep 27th, 2006No Comments

Thanks to Brandon for the meme.

684 [mikeh@gideon]>history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}' | \\
sort | uniq -c | sort -nr | head -10

69 cd
64 l
51 time
31 python
28 make
23 matrix
19 sudo
17 less
13 ./getdistance.py
10 sqlite3

Turning a string into a datetime object

Sep 25th, 2006No Comments

I think that all computer languages should be judged on how they handle dates and time in their standard library.  But then, most fail.

Python’s support improved greatly with the datetime but getting a string massaged into a datetime takes some doing.  This is what I came up with:

dateTup = time.strptime(dateStr,”%B %d, %Y”)  rssItem.pubDate = datetime.datetime( year=dateTup[0], month=dateTup[1], day=dateTup[2], )

To the Bid Snipers

Sep 25th, 2006No Comments

Dear eBay Snipers,

You tried, you really tried to snip all my bids away.  You frustrated me a lot — a lot — I never thought I would suceed.  I was down to less than a minute several times, but you guys and gals always stole it away.  Not matter how I priced it, you did it.

I thought that the sniping would be over towards the end of the week-long flood.  Alas, no.  The sniping continued.  Soon the flood would be over and I would be out of luck.  I relunctly raised my final price and, finally, I prevailed.

So, to you snipers, I say, “I spit in your general direction!”