Category Archives: Computers

How to fix your buttons – Ubuntu

For some reason, with each new major version, Ubuntu keeps changing the location of the minimize maximize and close buttons on the window decorations. Its really annoying because as soon as you get used to one way, they put it back the other way. Once and for all I wanted to fix this problem and have my buttons where they should be, where they have always been (for me this was on the right having come from windows)

gconftool-2 --set /apps/metacity/general/button_layout --type string ":minimize,maximize,close"

Now at least I can get used to them in the right place!

Desktop Wallpapers Waste Memory.

My colleague often says something along the lines of:

I don’t know why everyone has a desktop wallpaper its nothing but a waste of memory

I thought that this sounded somewhat like an urban myth and decided to see if there was any evidence to support or dispell this claim. Well it turns out that although the wallpaper is pushed to video memory for rendering it cant be kept there as if it were just general purpose RAM. So the wallpaper does have to be stored in conventional memory, but is it a waste?

Well assuming a resolution of 1280×1024 and a 32bpp color (4 bytes per pixel) we get:

1280 × 1024 × 4 = 5 MiB

So I am wasting 5 MiB of my 8 GiB of RAM. As a percentage:

5/8192 × 100 ≈ 0.0006%

But yes it is a bit of a waste, I should probably turn off my desktop wallpaper.

Android Development x64 Ubuntu 12.10 (Quantal Quetzal)

The android developer guide suggests you install ia32-libs when developing on a 64bit platform. However this installs some 242 packages. A much more sensible option is to only install the 32bit libraries that are actually needed and then you only have to install 57 new packages. Additionally Quantal Quetzal comes with an up to date version of eclipse (3.8) so you can install this via the package manager as well instead of downloading 3.7 as the guide suggests.

To install the packages simply run the following command:

sudo apt-get install eclipse libgl1-mesa-dev:i386 libsdl1.2debian:i386

The installation of eclipse will also provide a compatible Java runtime required for building android apps.

Ownership Permissions of /var in Debian Squeeze

Suppose you happen to accidentally do sudo chown -R www-data:www-data * whilst the current directory is /var. Now that’s a fairly daft thing to do! but we all make mistakes. There doesn’t seem to be an easy way to correct this other than restore a backup or look at another machine with a similar setup. Rather than having to restore a backup I looked at a machine with a similar setup, the machine has lighttpd, mysql, and sendmail installed on it so I built the following script based on the permissions with those packages installed on a fresh install of Debian Squeeze

#!/bin/bash

echo "Setting Directory ownership" &&
chown -R root:root /var &&
chown -R man:root /var/cache/man &&
chown -R www-data:www-data /var/cache/lighttpd &&
chown -R libuuid:libuuid /var/lib/libuuid &&
chown -R smmta:smmsp /var/lib/sendmail &&
chown -R mysql:mysql /var/lib/mysql &&
chown -R www-data:www-data /var/log/lighttpd &&
chown -R mysql:adm /var/log/mysql &&
chown -R www-data:www-data /var/run/lighttpd &&
chown -R mysql:root /var/run/mysqld &&
chown -R smmsp:smmsp /var/run/sendmail/msp &&
chown -R smmta:smmsp /var/run/sendmail/mta &&
chown -R smmta:smmsp /var/spool/mqueue &&
chown -R smmsp:smmsp /var/spool/mqueue-client &&
chown -R root:staff /var/local &&
chown -R root:mail /var/mail &&
chown -R root:smmta /var/run/sendmail &&
chown -R root:smmsp /var/run/sendmail/stampdir &&
chown -R root:crontab /var/spool/cron/crontabs &&
chown -R www-data:www-data /var/www &&
echo "Setting File ownership" &&
chown root:smmsp /var/lib/sendmail/dead.letter &&
chown root:adm 
 /var/log/auth.log 
 /var/log/boot 
 /var/log/daemon.log 
 /var/log/debug 
 /var/log/dmesg* 
 /var/log/fsck/checkfs 
 /var/log/fsck/checkroot 
 /var/log/kern.log 
 /var/log/lpr.log 
 /var/log/mail.err 
 /var/log/mail.info 
 /var/log/mail.log 
 /var/log/mail.warn 
 /var/log/messages 
 /var/log/news/news.crit 
 /var/log/news/news.err 
 /var/log/news/news.notice 
 /var/log/syslog 
 /var/log/user.log &&
