Bicycle Weights

I bought a super-handy digital hanging scale from DealExtreme ($10.84, by far the lowest price on the ‘net). The most useful weights to post that I can think of are those of my bicycles:

Posted in Cycling | Tagged , , , , , , , , | Leave a comment

The Thunders at Elbo Room

The Thunders

Ellie and I went to Elbo Room to see Crepe-Sensei Shinji’s band, The Thunders. Before them was Clouds and Cannons, which proved to be a great bonus for the night.

As their 11:00 showtime approached, the hipster crowd dissipated and the Japanese flooded in. I believe I heard shouts of "Shinji-chan!" (which initially sounded an awful lot like Shin-chan), the bass player. I could also swear that I heard a cry of "Zatoichi-chan" (the blind swordsman, which could be a reference to the lead singer, or maybe I just misheard).

The show was energetic, and quite a lot of fun. My only complaint is that the extremely dim stage lighting made it difficult to see the performers most of the time!

From The Thunders’s Myspace page:

Atsushi: Guitar
Shinji: Bass
Takuya: Drums
Satoru: Vocal

Posted in Events, Music | Tagged , , , , , , , | Leave a comment

Powdered Whole Milk

Nestle Nido Powdered Whole Milk
Powdered milk is a great thing to have along when backpacking. It’s a lightweight source of protein and flavor. Unfortunately, all of the backpacking-oriented stores seem obsessed with fat-free products. This yields tasteless, low-calorie breakfasts which don’t seem to keep one sustained through the morning hike.

Luckily, NESTLÉ make Nido, which is powdered whole milk. While it’s been popular for years throughout Europe and Africa, it’s only recently been imported into the USA, and even then it’s squirreled away in the Latino cooking section.

It’s available at Amazon, two 12.6oz cans for $10.99, or from Wal-Mart, for around $3.50 per 12.6oz can.

Variants

There are three types of Nido marketed in the US:

  • NIDO Clasica
  • NIDO Kinder 1+: intended for children, and as such, contains additional vitamins and sugar.
  • NIDO Heritage: intended, presumably, for the elderly.

Mixing

It appears that some cans of Nido may lack English instructions. The recommended combination is 1/3 cup of Nido to 8 oz water, yielding a single serving.

Nutritional Information

Full nutritional information is available full details here. Basic information:

Calories 150
Calories from Fat 81
Total Fat 9g
Saturated fat 5g
Total Carbohydrates 12g
Posted in Backpacking | Tagged , , , , | Leave a comment

Oakland to Yosemite

Google Maps provides a route from the San Francisco Bay Area to Yosemite National Park which runs along 580 to Highway 120. I find this route to be intolerably populated, unattractive, and often ground to a stop due to accidents or sheer traffic volume.

On a recent drive back, when I found traffic along 580 into Tracy at nearly a standstill, I cut north through the Delta and up to Concord. The contrast between the packed 580 versus the desolate back-roads was amazing.

Earlier, when Highway 120 led into Oakdale, I found that by cutting a single street North yielded a road which was almost entirely unused, had only the occasional stop sign, and featured beautiful views of fields and smelled of grass and cows instead of exhaust fumes.

According to Google Maps estimates, the standard 580/120 route only saves around 40 minutes versus a much more leisurely, scenic, and enjoyable route along Highway 4:

Posted in Backpacking, Climbing, Travel | Leave a comment

Weirdness With Echo and Parentheses Within Conditional Statements

The if command in Windows batch files has some strange implications. One problem is that parentheses take on special meaning.

I first ran into this problem because my batch file would terminate shortly after showing, “folder unexpected at this time“.

A very basic if command might look like this:

C:\>if exist C:\ ( echo The C drive exists )
The C drive exists

However, placing parentheses inside the echo statement will entirely confuse CMD:

C:\>if exist C:\ ( echo The C drive exists (no, really) )
) was unexpected at this time.

Well, that sort of makes sense. It becomes confusing when the last word in your echo command is something more general, like the word ‘folder’:

C:\>if exist C:\Windows ( echo Found the Windows (on C:) folder )
folder was unexpected at this time.

This is actually the classic %%i was unexpected at this time error.

One solution is to put double quotes around the message to be echoed:

C:\>if exist C:\Windows ( echo "Found the Windows (on C:) folder" )
"Found the Windows (on C:) folder"

The drawback here is that the double quotes appear in the output. A better option is to use the caret (^) escape character:

C:\>if exist C:\Windows ( echo Found the Windows ^(on C:^) folder )
Found the Windows (on C:) folder
Posted in Technology | Leave a comment

Organizing Files by Date Using Find

I had taken pictures using a friend’s SD card. He copied all the files to my flash drive, but this left me without a nice, tidy directory structure. Normally, I organize my photos like:

2008
   2008_06_27
   2008_06_28
   2008_06_29

First off, I needed to list the files by date:

ls -lt

This showed me that I had files from the 27th, 28th, and 29th in a single directory. So I created a directory for each date.

