no-www

This blog is hosted on my own domain, ever since the start I’ve supported finding my site as lowtek.ca or www.lowtek.ca.

WordPress allows you to do some simple URL rewriting to push people to whatever you want, and I had configured things to push visitors to www.lowtek.ca/roo since the ‘www’ seemed like the right thing to do. I never really thought much about it until I came across no-www.org.

No-www.org strives to make the Internet and communications about it as fruitful as possible. To that end, we make the modest proposal that website makers configure their main sites to be accessible by domain.com as well as www.domain.com.

This makes a lot of sense, and any site that supports they consider a Class A site. They define a further level of no-www support as Class B, and consider this optimal no-www compliance level. There is also Class C, but is not recommended.

Thus lowtek.ca has been a Class A compliant no-www site all along. However just the other day I switched things around to be Class B – allowing both www.lowtek.ca and lowtek.ca to work, but redirecting people who visit www.lowtek.ca to simply lowtek.ca. I had two reasons that motivated me: 1) lowtek.ca is shorter 2) I’m working on getting a SSL certificate and having the short name allows me to reuse it for other things (like mail) if I want.

To make the change I needed to address a couple of things. First step was to go to all of the wordpress blogs I host and change the General Settings to make sure wordpress wasn’t going to try to rewrite the URL to have a www prefix. Failure to do this will result in a broken site as you get a rewrite/redirect loop.

Next I had to do battle with my apache configuration. This is something I’m sure would be easier if I was a better web server admin. I ended up adding the rewrite rules to the sites-available definition(s) I use, one for normal HTTP and the other for HTTPS. Many suggest using .htaccess but I would rather this was codified in my actual apache config files.

The no-www.org FAQ has a rewrite rule, but I ended up using

RewriteCond %{HTTP_HOST} ^www.lowtek.ca$ [NC]
RewriteRule ^(.*)$ http://lowtek.ca$1 [R=301,L]

The [NC] specifies ‘no case’, ie: case insensitive. The R=301 specifies that we’re redirecting, and the HTTP code is 301 ‘Moved Permanently‘. The L indicates this is the last rule, as you can have multiples.

Now my domain validates with no-www.org as a Class B implementation.

There is a downside to the no-www movement, but only for larger sites. This is likely why Google continues to have a www prefix. Cookies that are set from domain.com can be read by anything.domain.com. For small sites like mine, this has no impact, for larger sites it could be a problem.

Unlocking Samsung Galaxy S Vibrant (Bell)

I’ve been a big fan of unlocked GSM phones since my first one back in 2009. I’ve also been through a surprising number of different phone since then, but all of them have been 2nd (or 3rd) hand and have been a good price for a phone that still has lots of use left in it. My latest phone the Samsung Galaxy S Vibrant (i9000m) is no different, but it came to me locked to Bell.

I purchased the i9000m knowing it could be easily unlocked if you had the right magic. With the stock firmware, if you don’t have the phone unlocked you’ll see what’s pictured at the top of this post when you install a SIM card.

It turns out the forums have a great how to guide, with pointers to an app on the Android Market if you’re afraid of a little bit of hex editing. It should go without saying that I selected the hex editing route. I’ll describe the steps I used here, but  all credit to the folks in the forums for figuring this out.

I will assume that you’ve rooted your i9000m and you’re not incapable of using a hex editor.

Step 1: We’re going to copy some non-volatile memory off the phone that contains the ‘lock’. Perform the following commands on the phone (probably via ADB).

$ su
# cat /efs/nv_data.bin >> /sdcard/nv_data.bin

Now copy that file onto your PC for editing. Make a backup of the original before step 2.

Step 2: Edit that file, I used hexedit on Ubuntu. The lock bit is inside of the byte at 0x181469 in the file. See the green circle below, change that 01 into a 00 and save the file.

Starting at offset 0x181468 you should see the series of digits: ff 01 00 00 00 00 46 46

