Category Archives: Uncategorized

Converting characters

I’ve often had issues with character sets getting muddled up.. generally from my clients pasting ISO-8859-1 special chars into my sites that are UTF-8. Today I discovered the super-handy iconv() function that’ll convert character sets.. in this case I needed to drop down to ascii for generating pdfs with dompdf:

$output = iconv('UTF-8', 'ASCII//TRANSLIT', $string);

Pretty handy!

Locking down an sftp user on Debian

This always ends up being a bit tricky, and some guides I’ve found on the net differ slightly from what I’ve got here. This seems to work pretty well for me on Debian.

Enter the following into /etc/sshd/config to allow sftp and to lock a user into a specific chroot’ed directory:

Subsystem sftp /usr/lib/openssh/sftp-server

For each user you want to lock down, you’ll first need to add the user, set the shell to false so they can’t log in via ssh and then set their home directory to where you want them chroot’ed:

useradd jorbloggs
usermod -s /bin/false joebloggs 
usermod -d /srv/www/somehome/ joebloggs

Now just add a few details for the user to /etc/sshd/config:

Match User joebloggs
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
ChrootDirectory %h


The users home directory must be owned by root and only writable by root – bit weird, but you get odd auth messages and it doesn’t work otherwise. There’s probably a work-around for this, but for me it doesn’t really matter. If or when I do need a work around I’ll post it here. Feel free to leave comments with tips/suggestions!

Samsung Galaxy S / Android review

On Monday I recieved my shiny new Samsung Galaxy S mobile phone. I’ve been putting off getting a smart phone for quite some years now as I never felt there was anything worth spending money on, and after some experience with my ipod touch I was put off getting an iphone. Anyway, I felt like writing my thoughts on the device now I’ve had it a week.

The hardware

My first impressions were that it does indeed look a lot like the iphone 3g, and I found I was trying to press the standby button which wasn’t there quite often, as well as picking it up and holding it upside down. As other reviews have pointed out, the handset does feel very light – this was a bit strange at first as I’m used to my wife’s iphone 3gs which weighs considerably more.

When I turned it on, I was genuinely impressed by how bright and sharp the display was – it easily outdoes the iphone 3g/3gs screen (I think the iphone 4 screen is probably better though.)

One thing a lot of reviews will skip over is how well the phone makes phone calls – I had no problems making a call from the phone, however because the phone’s speaker is on the back it’s sometimes hard to hear it ring if it’s on a flat surface.. bit of a weird issue but an issue non the less.

The sensitivity of the touch screen was reassuring. One reason why I’ve put off getting an android phone until now is because I’ve seen videos on the internet of slower devices and been really put off by the lag you can see when scrolling/pinching to zoom etc.. fortunately this isn’t a problem here. I did notice however that the accuracy of where you place your finger to begin with and then start to scroll is slightly off.. not a problem but I don’t think that happens on the iphone.

Inside, there is a SIM card slot (obviously) and an empty micro sd slot for adding more memory. My SGS came with 16MB of internal memory, which is strangely referred to as an SD card from within Android – my guess is that it does indeed use an internal sd card somewhere as it was probably a cheap way of manufacturing the thing.

Speaking of cheapness, the phone does feel a tad cheap compared to the iphone, although compared to any other device I’d say it’s fairly well built (certainly a lot better than my dell laptop for example!)

The GPS sensor on the phone seemed fairly good although it wasn’t so great when I went under some trees and when I began a walk to my local town to test it. There are known issues with the GPS which will be fixed next month (September) with a software update.

The compass and tilt sensors seem fairly standard. The compass only seems to be accurate if the phone is being held up rather than laid flat, but I guess that’s normal.

The front facing camera was fairly crappy, but I haven’t really found a use for it yet.. hopefully Skype will be released properly for Android soon so I can make use of it.

The software

Unfortunately, Samsung have decided to install their own custom software on the phone which is not easily removed (as far as I know you have to root the device.) This is apparent straight away as there’s a fairly naff locked screen thing and there’s a samsung task killer widget on one of your home screens. One of the nice things about android is you can customise it quite a bit so removing that widget and all the crappy samsung items from your home screens is easy enough.

I got this phone with version 2.1 of the Android OS also called Eclair, which is a fairly modern release although the most recent is 2.2 – Froyo which is due to be released for the SGS next month. One of the first things that struck me about the OS was how different it felt from the iphone operating systems (including iOS4.) Even though the home screen that the SGS uses is blatantly set up to mimic the iPhone’s, it’s still very different and there was certainly a bit of a learning curve to using it.

The first thing you notice is how there are more menus and options than on the iphone, which at first was a little bit strange, but now seems pretty logical. Rather than apps having a back button, there’s a physical button on the phone (a touch sensitive one,) along with a menu button which brings up a context menu much like right clicking something in windows. Having a back button is great, it’s certainly something I think Android has over the iPhone.

Another big feature of Android is the fact it does real multi tasking unlike the iPhone. This feature is certainly cool and useful, but requires some thought on the users part. I think this is the real deal breaker for whether someone will prefer Android to the iphone or not as some (bad) programs like to use up lots of CPU time when they’re in the background and this can slow things down and make stuff laggy. At first I was killing apps off left right and centre, but after doing a bit of a search on google I found that perhaps this isn’t the best idea.. and I think they’re right.. it’s basically working the same as your computer does by keeping apps resident in the memory it means if you ‘load’ them again or switch back this will be instant rather than having to load the app back of the internal storage. It’s quite complicated to explain, and for this reason alone I think anyone used to the iphone’s way of doing things will get pissed off with this until they ‘get it.’

