Friday, January 12, 2007 

http://www.georgevreilly.com/blog/content/binary/PythonBatch.jpg

Batchfile Wrapper

I've made some significant changes to my Python Batchfile Wrapper. The main virtue of this wrapper is that it finds python.exe and invokes it on the associated Python script, ensuring that input redirection works.

I've also adapted py2bat to work with my wrapper. I'm calling my version py2cmd.

Here's my latest batch file, which is shorter than its predecessor.

To use it, place it in the same directory as the Python script you want to run and give it the same basename; i.e., d:\some\path or other\example.cmd will run d:\some\path or other\example.py.

 @echo off
 setlocal
 set PythonExe=
 set PythonExeFlags=-u

for %%i in (cmd bat exe) do (
for %%j in (python.%%i) do (
call :SetPythonExe "%%~$PATH:j" ) ) for /f "tokens=2 delims==" %%i in ('assoc .py') do (
for /f "tokens=2 delims==" %%j in ('ftype %%i') do (
for /f "tokens=1" %%k in ("%%j") do (
call :SetPythonExe %%k ) ) ) "%PythonExe%" %PythonExeFlags% "%~dpn0.py" %* goto :EOF :SetPythonExe if not [%1]==[""] (
if ["%PythonExe%"]==[""] (
set PythonExe=%~1
)
)
goto :EOF

This is sufficiently cryptic that it merits some explanation.

The first set of nested loops attempts to find python.cmd, python.bat, and python.exe, respectively, along your PATH:

 for %%i in (cmd bat exe) do (
for %%j in (python.%%i) do (
call :SetPythonExe "%%~$PATH:j"
)
)

The %%~$PATH:j expression searches the PATH for %%j (i.e., python.cmd, etc). If it's found, the expression evaluates to the full path to %%j. Otherwise, it evaluates to the empty string. I've bracketed the expression with double quotes in order to handle spaces in directory names.

The SetPythonExe subroutine simply sets %PythonExe% to %1 if and only if %PythonExe% doesn't already have a value and %1 is not empty:

We can't set %PythonExe% directly in the loop. As explained at for loops and variable expansion, environment variables in the body of the loop are evaluated once before the loop starts and won't change until after the loop terminates:

 :SetPythonExe
if not [%1]==[""] (
if ["%PythonExe%"]==[""] (
set PythonExe=%~1
)
)
goto :EOF

Note: the %~1 notation strips off any surrounding double quotes. (ss64.com has details on parameter syntax.)

The square brackets and double quotes are necessary to make it all work if either %PythonExe% or %1 contains spaces. Getting this right was one of the hardest parts of the whole exercise.

The second set of nested loops are scarier:

 for /f "tokens=2 delims==" %%i in ('assoc .py') do (
for /f "tokens=2 delims==" %%j in ('ftype %%i') do (
for /f "tokens=1" %%k in ("%%j") do (
call :SetPythonExe %%k
)
)
)

The outer loop runs once: assoc .py yields .py=Python.File and %%i is set to Python.File. Running ftype Python.File yields Python.File="C:\Python24\python.exe" "%1" %* (on my machine).

The second loop also runs once: %%j is set to everything on the right-hand side of the =.

The third loop also runs once: %%k is set to the first token in %%j, "C:\Python24\python.exe", which is passed in to SetPythonExe.

At this point, %PythonExe% will have a value if python.cmd (or python.bat or python.exe) existed on your path, or the .py extension was registered.

If it doesn't have a value, then the invocation of "%PythonExe%" will fail, setting %errorlevel% to 9009:

 "%PythonExe%" %PythonExeFlags% "%~dpn0.py" %*
goto :EOF

%PythonExeFlags% was set to -u at the beginning of the script. As explained in my Python Batchfile Wrapper post, this treats stdin, stdout, and stderr as raw streams, instead of transliterating \r\n into \n. If you want cooked input, simply remove the -u.

The "%~dpn0.py" notation yields the absolute path to the Python script with the .py extension sitting beside this batch file: another example of parameter syntax.

Finally, goto :EOF ends execution of the batchfile, skipping the :SetPythonExe subroutine.

Whew!

py2cmd

You can have a batchfile sitting alongside a Python script as above, or you can have a self-contained batchfile cum Python script.

py2bat has been kicking around for years. It takes a Python script and turns it into a batchfile, by relying on a couple of tricks.

I've adapted py2bat into a new script, py2cmd. In essence, the generated batchfile looks like this:

 @echo off
REM="""
... set PythonExe as above ...
"%PythonExe%" -x %0
goto :EOF
"""

