2005/05/15

Family Ties

This morning I was minding my own business, googling for my grandparents' cookbook, when I was reminded of a web of family ties.

My dad used to play in a country band in Columbus, Ohio. His musical talent was part of the reason he met and married my mom, whose parents were Smiley and Dallas Burnette.



My brother and I grew up in New Albany, Ohio. In the summers we used to spend a lot of time at Uncle Hank and Aunt Donna's house, which was next to their pizza place.

Uncle Hank and his brothers had once played as Hank Newman and The Georgia Crackers. His musical talent played a part in his meeting and marrying Donna, who was born Donna Albanese.

The Georgia Crackers
The Georgia Crackers -- The Newman brothers are the three in back. Left to right: Uncle Slim, Bob, Uncle Hank.


The Georgia Crackers had long since disbanded by the time I showed up. The only time I remember hearing them play was one night at Veteran's Memorial Hall, when I was maybe five years old. The high points of the evening for me were getting to stay up really late, seeing Uncle Hank and his brothers on stage (I'd never met Bob before, but it was funny when he picked up that huge bass violin and "threatened" to leave the stage), and Tex Ritter and his amazing blue cowboy outfit, studded with rhinestones. I never got to say a word to Mr. Ritter but remember staring, mesmerized, at the back of his jacket as he sat at the bar in Uncle Hank's den after the show.

[So much for memory. Dad says it was Uncle Slim who was fiddling with the bass.]

The Newmans had met Grandpa in the late forties, on the set of one of the Durango Kid movies. I guess they'd long been established in Columbus by that time.

Mom met Dad in Columbus, while she was driving Grandpa around the country on one of his road tours.

The mesh ties together. That's how my brother and I came to spend our summers with Uncle Hank and Aunt Donna.

Century of Country

Other references to the Georgia crackers are here and here.

2005/05/12

Google's Singularity machine

Epeus' epigone - Kevin Marks weblog, on Google's Singularity Machine


Map/Reduce

"Map/Reduce" evokes and . (Danny Hillis wrote about the CM architecture in the late 1980s.) Would there were time enough in the day to get hands-on with parallel and distributed algorithms.

Ceviche

What is ?

Sadly, this reminds me of my neighbor across the hall at Los PiƱones apartments. He was not much older than me, in his early 40s I think. He was fond of seafood. In late summer of 2003, when my job and the health of my parents both took bad turns, he began to lose his life.

Suddenly taken ill, my neighbor was hospitalized with what was, for the first month, an unknown but deadly serious infection. The hospital staff in Albuquerque did what they could. Finally one doctor, after a flash of insight, walked in and bluntly asked whether my neighbor had recently eaten seafood.

From that point it was clear how to treat him, but it was too late. The infection had done too much damage. I can't remember all of the complications he suffered; I believe pneumonia and kidney failure were among them. Just before Thanksgiving, he died.

The restaurant was not shut down. As far as I know, they didn't even remove uncooked seafood from their menu, or add any cautions to it. Granted that would have been bad for business. And life is full of risk anyway. But some indication of regret would have been nice.

2005/05/11

2005/05/04

Wired News: Ethanol Grows as Gas Alternative

This article --

Wired News: Ethanol Grows as Gas Alternative

-- raises a few questions. It describes a process by which ethanol can be converted to hydrogen; and, separately, the current use of ethanol as a gasoline additive.

The most obvious question: what, if any, relationship exists between the conversion processes described in the article, and this research by Penn State researchers?

Is the hydrogen conversion technology being considered for use in cars, e.g. in fuel-cell vehicles? Or is it only for use in hydrogen "refineries"?

How does the carbon-dioxide by-product of the process affect the total environmental cost of hydrogen as a fuel?

Ethanol is made from grain crops, and the existence of the "corn belt" in which those crops is grown depends on certain climate conditions. Ongoing changes in global climate mean that the corn belt may move or disappear altogether.

It's easy to imagine a world in which we've become dependent on grain crops for both fuel and food (directly and indirectly, through consumption of meat and poultry). And it's slightly amusing to imagine a world in which, due to climate change, the "corn belt" has moved to Canada.

Much less amusing is a world in which that belt has disappeared.

Not to dismiss ethanol/hydrogen for the sake of an unlikely eventuality, but how likely is it that a drastic change in the grain supply will happen?

How likely is it to happen within the next 100 years? After all, you don't need to solve your problems once, for all. You need to solve them just long enough to buy time to find a better solution.

