Things I hate about Mac OSX

From my experience, these things are really annoying when it comes to the Apple Mac OS

  • Non-standard keyboard shortcuts
    having used windows, apple macintosh (many years ago) and linux systems for most of my life and used certain standard keyboard shortcut combinations (ctrl+x, ctrl+c, return, delete or backspace), it is infuriating to see that mac at some point must have thought that it’s wise to deviate from everyone else and therefore make their computers more difficult to use.
  • there is no standard programme to open archives – not even zip
    the standard is to unzip an archive. other than in the command line, there doesn’t seem to be a way of looking what’s inside a zip file. you have to extract it, then delete it. pointless.
    not only that, but zip is really the only thing supported, so you end up installing a different archive manager for tar balls, rar, 7z or any other files.
  • the decision to not support ntfs or fat32 or other file systems out of the box, but just their own journaling file system and exfat
  • you cannot cut and paste into the file browser “finder”.
this list will grow over time

An easy way to enable VNC in Ubuntu 14.04

i’ve struggled today for a few hours to get XDMCP connections running on my new tv server. in the end i posted on a few forums and gave up. a bit frustrating!

but i still didn’t want to leave my seat without having any ability to log into my server without gui, so i opted for a simple vnc server solution:

  1. you need to have the gnome-session-flashback package installed through apt-get
  2. you need to log into at least one session that is a gnome (fallback) one.
  3. go to applications > system tools > preferences > desktop sharing
and that solves the problem. you must have at least one desktop session running, logged into Gnome-flashback and this user must have the connection allowed.

Removing unused Kernel files via command line

regular kernel updates are great, but having 3 years of kernel updates on one hard disk is not. chances are you are never going to use any of the 10 or 20 that you installed last year. if everything continues to work fine, why would you?

you can obviously use a package manager, such as synaptic, to uninstall unwanted programmes. quite often you might find a few other programmes that you didn’t know you had still and want to get rid of. but it’s generally easier to just use the command line to remove things quickly.
use this command:

dpkg -l ‘linux-*’ | sed ‘/^ii/!d;/'”$(uname -r | sed “s/(.*)-([^0-9]+)/1/”)”‘/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d’ | xargs sudo apt-get -y purge 

i use this command in ubuntu and i’m pretty sure it will work in derived versions, but results may vary!

Bulk encode MP3s with Lame and avconv

to be honest, when i am in the car or listening to music at home, i don’t really hear the difference between “lossy” mp3s and lossless formats such as flac. flac is just really huge compared to MP3 and i wouldn’t care if hard disk space was unlimited.
even if buying 2-3 nat storage devices, i think i’d still run our of space eventually.

so i do compress flac files after a while. but doing a whole album that is correctly labelled and tagged can be tricky. you don’t want to use some software that renames the files or changes the tagging…

linux is very supportive for doing things like that via the command line:

what you need is avconv and lame. avconv is a very fast video and audio converter. it can use libmp3lame to encode to mp3. because avconv can also convert and optimise video files, you can use it the same way to strip mp3s from video files, such as music videos or stuff you downloaded from youtube. but this post is about mp3s.
lame ain’t an mp3 encoder, but it simply is the best of them.

the command line argument to convert all flac files to mp3s in one folder is:

for file in *.flac; do n=$(basename “$file” .flac); avconv -i “$file” -codec:a libmp3lame -qscale:a 2 “$n”.mp3; done

if you want to convert from a different format, simply exchange the “.flag” to a “.wav”, “.mp4”, “.swf” or whatever the source file might be.

Exporting Sound with XDMCP

Some of you might be connecting to your remote linux box using XDMCP. While that would export the display,what would one do if one wanted to play a song on the remote box but hear it on the present system? well that can be easily done using the arts server on the remote machine setup the arts daemon by typing

artsd -n -u -p 5001

once the server is started change to the X display of the remote machine and type in

export ARTS_SERVER=ipofcurrentsystem:5001

and then

xmms &

Voila you will have a complete remote desktop including sound just like in windows xp.

No more netbooks in future

as I read in the Guardian this morning, Asus (et all) are stopping the production of netbooks. It seems the economy of the netbook has failed. Too many tablets are being sold and the that has probably crippled the already poor performing PC hardware market.

It’s not even that the UltraBooks have moved into the market, no, it was partly notebooks, partly tablets and – most shockingly – the licensing that had to be paid to Microsoft for Windows XP or 7. These additional £30 – £70 meant that the netbook margin almost disappeared.

What a shame, as I really enjoyed having an inexpensive, small, durable, USB and SD card slot wielding, low energy consuming netbook when on the go. Thank god I still have one!

