Tunnelblick and the rest of the internet.

I have access via an OpenVPN tunnel to my University, and can access files located on the server there using Tunnelblick. This provides access through an insecure wireless network, as well as over the internet.

However, if I connect using Tunnelblick from home, I can either view my files, or view stuff on the rest of the internet.

It took me a while, but I figured out how to change the openVPN settings so that only a subset of IP addresses go through the VPN.

Assuming you are on a Mac, your settings file will be similar to ~/Library/openvpn/connection_name.conf, but with connection_name being something else. You need to edit this file, which is probably write protected. I’m not going to tell you how to fix that problem - if you can’t do that you have no business hacking with routing tables!

Find the entry near the bottom that looks like:

redirect-gateway def1

Comment this out (put a # at the start).

Now add in a line that looks somewhat like this:

route <network-address> <netmask> <gateway-address>

For example:

route 1.2.3.4 255.255.0.0 5.6.7.8

For Flinders Uni Infoeng, it should be:

route 129.96.6.0 255.255.255.0 129.96.59.73

You may need to authorise your Mac after saving the file. But when you connect with Tunnelblick, you should now be able to access addresses within the desired range, and the rest of the googlenet at the same time. Happy surfing!

Postsecret Teacher Edition

teacher1.jpg

No need to elaborate.

Fix Bluetooth connection errors with emitSMS

I use the excellent and free emitSMS for all of my SMS sending-from-my-Mac needs, and it works a treat. However, for some reason in the last couple of days it has stopped connecting properly to my phone, a Nokia E65.

I’ve had lots of hassles with this phone, and thought this might be just another one. But I’ve restarted both the phone and the Mac, and no joy.

If you look at the back of the emitSMS widget, you’ll be able to choose the serial port to connect to. If you try changing the port to one of the standard ones, it should give an almost immediate error. If you change it back to your phone’s serial port, and it hangs forever, there is a solution.

Picture 2.png

As can be seen from the image above, I’ve just created a second Dial-UpNetworking bluetooth port, and used that instead.

BluetoothSystemPrefs.png

Open up System Preferences, and visit the Bluetooth panel. Select your phone, and select Edit Serial Ports… from the utility menu.

BTSP_menu.png

Add a new serial port using the plus button, and duplicate all of the settings.

EditSerialPorts.png

Click Apply, and then change the serial port back in emitSMS. It should connect and identify your phone.

Unqualified Statistics

I hate statements that are unqualified, and therefore meaningless, with regard to statistics.

On Sunrise this morning, in the local news, they trotted out the chestnut:

“12% of people charged with drink-driving in the last two years were P-platers.”

This is totally meaningless without an indication of what percentage of the driving population are P-platers. What if it is higher than 12%? Then P-platers are actually more responsible than the rest of us…

Bah.

DoubleCommand and multiple keyboards

I love my MacBook Pro. But not everything about her.

For instance, I despise that there is no forward delete key on the inbuilt keyboard. But using DoubleCommand you can fix that. You can also make the fn key act like control (I’m always hitting fn-C instead of Ctrl-C to kill a thread, for instance), and a whole lot of other changes.

But if you remap the small enter key to forward delete (which I highly recommend), if you plug in a USB keyboard, then the keypad’s enter key will also be mapped to forward delete. Which is not cool.

The latest SVN version of DoubleCommand has the facility to fix this, but it requires a bit of terminal work to set it up.

If you haven’t got a newish version (~1.6.6), first, check out the latest code:

$ svn co https://doublecommand.svn.sourceforge.net/svnroot/doublecommand doublecommand

The code we want is in trunk/kext. Open the project inside that folder. Build the project, and then enter the following command from inside of the build/ subdirectory:

$ sudo cp -r Default/DoubleCommand.kext /Library/StartupItems/DoubleCommand/DoubleCommand.kext  

Enter your password when requested. Then change to the DoubleCommand installation directory:

$ cd /Library/StartupItems/DoubleCommand  

We need to unload and then load the kext. The easiest way is using the following commands ($ means type it in, > is the output):

$ sudo ./DoubleCommand stop  
> Unloading DoubleCommand  
> kextunload: unload kext ./DoubleCommand.kext succeeded  
$ sudo ./DoubleCommand  
> Loading DoubleCommand  
> kextload: ./DoubleCommand.kext loaded successfully  
> dc.config: 0 -> 1593344

Take a note of that last number, and then perform the two commands:

$ sudo sysctl -w dc.keyboard1=37
$ sudo sysctl -w dc.config1=<the_number_above>

Now, load up the DoubleCommand preferences pane, and disable the ‘Enter key acts as forward delete’, or whatever you had it acting as. Now, the two keyboards will appear differently in behaviour. And hopefully your life will be fuller.

Many thanks to the developer, Michael Baltaks, for his quick response and assistance in this matter.

Mac OS X hostnames

I run a DHCP/DNS server on my home network, which allocates addresses for all of my machines, and provides them with DNS when connected. Because my development machine, a MacBook Pro also sometimes has to run a web server, and provide varying responses according to the hostname by which she is currently being addressed, I set up a range of VirtualHost directives in apache, and entries in m own /etc/hosts file. This was fine as long as I was the only person accessing these sites, but I also needed to access them from a couple of other machines (including a VM running WinXP).

So, I palmed off the /etc/hosts entry to the DHCP server, a reflashed NSLU2. This machine is just the DHCP/DNS server, which is available only via ssh. But, if I connect to my home network, then the DHCP/DNS server decides to use this hostname as my hostname. I’m still tweaking to see if there is a way around it (have the correct hostname specified earlier in the file springs to mind).

It’s fairly annoying to have the wrong hostname showing in my Terminal when I open up a bash session, or look at the console.log. Something I really can’t live with.

Dictionary returns in ZSI

For my day job, I am developing a SOAP server in python. I have been using ZSI as a framework, and it is very good. It will, with mod_python, allow you to build a complete application in python (and even without mod_python you can have it as a standalone process). One of the touted features is easy return of lists and dictionaries, without having to declare ComplexTypes classes.

However, it doesn’t quite work. And the not-working-bit is really odd.

If you return a dict, such as the following:

1   return {"uid":23,"gid":993,"cid":333}

Then ZSI creates a SOAP response like:

1     <uid id="1234" xsi:type="xsd:int">23</uid>  
2     <gid id="5678" xsi:type="xsd:int">993</gid>  
3     <cid id="0987" xsi:type="xsd:int">333</cid>

But, if you return a dictionary with values that happen to be the same, as I did with my boilerplate code:

1     return {"uid":"xsd__string",
2             "gid":"xsd__string",
3             "cid":"xsd__string"}

Then it fails. The second and any other instance of any dict key where the value has already been used by another key is empty, and the wrong type:

1     <uid id="1234" xsi:type="xsd:string">xsd__string</uid>  
2     <gid href="#5678"></gid>  
3     <cid href="#0987"></cid>

This can be overcome with liberal use of classes (or subclasses, since most of the time I am returning dicts or lists). It is a bit of a pain in the arse, though. I’ve filed a bug report. And stopped using ZSI. If I found this bug this fast, then I don’t want to know how many more there are. It’s just easier to convert the XML to python objects and back again, and package it up to look like a SOAP request. Which is kind of what SOAP does anyway.

4 GB RAM

Well, the 4GB of PC2-5300 SO-DIMM RAM I ordered arrived today. I got it very cheap on eBay, and was pretty worried about it. But it all seems pretty stable so far - Rember tells me it is all okay, and it seems to be running smoothly.

Upgrading the RAM in a MacBook Pro is a piece of cake - took less than 5 minutes, including waiting for the machine to shut down and then start up after replacing the sticks. Had three small philips head screws to remove, after taking off the battery. Then the RAM came out fairly easy, and the new sticks were in.

I used the 2x 1G sticks from the laptop to upgrade my Media Centre - the Mac Mini (jens) seems to like the doubling of RAM she got too. Having said that, opening the case up was a bit trickier, but took less than 30 minutes anyway. The longest time was spent trying to figure out why the external HDD wouldn’t mount (because I had turned it off), then why it wouldn’t turn on (apparently it needs to be connected to a firewire port first).

The extra RAM in my laptop means I can finally run a VMWare machine without having to set aside 15 minutes for the machine to respond enough to be usable. I know this isn’t just a problem with the particular VM file, since this is a brand new VM. The old one was even worse! Having said that, I’m not about to use it all of the time. Although once it is running, it goes okay, it still consumes a fair chunk of the RAM.

Speaking of RAM use, I’m running a few Dashboard widgets, a couple of which use up 15MB of RAM each. DoBeDo and iStat widget seem to be the culprits. I think I’ll kill DoBeDo - I use Anxiety as my main ToDo viewer, which uses half of the RAM of DoBeDo. It’s just nice that whenever I go into Dashboard it’s there to remind me. I often use iStat widget just to keep a track on stuff, so that can stay too.

Back to Uni

After a nearly 10-year hiatus, I’m back at Uni. And loving it.

I’m currently sitting in the Flinders Uni “Coopers” bar, having a nice cold Pale Ale. My first day of Uni was today, and so far it’s pretty cruisy.

I actually finished the first two afternoons’ work in the first half of the first afternoon. The lectures didn’t really give me much new, it’s all just aligning what I already know about OOP with the syntax of java.

The thing that actually took me the longest today was remembering how many degrees are in the internal angles of a regular pentagon. I ended up having to fire up a python interpreter to keep a track of all of my maths. I think I would have finished in half the time it took me otherwise. That, and having to remember to declare variables…

So, Java is looking easy so far, and from what I can see the next 2.5 weeks are going to be more of the same. About time I started to get High Distinctions, I think. I’m finding plenty of time to listen to Late Night Cocoa, and learn Objective C/Cocoa while I learn Java.