astradele

Archive for October, 2005

Linda: creative Thai food at Yonge and Dundas

Posted by GJ on October 26, 2005

This entry was supposed to be about Hiro Sushi. Sadly, I got to the King and Jarvis restaurant to find it closed, with a remarkably friendly and sincere note that they had to close for that particularly day. :( I racked my brain for somewhere interesting to go, and remembered the Thai restaurant Linda. I was there not too long ago with friends and greatly enjoyed it, though I forgot my camera that time. A note: Linda prefers reservations, no matter the size of your party.

An interesting note about Linda is its relation to Salad King downstairs. The owner is the same, but Salad King is very much like a college cafeteria, albeit with unusually good food. Linda, however, is much more pleasing to the eye. The menu is also quite different, being much more unusual and creative than Salad King’s.

I seem to get more unusual events when solo dining with my camera. This time, probably because I was struggling to get legible menu pictures without a flash, the owner (Linda?) remarked that I seemed to have an interest in menus. I explained myself, but I tend to feel a little embarrassed, even though I don’t think I should be. Oh well.

I also had a neighbouring table that remarked on my choice of entree. I heartily recommended it, saying that it’s what I specifically came here for. Unfortunately, my recommendation was taken, but not enjoyed, judging from overheard comments.

I started off with Young Coconut Water (2.75) for a beverage. No picture, it looks very much like water, especially in low light. The beverage is the same as the Asian white/beige coconuts that can be drunk out of directly: light, sweet, a little of the fatty richness of coconut milk. I was also provided some free appetizers, salted, roasted peanuts with salted, dried shrimp:
Salted peanuts appetizer

The appetizer I ordered was a Lettuce Wrap (5.00), minced chicken, shrimp, crispy bean vermicelli, lime leaf, cashew nut, yellow beans chili sauce.:
Lettuce Wrap
The ingredients were fresh, and it was unlike the similar dish at Chinese restaurants, perhaps because of the difference in sauce. There was a hint of sourness (the lime?), and the lettuce and vermicelli made it very crispy. I found it satisfying, although not that remarkable except for the presentation.

The entree (that I recommended to the neighbouring table) was Lychee Lobster (22.95), shells of lobster tail with lychee, saffron, creamy sweet and sour sauce:
Lychee Lobster
This is what I had the first time here, and I enjoyed it greatly that time. The second time, however, I noticed that it was hard to finish, as the sauce is very sweet and rich. Like curry, I really needed the rice with to dilute the taste, but rice is also filling. I took half of it home. I guess the novelty enhanced my enjoyment the first time, although I still like it.

I really shouldn’t have, but the problem with this restaurant exploration is that it imbues me with a devil-may-care attitude when ordering food, both to costs and to how full I am. So I had the Deep friend bananas and ice cream (6.75), with mango and papaya flavours:
Deep fried bananas and ice cream
It was a good dessert, that I would have appreciated even more if I hadn’t been full and sweetness tastebuds saturated by my entree. Ice cream was its normal creamy, flavourful self, and the deep fried bananas were crispy on the outside and deliciously bad for me. I did have to wait awhile for it, though - but it was a packed restaurant at that point.

I intend to go back to Linda again (and again). The environment looks nice, service is good, and the menu is creative and not astronomically expensive (what I ordered was both a lot and on the higher end). I don’t even fault the waiter for filling my glass of Young Coconut Water with ice water. ^_^ An acquaintance I bumped into on the way home shared my enthusiasm for the restaurant, and although he felt the Lychee Lobster was too sweet, he recommended the Fish Curry (I think), which is a Chef’s Recommendation on the front of the menu. I’ll try to remember that.

Next up: Hiro Sushi.

Posted in everyday | No Comments »

Console shell advancements since 2000

Posted by GJ on October 25, 2005

I always get surprised by how far the Windows console shell has progressed since Windows 2000. It’s no zsh, but it’s certainly tolerable. I wish the syntax to the tricks were a little more consistent, but I guess they were operating under backwards compatibility constraints.

Today, I learned that the Windows shell has the equivalent of the UNIX pwd. For Windows 2000 and up, %CD% always evaluates to the current directory. My thanks to Google and the blog entry about getting the current directory on Windows.

Posted in techie | No Comments »

Naming factory methods: create() or newInstance()?

Posted by GJ on October 25, 2005

A coworker recently brought up an entertaining question, although we both agreed that it was unimportant overall: what do you name your factory methods?

Some observations:

  • The java.xml.* package uses newXXX() for the factories, e.g. DocumentBuilderFactory.newInstance(), DocumentBuilder.newDocument().
  • The java.xml.* package uses createXXX() for the builders, e.g. Document.createXXX().
  • java.lang.Class.newInstance().
  • java.lang.Array.newInstance().
  • Design Patterns, the GoF book, uses createXXX().
  • .NET uses System.Activator.createInstance().
  • COM uses CoCreateInstance().
  • The Wikipedia article on Abstract Factory uses create.

We traded some ideas, but we soon found that the criteria we used were often too vague or hard to use. In the end, we agreed that create was probably the best for everything, because:

  1. It’s a simple rule, with no exceptions, i.e. avoid thinking effort on something so minor.
  2. createXXX() is more versatile than newXXX(). There are cases where newXXX() sounds a little awkward (perhaps because “new” is an adjective)

createXXX also follows the common principle that method names are verbs, class names are nouns.

A fun exercise, but I hope no one actually spends that much time on issues like these - rather, I wish people didn’t, since I know some people do.

Posted in techie | No Comments »

UniBall Signo Bit 0.18mm Pens

Posted by GJ on October 25, 2005

I really don’t know why I like writing utensils so much, especially since I type far more than I write. Yet I have about 50 different pens (and a few pencils) each with its own set of characteristics: gel, ink, non-smudge, waterproof, good heft, low friction, and colour are just a few examples of why I’ve bought them over the years. From past experience then, it’s no surprise I want one of these:

UniBall Signo Bit 0.18mm Pens


World’s thinnest ballpoint pen…thinnest possible lines you could ever write. It’s quite fine. It has some sort of special ink for reducing friction so it won’t clog. It’s not super-flowy like a normal gel pen but it allows you to make sharp and precise short lines, which is what I suspect it was designed to do (i.e. for writing Japanese characters (see circle in picture with writing between lines of text), or alternatively adding fine details into drawings).

Posted in everyday | No Comments »

Automatically downloading TD Newcrest research reports

Posted by GJ on October 21, 2005

TD Waterhouse (Canada) has an excellent research arm, TD Newcrest. Every so often, the dense formal prose is dropped for a more informal commentary; it’s an interesting read for investment ideas.

However, I don’t like having to log in to their website to see the reports, and even worse, have my session timeout because I took a while to read a report (max. configurable time is 15 minutes). I also generally like data to be in the same “place” as my other data. So I figured out a way to automatically download the TD Newcrest report PDFs.

Since then, I’ve had to made one minor change that broke the original script. Someone made a small addition that matched the regular expressions I had been using originally. I don’t intend to actively invest anymore (want to divert my time elsewhere), but I thought someone might be interested in seeing what the mess looked like. So without further ado (right after I scrub my personal info from the script…):

 #!/bin/zsh  AUTH_TOKEN="`curl -s -b cookies.txt -c cookies.txt 'https://webbroker32y.tdwaterhouse.ca/LogOn?language=E&FromCookieConversion=true' | grep AuthToken | sed -s 's/.*value="\(.*\)".*/\1/'`"  CONNECT_ID=123 PASSWORD=rosebud START_PAGE="`curl -s -b cookies.txt -c cookies.txt https://webbroker32y.tdwaterhouse.ca/LogOnValidate -d "connectID=$CONNECT_ID&connectIDSelect=&idToDelete=&oldPassword=$PASSWORD&newPassword=&changePasswordMode=false&submitButton=Login&remember=of&publicTerminal=false&language=E&AuthToken=${AUTH_TOKEN}&javaScriptEnabled=true" | grep top.location.href | sed 's/.*href=.\(.*\).;.*/\1/'`"  # Need to go through theese pages to get the proper cookies. curl -s -b cookies.txt -c cookies.txt ${START_PAGE} > /dev/null curl -s -b cookies.txt -c cookies.txt 'https://webbroker32y.tdwaterhouse.ca/MarketsAndResearch' > /dev/null #curl -s -b cookies.txt -c cookies.txt 'https://webbroker32y.tdwaterhouse.ca/SecureSiteTopNav.jsp' > /dev/null #curl -s -b cookies.txt -c cookies.txt 'https://webbroker32y.tdwaterhouse.ca/MarketsAndResearchLeftNav.jsp' > /dev/null  RESEARCH_PAGE="`curl -s -b cookies.txt -c cookies.txt 'https://webbroker32y.tdwaterhouse.ca/MarketsAndResearchContent.jsp'`"  MAGIC_NO="`echo ${RESEARCH_PAGE}|grep name=.magicno|sed -s 's/.*value=.\(.*\).\/.*/\1/'`" BLOB1="`echo ${RESEARCH_PAGE}|grep name=.Blob1|sed -s 's/.*value=.\(.*\).\/.*/\1/'`" BLOB2="`echo ${RESEARCH_PAGE}|grep name=.Blob2|sed -s 's/.*value=.\(.*\).\/.*/\1/'`" BLOB3="`echo ${RESEARCH_PAGE}|grep name=.Blob3|sed -s 's/.*value=.\(.*\).\/.*/\1/'`"  # This is kinda nasty.  We have to go here to get authenticated, and then # we get redirected to somewhere else where we get the session cookie we # need.  Also, the HTML body of the redirect page isn't correct. curl -L -s -b cookies.txt -c cookies.txt 'https://www.tdcanada.wallst.com/tdw/canada/Decrypt.asp?hideTop=1' -d "magicno=${MAGIC_NO}&Blob1=${BLOB1}&Blob2=${BLOB2}&Blob3=${BLOB3}" > /dev/null  REPORT_MAP="`curl -s -b cookies.txt -c cookies.txt "https://www.tdcanada.wallst.com/tdw/canada/markets/reports.asp" | egrep '[0-9]{2}/[0-9]{2}/[0-9]{2}' | egrep 'value="[A-Z0-9]+"' | cut -d '"' -f 2-3 | sed 's/\(.*\)">\(.*\) $DATE.pdf      EMAIL=foo@foo.com     echo | mutt -a $DATE.pdf -s "TD Newcrest research - $DATE" $EMAIL   fi done  rm -f cookies.txt 

Posted in techie | No Comments »

Getting pictures out of FlipAlbum

Posted by GJ on October 21, 2005

A couple of friends of mine got married recently, and their photographer sent them their proofs on a CD. He used some product I’d never heard of, FlipAlbum, that places encrypted versions of the JPEGs on the CD, and includes a (gaudy) viewer to see the pictures.

When it comes to computers and being prevented from my natural behaviour (e.g. distributing to friends and family), I get irritable and a little obsessed. After getting an image of the CD, I picked through it, curious what was done. It’s pretty clear that the encryption is reversible - the CD has some encryption keys in a file for the viewer program to use. However, I didn’t have much interest in taking the direct approach to try my hand hacking the code or anything similarly “glamorous”.

I still wanted the pictures though, if only because it was being denied. So I went with a low tech solution.

First, I used Bulent Screen Recorder to record a movie of my desktop. BSR has a useful feature where it records a frame only when the monitored area changes. I killed my windows shell, bb4win, to get an empty blackness on one of my monitors and configured BSR to watch that half of my desktop. I then used FlipAlbum’s automatic full-screen slideshow to display all the pictures. I ran that overnight at a rate of three seconds per image, recording an uncompressed movie. I had to give three seconds instead of one, as BSR needed a couple seconds to switch to a new file when the current AVI file got too big (1GB).

Next, I used mplayer to extract each frame to a JPEG. I actually used a Win32 port of mplayer, because I was too lazy to upload the movies to process on my Linux server. The win32 version didn’t have support for non-lossy image types (e.g. PNG), so I bumped the quality to 100.

The next step was to shave off the watermarks BSR embeds into each frame. Fortunately, the pictures weren’t big enough to fill the whole screen, so the watermarks appeared in the “dead” black areas of the image. I looked a little into what Gimp and IrfanView, the desktop graphic programs I most often use, could do for me… but in the end used ImageMagick. Again, I did it in Windows, using the version that comes with Cygwin.

One little note about ImageMagick (I was using convert and mogrify): I struggled with it a bit, because I was getting a weird result using -shave 50x0 -fuzz 5% -trim. I would end up with pictures that still had empty space to the right and bottom. Using -crop 0x0 had the same effect. I finally figured out that shaving pixels off the left and right side changed the data, but didn’t change ImageMagick’s idea of how big the picture was. Transforming the JPEG in two steps, -shave 50x0 then -fuzz 5% -trim, gave the desired result. In case there are purists wondering, the pictures are only proofs, so encoding them a few extra times doesn’t make much of a difference, especially since the intermediate steps were at 100% quality.

It was fun, and I got to know some useful tools better. From a moral standpoint, I don’t feel it’s wrong: the quality of the original pictures provided are too low to blow up even to a 4″x6″ photo, and the photographer hasn’t provided the digital touchups yet. It’s an unnecessary measure that forces people to burn and distribute CDs. How did this protection measure accomplish anything but waste people’s time taking the long way around?

Posted in techie | No Comments »

IBM seems to always put out light, fast Java products

Posted by GJ on October 20, 2005

The earliest IBM Java product I recall using was a 1.1 JVM for Windows 3.1. The reason I probably remember it at all is that it used a fancy trick to simulate filenames longer than 8.3 characters. IIRC, it stored some kind of metadata file alongside the real files.

More recently, I’ve used IBM’s 1.4 JVM, their Jikes compiler, and now their 1.5 JVM (beta), primarily on Linux, although I used 1.4 on Windows as well. At the time I was using the 1.4 versions, I was doing timing comparisons, trying to eke out a little more performance out of the product I was working on. Not only did Jikes make our build process faster (it was much faster than javac), the IBM JVM was noticeably faster and lighter on memory footprint. I don’t remember the numbers anymore, but let’s say about 10-20%.

One interesting benefit of sorts to using an underpowered system is that performance issues really stand out. In my case, my blog runs on Blojsom, which requires a servlet container and thus a JRE to run. Since I used to use recycled PCs that are about a decade old - and now a virtualized host equivalent to a 1994 PC - the basic JVM memory footprint is of concern to me. For awhile I used IBM JVM 1.4, based on my old results.

Since I had to reinstall Java anyway for the hosted machine, I decided to check out some alternatives. I tried Sun’s 1.5 JVM, IBM’s 1.5 JVM, and SableVM. Long story short, IBM took the cake again (running Jetty and Blojsom). Sun’s 1.5 had about the same footprint as IBM 1.4 (30MB), but IBM’s 1.5 came in at 27MB. That’s physical memory according to top. I would expect IBM’s 1.5 to outperform Sun’s 1.5, too, although that’s just “fanboy-ism”.

3MB may not seem like much, but as a percentage (10) and relative to the physical memory for the virtual host (90MB), it’s pretty good. I could certainly pay more for more headroom, but all I really want is not to thrash to swap when doing basic work from a shell. After all, it’s not a production site… and I’m naturally inquisitive about these sorts of things.

[Update: IBM's 1.5 beta had problems staying alive after about three or four hits on the servlet - the process seems to silently exit. I guess IBM's meaning of "beta" is different than Google's; I did get to learn that IBM's 1.5 startup is noticeably faster than IBM's 1.4. :P I guess I'll use a different JVM for now.]

Posted in techie | No Comments »

Offshoring my servers to Rimuhosting

Posted by GJ on October 20, 2005

I normally have about four computers running 24×7 at home. One is my desktop, one is my “stable” server, one is my “unstable” server, and one is my critical services (email). However, all those computers generate a lot of heat (probable an extra 3 degrees Celsius for the room it’s in), noise, and need maintenance (cabling, software updates, don’t knock out the power supply, etc.). I’m also paying for a static IP to make those servers more useful to me outside.

In the spirit of trying to free up time, I looked into hosting services. My requirements were straightforward: Debian Linux, root access, reliable, cheap. I discovered that I actually wasn’t asking for that much. The world of hosting has changed since I last looked at it (years ago): virtualization is the norm and it makes sense. Virtualization is the use of a fast computer to simulate multiple smaller ones, e.g. a dual P4 simulating the equivalent of thirty-two 486 PCs. That may sound odd, until you consider that Linux can run quite well in a low resource environment, particularly if just running headless services.

Since Debian isn’t that popular in the mainstream, I found that there weren’t that many obvious contendors to choose from. In the end, the hardest part was making a judgment call on who was the most reliable. For that, I googled for reviews, recommendations, etc. One benefit of choosing Debian is that it’s popular with the grassroots crowd, who are disproportionately talkative on the Internet. For the cost (U$20/mo), I figured I’d make a best guess, and just bail after a month if I made the wrong choice - it’s not hard to just pull my data out and move it elsewhere.

I chose Rimuhosting, a company in New Zealand. While there were other hosting services that were recommended (A Slashdot article on virtual hosting had a plethora of useful comments and recommendations), Rimuhosting won over the rest because:

  • In their News announcements and the Rimuhosting bliki, they know what they’re talking about - or at least, as well as I know.
  • The owner (?) of Rimuhosting has a pretty obvious user ID on Slashdot (and advertising signature), so it was easy to read all his posts. They indicated good technical competence and communication ability.
  • The website looks good to me, in a functional and aesthetically simple way. This seems superficial, but it’s not entirely. A website that’s broken indicates poor maintenance after all. This one seemed well polished, and regularly received new information. People who take pride in their work, even in the little things, produce better products on average, IMO.

One last interesting “test” is that I passed along some questions when I first signed up. I was interested in the answer, of course, but even more interested in how it was answered. Not only was the signup quick (overnight), so was the response. It was articulate and professional:

Thanks for your order. I’ve setup your VPS and sent out a welcome email with your details. Running a SOCKS proxy should be fine on the VPS. Careful you don’t leave it setup as an open proxy. That can be a fast way to burn through a few hundred GB of traffic. All ports are open on the VPS. If you need our help filtering anything, just let us know. You can run a DNS server wherever you wish. We happen to offer DNS servers that you can configure via our http://rimuhosting.com/cp control panel. There is no cost for using these servers. It typically takes an hour or two for a new IP address to propagate after you change it on your DNS server. See also: http://rimuhosting.com/dns/aboutdns.jsp We keep just the one weekly snapshot. Sometime there _may_ be a second week available. We can restore the whole VPS from it (it is a filesystem snapshot). Or we can restore a single file/directory. There is a $10 restore fee. [snip] We also provide an FTP server you can use to run backups as often as you like. I hope your setup goes smoothly and you get to make the most of your new VPS. Regards, Peter http://rimuhosting.com

So there you have it. A static IP, a few GB of space, and my consolidated services (web server, FTP server, this blog, etc.) running out of a colo in Texas, managed by folks in New Zealand. I love the Internet and globalization. Now I just need to decide what to do with an ornamental Pentium 100. :)

