RSS .92| RSS 2.0| ATOM 0.3
  • About Me
  • Me@work
  • Kix
  • My CV - Oct/08
  • Hundreds of Short Quotes
  • Archives
  •  

    Gnome Cat Brush

    November 11th, 2008
    To further prove our cat is a geek, her brush has the Gnome Logo on it!

    The Gnome Logo

    I have also realised that Cypher is a good Halloween cat seeing as she’s black and witch-like:

    A photo of our cat with a hair brush with the Gnome Logo on it

    New release of Ubuntu - “Intrepid Ibex”

    November 2nd, 2008

    I upgraded to the new Ubuntu 8.10 release and found it included a few improvements. These are some of my favourite:

    A animation of an Ibex and the Ubuntu 8.10 default wallpaper
    • Nautilus now has tabs so you can middle-click folders to open them in a new tab.
    • The included version of F-Spot has had a bug fixed so it now correctly imports comment metadata from photos.
    • The eject software for my laptop DVD drive has been corrected and Nautilus now has new convenient eject icons.
    • The volume buttons on my laptop keyboard now work

    Things that I’m still disappointed with:

    • Cheese doesn’t find my laptop camera. In fact, /dev/video0 was completely missing (see bug 255678). This is a big step backwards from 8.04 where video Skype calls worked out of the box.
    • Playing DVDs didn’t work out of the box - If your going to have an application called “Movie Player” I think it should player DVDs without putting you through too much trouble. Even after I installed the plugins (gstreamer0.10-plugins-ugly) the sound in the DVDs didn’t work and the frames were jerky. Installing xine is the easiest way to watch a DVD.
    • The memory card reader in my laptop still doesn’t work.
    • On shutdown I get a error about CIFS that causes a lockup of about a minute. It’s caused because Ubuntu tries to unmount Samba shares after shutting down network services (see here for a fix).
    • In F-Spot, it would be nice if the Facebook export plugin automatically set the Facebook photo caption using the F-Spot photo comment. Who wants to write a caption for each photo twice?
    • Tracking down why my Samba share wasn’t showing in 8.10 where it worked fine in 8.04 was quite a headache. It turns out the Samba user credentials file format has suddenly started to disallow spaces. “username = tom” now needs to be “username=tom“.

    Fothofax v0.41 (Oct/08)

    October 25th, 2008

    Seeing as I have needed to organise my time more than usual lately (because I have more of it!) I made an update to my calendaring software called FothoFax and released version 0.41. It now supports events that span multiple days and has the ability to colour the background of a day. Anniversaries are handled in a standard way (and you can have as many as you like) and editing the data is easier because it is done full-screen instead of the old postage stamp sized textarea. There is a change log in the README file.


    screenshot of Fothofax 0.41
    Fothofax 0.41 screenshot

    It’s not a lot of extra effort to release the sourcecode, just in case someone else may want it. See the Fothofax project page for more info. I guess I should get round to making it a wordpress plugin one day…


    Stitching Photos Together (16/Oct/08)

    October 16th, 2008

    Hugin works like magic to stitch photos into a panoramic even without using a tripod. After doing the tutorial on the Hugin website, Kix used 3 photos to create this larger one:

    A Hugin produced panamaric of the Meteor Crater.

    A panoramic of the 65000 year old Winslow Meteor Crater

    The funny thing is that, if you look closely, there is a man in the photo that appears twice! This is because he moved during the time it took to take the pictures and so exists in a different place in two of them and was stitched into the final picture twice.


    Perfectly sized “Powered by Ubuntu” Sticker (18/Aug/08)

    August 18th, 2008
    If you have a Laptop with a small circular power button (e.g. a Sony VGN-AR51E) the stickers in issue 110 of Linux format magazine seem to be perfectly sized to frame it if you cut a hole in the middle of the Ubuntu logo.
    Of course, the other thing you have to do is peel off all the Microsoft stickers that any new computer comes with out of the shop.

    Ubuntu Cola (July 2008)

    July 8th, 2008
    Tom and Chloe drinking Ubuntu Cola in Stockholm In Stockholm we found a Cola drink with the same name as our favorite Operating System. It’s fair trade and tastes just as nice as the original Cocacola.

    Ubuntu roughly means “I am because we are”. From The Guardian: In fact, the word ubuntu is just part of the Zulu phrase “Umuntu ngumuntu ngabantu”, which literally means that a person is a person through other people. Ubuntu has its roots in humanist African philosophy, where the idea of community is one of the building blocks of society. Ubuntu is that nebulous concept of common humanity, oneness: humanity, you and me both.


    MyBook USB External Hard Drive - 20/Mar/2007 (Birthday present from Kix)

    March 20th, 2008
    This quality half-terrabyte Western Digital external hard drive is to replace our now broken NAS drive. Instead of using a NAS drive we have created a Samba share on our server which we find more convenient.

    This 2nd drive is for backing up our files using rsync to mirror our primary hard disk.

    We map the USB hard disk on our Ubuntu 8.04 machine by putting the following in /etc/fstab:

    /dev/sdb1   /home/fotherby/Bitbucket    ext3    user,rw 0       0
    

    We call our backup drive “Bitbucket” which is a name we learnt from the IC DOC labs. We do a nightly backup by putting the following script in /etc/cron.daily/ourBackup:

    #!/bin/sh
    
    rsync -a --delete /home/fotherby/OurStuff /home/fotherby/Bitbucket/CharmeleonMirror/
    rsync -a --delete /var/www/tomfotherby /home/fotherby/Bitbucket/CharmeleonMirror/
    
    • -a: Archive. This causes rsync to maintain things like file permissions and ownerships (same as -rlptgoD).
    • –delete: This tells rsync to delete files that are no longer on the server from the backup. The delete is done BEFORE any of the new data is transferred.

    Change the Opera start page on the Ameo (Jan/08)

    January 25th, 2008
    The T-Mobile Ameo One problem with the Ameo is that the webbrowser doesn’t open at your homepage, it opens with a useless T-Mobile page. To change this do the following:
    1. Install “PHM Registry Editor” (smartphone edition). This is a free program that allows you to edit the registry values. Get it from http://www.phm.lu/Products/PocketPC/RegEdit.
    2. Once installed, Run it and go to the root of the registry keys: Select Menu -> “Go to my Device”
    3. Then drill down to the value we want. Go: HKEY_LOCAL_MACHINE -> SOFTWARE -> HTC -> PIEplug (NOTE: You have to select with the touchscreen, then press Enter on the keyboard to drill down)
    4. Select “Values” and you should see 3 items (home, Launch, WebStub).
    5. Rename “home” to “homeBK” (to make a backup)
    6. Select Menu -> New Value -> String. Then enter the URL of your start page. I suggest “about:blank” which will mean the browser starts with a blank page (nice and fast). When you have entered, select “Done”.
    7. A value called “New Value #1″ will have been created. Rename it to “home”.
    8. That should be it. Exit PHM and open the browser to check it worked.

    Freedom Universal Keyboard - Dec/2007 (Christmas present from Grandpa)

    January 12th, 2008

    One of the reasons for getting my Ameo instead of a normal mobile phone was so I could write my journal whilst on the coach to work. But the keyboard that comes with it turned out to be inadequate. So I got a replacement:

    Freedom Universal Keyboard The HTC website for the Ameo has a link to a list of suggested accessories which includes the “Freedom Universal Bluetooth Keyboard for HTC (QWERTY)”

    To get the “Freedom Universal Keyboard” working with the Ameo, follow these steps:

    1. Download a file called “WM05SP.exe” from
      www.freedominput.com (The page is titled “Windows Mobile Smartphone 05″).

    2. Make sure your Ameo is attached to your Windows PC and that ActiveSync is running. When you double-click “WM05SP.exe” it will install a progrm in C:\Program Files\Freedom Universal Keyboard. The install.bat file in this program didn’t work for me so I manually moved “bthkeyb.ARM.CAB” (a file that was included in the install) onto the Ameo via ActiveSync and installed the CAB directly from the Ameo.
    3. After installation, a new icon will have appeared in “Programs” called “Bthkeyb”. The first time you click it, you will be given a “Device Code” and asked for a passcode.
    4. To get the passcode, go to www.freedominput/unlock.html and fill in the form including the “Device code” and a 7 digit number on a sticker from the back of the instruction book that came with the keyboard. The form asked whether I was sure before continuing - Press the “Confirm” button to get a passcode which you enter using the Ameo onscreen keyboard.
    5. The keyboard program shows a almost blank info screen except the bottom-right corner has a button labled “Main”. Select “Main”, then choose “General”.
    6. On the keyboard, move the switch to “HID mode” so the LED flashes green, then press and hold the “B” button. On the Ameo, click the “Bluetooth keyboard” checkbox.
    7. The connection is automatically made in a few seconds and a message “Keyboard was connected” pops up - it’s then safe to release the “B” button. Test the keyboard works in MS Word Mobile.

    Problems:

    • The connection isn’t permanent - You have to reconnect the keyboard every time you want to use it.
    • The backspace key doesn’t seem to work (delete does though). The home and end keys don’t seem to work either.
    • You can’t seem to hold down shift and then use the arrow keys to create a text selection area (vital for cut&paste).
    • The keyboard doesn’t work in every program. It works in Word and Text Messages though.

    Netgear Aerial extension (Dec/2007)

    December 15th, 2007

    We bought a Netgear aerial extension on Ebay because upstairs doesn’t get a reliable signal. But… It looks ridiculous:


    Photo of Netgear with default aerial Photo of Netgear with custom aerial
    Original Aerial Custom Aerial

    I measured the wireless signal strength on our two Squeezebox’s, one is in the room next to the router, the other is upstairs:


      Original Aerial Custom Aerial
    Downstairs signal strength: 81%-83% 76%-80%
    Upstairs signal strength: 44%-49% 56%-58%

    So it seems to have a minor decrease in signal close by but a better range. Worth the ridiculous form factor? Probably Not!


    Moved ISPs to bethere.co.uk (Dec/2007)

    December 12th, 2007
    The bethere broadband logo We Changed ISPs from “Freedom2surf” to “Be” because it is a faster and cheaper connection.

    The connection details that Be supply are minimal to say the least. This is because they expect you to use their pre-configured “BeBox” that they send you for free. We didn’t like the way the BeBox looked and we didn’t like it’s web interface and we didn’t want to have to re-configure our whole network and firewall - so we messed around with our existing Netgear DG834G until we got a working connection. These are the settings you need to enter:

    • Basic Settings
      • Does Your Internet Connection Require A Login? No (then leave “Account Name” and “Domain Name” empty)
      • Internet IP Address: tick Use Static IP Address, then enter the numbers supplied to you in the intro letter from Be. For me, they were as follows: IP Address: 78.86.193.198, IP Subnet Mask: 255.255.240.0, Gateway IP Address: 78.86.192.1
      • Domain Name Server (DNS) Address: tick Use These DNS Servers (then enter87.194.0.51 and 87.194.0.52)
      • NAT (Network Address Translation): leave Enable ticked.
      • Router MAC Address: leave Use Default Address ticked.
    • ADSL Settings
      • Multiplexing Method: Select LLC-BASED
      • VPI: 0
      • VCI: 101
      • DSL Mode: Select ADSL2+ (but this option was only available after I upgraded the netgear firmwhere to “V4.01.28″ - It worked before without this option)

    With these router ADSL settings, you won’t need to change anything on your machines (Ubuntu or Windows). What’s Be’s speed like? Disappointing considering it’s supposed to be 24MBits! (although it’s better than before).

    screenshot of our connection speed, 12MB down and 1MB up

    We started messing around with the Netgears firmwhere and the MTU and RWIN size but didn’t have any better results.


    Xbox software update - Stream video from Linux (Dec/2007)

    December 9th, 2007

    Microsoft released a software update that expands the number of video formats that the XBox will play. This is quite exciting for me because I usually have to watch anything I download on my unimpressive 15″ computer monitor but now I can stick it on a USB key and watch it on my TV from the comfort of my sofa (which actually isn’t comfortable at all!).

    Give Peas a Chance Even better than a USB key, we found out how to stream video from Ubuntu Gutsy. The protocol that the Xbox uses to communicate with Windows Media Center PC’s is UPnP. To run your own UPnp server on Ubuntu 7.10 you need to install “ushare” (open source streaming software developed for the “GeexBox” Linux distribution):
    1. sudo emacs /etc/apt/sources.list
      • add “deb http://www.geexbox.org/debian/ unstable main”
    2. sudo apt-get update;sudo apt-get install ushare
    3. ushare -n Arbitary_UPnp_Server_Name -c pathToTargetMediaDir -x -i eth0

    To get to the media in the XBox dashboard, you go to the “Media” tab, select “Videos”, then you should see “uShare” listed amongst the sources list. As a reference, the uShare version is currently 1.1 and the XBox dashboard version is 2.0.6683.0. Note: For some reason .avi files don’t show unless you rename them to .mov.

    I would say thank you to Microsoft for this update except this isn’t really a fix, it’s more of an uncrippling. Why did they cripple it so it can’t play xVid in the first place? They must have been hoping people would just use WMV format videos but they must have received enough feedback to tell them that this isn’t the case.


    Perl Pie

    October 1st, 2007
    Holy Pearl “How do I change “pelican” to “pecan” in all the files in a directory?”. “Dude, use Perl Pie”!

    I’m pretty familiar with Perl, having used it on and off whenever there’s a string manipulation related job to be done. I like Perl despite all it’s faults. I like writing Perl (not so keen on reading it though :-) ). I’ve been using Perl one-liners where I probably should be using Shell scripts but I used to forget what the right flags are until I heard the term “Perl Pie”.

    perl -p -i -e 's/before/after/g' your.files*

    -e is for “execute” - It allows you to define Perl code to be executed by the compiler

    -p is for “process” - It adds a loop around your -e code so that it is applied to each line of any specified files and the contents of $_ are printed out and errors are thrown if a file can’t be read. You can think of it like it adds this:

    while (<>) {
      # your -e code goes here
    } continue {
      print or die "Can't open blah: $!\n";
    }

    -i is for “In-place Editing” - Without it, no files will be changed. With it, Perl renames the input file and reads from this renamed version while writing to a new file with the original name. If -i is given a string argument, then that string is appended to the name of the original version of the file. for example, Sometimes it’s handy to use -i~ so Perl creates a backup file before making your changes. if -i has no arguments, the file names don’t change.


    Finding the Median in Linear time

    August 12th, 2007

    some eggs Here are three C++ programs to find the median of a set of numbers. The first is short and simple. The last is fiddly and fast.

    Simple but not linear (n*log n time):

    Sort using STL sort (presumably quicksort), then find the middle value:

    #include <iostream>
    #include <algorithm>
    
    int main() {
      int A[7] = {23, 1, 33, -20, 6, 6, 9};
      std::sort(A,A+7);
      std::cout << "The medium is: " << A[3] << std::endl;
    }

    Linear time (But too much memory used in recursion):

    The running time of the following algorithm is linear rather than logarithmic. The reasoning behind this is that each recursive call takes linear time (on average), and each recursive call reduces the size of the problem by a constant factor:

    #include <iostream>
    #include <vector>
    using namespace std;
    
    // Find Kth element using recursion
    int getKElem(vector<int> A,int K) {
      int a = *A.begin();  // Pick randomly a number a from A = {a1, ..., an}.
    
      // gather all numbers smaller, equal and bigger than a.
      vector<int> S, E, B;
      for(vector<int>::const_iterator ci = A.begin(); ci!=A.end(); ci++) {
        if (*ci < a)      S.push_back(*ci);
        else if (*ci > a) B.push_back(*ci);
        else              E.push_back(*ci);
      }
    
      if (S.size() >= K) return getKElem(S,K);
      else if (S.size()+E.size() >= K) return a;
      else return getKElem(B,K-S.size()-E.size());
    }
    
    int main() {
      int myints[7] = {23, 1, 33, -20, 6, 6, 9};
      vector<int> A (myints, myints + sizeof(myints) / sizeof(int) );
    
      cout << "Element " << A.size()/2 << " is: " << getKElem(A,A.size()/2) << endl;
    }

    Linear time with descend memory footprint:

    Here is the algorithm with the recursion unraveled:

    #include <iostream>
    #include <vector>
    using namespace std;
    
    // Find Kth element without recusion
    int findKMedian(vector<int> A,int K) {
      int l,m;
      l=0;
      m=A.size()-1;
      while (l<m) {
        int x=A[K];
        int i=l;
        int j=m;
        do {
          while (A[i]<x) i++;
          while (x<A[j]) j--;
          if (i<=j) {
            int t = A[i]; A[i]= A[j]; A[j] = t; // Swap A[i] & A[j]
            i++; j--;
          }
        } while (i<=j);
        if (j<K) l=i;
        if (K<i) m=j;
      }
      return A[K];
    }
    
    int main() {
      int myints[7] = {23, 1, 33, -20, 6, 6, 9};
      vector<int> A (myints, myints + sizeof(myints) / sizeof(int) );
    
      cout << "Element " << A.size()/2 << " is: " << findKMedian(A,A.size()/2) << endl;
    }

    Programming interviews Exposed (Aug 2007)

    August 9th, 2007

    Programming, 9/10 - Aug 2007

    This book should really be kept a secret because if everyone read it before a programming interview, all the good jobs would be taken. It’s an excellent refresher to put you back to fresh-out-of-uni programming knowledge level. It covers Programming Problems, Logic Puzzles and Knowledge based problems with a very good explanation after each question.

    For me, it would be good if the code examples were in C++ (over C).