chown root:utmp 
 /var/log/lastlog 
 /var/log/btmp 
 /var/log/wtmp 
 /var/run/utmp &&
chown root:smmsp 
 /var/run/sendmail/mta/smsocket 
 /var/run/sendmail/stampdir/reload &&
chown -f root:smmsp /var/run/sendmail/mta/sendmail.pid &&
chown mysql:adm 
 /var/log/mysql.err 
 /var/log/musql.log &&
chown -f mysql:adm /var/run/mysqld.pid &&
echo "Done."

In addition you will need to set the ownership permissions of /var/spool/cron/crontabs/<user> and /var/mail/<user> depending on the users on the system.

Revisited – make a DVD out of just about any video file.

I recently was asked to create a DVD from a .mov video file. I had already made a post about how to do this under windows using windows ports of various linux based applications. Coming back to it and this time running completely on linux, I have realised that it can be done much more simply.

The required software can be installed using

sudo apt-get install ffmpeg dvdauthor growisofs

First off the video file has to be transcoded into an dvd compatible mpeg2 file.

ffmpeg -i <video.mkv> -aspect 16:9 -target pal-dvd output.mpg

Then the file has to be authored into the correct VOB files using dvdauthor. To make sure that there are no errors in the process the following environment variable must be set.

export VIDEO_FORMAT=PAL

Rather than using an xml control file for simple DVD’s the following two dvdauthor commands will suffice.

dvdauthor -o DVD/ -t output.mpg &&
dvdauthor -o DVD/ -T

Finally the files are burned to DVD media using growisofs

growisofs -dvd-compat -Z /dev/dvd -dvd-video -V "<name>" ./DVD

Green Code

Green code is code that has been commented out. Its usually green because the popular development environments I use syntax highlight the comments in green. In my personal opinion having large chunks of commented out code is a violation of YAGNI. A much better approach than commenting out the code is just to remove it, if you are using  source control, which surely you must be? a record of it will be stored in version control. Doing this has two advantages, firstly the current source code has less clutter, and secondly the source code is kept historically in version control along side the code that it was meant to work with. Keeping the code commented out along side the current code is daft, unless you think that un-commenting out the code six months later it will still work, which in most cases it probably won’t.

Sidechaining in Reason

Here is how I do sidechain compression in Reason. In this example I am going to use a kick for the sidechain source, which can give the output of the compressor a bouncy catchy effect.

First of all you want to setup a default rack with a 14:1 Mixer, an MClass Compressor and a Redrum, make sure when you add the compressor its auto routed as an effect send to the mixer.

Now flip the rack and connect the Redrum’s Send 1 to the Left(mono) channel of the sidechain input on the compressor. Note that the sends from Redrum are mono outputs.

Program a basic 4/4 kick drum pattern into the Redrum device. You can add claps snares or anything else you like they will not be being sent to the compressor at this time until you turn the send knob for a particular Redrum channel.

Once the Redrum is setup how you like you can now send the kick drum to the sidechain by turning the send knob for the kick channel all the way to the right. Note that this doesn’t stop the kick from being sent to the mixer.

You can lower the compressors Threshold and raise its Ratio until you see the kick drum really pump the VU meter. Now that the compressor is pumping we need to give it something to compress. Add a synth to the rack and make sure its auto routed to the mixer. Turn up the aux send of the channel to which the synth was added.

When you play notes on the synth you will hear it go quieter when the kick drum is playing. This can be a useful way to make synth baselines fit better in the mix.

The advantage of using sends rather than using the single channel output of the Redrum are two fold. Firstly the kick drum is not muted and does not need further splitting using a Spider Audio Merger & Splitter. Secondly other elements of the beat can be sent to the sidechain in varying amounts. The advantage of using the compressor as a effect send is that many instruments can have the same compression added to them by altering the aux send of each channel.

Firefox

I have finally given up and installed firefox again. I was a little disapointed that the ‘Live bookmarks’ feature was not as good at displaying news feeds as Internet Explorer, however I quickly rectified this situation by Installing Sage