Anyway, the apps from google seem very good, perhaps with the exception of google listen which seems to have a very laggy interface – which is surprising. I won’t go into any individual apps as there’s a lot of good/fun ones I’ve been playing around with and I don’t want to spend too long writing this.

All in all I’m very happy with the handset, I get fairly decent battery life out of fairly heavy (but careful) usage – perhaps just under 2 days. I’ll probably make some additions and corrections to this post over the weekend.

What’s going on

I’ve recently moved again, from Australia to Texas in the states. The reason for this is my web host here in Australia was crap and the server kept going down (among other things.) They weren’t that terrible (hence I won’t mention them), but not worth the hassle.

Anyway, hopefully this year will undergo a bit of a transformation.

Ableton Live 7.3 under Wine

Amazingly, I’ve managed to get Ableton Live to work properly under Wine.. installation was a breeze, but getting it to decode MP3s properly was a head scratcher.

When I dragged an mp3 over into Ableton live, it would clip all over the place, even in the waveform which tipped me off that this wasn’t a hardware or emulation issue of some kind. Anyway, after faffing around with ffdshow and stuff, I finally found the answer: the summary says:

Install Apple iTunes and change msacm.winemp3=winemp3.acm to msacm.winemp3=QuickTime.qts to fix mp3 issue.

Now, I tried to install iTunes 8, but that was a lost cause, so I got iTunes 7 here:,apple-itunes-7.aspx

Installed that, then edited ~/.wine/drive_c/windows/system.ini and changed the above line. However this still didn’t work. What I needed to do was copy QuickTime.qts from it’s directory to system32:
cp ~/.wine/drive_c/Program\ Files/QuickTime/QTSystem/QuickTime.qts ~/.wine/drive_c/windows/system32/

Then it worked.. keep in mind that previously imported samples that are glitchy will still be glitchy as they need to be re-analysed, probably best to just delete and re-import them.

Oh, and make sure you’re using the latest version of Wine.

Western Digital Mybook World Edition (2nd edition)

The new(ish) mybook world edition
The new(ish) mybook world edition

A few weeks ago, I decided I needed some kind of NAS for my home as I’m often replacing my linux distro, installing Win7 or whatever and I wanted somewhere more permanent for my files.

I looked at the possibility of getting another PC to set up as a NAS, but this looked like it was going to be too costly, and I really needed something that could be plugged into my router which is stuck in the kitchen so I went for the WD Mybook World Edition as I knew it was running Linux and was hackable.

So far I’ve been fairly happy with it, it was *Very* easy to enable SSH and get to work fiddling with it. There’s a checkbox option on its web interface to allow SSH access. From there it’s fairly easy to install optware (similar to apt on Debian/Ubuntu) which allows you to easily install pretty much anything.

Performance is apparently a lot better than the old blue-ring version, however I must say the USB & ntfs performance is laughable – after a lot of tweaking I managed to only get 1.2MB(megabytes!)/sec out of it via USB where as I get about 5MB/sec over my wireless network! Oh well.

The only other issue I’ve had with it is the software it runs.. WD have done something very bizzare indeed and used what seems to be some kind of generic PHP software for embedded devices to run the thing. At first I thought this was just for the web front end, but no, there are all kinds of system() and shell() (or whatever it is) calls in a whole bunch of weird php files that do everything from mounting hard disks to starting other services etc.. very weird! I think significant performance gains could have been made if WD had opted for a more ‘normal’ system rather than having the overhead of a web server and php for everything.

Having said that, using optware allows you to do things as you would on a normal system without interfering with the main system which is a nice feature of optware.

Overall, I’d recommend this device – it’s not the best, but for the price I think it’s pretty reasonable.

WDTV – Western Digital TV media player

Picked up a WDTV last night for $200. As you may have guessed from some of my other posts, I’m into my A/V stuff, so this thing seemed like a bargain. Many reviews will rave about how great it is, and I must say it’s not too bad, but I have found there are bugs (even in the latest firmware):

Playback of any AC3 file seems to result in a barely noticable (but very annoying) 100ms or so audio lag. This doesn’t drift which is good, but it makes watching anything with an AC3 soundtrack very annoying. I’ve tried various things to try and fix this and make sure it’s not me or my files, but the unit. Strangely, this only seems to occur when playing back NTSC files, and not PAL (25fps) files.

Other than that, it’s pretty good. I’ll hang on to it until I can test it on someone else’s setup. Otherwise it might have to go back to the shop!


After more testing with different files, it seems to be off-sync with a bunch of files, not just ones with an AC3 soundtrack. I also tested the device at a friends place before finally taking it back. If Western Digital manages to sort this bug out, I may consider buying it again…probably not though, manufacturers need to start testing stuff rather than just putting things out there and then releasing good firmware a year later.

I also just found out the WDTV violates the GPL, so I don’t want it anyway!


Version 1.02 firmware is now released for the WDTV, and I’ve recently bought an AV reciever which has built in a/v delay stuff (and optical/hdmi inputs etc..) so perhaps it is time to re-purchase WDTV after all. Converting MKV/h264 to AVI/xvid for my xbox w/ac3 isn’t so great.


I did re-buy the WDTV, and I’ve been very happy with it, but only if using firmware version 1.02.03 (I think it’s that one) which has all the sync issues sorted. Recommended!