What I found most disappointing about the whole story was that this, kinda, seals the fate of the One Laptop Per Child campaign from a few years back. The Raspberry PI won’t be the same, as you still need big screens, keyboards and mice on each desk. I also don’t think that a tablet, least of all the iPad, would be a good addition to the classroom. It’s too simple, it’s not good for typing for a long time and it’s bound to be more restrictive than a computer in so many ways. You can’t teach children IT and programming on a tablet (yet).
The netbook would have the solution and meant that you could have run a complete system – like I already am – with IDEs, services (such as MySQL, Tomcat, Apache…) and that would have really made a difference in the classroom.

It’s a shame that this was possibly never recognised. Maybe a large scale production of netbooks for schools would have been an excellent solution and netbooks would have become even more affordable. After all, they are able to build tablets for under £100…

The amount that could have been saved on books and materials over the years would be massive.

I wonder if anyone ever looked into this.

Script to disable & enable touchpads

I constantly touch the touchpad when I type. I also normally use an external mouse when I’m on my laptop. I seldom really need it, but I will sometimes want to switch it on (or off).

First you need to find the name of your touchpad in the xinput list:

$ xinput list

⎡ Virtual core pointer                     id=2 [master pointer  (3)]

⎜   ↳ Virtual core XTEST pointer               id=4 [slave  pointer  (2)]

⎜   ↳ Razer Razer Imperator                   id=10 [slave  pointer  (2)]

⎜   ↳ Razer Razer Imperator                   id=11 [slave  pointer  (2)]

⎜   ↳ PS/2 Mouse                               id=13 [slave  pointer  (2)]

⎜   ↳ AlpsPS/2 ALPS GlidePoint                 id=14 [slave  pointer  (2)]

⎣ Virtual core keyboard                   id=3 [master keyboard (2)]

    ↳ Virtual core XTEST keyboard             id=5 [slave  keyboard (3)]

    ↳ Sony Vaio Keys                           id=6 [slave  keyboard (3)]

    ↳ Video Bus                               id=7 [slave  keyboard (3)]

    ↳ Power Button                             id=8 [slave  keyboard (3)]

    ↳ USB 2.0 Camera                           id=9 [slave  keyboard (3)]

    ↳ AT Translated Set 2 keyboard             id=12 [slave  keyboard (3)]

So in my case the touchpad is most likely: PS/2 Mouse on id 13.

You can easily identify if the device is “on” (enabled):

$ xinput list-props “PS/2 Mouse” 

Device ‘PS/2 Mouse’:

Device Enabled (144): 1

Coordinate Transformation Matrix (146): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000

Device Accel Profile (267): 0

Device Accel Constant Deceleration (268): 1.000000

Device Accel Adaptive Deceleration (269): 1.000000

Device Accel Velocity Scaling (270): 10.000000

Evdev Axis Inversion (271): 0, 0

Evdev Axes Swap (273): 0

Axis Labels (274): “Rel X” (154), “Rel Y” (155)

Button Labels (275): “Button Left” (147), “Button Middle” (148), “Button Right” (149), “Button Wheel Up” (150), “Button Wheel Down” (151)

Evdev Middle Button Emulation (276): 0

Evdev Middle Button Timeout (277): 50

Evdev Wheel Emulation (278): 0

Evdev Wheel Emulation Axes (279): 0, 0, 4, 5

Evdev Wheel Emulation Inertia (280): 10

Evdev Wheel Emulation Timeout (281): 200

Evdev Wheel Emulation Button (282): 4

Evdev Drag Lock Buttons (283): 0

 Now create yourself a little file (eg: “touchpad”):

# toggle synaptic touchpad on/off

SYNSTATE=$(xinput list-props “PS/2 Mouse” | grep Enabled | grep -Eo ‘.$’)

if [ $SYNSTATE = 0 ]; then xinput set-int-prop “PS/2 Mouse” “Device Enabled” 8 1

else xinput set-int-prop “PS/2 Mouse” “Device Enabled” 8 0; fi

dengar@dengar-vaio:/usr/bin$ $ xinput list-props “PS/2 Mouse” 

This should sort you out. Don’t forget to  change the name of your actual device, remember mine is “PS/2 Mouse”

Next you need to make the file executable:

sudo chmod +x touchpad

Now, to have that file available from the command line, simply copy it to /usr/bin.

Create a home VPN and allow computers to connect with each other

Like most organisations, my workplace has quite strict security policies. For some reason, I wasn’t allowed and able to connect to the data centre through the Cisco VPN that had been set-up by our company. I had to had a static URL at home that needed to be allowed, but I wouldn’t consider changing my provider purely for that benefit.

There are plenty of options to ‘break’ that security restriction, like having a Terminal Server within your corporate network that you could log onto. The slow and clunkiness of that solution turned me off. In addition, I would have to get helpdesk to install all sorts of programmes and, since I’m a Linux man, I would have to compromise on every which way.

