Mike Hughes

Just a few words…

T-Mobile 3G Dongle and OSX Snow Leopard

After spotting a great deal in PC World this evening, I came home with a T-Mobile PAYG 3G Dongle, £20 got me the Dongle, £10 credit and 30 days service for just £2.

Upon installing, everything seemed fine until I went to use Terminal.. “[Process Completed]“, at first, I thought zcsh was broken, but no other shells were working either, so I reboot in hope that it may just go away, but this is where my problems start, it won’t boot.

After doing a bit of research, it seems the installer replaces libcurl.4.dylib with a 32bit only version - many things rely on this lib, resulting in a broken system.

Now, to fix this problem, you need to replace the lib with the original, you can download a copy of this here: http://www.mike-hughes.net/share/libcurl.4.dylib.bz2

Once you have this, you need to boot your mac up in Single User mode, you can do this by holding Command/Apple + S immediately at boot.

Once there, you need to mount your disk

fsck -fy
mount -uw /

Now, The only easy way I found of getting the file over to the mac in single user mode is to scp it over, but for this you’ll need networking support, you’ll need an ethernet connection;

launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist
launchctl load /System/Library/LaunchDaemon com.apple.DirectoryServices.plist

Once you’re connected (You can check with `ifconfig`), you can scp the file over;

scp user@yourhost.com:/path/to/libcurl.4.dylib .

And then simply copy it to /usr/lib;

cp libcurl.4.dylib /usr/lib/

And that’s it, reboot and you’re all sorted.

I’ve tested my dongle since, and it still seems to work, I’ll report back if any more issues ensue.

Filesharing for OSX: AFP on Debian

So I have my shiny new Macbook Pro 13″ for work, a 24″ Dell 2408 to make things a bit more usable and a new Aluminium Apple Keyboard. This setup is working really well as far as work goes, but one thing really troubling me is the poor samba mount performance under OSX, and this was a real problem for me, considering all of my development work is done on a local dev server, and I was accessing its filesystem via Samba previous. In steps AFP…

I chose AFP because support for it inside OSX seemed better than NFS in the fact that it seems far better integrated into Finder (well, NFS isn’t integrated at all). It also lets me use Time Machine, Apple’s own backup suite, which seems to work rather well.

To achieve AFP on a Linux server, working perfectly under OSX as well as having support for Time Machine, we will need the latest Netatalk (2.0.5 at time of writing), and Avahi.

Netatalk

Latest Version

If you are running unstable already, you can skip this part, but for those of us less brave, we need to grab netatalk 2.0.5 from unstable for Time Machine support.

FIrst up, we need to do some basic apt-pinning configuration, this will let us use packages from further up the development tree.

Open ‘/etc/apt/preferences’ (You’ll need to create it if this is the first time you’ve used it)
Package: *
Pin: release a=stable
Pin-Priority: 900

Package: *
Pin: release a=unstable
Pin-Priority: 800

You’ll need to replace stable with the release you are using (ie. of you’re on testing a=testing).

This allows us to put a higher priority on stable packages, so apt doesn’t see all the new packages from unstable and try updating everything.

Next we need to add the unstable repository to ‘/etc/apt/sources.list’
deb ftp://ftp.us.debian.org/debian/ unstable main

Followed by
apt-get update

Installing Netatalk

Now we need to fetch Netatalk from the unstable tree.
apt-get install netatalk/unstable

Configuring Netatalk

First we need to open up ‘/etc/default/netatalk’, Scroll down until you find the configuration block looking like the one below and change the values to match what you see here:
# Set which daemons to run (papd is dependent upon atalkd):
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no

Configure Shares

Open up ‘/etc/netatalk/AppleVolumes.default’, and add shares following the examples below:
~ "$u" cnidscheme:cdb options:usedots,upriv
/mnt/files Files cnidscheme:cdb options:usedots,upriv
/home/mike/dev Dev cnidscheme:cdb options:usedots,upriv
/mnt/files/TimeMachine TimeMachine cnidscheme:cdb options:usedots,upriv,tm

Notice the ‘tm’ option for TimeMachine. Also, the first line creates a share named the same as the authenticated user to their home directory.

That’s everything for netatalk, we can restart it now:
/etc/init.d/netatalk restart

Avahi

We’ll use Avahi to advertise our AFP server, so it comes up in Finder with no configuration needed (other than a login!).

Let’s get the programs we’ll need:
apt-get install avahi-daemon libnss-mdns

Firstly we need to edit ‘/etc/nsswitch.conf’ and add ‘mdns’ to the end of the hosts line, so it looks something like this:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns

Now we need to configure the Avahi advertising for our AFP server, we do this by creating a new service (replacing vi with your preferred editor):
vi /etc/avahi/services/afpd.service

And add the following:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM “avahi-service.dtd”>
<service-group>
<name replace-wildcards=”yes”>%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>