How long is long enough? Gasoline-powered vehicles have solved so many problems of transportation that we now have trouble replacing the extensive infrastructure which has grown up around them.

Ethanol/hydrogen is interesting as a possible fuel source. It's maybe more interesting for the questions it raises about climate and politics.

2005/04/29

Photoshop CS2 HDR

Photoshop CS2 HDR

A couple of years ago I saw an article on how to use Photoshop and exposure bracketing to create composite images that had good detail in both highlights and shadows. The article explained that digital had a smaller dynamic range than film, and that even film didn't have the range to cover some landscape scenes.

By the time I was done reading I had the impression that the author, Michael Reichmann, would be pleased if he didn't have to compress the dynamic range, but instead had a way to combine two images of 8-bit depth into a single image having, say, a 12-bit range.

Sure enough, the new Photoshop release can do it. And the same author has posted an article on how to use it:

http://www.luminous-landscape.com/tutorials/hdr.shtml

Naturally, now the problem is that neither computer monitors nor printers can handle 32-bit image data. And at the end of this article Mr. Reichmann suggests that camera manufacturers need to begin producing cameras that provide better control over exposure increments when producing bracketed shots.

But why stop there? Why not let the camera do its own sampling of light levels across the scene and then automatically produce bracketed shots which cover the scene's entire dynamic range?

Even better, why not perform the bracketing and merge in-camera, producing a final, high-dynamic range image with no effort on the part of the lazy photographer? (Me.) I can think of only three reasons: processing power, battery power and memory :)

2005/04/20

Wired News: People Are Human-Bacteria Hybrid

Wired News: People Are Human-Bacteria Hybrid

we are best viewed as walking "superorganisms," highly complex conglomerations of human cells, bacteria, fungi and viruses...we are somewhat outnumbered by the [microbes].


Nicholson's colleague, professor Ian Wilson from Astra Zeneca, believes the "human super-organism" concept "could have a huge impact on how we develop drugs, as individuals can have very different responses to drug metabolism and toxicity."


the human genome does not carry enough information on its own to determine key elements of our own biology.


2005/04/03

TortoiseSVN

Some of my co-workers dislike using the command-line to access Subversion repositories. For those running Windows, TortoiseSVN is looking good.

Once it's installed, subversion operations become available from the context menu of Windows Explorer. Checkouts, commits, configuration of TortoiseSVN, it's all right there.

When you're browsing a local checkout of an SVN repository, document icons are decorated with green checkmarks, red exclamation marks, etc. to show whether they are in sync with the repository, whether you have made local modifications, etc.

So far the only problem I've had with TortoiseSVN has been in figuring out how to do a checkout from a read-write repository. There may be better ways of solving the problem, but here's what has worked for me.

First, use svn+ssh to access the repository. In the URL, specify your username on the subversion host. And of course this means you need to use the absolute path to the repository in the URL:

svn+ssh://my_username@my_svn_server/abs_path_to_repository/my_project/trunk

Next, modify the TortoiseSVN settings to enable ssh tunneling. I'm not sure this is really necessary. But I did make the change, via the "Edit" button next to the "Subversion configuration file" label. Once notepad popped up with the contents of the config file, I uncommented the lines for ssh tunneling:

[tunnels]
ssh = $SVN_SSH ssh

2005/04/02

svn+ssh: Using Subversion with SSH

I've been trying to learn how to enable secure shell (SSH) access to Subversion, on both the client and server sides. It's kind of a pain.

The whole point of using SSH is to avoid sending your source code in the clear, so maybe the pain is worth it. Or maybe this is such a common-sense usage of Subversion that somebody (like, say, me) should put some effort into making it easier to do. But I digress.

To connect to an svnserve daemon via SSH you use this repository syntax:

$ svn co svn+ssh://.../

This requires some careful preparation. First, you need to have the following lines uncommented in your client-side ~/.subversion/config:
[tunnels]
ssh = $SVN_SSH ssh

Then, on the client, your URL must include the absolute path to the repository, followed by the path of the project you want to check out from the repository.

For example, suppose you ordinarily use this command to check out a project:
$ svn co svn://svn_server/project/trunk local_name

In order to perform the same checkout using an svn+ssh URL, you'd have to use this command:
$ svn co svn+ssh://svn_server/abs_path_to_repository/project/trunk local_name

You also need an account on the SVN server, with the same username as your account on the client machine. Or you need to specify the username when performing your svn checkout, like so:
$ svn co --username bubba ...