Next, I used find with the -newer and -exec switches to execute a move command on each file newer than a particular file.

By looking at the ls -lt output, I found the last photo taken on each day. IMG_6369.JPG was the last taken on the 28th, and IMG_6284.JPG was the last taken on the 27th.

To move all of the files taken on the 28th and 29th, I used this command:

find . -type f -newer IMG_6284.JPG -exec mv {} 2008_06_28 \;

Now, all files taken after the 27th are located in the 2008_06_28 directory. Now, I change into that directory, and execute:

find . -type f -newer IMG_6369.JPG -exec mv {} ../2008_06_29 \;

Now I’m left with all the photos from the 27th in the main directory. Those could easily be moved with:

find . -maxdepth 1 -type f -exec mv {} ../2008_06_27 \;

I’m sure there is a quicker, cleaner way to do this, but for the limited number of subdirectories I had to filter into, this was reasonably efficient.

Posted in Scripting, Technology | Leave a comment

Extracting a Version Number From a Text File Using Batch Files and Cygwin

We have a version.h file. It contains lines such as:

#define VERSION_MAJOR     3
#define VERSION_MINOR     1

By piping this through grep, I can get the line I’m looking for:

c:\>grep "VERSION_MAJOR" version.h
#define VERSION_MAJOR     3

But what I really want is the version number within the line, so I pipe this through sed:

c:\>grep "VERSION_MAJOR" version.h | sed -e "s/^.* VERSION_MAJOR\s*\([0-9]\+\)/\1/g"
3

So now we have extracted the version number corresponding to “VERSION_MAJOR”. However, in order to conditionally branch in our batch script, we need to get this value into an environmental variable. In bash, this would be accomplished with backticks. As it turns out, Windows batch files do provide similar functionality, but through a much clumsier means:

c:\>for /f "tokens=3" %i in ('grep " VERSION_MAJOR" version.h') do set MAJORVERSION=%i
c:\>echo %MAJORVERSION%
3
Posted in Scripting, Technology | Leave a comment

Installing Graphviz Dot Without Root Access

I want to install Graphviz on a machine in order to get access to the dot diagram generator. However, I don’t have root access on this box, so I want to install it in my home directory, under ~/bin/graphviz. To do this, call the configure script with a few arguments to change the installation directory:

./configure --exec_prefix=$HOME/bin/graphviz/ --mandir=$HOME/man \
--prefix=$HOME/bin/graphviz/

Then make, and install:

make
make install

Even though make install gives me an error, “/usr/bin/ld: cannot find -lperl“, I find that Graphviz now appears under ~/bin/graphviz:

ls ~/bin/graphviz/
bin/  include/  lib/  share/

On a different box, I was unable to get this far. I received this error:

libtool: install: error: cannot install `libgraph.la' to a directory not ending in /usr/local/lib

This is caused by an out-of-date libtool.

libtool --version
ltmain.sh (GNU libtool) 1.4 (1.920 2001/04/24 23:26:18)
Posted in Technology | 4 Comments

Linking to XML Stylesheet Stored on Local Server in Firefox

Problem

I created an XML stylesheet which I wanted to place on a local Samba share. In the XML file to be transformed, I placed a file:// URI in the xml-stylesheet tag, but it wouldn’t work in Firefox. Internet Explorer would happily format the content as expected, but Firefox simply displayed a rather uninformative error:

Error loading stylesheet: (null)

Cause

As it turns out, I was formatting the URI incorrectly.

Solution

Proper URI formatting for the file protocol requires three slashes to establish an empty authority or host segment, followed by the full path, with all backslashes converted to forward slashes. Since it was a path to a file on a local Samba server, which normally begins with two backslashes, this means I needed a total of five forward slashes following file:!

So, given a Windows-style path such as:

\\myserver\mypath\mystylesheet.xslt

The corresponding URI would be:

file://///myserver/mypath/mystylesheet.xslt

Yielding an xml-stylesheet tag like

<?xml-stylesheet type="text/xsl"
                 href="file://///myserver/mypath/mystylesheet.xslt">

Reference

MozillaZine: Links to local pages don’t work

Posted in Technology | Leave a comment

Mouse Scroll Wheel in Ubuntu in VMware

I’m running VMware Workstation 6.5 under Windows Vista. I have Ubuntu 8.04 installed. I found a tip on how to enable the mouse scroll wheel, but I found that it switched my mouse over to Ubuntu control. That is to say, my mouse acceleration changed, and I was no longer able to seamlessly move my mouse out of the VMware window.

In the end, it turns out to be critical that VMware Mouse be retained as the input device identifier in /etc/X11/xorg.conf:

Section "InputDevice"
	Identifier	"VMware Mouse"
	Driver		"vmmouse"
	Option		"CorePointer"
	Option		"Device"	"/dev/input/mice"
	Option		"Protocol"	"ImPS/2"
	Option		"Buttons"	"5"
	Option		"ZAxisMapping"	"4 5"
EndSection
Posted in Technology | Leave a comment