astradele

Archive for January, 2006

Is there a Singapore, USA?

Posted by GJ on January 29, 2006

Junk mail senders are like spammers - they don’t lack for creativity in finding ways to get you to read  their material.  I got fooled by today’s junk mail: a very business-y envelope, apparently sent from Singapore.  Naturally, I wonder, who in Singapore would know about me?  The contents, however, recommended that I send my subscription request for oil stock information to an address in the United States.

Would you be taken in?
Junk mail "from Singapore"

Posted in everyday | No Comments »

HOWTO: Internet accessible network drive with WebDAV

Posted by GJ on January 25, 2006

A quick background why I wanted this: I wanted to use an editor for writing blog posts that better supported tags.  I’m really not that facile at typing the < and > characters for HTML tags.  Also, I prefer my nascent post to grow somewhere I can get to it wherever I reasonably might get an idea.

I could use Subversion, Unison, or similar synchronization software. It’s discomfiting to use version control software for non-versioning purposes, but the main problem I have is remembering to start the synchronization.  For me, remembering to save the file was quite an accomplishment already!  :)

I recalled WebDAV had something to do with shared web drives (WebDrive also came to mind).  As it turns out, Apache (I’m using 2.0 on Debian) has support for WebDAV as a module; I conveniently found instructions to set up WebDAV on Debian.  I then found out that Novell produces an excellent WebDAV client for Windows, NetDrive (I don’t know why Novell doesn’t provide it).

I ran into frustrating problems for awhile, and eventually discovered that it was because the instructions I used to set up WebDAV recommend using “Digest Authentication” to control access to the WebDAV location.  NetDrive doesn’t know how to work with this.  Switching Apache to use “Basic Authentication” (and remembering to use htpasswd2 instead of htdigest to generate the user/password pairs) solved that problem. I also went a little further and exposed the WebDAV URL via HTTPS only.

So far, everything works beautifully.  My WebDAV folder shows up as a drive letter on my Windows boxes.  If I had a Linux desktop, I’d have even more choices of WebDAV clients.  If I’m in a pinch (e.g. foreign computer), I can still SSH to my server and edit files locally.  It’s just me, so I don’t have to worry about conflicts and similar muti-user issues.

FYI, I eventually settled on NVu as my HTML editor;  NVu is derived from Netscape Composer.  WYSIWYG HTML editors aren’t great, but I’ll give up optimal HTML if I can concentrate on content rather than syntax.

Posted in techie | No Comments »

A wolfish friend

Posted by GJ on January 25, 2006

I bumped into this friendly passerby on my way to the subway.  He was on his way to the bus.
Wolfhound

I had to get a picture - I’d never seen a dog like this.  The dog walker was kind enough to hold him steady for me.  I’ve seen a Great Dane or two (I stopped to stare at those, too), but this Wolfhound is bulkier - overall size vs. just height, I guess.  That’s a “normal” sized dog behind him, btw.

Posted in everyday | No Comments »

Getting the Subersion revision number in Ant

Posted by GJ on January 22, 2006

Subversion support in Ant, while present, isn’t that great.  It handles the basics, but not much else.   One are of improvement that I had needed was in accessing the repository metadata, specifically the revision number that was being used to build, so that the distributable could embed that as part of the filename.  Previously, I had been using the build date, but that’s obviously not accurate.

To support cross-platform, I ended up with JavaSVN from Tmate.  It didn’t totally do what I needed to do, but at least I could call it as a command line application to recursively display the information about every file in the repository.  After that, it’s only a matter of grep‘ing for “Revision:” and finding the highest revision.  I also had to write a simple sorting class to extend Ant (which has tail and head but no sort).  It works well, in a wasteful sort of way.

Here’s what I did:
<target name="checkRevision">
    <property name=”source-root” value=”.”/>
    <java classname=”org.tmatesoft.svn.cli.SVN”
       dir=”${source-root}” fork=”true” outputproperty=”revision.list”>
      <arg line=”info -R .”/>
      <classpath>
        <pathelement location=”${tools}/svnant/javasvn.jar” />
        <pathelement location=”${tools}/svnant/javasvn-cli.jar” />
      </classpath>
      <redirector>
        <outputfilterchain>
          <linecontainsregexp>
            <regexp pattern=”^Revision:”/>
          </linecontainsregexp>
          <deletecharacters chars=”Revision: “/>
        </outputfilterchain>
      </redirector>
    </java>

    <java classname=”Sort” inputString=”${revision.list}”
    outputproperty=”coconut.revision”>
      <classpath>
        <pathelement location=”${tools}/sort” />
      </classpath>
      <redirector>
        <outputfilterchain>
          <tailfilter lines=”1″/>
        </outputfilterchain>
      </redirector>
    </java>

    <echo message=”Latest commited revision: ${coconut.revision}”/>
  </target>

Posted in techie | No Comments »

North 44 with the family

Posted by GJ on January 22, 2006

