GPS on the SkypePhone

Yesterday I was sort of curious if I could use my 3 Skypephone in a pinch if I got lost, which here in Sydney, happens quite often. Luckily 3’s Skypephone has both Bluetooth, and supports j2me apps. Mobile GPS unit, here I come.

The recipe to get maps on your Skypephone is pretty darn easy. You’ll need one dash bluetooth GPS receiver (I have the Qstarz BT-Q1000), TrekBuddy, a TrekBuddy acceptable map (easily downloadable), and one dab computer – but since you’re reading this, I figure you’ve got that part taken care of.

My process is as follows (on Linux): plug in your Skypephone and select “usb storage” on your phone. Drag the TrekBuddy.jar file onto your new mounted drive (mine comes up as KINGSTON). Drag a relevent map downloaded from bandnet.org onto your phone as well. Unplug your phone from the USB, and it will scan for new media. Hit Menu -> My Stuff -> Others and scroll down to treckbuddy.jar – hit Run. Go to your Connectivity settings and turn on bluetooth. Next go to Games and Apps and downloaded apps, start TrekBuddy. Press the key above MENU and select Load Map, and choose the map you uploaded to your phone. Now hit Start. Select the GPS device, and you’re in business!

There are more instructions here and also here.

Size of Uncompressed OSM File

I’ve been playing around with OSM a little lately, and have been meaning to construct my own slippy map. At first I wanted to do it on my VPS – but with rather limited storage, and even more limited memory, there just isn’t a way. Three problems exists: the first occurs when trying to use osm2pgsql to import the OSM file into the database. Current records state that this typically uses 650+ MB, something my 512MB VPS just doesn’t have (although I’m writing some code that might make this possible in the future).

The second problem exists with CPU usage. Processes on my VPS don’t really utilize the CPU much, which means renicing the process doesn’t do a thing. The CPU pegs at 100%, as it is supposed to do, except that the VPS auto-kills processes that stay at 100% for any length of time. Luckily somebody wrote a program called “cpulimit” (apt-get install cpulimit) that will cap the CPU usage for a process.

The last problem that I thought about is what if I could uncompress the file. Would that use less memory to stick it in the database? I searched and searched but couldn’t find an answer to how big the actual .osm file is. I ultimately broke down and decided to spend the 50c it would take to get this all done with EC2, and write some scripts to automate it in the future.

However, since I’ve finally uncompressed the .osm, I can tell you that as of about January 1st, 2008, the uncompressed OSM size is 67GB.

Using Distcc

I’m in the process of working on one of my projects, and the requirement came up to download a fairly large file (4GB). Since I only receive ~20GB/month at my house, I decided to just use my server in the U.S. The next requirement came about needing to compile Mapnik, which I had intended to do on the server at some point anyways, yet I ran into memory constraints.

Good old distcc comes to the rescue. I don’t need to use distcc that often, yet when I do, it is very handy. However, I always forget to set g++ to use distcc as well. So, for when I forget next time…

DISTCC_HOSTS='home'
./configure
make CC=distcc CXX=distcc

Maybe one of these days I’ll write a more in depth tutorial for installing distcc, yet until then, you can peruse the notes I left on my VPS provider’s wiki.

Zenity GUI to a Shell Script

I have to admit, I’m pretty lazy. I don’t (ironically) like to type, and I really don’t like typing the same command over and over. I found myself switching between my external monitor and laptop quite frequently, and decided to somewhat automate the task. Although I know there are other programs out there that allow this, they either had too many features, or crashed. Xrandr works just fine, but like I said, I’m lazy…

Enter Zenity. Initially I created a PyGTK monitor switcher, yet wanted something even simpler. If you aren’t in the know, Zenity allows you to create super fast, super simple dialogs to regular commands. After you click “ok”, the command is executed, and the dialog disappears. Perfect for switching displays.

And here is the simplistic code behind it:

#!/bin/sh

ans=$(zenity  --list  --text "How do you want to switch your monitor?" \\
--radiolist  --column "Pick" --column "Output Type" TRUE LCD FALSE VGA \\
FALSE Both);

if [ "$ans" = "LCD" ]
then
    xrandr --output VGA --off
    xrandr --output LVDS --auto
elif [ "$ans" = "VGA" ]
then
    xrandr --output LVDS --off
    xrandr --output VGA --auto
elif [ "$ans" = "Both" ]
then
    xrandr --output VGA --auto
    xrandr --output LVDS --mode 1024x768
fi

I send a big cheers and thanks to the Zenity guys, I’ll surely use this quick language more frequently.

Mass Spam Delete Django

As you can read, I’ve been traveling around quite a bit lately. This means I haven’t been checking the comments on my blog, which means quite a bit of spam has been entered. I am blocking the spam via akismet, however, it is still recorded in the database. Being somebody who hates cluttered desktops, you can imagine how I feel about having a lot (447) of spam. Well, since akismet flips the is_public switch True for good comments and False for bad comments, that makes a really easy query in mysql.

mysql> delete from comments_freecomment where is_public = False

Of course, make sure you have backed up your database first.

Works With Windows Vista

I’m in Tibet right now, so will keep this somewhat brief.

For the next few hours I’ll be sitting in this dingy internet cafe in Lhasa updating my blog with my travels. I happened to look down and on the monitor it says “works with windows vista”. I find this quite humorous, of course it is going to work with vista, it is a normal generic monitor.

Anyhow, I guess there is a reason for marketing. Back to writing our travels.

Last Xenful Comments