The XDA post describes it as follows:

There are 5 different types of locks in 5 different bytes

the FF byte should be left alone
the first byte after the FF is the network lock
the next byte is the network subset lock
the next byte is the sp lock
the next byte is the cp lock
the last byte appears to be a data lock.
the 46 46 should be left alone

Step 3: Use the modified file to update your phone. Let’s assume you copied the modified file to /sdcard/nv_data.bin on the phone, and again the commands below are executed on the phone.

$ su
# rm /efs/nv_data.bin
# rm /efs/nv_data.bin.md5
# cat /sdcard/nv_data.bin >> /efs/nv_data.bin
# chmod 755 /efs/nv_data.bin
# chown radio.radio /efs/nv_data.bin || chown 1001.1001 /efs/nv_data.bin
# reboot

That’s it, you’re unlocked. The unlock should persist across ROM (firmware) changes.

References: a great article with pointers to valuable information on the i9000 series.

Samsung Galaxy S Vibrant: CyanogenMod 7.1

While I switched phones, I wasn’t interested in switching away from the community firmware (CyanogenMod) that I’ve been running for the last several phones. Above you see the Samsung Galaxy S Vibrant pictured next to the HTC Desire. You can clearly see the difference in screen size (resolution is identical).

For purposes of firmware changes, the i9000m is very similar to the international version of the i9000. CyanogenMod for the i9000 has only been moved to stable as of 7.1 – so support for it is still relatively new. Compared to the Desire which shares much with the NexusOne and has a very stable base in the community.

Initially my plan was to root, unlock, then start playing with firmware changes. After banging my head for an evening trying to get SuperOneClick to work under Linux I gave up my initial plan. [Recent experience shows that SuperOneClick 2.2 works fine under Windows]. Plan B was to just install CyanogenMod after which we’ll have root and we can unlock.

Since I did this, the wiki instructions have changed and now specify 2.3 as the base, when I did this they specified 2.2. If in doubt, follow the wiki.

The steps break down the following steps

  1. First we install heimdall on our PC
  2. We use that to install custom kernel with root on the phone
  3. Then we flash CyanogenMod via ClockworkMod recovery that came with that new kernel package

Step 1) So heimdall is a cross platform open source firmware tool for Samsung devices. It seems to work well under Ubuntu and you can use the CLI, or add a GUI package.

Step 2) I used the GUI and found it to be straight forward installing the speedmod kernel.  Simply place your device into download mode, point heimdall at the kernel file you download via the wiki and off you go.

At this point we are running a rooted device AND we have ClockworkMod recovery image installed. We could at this point decide to unlock the device and use it as is. Since we’re so close, let’s just move on to step 3.

Step 3) Install CyanogenMod + optional Gapps. I suggest you get these via the Forum and grab the latest. This is as simple as place the files on the internal SD card, and boot into recovery. From there I suggest you follow the instructions and do a full wipe / factory reset then do the installation.

The install of CyanogenMod 7.1 will result in your ClockworkMod being upgraded as well, this is an artifact of the Samsung system layout which seems to lump everything into a single update lump. In my case this meant I also got a modem that was more suitable for use in the United States and registered with my local carriers as roaming. I ended up using the KG3 radio.

In the photo at the top of the screen, both devices are running basically identical configurations. I used TitaniumBackup to get to this state, but I won’t recommend it in general. The resulting installation worked, but exhibited some instabilities. I can’t pin the blame on TitaniumBackup, but the wisdom of the forum was that it can introduce problems. What it did do for me is something that I find to be a real problem moving from device to device, the Android Market treats each device you connect individually – there doesn’t appear to be an easy way to say “take all the apps on this device, and put them on this other one”.

The nice thing about the sequence of steps here is that we haven’t needed to change the bootloaders at all, this increases the safety factor of what we’ve done as we should be able to easily get into recovery or worst case download mode to fix things.