For Christmas, I took my family to North 44.  North 44 probably isn’t the best place I can think of to treat family (the cost is a major factor), but I wanted my siblings and mom to try something they would normally never be willing to try - and nearly everything on the North 44 menu is unusual.

Even the bread appetizers are a little different:

My family isn’t as used to my penchant for food photography, so I stuck to my own dishes.  I do love butternut squash soup:
butternut squash soup
It was quite satisfying, with a bit of a peppery taste.

Now I admit I got conned on this entree.  It was good, but far too expensive.  As I later tried to explain to friends at another dinner, however, as the cost goes up, my curiosity gets the better of me and makes more allowances for ridiculous pricing (up to a point!  Flying in just for a meal at French Laundry is excessive even for me!).  That evening, North 44 had four lobsters.  Hemming and hawing, recalling the delectable morsel of lobster I had the last time I was at North 44, I finally caved when even my dad said that I may as well get it if I like the lobster at North 44 so much.  It  was delicious:
lobster and shrimp ravioli.
The ravioli was filled with minced shrimp with some other ingredients to make a lovely seafood medley.  The ravioli was interesting in that it had been pan-fried, so it was crispy - a delight to eat.  Finally, the infamous lobster was excellent.  Small, of course, and the tail was far better than the claws, but it was wonderfully artery-clogging with a firm texture.  It was very rich - at the end I wasn’t enjoying it as much as at the beginning!

Nevertheless, no matter how rich the entree, dessert must never be skipped!  This is the Pear Mille Feuille, with ice cream (pistachio I think?):
Pear Mille Fueille
The wafers were a fun, sweet experience.  Taking it all at once - ice cream, pear, wafer - tasted very good.  The pears were caramelized (I think?), but I didn’t really notice too much different about them.  A solid dessert; not too unusual.

The food was good, there is no doubt.  However, North 44 has more than fairly received its share of my wallet for the next year or two, after hosting a party of seven with a host that has more curiosity than sense.  :)  The kind of place that’ll happily devour what you offer, just as I happily devoured what they presented.

Butternut squash soup (12); lobster and shrimp ravioli (87); pear mille feuille (14).  Yes, I am crazy sometimes.

Posted in everyday | Tagged: | No Comments »

Receiving strange letters in the mail

Posted by GJ on January 11, 2006

What would you think if:

  • You received a letter from outside the country, your name and address printed on it.
  • The letter had no return address.
  • Contents consisted solely of a large peel off sticker, gold border, white writing area.
  • Sticker had a messy scrawl what appears to be, “87 Litt 8th Did”

I’m at a loss of whether to toss it, or keep it around and ponder it some more. Correctly addressed, business envelope, someone paid the extra postage to send it cross-border. Computer error perhaps, except no return address and human-generated contents?