# python code starts here
# ...

When this file is executed by cmd.exe, the control flow should be obvious. Disable echoing to the screen, a funny-looking REM, set %PythonExe% as before (not shown), invoke python.exe with the -x flag on the current batchfile, and finally skip past the rest of the file.

When Python is invoked with the -x flag, it skips the first line of the script (@echo off). The second line sets the variable REM to the multiline string which continues down to the closing """ below the goto :EOF. Everything after that is the original Python script. All the batchfile nonsense is wrapped up inside the REM variable.

Download py2cmd.

Other Wrappers

Fredrik Lundh's ExeMaker generates a stub executable to launch a Python script with the same basename. It requires that Python already be installed on the target machine. I couldn't get ExeMaker to work properly. The stub executable leaves me at the Python interpreter's interactive prompt.

py2exe takes a Python script and bundles up all the Python support files to make it run on a machine that doesn't have Python installed. Works fine for me, but you get 4MB+ of associated runtime. Massive overkill if the target machine is known to have Python installed.

posted on Saturday, January 13, 2007 2:49:31 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]

content/binary/olbermann_countdown.jpg

Keith Olbermann was on fire tonight, condemning the insanity of escalating a lost war that the American public so clearly wants no more of.

Only this president could look out over a vista of 3,008 dead and 22,834 wounded in Iraq, and finally say, “Where mistakes have been made, the responsibility rests with me” — only to follow that by proposing to repeat the identical mistake ... in Iran.

... 

And yet — without any authorization from the public, which spoke so loudly and clearly to you in November’s elections — without any consultation with a Congress (in which key members of your own party, including Sens. Sam Brownback, Norm Coleman and Chuck Hagel, are fleeing for higher ground) — without any awareness that you are doing exactly the opposite of what Baker-Hamilton urged you to do — you seem to be ready to make an open-ended commitment (on America’s behalf) to do whatever you want, in Iran.

... 

The lives of 21,500 more Americans endangered, to give “breathing space” to a government that just turned the first and perhaps the most sober act of any democracy — the capital punishment of an ousted dictator — into a vengeance lynching so barbaric and so lacking in the solemnities necessary for credible authority, that it might have offended the Ku Klux Klan of the 19th century.

... 

Before Mr. Bush was elected, he said nation-building was wrong for America.

Now he says it is vital.

He said he would never put U.S. troops under foreign control.

Last night he promised to embed them in Iraqi units.

He told us about WMD.

Mobile labs.

Secret sources.

Aluminum tubes.

Yellow-cake.

He has told us the war is necessary:

Because Saddam was a material threat.

Because of 9/11.

Because of Osama Bin Laden. Al-Qaida. Terrorism in general.

To liberate Iraq. To spread freedom. To spread Democracy. To prevent terrorism by gas price increases.

Because this was a guy who tried to kill his dad.

Because — 439 words in to the speech last night — he trotted out 9/11 again.

In advocating and prosecuting this war he passed on a chance to get Abu Musab Al-Zarqawi.

To get Muqtada Al-Sadr. To get Bin Laden.

He sent in fewer troops than the generals told him to. He ordered the Iraqi army disbanded and the Iraqi government “de-Baathified.”

He short-changed Iraqi training. He neglected to plan for widespread looting. He did not anticipate sectarian violence.

He sent in troops without life-saving equipment. He gave jobs to foreign contractors, and not Iraqis. He staffed U.S. positions there, based on partisanship, not professionalism.

He and his government told us: America had prevailed, mission accomplished, the resistance was in its last throes.

He has insisted more troops were not necessary. He has now insisted more troops are necessary.

He has insisted it’s up to the generals, and then removed some of the generals who said more troops would not be necessary.

He has trumpeted the turning points:

The fall of Baghdad, the death of Uday and Qusay, the capture of Saddam. A provisional government, a charter, a constitution, the trial of Saddam. Elections, purple fingers, another government, the death of Saddam.

He has assured us: We would be greeted as liberators — with flowers;

As they stood up, we would stand down. We would stay the course; we were never about “stay the course.”

We would never have to go door-to-door in Baghdad. And, last night, that to gain Iraqis’ trust, we would go door-to-door in Baghdad.

He told us the enemy was al-Qaida, foreign fighters, terrorists, Baathists, and now Iran and Syria.

He told us the war would pay for itself. It would cost $1.7 billion. $100 billion. $400 billion. Half a trillion. Last night’s speech alone cost another $6 billion.

And after all of that, now it is his credibility versus that of generals, diplomats, allies, Democrats, Republicans, the Iraq Study Group, past presidents, voters last November and the majority of the American people.

Oh, and one more to add, tonight: Oceania has always been at war with East Asia.

Mr. Bush, this is madness.

You have lost the military. You have lost the Congress to the Democrats. You have lost most of the Iraqis. You have lost many of the Republicans. You have lost our allies.

You are losing the credibility, not just of your presidency, but more importantly of the office itself.

And most imperatively, you are guaranteeing that more American troops will be losing their lives, and more families their loved ones. You are guaranteeing it!

This becomes your legacy, sir: How many of those you addressed last night as your “fellow citizens” you just sent to their deaths.

And for what, Mr. Bush?

So the next president has to pull the survivors out of Iraq instead of you?

Bush sent troops into an Iranian consulate in Iraq last night, invading the sovereign territory of Iran. Is he trying to provoke Iran into a war too? How does he propose to fight it? Is he trying to bring on the end times?

Feh!

posted on Friday, January 12, 2007 8:11:13 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Wednesday, January 10, 2007 

http://images.amazon.com/images/P/0441014011.01.MZZZZZZZ.jpg

Title: Pushing Ice
Author: Alastair Reynolds
Rating: 4 stars out of 5
Publisher: Ace
Copyright: 2006
ISBN: 0441014011
Pages: 464
Keywords: speculative fiction
Reading period: 4-9 January, 2007

Fifty years hence, Janus, one of the moons of Saturn, suddenly leaves its orbit and starts heading for Spica, 260 light years away. Only the mining ship Rockhopper can intercept what is now apparent as a long-dormant alien artifact and learn something about it. Things go wrong and the ship crash lands on Janus, as it heads towards Spica at near-relativistic speed. The crew splits into factions led by the captain, Bella Lind, and the chief engineer, Svetlana Barseghian, once the best of friends, now implacable enemies.

Reynolds tells an exciting tale of big ideas, hard science, and clashing personalities.

Recommended.

posted on Wednesday, January 10, 2007 8:29:57 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Monday, January 08, 2007 

content/binary/MindMapSpeech.png

I gave a speech at Freely Speaking Toastmasters this evening, on Mind Mapping. You can see a shrunken version of the mind map for the speech above. Clicking on it will lead to the full-sized image.

I created the mind map with Freemind. Here's the speech mindmap as a Freemind document.

I thought the speech went quite well. It was speech #8, working with visual aids. I drew a partial version of my speech's mind map on a white board ahead of time, and drew a couple of mind maps on a flip chart during the speech. The second one was a two-minute brainstorming session on increasing club membership.

I had intended to record the speech and turn it into a podcast, but I forgot.

Usually, I write out the words of the speech ahead of time, rehearse it several times, fine-tuning the words, and then deliver the speech from a handful of notes.

This time, I never wrote down anything except the mind map itself. I did have a printout of the map in front of me, though I didn't refer to it often.

posted on Tuesday, January 09, 2007 7:46:09 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Thursday, January 04, 2007 

http://farm1.static.flickr.com/141/336010760_60ec3f674d_m.jpg

This recipe comes from my mother, who has used it for many years.

Fruit-based Christmas cake is considered a treat in Ireland, not a thing of horror, as so many Americans regard it.

12 ozs

butter

12 ozs

brown sugar

12 ozs

plain flour

1 tsp

salt

12 ozs

raisins

12 ozs

sultanas

6 ozs

dried currants

6 ozs

candied peel

4 ozs

glacé cherries

4 ozs

walnuts, optional, cut in half

2 ozs

angelica, optional

4-5

eggs

Makes 9" round cake in a 3" tall cake pan.

Note: For the raisins, you can substitute stoned muscat raisins or valentias if you wish. Be careful to only take the stone and leave the flesh. I usually cut them in half as they are big.

Soak all fruit overnight in some whiskey (approx half cup) or brandy. Stir and cover.

Line tin with buttered greaseproof paper (two layers) on sides and bottom. Must be 3" taller than tin. Put brown paper around outside to prevent burning: prevents base being burned.

Cream butter and sugar very well: about 10 mins in a beater. Whip eggs together and sieve flour. Gradually add eggs slowly and alternate with some flour (it might be better to do this by hand to prevent curdling). Add rest of dry ingredients. Lastly add soaked fruit. Stir and pour into lined tin.

Before putting into oven, make a 3" wide scoop in centre of top; glaze cake with some milk to prevent cracking. Cake takes approx four hours to cook. If getting too brown, put some paper on top for last half hour. Don't open oven before that.

Cook on 2nd shelf from the bottom. My oven in Dublin I cook at 300F for 1 1/2 hours and reduce to 250F for 2 1/2 hours.

While still warm, pierce top several times and pour in a little whiskey. Leave in tin overnight.

The cake may be made several months ahead of time. Keep in an airtight container. Every few weeks, drizzle a little whiskey on it to keep it moist.

In mid-December, the cake should be covered with a layer of marzipan icing. It should then be decorated with a layer of royal icing.

Update: 2008/03/31: Emma posted several blog posts about the Christmas Cake that I made in 2007: making the cake, making marzipan, and icing the cake.

posted on Friday, January 05, 2007 6:41:01 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Quicksilver
Title: Quicksilver: The Baroque Cycle, Vol. 1
Author: Neal Stephenson
Rating: 3 stars out of 5
Publisher: William Morrow
Copyright: 2003
Pages: 927
Keywords: historical fiction
Reading period: 10 December 2006–4 January, 2007

The first of three equally long volumes of historical fiction by Neal Stephenson, who is better known for his speculative fiction. This is a prequel of sorts to Cryptonomicon, featuring the distant ancestors of the Waterhouse and Shaftoe characters.

Quicksilver primarily takes place in late 17th century Europe, the baroque era where giants such as Newton, Leibniz, Hooke, and Huygens brought about a new understanding of the world. Daniel Waterhouse, a Puritan scholar, moves among them, knowing that he is not a good enough Natural Philosopher to be their equal, while he also moves through the courts of King Charles II and James II. Jack Shaftoe, who styles himself the King of the Vagabonds, moves in far less reputable circles. The two men do not meet, but they are both tied to the remarkable Eliza, who rises from being a Turkish harem slave to becoming both a French countess and a Dutch duchess, by working as a double agent for the Dutch against the French.

It's an engaging tale, conveying a good deal of the intellectual and political ferment of the times. However, both Daniel and Eliza seem anachronistic to me, like characters transplanted from the twentieth century. Stephenson works in a variety of styles ranging from straight narrative, to short plays, to long epistolatory chapters. He throws in other anachronistic touches too, such as Leibniz referring to the growing incidence of 'canal rage' amongst the gondoliers of Venice.

At 900 pages, it's far too long. Stephenson's editor should have reined him in. I would have enjoyed it more at half the length.

posted on Friday, January 05, 2007 6:02:04 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Sunday, December 31, 2006 

http://images.amazon.com/images/P/0596100833.01.MZZZZZZZ.jpg

Title: Window Seat: The Art of Digital Photography & Creative Thinking
Author: Julieanne Kost
Rating: 3 stars out of 5
Publisher: O'Reilly
Copyright: 2006
ISBN: 0596100833
Pages: 148
Keywords: photography, photoshop, creativity
Reading period: 30 December, 2006

Julieanne Kost, a Photoshop evangelist for Adobe, flies 200 days a year. For the last five years, she's been taking photos out of airplane windows.

This book is part pretty pictures, part a meditation on creativity, and part a Photoshop tutorial.

It is said that a picture is worth a thousand words. That must be why the word count is so low. In the first 120 pages, there are eight pages of text on creativity, and one page of text for each of the following seven chapters. The book concludes with twelve pages of text in an appendix on Imaging Techniques, a high-speed introduction to photo manipulation in Photoshop.

The rest of the book is pictures. Pictures of clouds, pictures of fields, of mountains, of the sea, pictures of sunrises and sunsets. Great photos, even if the subject matter is a little repetitive.

The appendix shows several examples of before-and-after shots, and she's worked some wonders, though you'd expect no less from a Photoshop Evangelist.

Ultimately, the book is unsatisfying. Both the creativity and the Photoshop sections are too cursory to be of much value. It is more successful as a book of photographs, but I would have appreciated more commentary on the photos themselves. Why choose this one? What caught her eye in the first place? The choices of composition and cropping. What worked, what didn't.

Too bad.

posted on Sunday, December 31, 2006 9:09:25 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Saturday, December 30, 2006 

http://images.amazon.com/images/P/006088231X.01.MZZZZZZZ.jpg

Title: Matriarch
Author: Karen Traviss
Rating: 4 stars out of 5
Publisher: Eos
Copyright: 2006
ISBN: 006088231X
Pages: 387
Keywords: SF
Reading period: 20-30 December, 2006

The fourth installment in Traviss's series about the wess'har, which began with City of Pearl. The plot is too complex to summarize here, and would make little sense if you haven't read the preceding books.

This is intelligent, character-driven SF, written for adults. A small cast of humans interact with four very different alien races, far from home. These aliens are not Americans with green skin; they live by different rules. The humans are flawed people who struggle with complex issues.

Traviss's themes include ecology, ethics, and responsibility. She also throws in some action and enough plot twists to keep things unpredictable.

The books take a little getting used to, but pull me along. I look forward to the projected remaining two books in the series.

posted on Sunday, December 31, 2006 4:04:58 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [1]

http://images.amazon.com/images/P/1852427817.01.MZZZZZZZ.jpg

Title: Rilke on Black
Author: Ken Bruen
Rating: 3 stars out of 5
Publisher: Five Star
Copyright: 1996
ISBN: 1852427817
Pages: 160
Keywords: crime, fiction
Reading period: 26-28 December, 2006

Three very screwed-up Londoners kidnap a Rilke-spouting businessman and hold him for hostage. There's a horrified fascination as it inevitably goes pear shaped. Written in a spare, first-person style, it's short, but certainly not sweet.

posted on Sunday, December 31, 2006 3:56:44 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]

http://www.salon.com/books/feature/2001/07/19/book_reviews/story.jpg

Inspired by Keith Martin's Reading Notes, I've decided to try writing a short review of every book that I read, starting today. I expect that most reviews will be 100 to 250 words.

Why? Like my Picture of the Day project, it should help me think a little harder about what I'm reading, if I know that I'm going to have to say something pithy about it. I'm a better photographer than I am a reviewer, so the exercise should be good for me.

Now you know why I put together a way of Rating with Stars for dasBlog yesterday.

The first two reviews have already been written and will follow shortly.

Technical Notes:

  • Abusing Amazon images showed me how to grab the book covers.

  • I'm using my Amazon Associates ID to link to the books, http://www.amazon.com/exec/obidos/ASIN/ISBN/georgvreill-20 Unless my readership grows signficantly larger, I'll be lucky if I haul in as much as $10 per year.

  • Right now, I'm filling out a little template in a text file and generating HTML. In time, I hope to add some plumbing behind the scenes to generate automatic indexes of authors, keywords, etc. But first, some content.

posted on Sunday, December 31, 2006 3:55:39 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]

content/binary/5star0.gif

content/binary/5star3.5.gif

content/binary/5star5.gif

I want to be able to write some reviews and graphically rate them with stars. I put together some transparent stars in Gimp and added a macro to dasBlog.

I'm going to rate this effort:

4.5 stars out of 5

To get this effect, I simply wrote $stars(4.5).

(And I had to carefully construct the previous sentence so that dasBlog wouldn't invoke the stars macro.)

I'm hardnosed. I rarely give 5/5 to anything. I don't really expect to need the half stars, but I may want that fine control at some point.

To use this in your own blog, download the zipfile of star images.

Copy 5star*.gif to your blog's images directory. The *.xcf files are Gimp source files.

Add the following line to the <ContentFilters> section of your blog's site.config:

<ContentFilter
find="\$stars\((?&lt;expr&gt;[\d.]+)\)"
replace="&lt;div&gt;&lt;img src=&quot;images/5star${expr}.gif&quot; /&gt; ${expr} stars out of 5&lt;/div&gt;"
isregex="true" />

Enjoy!

posted on Saturday, December 30, 2006 9:36:06 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [1]
Thursday, December 28, 2006 

content/binary/PythonBatch.jpg

I've been getting into Python lately. One problem that I've encountered under Windows, is that input redirection doesn't work if you use the .py file association to run the script; e.g.:

 C:\> foo.py < input.txt

There's a well-known input redirection bug. The fix is to explicitly use python.exe to run the script.

A related problem for me was that stdin was opened as a text file, not a binary file, so \r bytes were being discarded from binary input files. The fix is to run python.exe -u (unbuffered binary input and output).

I didn't want to hardcode the path to python.exe in a batch file, so I came up with the following wrapper, which parses the output from assoc .py and ftype Python.File.

Just place this batch file in the same directory as foo.py and call it foo.bat.

 @setlocal
 @if (%_echo%)==()  set _echo=off
@echo %_echo% :: You must explicitly invoke python.exe, rather than rely on the :: file association for .py, if you want stdin redirection to work. :: See http://mail.python.org/pipermail/python-bugs-list/2004-August/024920.html :: The -u flag to python.exe specifies unbuffered, binary stdin, :: so '\r\n' is not remapped to '\n'. call :FindPythonExe if "%PythonExe%"=="" (
echo Can't find python.exe exit /B 1 ) :: Replace the extension of this batch file with .py: s/.bat$/.py/ set PythonFile=%~dpn0.py

"%PythonExe%" -u %PythonFile% %* goto :EOF :: :: Find python.exe in the path or via the .py association :: :FindPythonExe set PythonExe= :: Search for python.{cmd,bat,exe} in %PATH% for %%i in (cmd bat exe) do (
if "%PythonExe%"=="" (
for %%j in (python.%%i) do set PythonExe=%%~$PATH:j ) ) :: Extract path to python.exe from .py association if "%PythonExe%"=="" call :AssocPy2Exe goto :EOF :: :: Return the executable associated with .py in %PythonExe% :: :AssocPy2Exe call :AssocExtn2Exe .py
set PythonExe=%_exe% goto :EOF :: :: Return the executable associated with file extension %1 in %_exe% :: :AssocExtn2Exe :: assoc .py -> .py=Python.File for /f "usebackq tokens=2 delims==" %%i in (`assoc %1`) do set _ftype=%%i :: ftype Python.File -> Python.File="C:\Python24\python.exe" "%1" %* :: Grab everything after the '=' for /f "usebackq tokens=2 delims==" %%i in (`ftype %_ftype%`) do set _rhs=%%i :: Get the first token of the space-separated list for /f "tokens=1" %%i in ("%_rhs%") do set _exe=%%i goto :EOF

Now you can run foo.bat < bar.jpg with the expected results.

Enjoy!

Update 2007/01/03: The batchfile now searches %PATH% before looking up the .py association.

Update 2007/01/12: See here for a significantly improved batchfile and for py2cmd.

posted on Friday, December 29, 2006 1:47:28 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Tuesday, December 26, 2006 

content/binary/rainlendar.png

I've dualbooted my laptop between Linux and Windows since June, spending nearly all of my time in Linux. I started out with Ubuntu 6.06 (Dapper Drake), but soon switched to Kubuntu (the KDE variant), later upgrading to Kubuntu 6.10 (Edgy Eft).

To make this useful, certain key applications have to be available in both Windows and Linux. Firefox for browsing; Thunderbird for email; Rainlendar for calendar; KeePass and KeePassX for password management; among others.

My laptop has four partitions:

  • Primary 1, NTFS - Windows, aka /windows or /dev/hda1. 8GB

  • Primary 2, Ext3 - Linux system partition, aka / or /dev/hda2. 12GB

  • Extended 1. Linux swap partition. 2GB.

  • Extended 2, Ext3. Shared partition, aka /shared. 15GB.

I'm using NTFS-3G under Kubuntu to read and write the NTFS partition. Linux has long had support for reading NTFS partitions, but only recently has good support for writing NTFS partitions been added. It's a user-mode only filesystem, so it's not possible to run Linux from an NTFS partition.

I've installed Ext2 IFS (Installable File System) on Windows, which allows me to read and write Ext3 (and Ext2) partitions. I keep cross-platform data, such as my Thunderbird mail folders, on the Ext3 partition, /shared. My home directory is also on the /shared partition, so there's very little data that I mind losing on the / partition. I haven't had any problems with Ext2 IFS, except that I've had no luck with external USB hard drives formatted as Ext3. I'm not about to convert my Windows partition to Ext3, however.

Rainlendar is a fairly recent addition to the above list of cross-platform apps. I was using Mozilla Sunbird, but I never liked it very much. It's very much the poor cousin of Firefox and Thunderbird. Sunbird is slow, clunky, and ugly, with very few developers, who have taken years just to get it to version 0.3. It supports iCal as an export format, but publishing calendars to the web is a bear.

I discovered Rainlendar a couple of months ago. It's far slicker, with a large set of skins, and more functionality. iCal is the native format. Rainlendar is based on wxWidgets, so it's cross-platform. Installation on Linux consists of extracting everything from a compressed tar file. There's no deb or rpm packages to install it into your system menu, alas. I've been running it by using Alt+F2 (Run Command) to launch /shared/georger/rainlendar2/rainlendar (yuck!)

Earlier today, I ran across the very useful ArsGeek site, which has an enormous set of useful tips for Ubuntu users. One post on installing Songbird inspired me to figure out how to add Rainlendar to the KDE Menu.

First, open up a terminal, then:

 cd /opt
sudo mkdir rainlendar2
sudo chown georger:georger rainlendar2
tar jxvf /shared/Downloads/Rainlendar-Lite-2.0.1.tar.bz2

Substituting your username twice in the chown line.

You should now be able to run Rainlendar from the command line:

 ./rainlendar2/rainlendar2 &

At this point, you may want to install a different skin, as the default look is overwhelming in my opinion. I use the Vista skin. The older skins (.zip files) need to be unzipped into rainlendar2/skins; newer skins (.r2skin files) merely need to be copied into that directory.

Now to get the Rainlendar icon into /usr/share/pixmaps. (Finding the damn icon was the trickiest part of this whole exercise.):

 cd rainlendar2/resources
unzip -j resources.zrc res/logo-large.png
sudo mv logo-large.png /usr/share/pixmaps/rainlendar.png

Finally, let's add Rainlendar to the Office menu. ArsGeek gives the instructions for using Alacarte under Gnome. For KDE, click the K Menu button, right-click on Office, and choose Edit Menu, which brings up the KDE Menu Editor. Click New Item, then set:

  • Name: Rainlendar

  • Description: Calendar

  • Comment: Manage calendar and todos

  • Command: '/opt/rainlendar2/rainlendar2'

Click the blank icon button, then Other icons. Choose the rainlendar icon and click OK. Save the new menu entry.

You should now be able to launch Rainlendar from the Office menu. Enjoy!

posted on Tuesday, December 26, 2006 10:29:49 PM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Wednesday, December 13, 2006 

At work, we're having a Christmas party every day this week at 4pm. Each day, a different team is responsible for providing food and drink. Yesterday, my team provided Caipirinhas and some Brazilian food. Today, we had Scotch and savory cheesecakes!

I'm so used to cheesecakes being sweet that it's never occurred to me that they could come any other way, but I have to say that mushroom, pepper & pesto, and brie &hazelnut cheesecakes are all quite tasty.

posted on Wednesday, December 13, 2006 8:33:04 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Tuesday, December 05, 2006 

http://static.flickr.com/101/313774151_87aed6679c_t.jpg

10/29. In mid-October, I shaved off the goatee that I had sported since March, leaving me clean-shaven for the first time in a decade. I quickly got over that urge and let the beard start growing back.

This is me at the two-week stage: a self-portrait taken while experimenting with the new camera. It looks a little odd to me. I'm using this as the startup photo on the camera.

http://static.flickr.com/121/313775428_9792710da3_t.jpg

10/30. I go back and forth between Atlas's offices at Pioneer Square and the International District, and Smith Tower is a major landmark.

http://static.flickr.com/105/313774642_85646ea733_t.jpg

10/31. Once again, we got dozens and dozens of young callers at Halloween. I have a set of Halloween photos at Flickr.

http://static.flickr.com/108/313774925_1bd5ce9417_t.jpg

11/01. This is taken from the roof of Atlas's office Occidental Square, looking at the building on the other side of the street.

http://static.flickr.com/104/313775669_7531936e4e_t.jpg

11/02. Tres works in the group that I'm loaned out to, Atlas Publisher. He has a certain sartorial flair. He also turns out to be a friend of Sparky.

http://static.flickr.com/110/313774119_11f352653b_t.jpg

11/03. Occidental Square at dusk.

posted on Tuesday, December 05, 2006 8:00:25 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Monday, December 04, 2006 

content/binary/flickr-matrix.jpg

About six weeks ago, I read about Sparky's A Picture a Day project on his blog. He in turn had been inspired by Photojojo's Project 365.

Here's how it works, for me. I take at least one photo a day, every single day for a year. Every so often, I upload the photos to my Flickr site. If I get more than one worthwhile photo in a day, great, but one and only gets tagged potd (picture of the day).

Why? Apart from the reasons enumerated by Photojojo, here's what I get out of it.

First of all, fun. It adds a little spark to my day, to be always looking for photo ops.

Second, the constant practice makes me a better photographer.

Third, more photo editing and photo organization. Historically, I have been much better about taking photos than I have about organizing them and editing them. This should get me off my duff about going through the thousands of photos I've taken since I went digital in 2001, and posting the best of them.

Before I was inspired to start this project, I had been thinking about getting a small point-and-shoot, like the Casio Exilim. When my parents stayed with us and went to Hawaii with us a month before, I had played with my mother's Exilim and liked it. My father had also had me order another Exilim as a present for Michelle, and I had carried that around for a week.

I bought myself a Casio Exilim EX-Z1000 at CostCo. It's 10 megapixels, which I think is overkill, but even so, I can get more than 700 photos on to a 2GB card. It came with a leather carrying case, now a fulltime resident on my belt. I'm fairly happy with it, and I think I've got some good results from it. But judge for yourself.

I love my other camera, a Nikon D70 digital SLR, but it's far too bulky and heavy to carry with me all the time.

I finally uploaded the first 36 pictures to Flickr last night, after working on them for most of the weekend. It would have been sooner, but we spent 2.5 weeks in Ireland with wholly inadequate Internet access, and I was quite busy before then.

From now on, I hope to post new POTD pictures two or three times a week.

The next few posts will talk about those first 36 photos in more detail. I also intend to write up the workflow that I'm developing.

posted on Tuesday, December 05, 2006 3:29:01 AM (Pacific Standard Time, UTC-08:00) 
#    Comments [1]
Sunday, December 03, 2006 

http://lh3.google.com/image/ethnamamamia/RVscdSwWABI/AAAAAAAAACU/L0ldxg_0xgs/DSCF1234.JPG?imgmax=320

I noted at the beginning of July that my sister Michelle was to be married to David Bowles in Dublin in early November.

The wedding took place on Friday, November 10th. Emma and I arrived the afternoon before, half stumbling with tiredness. My brother, Mark, and his wife, Lizzy, had arrived from New York only hours earlier.

The ceremony took place at 1pm at St. Brigid's, a small, old Anglican church, on the outskirts of Stillorgan village, long since absorbed into the Dublin metropolitan area. It was very Ascendancy, with 19th century plaques about Fellow of the Royal College this and Brevet Colonel (Boer War) that.

The bride looked lovely, and I have the photos to prove it.

After the wedding, we all repaired to Barberstown Castle for the reception. There were, I think, 160 guests who partied late into the night. Emma and I gave up around 1:30, exhausted from the jet lag. My mother didn't get to bed until after 4am. Philip Bowles, David's father, who had been undergoing chemotherapy, was in fine form and stayed up nearly as late.

Emma and I had arranged to stay a second night at Barberstown Castle, and I ended up sleeping until 4pm on the Saturday, trying to sleep off the drink and the jetlag.

The following week, my mother and I went through the nearly 400 photos that she, Emma, David Reilly, and I had taken, and whittled it down to 74 representative ones. She badly wanted to send the photos to her friends around the world, so I set up a Picasa web album for her and uploaded them.

Mark set up a site for Michelle and David before the wedding, but it doesn't yet link to the photos.

posted on Sunday, December 03, 2006 7:00:56 PM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Wednesday, November 08, 2006 

http://www.microsoft.com/library/media/1033/technet/images/sysinternals/hero/hero_windows_sysinternals.jpg

SysInternals has always been a source of great tools for troubleshooting your system. FileMon, RegMon, Process Explorer, Handle, ListDlls, PsTools, DebugView: all of these have earned a permanent place on my Windows installations. Mark Russinovich, the co-founder, is a world-class hacker. He co-wrote Microsoft Windows Internals without access to the Windows source. It was he who discovered the Sony Rootkit and publicized it on his widely read blog.

Many people were somewhat disturbed to learn that Microsoft bought SysInternals a few months ago, that it would compromise the tools.

It seems not to be a problem. The tools have just been re-released on the TechNet SysInternals site. There's one new tool, ProcMon, which aggregates together FileMon, RegMon, and a process monitor. And they've made the whole suite available as one zipfile, instead of having to download each tool separately.

posted on Wednesday, November 08, 2006 9:22:06 PM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Monday, November 06, 2006 

King George II -or- How I Learned to Stop Worrying and Love W

This video says it all.

Go vote tomorrow!

posted on Monday, November 06, 2006 10:25:36 PM (Pacific Standard Time, UTC-08:00) 
#    Comments [0]
Thursday, November 02, 2006 

http://athena.libraries.claremont.edu/~blog/blog/images/scotty.jpg

I've seen a number of references to a Microsoft demo of speech recognition that went famously wrong, but it wasn't until this evening that I finally watched the CNBC Video that started the meme.

A TV reporter makes a snarky introduction then cuts to video of a Microsoft PM demoing the new speech recognition technology in Windows Vista. Dear Mom comma, he says. Dear aunt, appears in Word. It gets worse from there. Funny stuff. Go watch the original video.

But it's not the whole story. There's another video which sets the demo in context. Overall, the demo was reasonably successful and the speech commands worked fairly well.

If you think people talking into their cellphones is annoying now, wait until you hear them talking at their computers!

posted on Friday, November 03, 2006 3:32:41 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]