The easiest solution, I thought, was, since I can’t VPN onto the network from home, to VPN to my home network from work!

I already have a server for various tools that keeps on running most days and nights, so why not also use it as a VPN server.

Installing and configuring the necessary software is easy and takes just minutes.
First you will need to install the PPTP daemon:

$ sudo apt-get install pptpd

In Ubuntu, the configuration file for the pptp-daemon is: /etc/pptpd.conf and we will need to modify it so there is a separate IP defined for a) the server (which can be the one the server is getting from your router) and b) the client(s). If you have more than one client you will obviously have to make sure you have a range of IPs available for the clients.

In my case, since the networks should be quite separate at home and through VPN, I decided to use a different IP range. My router assigns IPs in the range 192.168.1.XXX, so I will use the range 192.168.0.XXX through my VPN server. You will need to update the last lines of your pptpd.conf like this:


This assigns the IP ~.1 to the VPN server (a separate interface) and allows the numbers ~.2 to ~.10 to be assigned to clients.

Next step: create VPN users and their passwords. This is stored in the /etc/ppp/chap-secrets file. Here is an example:

# Secrets for authentication using CHAP
# client server secret IP addresses

You could obviously restrict the IP addresses the client can connect, but a very long password should also be quite secure.
In theory that’s all you need to connect, but you might want to allow clients to use the server’s internet connection and allow it to connect to other IPs within your local network. For this we will need to use NAT and IP forwarding. You can enable this via adding this line to your /etc/rc.local (before exit):

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

and in /etc/sysctl.conf uncomment the line:


Now you can restart the daemon:

$ sudo /etc/init.d/pptpd restart

If your computer doesn’t use the public IP address, eg. you are behind a modem – router or a firewall, you will need to forward the port 1723 to your server. And to avoid trouble with dynamic IP addresses you get from your ISP, you should use a dynamic DNS service. This will update your current IP to the DNS lookup tables and you get an easy URL name to remember. I think I use

Finally, you are on the client, but you can’t see any other computers within the VPN or the local network of the server. This is because the routing is not set correctly on your client computer. You will want to “search” this VPN IP range through the VPN server, not your normal internet connection, so you can add a manual route like this:

route add -net netmask dev ppp0

Tadah! You can find other computers in the VPN!

For more advanced routing, eg: make your client’s local connections available to hosts local connections, I advise to take a look at this page full of knowledge. The beauty is that once the VPN connection is established, you can bridge pretty much all connections through using routing and iptables.

Feng Office – Team Collaboration & Project Management software

Feng Office is the successor of a software called OpenGoo and probably one of the best pieces of free, open source software that I have come accross. It’s really on par with MediaWiki and has become a real asset in the development of my site.

It combines a powerful project management and tracking system with a collaboration hub.

Using workspaces, you can conveniently manage multiple projects at the same time and handle resources accross the different projects. User rights prevent people from accessing locations that they are not meant to see.

Through a bit of customisation, you can set it up to not only track changes to all your online files, but also see who is working on which file at the moment. While someone is working on a file, and be this a PHP file or a letter to a supplier, it is marked as ‘checked out’. This prevents two people modifying the file at the same time, thus eliminating one parties work…

It also has features for Notes, email, contacts and a calendar. It’s a truly amazing piece of software and deserves the support fo the community…

MySQL problems: Starting MySQL. ERROR! Manager of pid-file quit without updating file.

I stumbled across this error when I tried to import an InnoDB backup into my existing MySQL server.
I have one application that collects data that I need to tie to another set of data that is recorded on a different server through a different application.
It’s been rather challenging, cause I had to work of an InnoDB backup and they aren’t easily imported to another MySQL server, especially if you want to keep the data on that other server.

Okay, so what I tried, and ultimately prevented me from restarting MySQL was:

  1. changing all tables on the MySQL server to MyISAM
  2. killing MySQL (yes, I couldn’t stop it)
  3. copying the files in the MySQL DataDir to a backup location
  4. Copying the InnoDB backup files that I want to import into my DataDir
  5. trying to restart MySQL
But this is were the trouble started. The files couldn’t be imported and I had to roll back and use my backup files. But:

# sudo /etc/init.d/mysql start
Starting MySQL. ERROR! Manager of pid-file quit without updating file.

So I deleted the pointer file in /var/lock/subsys/

# sudo rm -f /var/lock/subsys/mysql
# sudo /etc/init.d/mysql start
Starting MySQL. ERROR! Manager of pid-file quit without updating file.

This didn’t work…
After long fiddling, I found out that the files in my DataDir have changed it’s owner, since I copied them as root to the backup location and back. They were now owned by root. So after:

# sudo chown mysql:mysql *
# sudo chgrp mysql *

I could do:

# sudo /etc/init.d/mysql start
 Starting MySQL. SUCCESS!

Hope this helps you too!