Programming

Thursday, November 30, 2006

Customizing user interfaces

In the same way that resource files are customised on language, they should also be customised on user. This is almost like theming, except that it really applies to windows text. For example you would have advanced users who require a minimum of text, and novices where all the buttons are quite verbose.

Labels:

Friday, November 17, 2006

Today I came up with something really clever - or so I thought. I was trying to determine whether one class was derived from another, but not having much luck. The following solution struck me at 2am last night:

template
class is_derived_from
{
typedef char success;
struct failure { success x[2]; };
static failure f(void*);
static success f(Base*);
public:
static const bool value = sizeof(f((Derived*)0)) == sizeof(success);
};



Unfortunately I googled around a bit and there is one place where this has been invented before, almost verbatim. Darn.

Labels:

Tuesday, November 14, 2006

Home server

I have recently bought a Linksys NSLU2 for under £60. This is a networked storage device where you can plug up to two USB hard disks in, and an ethernet cable. The box can server files via SMB and FTP.

The fun starts when you install Linux on it. Some very keen hackers have written instructions on how to "extend" the system by installing your own software on it. You can upload different firmware which gives you proper telnet access, and there is a package system where people have pre-built a load of software for you to install on it. The box runs at 266MHz, and the software runs from your hard disk.

I have a 250GB disk attached, and am running Apache 2, Subversion, OpenSSH and a very nice iTunes server. This means that my entire music collection is available to all of my networked devices, e.g. iTunes and my Roku wireless media player. I also have X11 and gcc, and a load of other GNU software. Coupled with dyndns.org, I can have a webserver with a fixed address.

This is a very cheap way to set up a home server, and is much cheaper and more satisfying than leaving your computer permanently on.