Make MSDN Website Load Faster

The MSDN website sucks. It loads extremely slowly, and is visually cluttered.

It turns out that MSDN has a low-bandwidth (“loband”) option. This will cause MSDN to render using much simpler HTML, which loads much more quickly and has a very clean appearance. To use this feature, tack “(loband)” at the end of the URL, before the .aspx suffix.

For example, here are the MSDN pages for SendMessage:

Note that you can make this the default rendering method by clicking on “Persist low bandwidth view” at the top of the page:

Persist Low-Bandwidth View

(source)

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

Photographer’s Rights

The Bert P. Krages website has a handy, downloadable PDF version of the “The Photographer’s Right”.

If you object to the recent harassment of photographers in public places, I suggest that you download this, print it out, and carry it in your camera bag.

Posted in Photography | Leave a comment

Craigslist Blocks Yahoo Pipes

Craigslist has no love for Yahoo Pipes

Craigslist is one of the greatest sites in the world, and the entire Bay Area seems to revolve around it. Sadly, Craigslist’s search facility is extremely bad, seemingly only capable of searching within a price range and neighborhood. Craigslist supplies RSS feeds, but this still means I have to sift through a lot of information in order to find what I’m looking for.

Yahoo Pipes provides a way to filter and manipulate RSS feeds. It’s very visual, and relatively easy to use. This would be an excellent tool to prune down my Craigslist RSS feeds.

Unfortunately, as of some time in the recent past, Craigslist has begun blocking Yahoo Pipes. Perhaps someone wrote an overly-popular pipe which caused a tremendous load on Craigslist’s servers, or perhaps Craigslist thinks they’ll somehow lose income by allowing Pipes. Either way, it sucks.

The work-around which I’ve employed is to mirror the base Craigslist search on my own server, then feed the Yahoo Pipe from that.

This requires you to have a server which:

  1. Is HTTP accessible.
  2. Provides cron, or some other method of running a script at regular intervals.
  3. Has curl, wget, or another HTTP-content-fetching utility.

Mirroring the RSS Feed

First, create an appropriate directory structure. For example:

mkdir ~/public_html/feeds

Next, test out curl or a similar content-fetching application on a Craigslist RSS feed URL. Don’t forget that quotes are usually needed around the URL:

curl "http://feedUrl" --output ~/public_html/feeds/yourFile.xml

Examine the content of the file and make sure that it’s the expected XML. If the file is very small, and contains text to the effect of, “this URL has moved”, then you may have forgotten to surround the URL with double quotes.

Creating Yahoo Pipe


To fetch this mirrored RSS feed, use the “Fetch Data” source and provide it the URL to your freshly-fetched file.

If the pipe can’t be read, verify the permissions for the containing folder hierarchy on your server. For *nix boxes, make sure the execute bit is set (chmod a+x ~/feeds).

Automating Update

Create a script file which will retrieve any and all feeds you wish to mirror. I place my scripts in ~/bin, so I placed the following into ~/bin/fetch-feeds:

#!/bin/bash

rm ~/public_html/feeds/yourFile.xml
curl "http://feedUrl" --output ~/public_html/feeds/yourFile.xml

Note that I delete the existing feed mirror before fetching the new one so that any retrieval error will be obvious.

Now, call this script from inside your crontab (Scheduled Tasks on Windows servers):

crontab -e

I update my mirror at 7am and 2pm with the following:

# Fetch Craigslist feeds at 7am and 2pm:
0 7,14 * * * ~/bin/fetch_feeds
Posted in Internet, Technology | 1 Comment

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