One of the biggest things I regret is not utilizing Xen more. I’ve finally been admitted to Amazon’s EC2 Limited Beta, just two days before I leave, so not enough time to actually do anything fun. However, I think Xen is an ideal infrastructure aid for SMEs in particular. The cost of technology is continuing to decrease, which means bigger servers cost less. This is great for the small/branch office. Let me explain.

One of the themes I noticed while studying and taking the MCSE was that the solution to the majority of the problems was to just buy more servers. Even for simple things like DHCP, buy another server. I’ve always operated on a limited budget, and anyways, I don’t think money should be wasted on resources when it isn’t needed. With a VT chipset, you aren’t tied to any OS in particular.

My friend Ian and I were talking and he illustrated a great usage of Xen through his work. What he’s ended up doing is installing the Small Business Edition of Server 2003 in a Xen node. The reasoning is that SBE is, apparently extremely difficult to create backups of – mainly due to odd file locking behavior. I’ve had similar thoughts, but mainly taking advantage of Xen’s migration feature. The idea of taking a small branch office and putting everything on a Xen server is quite appealing to me, especially considering a second server could be used to create virtual hot spare.

As you can see, I like Xen. I’ve found it relatively easy to install, and the fact that it is starting to come bundled with recent distributions is pretty darn, sweet.

My Portable Travel Stick

This will be my last post from Taiwan, and I’m placing it in my tech section. Shortly I will be flying to Hong Kong, and then traveling into China. I’m not bringing my laptop with me. I’m always a little wary of using public computers, especially in many of the poorly run internet cafes. Often the logged in user is the administrator, and we all know the computers are obviously crawling with worms and keyloggers. What can I do?

I had a 128MB flash drive, which is the perfect size fo this. I’ve installed the following applications to run directly from it:

  • Portable Clamwin - I plan to fire it up and do a memory scan before I start typing any passwords.
  • Portable Putty - This is useful for two reasons. Firstly, in case my server (or any server with SSH) needs help, I’m on it. Secondly, and more importantly, for security. Putty can easily be used as a SOCKS5 proxy over SSH, so I can tunnel Firefox and IM securely. Password sniffers, be gone! A side benefit is the ability to bypass the “Great Firewall”, if needed (e.g. the block my Google account).
  • Portable Miranda - In case I’m feeling home sick, or have some crazy desire to talk on IRC. Don’t count on it.
  • Firefox - I tried the Portable Apps package, yet it didn’t work.

I noticed in the “known issues” that it doesn’t work if loaded on a drive with a non-asci path, which this machine (and those in China) usually have. The “resolution” is to run it in Win98 compat mode, but this didn’t work for me. To get around this, I downloaded the normal Firefox, installed it, copied the contents of “Mozilla Firefox” and dumped it in /Firefox. Then I created a profile directory called /FFProfile, and created a bat file called “firefox.bat”:

start \Firefox\firefox.exe -profile \FFProfile

Double click the bat file, and you have FF running on your usb drive.
I’m in a search for a better keylogger detector, as I don’t know how complete ClamAV will be. If you know of one, let me know. Until then, I’m going to pretend I have the perfect traveling USB companion.

OpenMoko In Person

Two weeks ago I had the privilege of meeting up with some of the OpenMoko guys. You’ve seen me write a little bit about this project, but meeting them and actually getting to play with a device was quite enlightening.

Most foreigners in Taipei take taxis, but not I. I already had an idea how to go to FIC headquarters, yet it was – rough. I jumped on the right bus, going the right direction, yet didn’t really know where to get off. In my broken Chinese I started talking to a group of high school kids, who somewhat pointed me in the right direction. At one point we were coming up to a light and a lady just said: “get off, go down that road.” I grabbed my bag and jumped off the bus. The street signs started to resemble the characters I had written down, but I didn’t know which direction to go in. I asked a travel agency, and they pointed me in the right direction – and then it started to rain. I luckily found FIC without getting too wet, and quickly met Sean, the project leader for OpenMoko.

Sean, myself, and several other OpenMoko developers went out to lunch and talked shop. Mickey pulled out a Neo, the hardware platform OpenMoko is going to be based off of. I’ll admit, when I saw photos I wasn’t really impressed – but in person, it is pretty sexy. Not too big, but big enough to be functional. In one of my previous posts I mentioned learning C++ back in university, and having basically not touched it since. In a way, I haven’t had to, and I’ve recently found Python, which is just fun. However, I’m so excited about the OpenMoko, I’ve picked up the K & R bible to read while we are traveling. Not the ideal way to learn a language, but the concepts are somewhat a refresher. I can’t wait to play with SIP/IAX on this thing, it will then be my dream phone.

Well, I have one more post to make to get some thoughts off my chest. If you want a postcard, send me an email.

IIS7 GoLive Program

You can easily see that I am a big Linux fan, I’ve mentioned this over and over. I’ve also mentioned that I’m finishing up my MCSE, which started as a dare with my buddy, Ian. In the process of studying for my MCSE I’ve developed a certain amount of respect for Windows Server 2003, yet I’ll comment more on this later.

What I really wanted to write two paragraphs about was an interesting discovery I made today. I happened to stumble over to Microsoft’s hardware site, and noticed in my little Server Spy monitor that it was running IIS/7 – the first time I have seen this anywhere. Upon further investigation I perused their GoLive program, which details several ways to test drive IIS7. There are some details about Microsoft’s setup, which one would expect to be impressive. And it is. So, if you are a Microsoft person, you may want to grab a test drive of Beta3 while you still can.