Save that and restart avahi:
/etc/init.d/avahi-daemon restart

Time machine

Before you can use your new network share for Time Machine, you need to enable support for unsupported network shares on the command line:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

iptables

You need to open 548 and 5353, I added the folowing to my iptables import file.
-A INPUT -p tcp -m tcp --dport 548 -j ACCEPT
-A INPUT -p udp -m udp –dport 548 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 5353 -j ACCEPT
-A INPUT -p udp -m udp –dport 5353 -j ACCEPT

Conclusion

That should be it, you should be able to see your share in Finder, on the first time you’ll have to click “Connect As..” - if you choose to remember the details in your keychain then it should connect automatically in future.

I found the performance of AFP to be far greater than Samba at least, and I now have a full filesharing and backup system, so winners all round.

Installing Debian Lenny from a USB stick with Windows.

I recently purchased an Acer Aspire REVO for the purposes of a Development server that I can keep running 24/7 without the fear of racking up electricity bills. The trouble is, it has no cd-rom, so I set about looking to install from a USB disk.

After a bit of googling, it wasn’t quite obvoius how to achieve this, so here is what I ended up with.

You’ll need a USB disk, formatted as FAT32 - for the purposes of this article, we’ll assume the usb disk is mounted on G:

First of all you’ll need dd for windows.

Then boot.img.gz from here

Extract boot.img.gz to the same place you put dd (I stuck it in c:/) and simply run:

dd.exe if=boot.img of=\\.\g: bs=1M

Once this is completed, remove the disk and re-insert it to fresh the filesystem, upon opening it up you’ll find all the necessary files needed to boot.

The final step is to add a disk image to install from, I used the NetInst ISO - simply drop it into the root of the usb disk.

That’s it, boot the USB disk

Wordpress 2.8 Released

It’s slightly old news now, but for those that haven’t seen it, Wordpress 2.8 has been released. We’re getting closer!

Read More here

iPhone tethering “hack” without jailbreak.

By Mike Hughes.

Someone has come up with a way of enabling tethering on the iPhone without paying your network silly amounts for the privilege, and allowing those with providers that do not “support” tethering to make use of this wonderful new feature in iPhone OS 3.0.

Simply head over to help.BenM.at -

Choose the first option, “MobileConfigs”, then go through your country and carrier where you’ll eventually be provided with a download for a new “Profile”, choose install, you’ll be presented with a message telling you that the phone cannot verify the profile, hit install and you’re ready to go.

You can find tethering under settings -> general -> network. It needs to be switched on manually, and can be used over USB or Bluetooth.

I just tried it over USB and it appears to work very well, it provides windows with an “ethernet” device, over which the iPhone appears to act as a NAT gateway (residing on a non routable 192.x.x.x IP.

I haven’t had a chance to try this on 3G yet (No coverage where I live), but it worked ok under GPRS (Despite people saying it only works on the 3G connection!), albeit very slowly.

Enjoy :)

iPhone OS 3.0 & Isle of Wight parody

By Mike Hughes;
Well iPhone OS 3.0 is here, the search is awesome, now, just the wait for quickpwn/jailbreak.

Oh, Was pointed at this today, made me giggle, and deserves to be shared :)

YouTube - IOW (A song for the Isle Of Wight - a parody of Lily Allen’s LDN)

Processing XSLT with PHP.

I’ve been playing around with XSLT recently, with the hope of using it to move to a more “MVC” approach to web development.

If like me, you don’t use Apache, and want a little more control over your XSLT processing, PHP has a fantastic XSLT class that can do just that!


<?php

$dom 
= new DomDocument();

$dom->load‘test.xml’ );

$xslt = new XSLTProcessor(); 

$XSL = new DOMDocument(); 

$XSL->load‘xslt/layout.xsl’LIBXML_NOCDATA); 

$xslt->importStylesheet$XSL ); 

print 
$xslt->transformToXML$dom );

?> 

It’s as easy as that.

Mike Hughes.

Mike-Hughes.net

I decided to take a change in direction as far as my SEO experimentation goes.

Since making it to second result for Mike Hughes, I started looking at the first result, and I didn’t really find much of a reason for why it was first, other than the almost exact keyword match in the domain name.

So in the name of research, I’ve intelligently 301′d mikehugh.es and mikeh.me.uk here to mike-hughes.net - which means the existing position should be maintained, but it will be interesting if the 100% keyword->domain match will be enough to make it in to first place.

Mike Hughes - MikeH.me.uk

I finally sorted out the new domain for myself (Mike Hughes), there wasn’t really any reason behind it, just a little experimentation with SEO.

Mike Hughes

Cherokee

Just for a change, and something new to try, I’ve now switched the webserver from Lighttpd to Cherokee.

Cherokee is very “up and coming” in my opinion, with it’s easy to use admin interface, and some benchmarks appear to show it outperforming Lighttpd.

Find out more at: Cherokee Web Server