Posted in techie | No Comments »

Life re-org

Posted by GJ on October 19, 2005

One activity to explain my recent hiatus has been to reorganize my life. There were a lot of different areas that added up…

Investing

It started when I took stock of my investment returns over the last couple years. When I first set out on making my own stock picks, I told myself that if I couldn’t beat the indices (the “average’), then I’d be better off leaving my investment to other means that required less of my time. I tell others to do so all the time.

Unsurprisingly, I didn’t do well enough. I didn’t do poorly, but I hardly matched the rocket that was the energy-heavy TSE; since I play mostly in Canada, that was the figure to beat. I don’t regret the time I spent over the last couple years trying, though - the business and finance knowledge learned is useful. I did a little more research, decided how to reposition my portfolio, and executed. Hopefully, I’ll be able to just make do with a relaxed eye on it from now on.

Magazines

I subscribe to the Economist, Fortune, and eWeek. I’d like to subscribe to IEEE (Software), and perhaps ACM. I also have a very long wish list on Amazon, and several dust collectors on the shelf.

eWeek I decided was a product advertisement magazine in the guise of reviews, when they let me renew my subscription for another free year if I went to a certain URL. Fortune I find to be too lightweight: like Cosmos to fashion, Fortune to business. I knew that before subscribing, but a three year subscription cost me what I might pay to dine out (not lavishly). Finally, the Economist - I still think very highly of this periodical, and perhaps I’ll waver yet… but these guys are almost too good, cranking out an issue every week. Even developing the habit of only skimming Central and South America, Britain, and several other sections, I find it far too easy to fall behind. I’ll miss the critical thinking and wit.

I’m not going to stop reading. What this achieves is to free up some time to read the stuff that gets me avidly reading - usually software, software techniques, related human behaviour, etc. Maximizing my reading pleasure, so to speak.

Other reasons forthcoming

There are other reasons for my hiatus, technical and non-technical. I’ll get back into the habit of blogging by discussing them.

Posted in everyday | No Comments »

Misfire: sharing my experiences

Posted by GJ on October 5, 2005

Well, now I look like a total idiot for the world to see. I should adopt the same policy for comments as I do email: the earlier in the day the better, and never when tired.

Read about me commenting stupidly about RAID.

Posted in techie | No Comments »