Tracking the ISS

iPhone Geolocation Bookmarklets Part II

Back when I wrote about creating iPhone bookmarklets that automagically grab GPS location, I lamented that you’re unable to easily bookmark them within an iOS device or save them as web apps. A few friends were pestering me about the using the GPS-enabled Heavens Above link to track the ISS, so I quickly threw together something here on my website. The webpage will simply request your location and forward you on to Heavens Above’s ISS tracking page.

The page itself is extraordinary simple. It uses entirely client-side processing; no data is logged. I only use your location to point to the correct URL to Heavens Above. The only little bit of fanciness involved is that it detects if you’re on an iPhone or iPod and then displays instructions on how to add to your homescreen. There’s a nice homescreen icon to go along with it. That said, it also works quite nicely with relatively advanced desktop browsers.

Posted by Matt on Jul 02, 2011

Finer zoom increments in WebKit

I’ve always been annoyed at how large the jumps are between zoom increments in every single web browser. One click of “Zoom In” and suddenly the text is HUGE. I have found it so unhelpful in the past that I had completely forgotten about the feature. But then two things changed:

  1. I purchased a high resolution laptop. I really like the display, but it can make text on some websites too small to read comfortably.
  2. Apple made zoom in a built-in gesture on their trackpads. In almost all applications, the “pinch” and “stretch” gestures gradually zooms the content in and out. In Safari, however, the jump between zoom levels is so large that the zoomed page feels jarringly disjointed from the original.

Fortunately, WebKit is open source and anyone can download and modify the source code. And it’s an extremely simple change (as it should be). In file WebKit/mac/WebView/, change

#define ZoomMultiplierRatio 1.2f


#define ZoomMultiplierRatio 1.06265857f

To be more precise, you may use this diff file as a patch. Why 1.06265857f? It’s the cube root of 1.2. Since the current zoom level is computed by multiplying by this ratio, using the cube root effectively makes the zoom increment a third of what is previously was.

To compile your very own modified WebKit, go to WebKit/ Tools/Scripts and run ./build-webkit --release (it takes a while – about 40 minutes for me). To use it, open and compile WebKit/Tools/WebKitLauncher/WebKitLauncher.xcodeproj in Xcode. This creates the that is found in the nightly builds. But you’re not done yet. You need to add your custom-built webkit into this app. Navigate into the build directory and right-click on to Show Package Contents. You need to create the directory Contents/Frameworks/10.6 (or 10.5 if you’re still on Leopard). Finally, copy all the items from WebKit/WebKitBuild/Release into that new folder, and you’re done!

Now if only I could hack Safari to not require such a large gesture to zoom in… but alas that code resides in Apple’s closed source.

Posted by Matt on Jan 07, 2011

iPhone Geolocation Bookmarklets

Create direct links to GPS location-specific webpages

Very few websites have implemented the new javascript GPS geolocation features that were intruduced with HTML 5. However, there are a few sites that use latitude and longitude directly in their URLs.

I first wanted a quick way to get my current latitude and longitude while looking at Heavens Above. It’s a great site that allows you to find visible satellites based upon your current location. Here’s the bookmarklet that I created:

javascript:navigator.geolocation.getCurrentPosition(function(g){c=g.coords;z=c.altitude;z=z?z:0;d=new Date(2009,0,1,0,0,0,0).toLocaleString().substr(-3,3);window.location=""+c.latitude+"&lng="+c.longitude+"&alt="+z+"&loc=iPhone&tz="+d;},function(){alert("Permission denied.")});

Copy this link to your bookmarks and when accessed on an iPhone or location-aware web browser, it will directly load the site with your current location entered!

I had to jump through several hoops here. When the altitude is not available (when only using cell-tower triangulation), the javascript code returns null. The website only supports numeric values, so z=z?z:0 replaces the null with a 0. Secondly, the website needs the local timezone, but unfortunately it only accepts a small subset of the three letter codes (and not the numeric offset from UTC). Even worse, the daylight savings version of the code (EDT/CDT/MDT/PDT) are unsupported – the site just assumes that you follow the trend (sorry Arizona). So I grab the code from January 1, 2009 (when daylight savings is not in effect), and parse the three letter code from that string.

For most sites, you’d only need something of the form (The NOAA’s weather forecast , for example):

javascript:navigator.geolocation.getCurrentPosition(function(g){c=g.coords;window.location=""+c.latitude+"&lon="+c.longitude;},function(){alert("Permission denied.")});

Now if only I could find a way to save the javascript bookmark to the Home Screen, I’d be set!

Posted by Matt on Aug 06, 2009

Minor Truetype Font Editing on a Mac

(also: how to fix Consolas' baseline)

Update December 5, 2011: Changed download link to the most recent version of Apple Font Tool suite, which is now x86 compatible.

With the release of Windows Vista, Microsoft included six new fonts that they commissioned for the occasion. They are the new defaults for Vista and Office. They’ve also made them available for Mac through Office as well as a handful of free (as in beer) utilities. I got them by following these instructions.

These new modern fonts are explicitly designed for display on computer screens with ClearType. Although Apple has a different philosophy on font rendering, the same basic premise is used in OS X. Besides all that (or, rather, because of it) these fonts are very pretty.

But there’s a problem, and you can see it in the image above. When packaging these fonts up for the Mac, Microsoft goofed on the baseline for Consolas. The icon previews below show it much more obviously.

In short: it’s annoying. And wrong. And the fix is after the break.

Continue Reading…

Posted by Matt on Mar 15, 2009

Adding an OptiBay to my MacBook Pro

Well, I finally decided to risk voiding my warranty for the luxury of double the disk space. I have a 160GB hard drive installed in my MacBook, but I’m constantly squeezed for space. I never use my internal CD drive (the last time was over two months ago… and it was actually my house-mate that needed it), so the thought of occasionally using an external CD drive is much more pleasant than lugging an external HD around all the time.

MCE Technologies sells a decent-looking package called OptiBay for a little too much money that takes the internal optical drive and replaces it with a Hard Drive. You can do it on most any Mac laptop. I searched around online quite a bit for reviews and experiences, but it seems as though nobody has done a formal review. So, I figured I’d photograph and document my experience as I went.

Continue Reading…

Posted by Matt on May 26, 2007