Or you need an entry like this in your ~/.ssh/config, to tell ssh as whom it should connect to the server:
Host svnserver
Hostname svnserver.blah.com
User bubba

On the server, you need to ensure that svnserve is in the path of the user account under which you run svnserve.

You also need to ensure that the account under which you run svnserve, as well as your user account on the server and any other userr accounts which need access to the repository, are all members of the same group. (subversion would be a good name for the group.)

You also need to make sure that your umask is set to 002 (group write-able). Otherwise other users of the remote repository might find themselves suddenly unable to change some file that you've added.

Got all of that? Good! Of course, I probably forgot a few steps...

2005/03/30

PHPmac - Additional Useful Apache2 Config Settings

I'd like to be able to replace Apache 1.3 on my iMac with Apache 2. I've installed the DarwinPorts port for apache2, but starting and stopping the server requires a trip to the command line. Is there any way to use System Preferences to control Apache 2?

Thanks to Google and the folks at phpmac for showing that the answer is "yes":

PHPmac - Additional Useful Apache2 Config Settings

2005/03/17

More Problems With Coal

Yesterday a study was publicized which claimed a correlation between mercury emissions from coal-fired powerplants and the incidence of autism.

On Tuesday the EPA issued a new "Clean Air Mercury" rule.

You would think this rule, which requires a 22% cut in mercury emissions by 2010, would gain some credit for the Bush administration, which has often been accused of weakening environmental regulations to the short-term benefit of industry. But it's not so simple. According to a Knight Ridder news article:

The Bush administration... [hailed] the reductions as the deepest cuts technologically possible... But nearly a dozen power plants nationwide have [cut] cutting mercury emissions by as much as 94 percent -- in test projects paid for by the same Bush administration.


Not long before the Three Mile Island incident, the Union of Concerned Scientists published a paper comparing total expected deaths from radiation, for
two types of powerplants: coal and nuclear. They concluded that nuclear power was safer. (!) If you consider other factors such as environmental damage caused by sulfur emissions (acid rain) and now mercury, the only advantages to burning coal are that: we have a lot of it; it's mined in areas which would otherwise be economically impoverished (e.g. West Virginia).

I think the paper was:
Union of Concerned Scientists. The Risks of Nuclear Power Reactors (Cambridge, MA: 1977).

2005/03/14

DarwinPorts and Subversion on Mac OS X

This is a recap of instructions posted by Bill Bumgarner (here and here) and James Duncan Davidson (here), on installing Subversion and Apache2 via DarwinPorts on Mac OS X 10.3.

Install DarwinPorts

Get DarwinPorts from CVS and build and install it. Assuming default installation locations are okay, this script should work:


#!/bin/sh

cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od login
cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co -P darwinports
cd darwinports/base
./configure
make
sudo make install

Now you need to add the DarwinPorts binaries directory to your PATH. Depending on whether you prefer sh-like shells such as bash or csh-like shells, one of the following should work:

export PATH=$PATH:/opt/local/bin
set path=($path /opt/local/bin)

Install subversion and apache2

Next, using James's instructions as a guide, configure and install subversion and apache2. To do so, run the following script using sudo:

#!/bin/sh
port install apache2
port install subversion +mod_dav_svn +python
port install DarwinPortsStartup
Note a small problem here: This script installs subversion Python bindings, but only for a non-framework installation of Python. If you need bindings for a framework installation of Python, you're on your own.

Create The Repository

Bill created his subversion repository in /svn. I wanted mine in /usr/local/svn-repository, for no good reason.
$ sudo mkdir /usr/local/svn-repository
$ sudo svnadmin create --fs-type fsfs /usr/local/svn-repository/master
$ sudo chown -R www /usr/local/svn-repository
Patch httpd.conf

Bill has provided a patch for httpd.conf. It assumes that your subversion repository resides in /svn. If it resides elsewhere you'll need to change the patch file before applying it.

For example, since I put my subversion repository in /usr/local/svn-repository I had to change every reference to the /svn filesystem location in the patch file to point to /usr/local/svn-repository.)

You can copy the patch file to /opt/local/apache2/conf, and then apply it from there. Patch will ask you if it should assume this is a reverse patch (-R). Say 'y':

$ sudo cp my-httpd-conf-svn.patch /opt/local/apache2/conf/
$ cd /opt/local/apache2/conf/
$ sudo cp httpd-std.conf httpd.conf
$ sudo patch httpd.conf my-httpd-conf-svn.patch
patching file httpd.conf
Reversed (or previously applied) patch detected! Assume -R? [n]
y
Add Repository Users
$ cd /usr/local/svn-repository/
$ sudo -u www htpasswd -c master-auth mitch
New password:
Re-type new password:
Adding password for user mitch
Test The Apache2 Configuration
$ /opt/local/apache2/bin/apachectl configtest
Syntax OK

