Blog
General articles and random thoughts that don’t fit into the knowledgebase.
Latest Blog Posts
What stops me finally parting company with Windows
Will I ever be free of Microsoft? Well, unlike many people I’m not really evangelistic about this. I’ll use whatever gets the job done properly. My main reason for ditching Microsoft products is due to their overly restrictive and greedy licensing without really giving real innovation in return. So why can’t I escape? Well one of the main reasons is that I am constantly faced with Microsoft products through my job as an IT consultant.
Update one table using data from another
If you want to update tbl1 with information from tbl2:
Welcome
I’m afraid that his is likely to be a pretty random collection. I will add stuff here that I come accross on the web that I think may be useful at some point. I will also add things that I discover as I’m writing stuff.
Cannot directly use the IF function on a MySQL query that uses GROUP BY
Cannot directly use the IF function on a query that uses GROUP BY. This tip provides an alternative that is cross-db. It is extracted from: http://surfnet.dl.sourceforge.net/sourceforge/souptonuts/README_mysql.txt SQL Characteristic Functions: Do it without if, case, or GROUP_CONCAT. Yes, there is use for this … if statements sometimes cause problems when used in combination. The simple secret, and it’s also why they work in almost all databases, is the following functions: sign (x) returns -1,0, +1 for values x < 0, x = 0, x > 0 respectively abs( sign( x) ) returns 0 if x = 0 else, 1 if x > 0 or x < 0 1-abs( sign( x) ) complement of the above, since this returns 1 only if x = 0 Quick example: sign(-1) = -1, abs( sign(-1) ) = 1, 1-abs(sign(-1) ) = 0 Data for full example:
Defaulting optional parameters
If you have a function that takes an optional parameter – e.g. function blah($xx,$yy='Default',$zz){ …. You can use the function and ensure that the optional parm always takes the correct default (even if the definition changes) by passing a NULL to it. e.g. … $mydate=blah($something,NULL,$more); …
Fast storage using tmpfs
Here is a link to an article on using tmpfs (and the commonly pre-defined /dev/shm mount for tmpfs) as a high-speed, in-memory filing system. This is very handy for small-ish amounts of data in files that get a lot of access. Just remember that you will loose it if the host crashes! You can use this for SqlLite database files too. [Create turbocharged storage using tmpfs][1] [1]: http://kevin.vanzonneveld.net/techblog/article/create_turbocharged_storage_using_tmpfs/
Update on FreeOTFE
Thought I would add a quick update on using FreeOTFE under Windows and PocketPC. I tried it under Windows on a different PC and it does indeed work OK though it is nowhere near as polished as TrueCrypt. I’ve also tried again a few times on a PocketPC with limited success and I think I know what is happening. Firstly, you must install FreeOTFE for PPC into system memory and not on a storage card – not terribly surprising really.
Living with Firefox
I use Firefox all the time. Both with Windows and Linux but I don’t like the fact that it assumes that you are using Gnome under Linux and doesn’t really play nicely with KDE. Thankfully there are a few things you can do. To get printing to use KPrinter (the default KDE print dialog). Choose the printer called Postscript/default and then change the command that is run to kprinter –stdin. Now, whenever you print to that printer, you will get the KDE standard print dialog where you can choose the printer (most importantly, output to PDF) and change the settings.
One command system update (Without password)
Here’s a very handy tip about configuring SUSE to run a full update from the command line without requiring a sudo (and hence a password). [One command system update (Without password)][1] [1]: http://fnmueller.wordpress.com/2008/03/02/one-command-system-update-without-password/
Speed of network copy
I needed to copy some big video files from my NSLU2 NAS box to my desktop a couple of days ago and noticed that, using Konqueror, the FTP protocol was significantly faster than using SMB. Using ftp://192.168.n.n/DISK 2/video/… gave me around 5.5MB/s Using smb://192.168.n.n/DISK 2/video/… gave me around 3.5MB/s Of course, the NSLU2 is constrained mainly by only having a 10M network interface but this is a very significant difference in speed.
Mounting disks by ID – Redux
OK, maybe I was a bit harsh with the verdict on mounting by UUID in my last post. Having played further with trying to get the right disk to boot by default, I realised that there is something rather odd about my ASUS motherboard. I seems to want to boot SATA drives in REVERSE order so that SATA disk 3 is booting before SATA disk 1 no matter what order I tell it boot in (via the BIOS).
Distributions January 2008
I was getting very frustrated with SUSE recently. Mainly because of the slow and flaky package management but also due to my scanning difficulties. So I decided to do a quick test of a couple more Linux distributions. Here are a few quick notes. MEPIS 7.0 Release 3 There is a password on the Live CD login with no information on what it is (guessed demo) Install to disk has to run as root – it silently logged when run as demo with no indication as to why In the disk partitioner, there were no partition names or labels to give a guide to existing partitions – both SUSE and Mandriva give better information No wizard to help install my Wacom graphics tablet (this works great under SUSE) THERE IS NO SETTINGS WIZARD FOR NVIDIA!
Mounting disks by ID
One think I discovered in my January foray into other distributions is that mounting disks by ID which is now the default in many distributions (such as SUSE and Ubuntu) is not such a good idea when you might be ripping some out. In fact, Linux does not seem to take kindly to having hard disks ripped out at all! I had to manually edit the device.map, menu.lst and fstab files of my existing distributions to get them working again after removing my two PATA drives that have driven me mad with buggy GRUB configurations.
Things to dislike about SUSE 10.3
OK, so we’ve have the good things about openSUSE 10.3, now for the bad. The repository and package installation management in openSUSE 10.3 sucks – bigtime! I’m often getting failures to read the control files from the Internet (though normal browsing works fine), it is slow – really very very very slow, and you do seem to get weird dependency issues more often than other distros, there are too many fairly standard packages missing from the default repositories so you have to configure third party ones (at least this is often easier with the 1-click install facility now available),
More on the GRUB bug (with mixed PATA and SATA drives)
I’ve mentioned this one a couple of times so I’ll give a bit more detail because it is a nightmare to solve if you don’t know what is going on. If you have both a parallel ATA (PATA, this is the way most hard drives were connected on desktops and laptops until around 18 months ago) and a serial ATA (SATA) hard disk controller on your PC (as many do) and hard drives connected to both controllers, you are going to get hit by the GRUB PATA/SATA bug.