Gnome Cat Brush
November 11th, 2008|
To further prove our cat is a geek, her brush has the Gnome Logo on it!
I have also realised that Cypher is a good Halloween cat seeing as she’s black and witch-like: ![]() |
|
|
To further prove our cat is a geek, her brush has the Gnome Logo on it!
I have also realised that Cypher is a good Halloween cat seeing as she’s black and witch-like: ![]() |
|
I upgraded to the new Ubuntu 8.10 release and found it included a few improvements. These are some of my favourite:
|
|
Things that I’m still disappointed with:
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.

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…
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:
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.
|
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. |
|
|
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.
|
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/
|
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: |
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:
|
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:
Problems:
We bought a Netgear aerial extension on Ebay because upstairs doesn’t get a reliable signal. But… It looks ridiculous:
![]() |
![]() |
| 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!
|
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:
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).

We started messing around with the Netgears firmwhere and the MTU and RWIN size but didn’t have any better results.
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!).
|
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): |
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.
|
“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.
|
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. |
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;
}
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;
}
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, 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).