Start Apache2


It should start up, listening on port 8000.
$ sudo /opt/local/apache2/bin/apachectl restart
httpd not running, trying to start
At last you should be able to view the topmost directory of the (empty) subversion repository in your web browser, by loading http://localhost:8000/svn/

2005/02/02

Rendering GL content to grids and printers

I'd like to render 3D graphics into the cells of a wxGrid, and am considering using an offscreen wxGLCanvas to prepare the contents of each cell as requested. This seems like a common approach; for example, NSTableViews in Cocoa use a single NSCell to paint the contents of each column.

How to render the contents of the wxGLCanvas into each grid cell? The easiest way seems to be to set the size of the canvas to match the size of the current cell, render the scene, copy the content into a wxBitmap, and draw the Bitmap into the cell rect.

Others have shown how to copy wxGLCanvas content into a wxBitmap, e.g. in order to print the contents of a canvas. But the sample code I've found has omitted a key step: a call to glPixelStorei to ensure proper packing of the data provided by glReadPixels.

Anyway, here's what works for me. This code assumes the GLCanvas size has been set and the scene already rendered:


def _getBitmap(self):
c = self.canvas
x, y, w, h = glGetIntegerv(GL_VIEWPORT)

glPixelStorei(GL_PACK_ALIGNMENT, 1)
pixels = glReadPixels(x, y, w, h, GL_RGB, GL_UNSIGNED_BYTE)
img = wx.EmptyImage(w, h)
img.SetData(pixels)
img = img.Mirror(False)
self.bm = wx.BitmapFromImage(img)


2005/01/21

Temporarily disabling callbacks in wxPython

A data model can have many views. When a user changes one of the views, that change needs to be reflected in other views. If you use wxPython widgets to implement your views, this can set off an update storm. Here's how to avoid it.

It's frustrating that a programmatic change to a wxPython widget causes callbacks associated with the widget to fire. For example, if you've bound wx.EVT_TEXT in a wxTextCtrl then any subsequent call to SetValue can trigger the bound callback.

In contrast other toolkits (e.g. Apple's Cocoa) recognize that, when you change a widget programmatically, you're usually trying to treat it as just a passive MVC view. You just want to reconfigure your widget, not to generate any callback events. Events are for user input.

wxPython widget classes are derived from wxEvtHandler, and there lies the solution to the problem. If you want to update a widget without triggering its callbacks, first call its SetEvtHandlerEnabled method with an argument of False. Make your update, then call SetEvtHandlerEnabled with an argument of True.

It's a lot of extra typing, but it works. I just wish it hadn't taken me so long to notice wxEvtHandler. I could have avoided a lot of grumbling.

But that sure is a lot of extra typing...

Here's a wrapper function which lets you disable callbacks for the duration of a single method invocation, without suffering the typical verbosity of wxPython:

def withoutCBs(method):

def wrapper(*args, **kw):
widget = method.im_self

oldSetting = widget.GetEvtHandlerEnabled()
widget.SetEvtHandlerEnabled(False)
try:
return method(*args, **kw)
finally:
widget.SetEvtHandlerEnabled(oldSetting)
return wrapper
This wrapper makes it easy to perform a single, callback-free widget update:
    def _uiQuietBtnClicked(self, evt):

withoutCBs(self.field.SetValue)("Quiet")
Of course this is only good for invoking a single method defined directly on the target widget. What if you've composed a complicated method in a controller class, and you need to disable callbacks for the duration of that method? A simple refactoring lets you state explicitly which widget you want to stifle:
def withoutCBs(method, widget=None):

"""Prepare to call method with widget's callbacks
disabled.

If widget is None it is assumed to be the widget
bound to method.
"""
def wrapper(*args, **kw):
w = widget or method.im_self

oldSetting = w.GetEvtHandlerEnabled()
w.SetEvtHandlerEnabled(False)
try:
return method(*args, **kw)
finally:
w.SetEvtHandlerEnabled(oldSetting)
return wrapper
With this modification you can silence a widget for the duration of any operation, regardless of where it's defined:
    def _uiQuietBtnClicked(self, evt):

withoutCBs(self._performComplexOperation,
widget=self.field)()

def _performComplexOperation(self):
...