Category: Tech
Date: 2009.05.27

Left Brain

Is Wolfram Alpha the "left brain" of the internet to Google's right? Seems the obvious analogy in some ways.

Category: Health
Date: 2008.12.12

Joined a Gym

I've broken a life long trend and joined a gym. I've been feeling a bit lethargic lately and a bit stiff from all the sitting I do. Awhile ago I realized that my keyboard and my chair were the largest contributing factors to my full set of daily actions. That surely has to be a little out of balance.

I'm still not sure how I feel about the whole gym thing yet - however the culture of this particular establishment strongly favors health activity vs. "pumping iron" and is directly on my home-bound commute.

Look at that - a pre-new-year's resolution!

Category: Books
Date: 2008.10.21

A Documentary History of the United States

A Documentary History stitches together historical documents, speeches and essays with brief (and largely liberal) comments from the author. Every few documents, a page or two is dedicated to setting the frame of the times, explaining why the following pieces were selected and providing the briefest historical context.

I'm sure this book is more fun to read if you lean left - the author's comments generally reflect a liberal point of view on the social history assembled. However, the reminder that the full and original texts of our history are readily available and immediately accessible to (English speaking) readers, is powerful.

I wish my High School American history teacher had thrown out the Houghton Mifflin and simply handed us copies of this book, instead. Both the method of learning and considering history and the details derived from the study would have been better served.

Category: Tech
Date: 2008.07.20

Twitter - two kinds of people?

Someone recently told me the world divides in to those who grok twitter.. and those who don't. It wasn't implied that camps can't be changed. Figured I'd give it a try again. My mother is following me. I'm still pondering the implications.

Category: Books
Date: 2008.05.05

Wall and Piece by Banksy

Unfamiliar with Banksy (perhaps exposing my American middle class wankerism), I stumbled across this book browsing Amazon.

I wish I'd stolen it from the bookstore to hide in the library.

This Banksy fellow is a hardcore graffiti artist, employing stencils and humor, often black, to political and social point making.

He's got a website.

Reading this reminds me of Ralph Steadman's The Curse of Lono... I always thought Ralph deserved top billing. Banksy side-steps that and does his own writing.

Category: Code
Date: 2008.05.04

gcov file summaries vs. manpage

Playing with gcov recently, I noticed the output on multiple machines does not match the manpage. On a larger program the gcov summary of a source file appears displays a value the man page implies should be total lines but is in reality ... not.

Even the trivial example from the gcov man page (from both OS X leopard and redhat box) produces different output (in format an values).

man page:

gcov -b tmp.c
90.00% of 10 source lines executed in file tmp.c
80.00% of 5 branches executed in file tmp.c
80.00% of 5 branches taken at least once in file tmp.c
50.00% of 2 calls executed in file tmp.c
Creating tmp.c.gcov.

reality:

ryans-mac-pro:Gcov rbetts$ gcov -b man.c
File 'man.c'
Lines executed:87.50% of 8
Branches executed:100.00% of 4
Taken at least once:75.00% of 4
Calls executed:50.00% of -2
man.c:creating 'man.c.gcov'

The useful in-file annotations are correct and on the non-trivial program match my understanding of what's being excercised.

Wonder how lcov generates its results? From the summary or by recalculating from the source annotations? It does make pretty summaries, though:

Category: Code
Date: 2008.02.16

Creating XML with Python using xml.dom.minidom

A google search for "create xml with python" doesn't return the python documentation site as top link. Searching for "site:www.python.org create xml with python" doesn't do much better. Google does lead to a few good pages on the topic. I read those to start.

Create a document:

    import xml.dom.minidom
    doc = xml.dom.minidom.Document()

Create an element:

    el = doc.createElementNS("http://example.com/namespaceURI", "name")
    doc.appendChild(el)

Don't to be fooled in to thinking minidom's output methods will serialize that namespace in any way whatsoever. Long discussions debate this point... I didn't go off and read the DOM spec. (Well, okay, I peeked.) I added my own namespace attributes, setting the default namespace in this example. The first time I felt let down by python.

    el.setAttribute("xmlns", "http://example.com/namespaceURI")

Create additional elements and text nodes.

    elWithContent = doc.createElementNS("http://example.com/namespaceURI", "content")
    content = doc.createTextNode("some text content")
    elWithContent.appendChild(content)
    el.appendChild(elWithContent)

Serialize to a file.

    fileObj = open("example.xml", 'w')
    fileObj.write(doc.toxml())
    fileObj.close()

The resulting output:

    <name xmlns="http://example.com/namespaceURI"><content>some text content</content></name>

Category: Tech
Date: 2008.02.02

Google Android Boston Code Day

Google is presenting and discussing android phone os code in Boston, Feb. 23rd, 2008. Looks like there will be a sign up sheet soon.