[Updated: Eureka! I'm glad I didn't throw it out. It's the authours' signatures for the book, Freakonomics. A couple months ago, they announced on their blog that they would indirectly "sign" every book, if readers would merely send in their address. Their names, btw, are Steven Levitt ("87 Litt") and Stephen Dubner ("8th Did).]

Posted in everyday | No Comments »

The not-so-secret secret of Starbucks

Posted by GJ on January 11, 2006

Here’s a little secret that Starbucks doesn’t want you to know: They will serve you a better, stronger cappuccino if you want one, and they will charge you less for it. Ask for it in any Starbucks and the barista will comply without batting an eye. The puzzle is to work out why.

The drink in question is the elusive “short cappuccino”…

Starbucks’ short cappuccino

I wish I’d known about this earlier! Sometimes, I only want the espresso and enough milk to take the edge off. Still not Tim Horton’s prices though. :P

Posted in everyday | No Comments »

The Ultimate Showdown of Ultimate Destiny

Posted by GJ on January 6, 2006

The Ultimate Showdown of Utlimate Destiny is a very entertaining flash video. I admire the musician’s talent for creative lyrics and good musical qualities. My thanks to the one who told me about it!

For best results, it’d be good if you’re in the age group that appreciates Optimus Prime, Robocop, and Indiana Jones (i.e. that era of shows) as nostalgic icons.

Posted in everyday | No Comments »

Scraping pictures from Tiffany’s website

Posted by GJ on January 5, 2006

Not that this is what’s kept me busy in technology for the last couple months, but it’s easy to post about as I try to recover from the holidays’ hiatus.

Tiffany’s (that high-end jewelry store) has many picture of its products on its site. The photography is quite good, and most of the pictures have large, high quality versions; makes for good desktop wallpaper. However, it’s tedious to go to each link and save each picture individually - there’s a lof of them.

Regular mirroring doesn’t work too well. The site uses a lot of Javascript, in particular to pop up windows with the englarged picture inside. Fortunately, most of Tiffany’s zoomed-in pictures of its products on the website have a regular format, e.g. http://www.tiffany.com/images/products/zoom_images/12259417_xl.jpg. Tather than try to be “smart” and figure a way to decipher correct links from the website programmatically, I chose to be “dumb” and do a brute force search on every possible number.

This saves me a lot of brain time, at the expense of computer time. Fortunately, the computer doesn’t value its time as much as I value mine, so it’s happy to run for a few days. It takes quite awhile to test one hundred million possibilities. The script below isn’t my first attempt at trying to get them all, but it’s certainly the fastest. I ran it on a Linux box, and it’s mainly curl that makes it possible.

Some of the optimizations I made along the way:

  • A naive HTTP download for each possibility is quite slow, not so much from creating a new process each time, but from the network connection overhead and I/O.
  • curl is much better than wget for these kinds of things, as one can specify a pattern and range of numbers to use, and it will also reuse the same HTTP connection. Truly, “a Client that groks the URLs”.
  • It was faster to download the HTTP header and look at the advertised file type (e.g. image/jpeg) using grep than make a full HTTP request and examine the resultant downloaded data to determine the file type (e.g. with file). More so than I would have thought if the speedup was only due to less bytes over the wire.

The script follows:

 #!/bin/sh  # e.g. http://www.tiffany.com/images/products/zoom_images/12259417_xl.jpg START_ID=10000000  CLEAN_LOCK=clean.lock CURL_LOCK1=curl1.lock CURL_LOCK2=curl2.lock CURL_LOCK3=curl3.lock CURL_LOCK4=curl4.lock  function remove_non_jpegs {   # Delete the non-JPEG files   START_ID=$1   END_ID=$2   CLEAN_LOCK=$3   echo "[`date +'%x %X'`]" Cleaning $START_ID-$END_ID    ID=$START_ID   while [ $ID -le $END_ID ];   do     JPG=${ID}_xl.jpg     if [ -z "`grep -m 1 'image/jpeg' $JPG`" ]; then       rm $JPG     else       echo $JPG is O.K.       rm $JPG       wget -q "http://www.tiffany.com/images/products/zoom_images/$JPG"     fi     ID=`expr $ID + 1`   done    rm -f $CLEAN_LOCK    echo "[`date +'%x %X'`]" Done cleaning $START_ID-$END_ID }  function slurp_data {   curl -I -s "http://www.tiffany.com/images/products/zoom_images/[$1-$2]_xl.jpg" -o "#1_xl.jpg"   rm -f $3 }  while [ $START_ID -lt 20000000 ]; do   END_ID=`expr $START_ID + 4000`    INTERVAL=`expr $END_ID - $START_ID`   INTERVAL=`expr $INTERVAL / 4`    ONE_QUARTER_ID=`expr $START_ID + $INTERVAL`   TWO_QUARTER_ID=`expr $ONE_QUARTER_ID + $INTERVAL`   THREE_QUARTER_ID=`expr $TWO_QUARTER_ID + $INTERVAL`    echo "[`date +'%x %X'`]" Getting $START_ID-$END_ID   lockfile $CURL_LOCK1 $CURL_LOCK2 $CURL_LOCK3 $CURL_LOCK4   slurp_data $START_ID $ONE_QUARTER_ID $CURL_LOCK1 &   slurp_data `expr $ONE_QUARTER_ID + 1` $TWO_QUARTER_ID $CURL_LOCK2 &   slurp_data `expr $TWO_QUARTER_ID + 1` $THREE_QUARTER_ID $CURL_LOCK3 &   slurp_data `expr $THREE_QUARTER_ID + 1` $END_ID $CURL_LOCK4 &   lockfile $CURL_LOCK1 $CURL_LOCK2 $CURL_LOCK3 $CURL_LOCK4   rm -f $CURL_LOCK1 $CURL_LOCK2 $CURL_LOCK3 $CURL_LOCK4   echo "[`date +'%x %X'`]" Done getting $START_ID-$END_ID    lockfile $CLEAN_LOCK   remove_non_jpegs $START_ID $END_ID $CLEAN_LOCK &    START_ID=`expr $END_ID + 1` done 

Posted in techie | No Comments »

Kenzo Ramen mania

Posted by GJ on January 5, 2006

I’ve been going to Kenzo Ramen a bit too much lately, trying to bring other people there and solicit confirmation of whether this reaches the apex of “true ramen” that can be found in Asia. I also tend to eat two (large) bowls each time I go, which perhaps contributes to the feeling of dropping by too often. :)

This is the Galbi (Korean BBQ meat) and Shoyu (soy sauce) Ramen combo:
2005_1228_183231
The gabli’s good and the shoyu ramen is almost refreshing, it’s such a simple broth.

I followed that order (I’m a glutton I know) with Kenzo’s newest addition, the pork-broth Tonkotsu Ramen:
2005_1228_183104
The broth for this is rich, with a fair bit of fat. I think I would have preferred this first instead of the Galbi/Shoyu combo. I love the egg too, though I wish I knew how to marinade to make it slightly sweet light that.

Posted in everyday | Tagged: | No Comments »