Archive for the ‘Programming’ Category

Set is Back

Saturday, June 14th, 2008

A few of you will remember Set, a brain-intensive card game where you have to find three cards that have either the same or totally different properties in each of four categories of properties. Sounds complicated? Try it here! I coded up this game five years ago, for my friend Kristian’s birthday. That’s why you have to get through the deck in less than ten minutes. He didn’t get his birthday present before he had completed it in less than ten minutes 😉

US Dollar Index Gadget

Sunday, March 2nd, 2008

Non-mac users can now enjoy the US Dollar Index Widget as a Google Gadget on their iGoogle.com homepage (Mac users can install this widget too, but might want to use the dashboard version instead). I find this widget to be very useful on my iGoogle Finance tab! Again, thanks to INO.com for letting me use their feed, and Fabian Graciano, for the idea of making the original widget.

The US Dollar Index Widget

Sunday, February 10th, 2008

Will the USD continue to tank, or will the greenback make a comeback? Follow the day-to-day movements with this widget for Mac OS X.

The US dollar index is computed from the exchange rate with the Euro, Yen, British Pound, Canadian Dollar, Swedish Krona and the Swiss Franc. It was introduced in 1973 and was initially set to 100. Since then, it has been as high as 160 and as low as 75, where it is now. If you’re an international investor with US-denominated assets, you almost certainly want to track the US dollar. If you’re an American, you should definitely be concerned with the decline of the dollar as a result of your government’s policies. Lowering interest rates makes the dollar less valuable. And that means inflation and more expensive imported stuff such as oil.

Graphics and idea are from Fabian Graciano. Yeah, that’s why it looks so much more awesome than my previous widgets :) The data feed is graciously sponsored by INO.com. Thank you! Comments, requests and bug reports are very welcome! Just leave your feedback on this website. I’ll do my best to respond.

Download: US Dollar Index Widget.

Instructions: Mac OS X 10.4 Tiger is required. If you’re using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it. If you’re using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it.

Optimize Your Trips

Sunday, August 26th, 2007

A while ago, I made OptiMap, a Google Maps mashup that will take a number of locations and give you the best way to visit all of them. By best, I mean fastest. Since then, I have been exposed to various ideas on applications for this tool. One is in the real-estate business, where prospective home buyers want to visit a number of houses for sale.

To make things easier for anyone interested in applying this tool, there is now a way for your website to make search requests automatically. This is done by sending a http GET request to http://gebweb.net/optimap/index.php?loc0=start&loc1=dest1&loc2=dest2. Here, start should be replaced by the address or (latitude, longitude) pair where your trip starts and ends, and dest1 and dest2 each should be replaced by either an address or a (latitude, longitude) pair you want to visit.

Up to 20 locations can be specified in the variables loc0, loc1, …, loc19. Remember to http-encode any whitespace etc. in your address strings. This is done automatically if you use the html form element to store your data. Example:


<form NAME="roundtrip" METHOD="get" ACTION="http://gebweb.net/optimap/index.php">
<input NAME="loc0" TYPE="text" />
<input NAME="loc1" TYPE="text" />
<input NAME="loc2" TYPE="text" />
<input NAME="loc3" TYPE="text" />
<input TYPE="submit" VALUE="Submit" />
</form>

In some applications, you will not want the user to be typing in addresses himself, so the html form hidden input element may be more suitable than the text input element. The value of such an element can be set with php when the page is created. It can also be changed with JavaScript, with the following code (assuming the form is called “roundtrip”):


document.roundtrip.elements["loc0"].value = "2 Bloor St West, Canada";
document.roundtrip.elements["loc1"].value = "(37.4419,-122.1419)";

If you have any comments, bugs or feature requests, please leave a comment on this site :)

The Oil Price Widget

Tuesday, July 31st, 2007

UPDATE: This widget no longer works. Please consider the Commodities Widget instead.

Apple Mac OS X (version 10.4 and above) has this neat feature called dashboard. It lets tiny programs, called widgets, run as an overlay to your screen when you press ‘F12’. There are widgets that show the current time in any timezone, hurricane advisories, stock quotes, your computer’s vital stats, and much more.

I’ve got a certain desire to stay updated on the price oil, since it’s often related to world events. For instance, a spike in the oil price might mean a hurricane is headed towards the Gulf of Mexico or that there is more unrest in the Middle East. So to satisfy this urge for oil price updates, I’ve created the Oil Price Widget. It works on Mac OS X Tiger and gathers information from 321energy.com, which is displayed in a small window on the dashboard.

The Oil Price Widget on my dashboard

Download: Oil Price Widget.

Instructions: Mac OS X 10.4 Tiger is required. If you’re using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it. If you’re using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it.