Tag Archives: update

MySQL: Conditional SQL Statement to handle Setting Null Values if Not Set CodeUnit 07 NOV 2011

Identifying column values in your database that are currently set to NULL and then updating them to a default value is made easy through the use of the common UPDATE and not so common IFNULL function in MySQL.

If say for example you have a legacy `color` column that used to allow NULL entries in your database, but which you now want to force to have a color, with a starting default of say ‘blue’, you can quite easily achieve this through a simple UPDATE statement which will indiscriminately set all the records having a NULL value for the `color` column such that they now reflect ‘blue’ as their value.

This query would look like:

UPDATE `pencil-box` SET `color` = IFNULL(`color`,'blue')

The IFNULL function accepts two parameters. If the first parameter is not null, then it returns the first parameter. If it is null, then the function returns the second parameter. So in our example above, any `color` value that already exists is simply replaced with itself again. However, if one comes up as being NULL, it gets replaced with ‘blue’.

Clever.

Related Link: http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_ifnull

How to Upgrade Your Ubuntu Server Version over the Network and via the Terminal CodeUnit 20 JUL 2010

The nice thing about Canonical’s Ubuntu is that they have a nice and consistent major release cycle, making the management of your Ubuntu servers a pretty planned affair.

The question today is of course how to actually initiate a network upgrade on your terminal-only Ubuntu server once the time to upgrade finally rolls on by?

Well that actually depend on which version you are upgrading from and which version you are upgrading to!

So let’s do the most expected one for now: Upgrading your 9.10 Ubuntu Server (Karmic Koala) to 10.04 LTS (Lucid Lynx).

First, make sure you apply all updates to your current version (run sudo apt-get update to update your package sources and then sudo apt-get upgrade to update all the actual packages).

Next, install the update-manager-core if it isn’t already installed: sudo apt-get install update-manager-core.

Then edit /etc/update-manager/release-upgrades and set Prompt=normal.

Finally, launch the upgrade tool via sudo do-release-upgrade and then follow the on-screen instructions as the system pulls down all the necessary files over the network and attempts to upgrade your system.

Great.

If however you are upgrading from something slightly older like 8.04 LTS (Jaunty Jackalope) to 10.04 LTS (Lucid Lynx), you’ll have to do the following:

First, make sure you apply all updates to your current version (run sudo apt-get update to update your package sources and then sudo apt-get upgrade to update all the actual packages).

Next, install the update-manager-core if it isn’t already installed: sudo apt-get install update-manager-core.

Then edit /etc/update-manager/release-upgrades and set Prompt=lts.

Finally, launch the upgrade tool via sudo do-release-upgrade –devel-release and then follow the on-screen instructions as the system pulls down all the necessary files over the network and attempts to upgrade your system.

And that’s really all there is to it. Note that upgrading might take a while over a slow connection as there are a lot of files that need to be pulled down.

Also, if you want to see which version of Ubuntu Server you are currently running, this might be useful: cat /etc/lsb-release

Nifty, you should now be good to go! :)

Related Link: http://www.ubuntu.com/desktop/get-ubuntu/upgrade

Afrihost Internet Connectivity: A “Still not Quite Up” Update CodeUnit 28 APR 2010

If you are in the position of having switched to Afrihost thanks to their particularly cheap ADSL prices or any of the other smaller ISPs that offer some quite attractive rates, you’ll no doubt be quite frustrated over these last couple of days I’m sure.

International connectivity has pretty much been non-existent or moving at a completely unusable crawl since Monday, all thanks to a disruption in the all important Seacom undersea fiber cable that connects Africa to the rest of the world and acts as the cheap carrier line that allows all these small ISPs to offer the deals that they do.

After noticing a fault in the line, Seacom originally pencilled in the maintenance period to commence on Saturday 24th April, but unfortunately rough seas and stormy conditions prevented the repair ship from launching the submarine operation in order to bring up the affected faulty segment and run repairs on it. As it is, it would now seem that the problem is much larger than initially thought and there are currently reports from Seacom that the cable may very well be down all the way through until Friday the 30th of April!

Some of the other ISPs like MWEB purchased redundancy on the SAT3 cable that Telkom uses and that certainly helped their customers a bit, but as of the 28th that access has since been withdrawn by Telkom, meaning that if you opted to go with any other ISP outside of Telkom and the few others that make use of the SAT3 or 3G system, you’re pretty much screwed at the moment.

A good example of single point of failure then I’m afraid.

That said, Afrihost is at least offering some sort of limited, extremely shaped and throttled Internet access through a special proxy server it has since set up (http://www.afrihost.com/proxy.pac), but as you can well imagine, the amount of traffic trying to get through there is already clogging that alternative route up.

So in other words, unless your needs are entirely local, you’re pretty much dead in the water at this point in time.

Else, if you have a setup like me back home where I make use of both an Afrihost and Telkom ADSL account, you can sit back, give a wry smile and continue to work, thanks to the surprisingly reliable (for a change) Telkom alternative!

Now who would ever have thought the use of the words “Telkom” and “alternative” in a single, positive sentence? ;)

Don’t Touch Me on My Site – A Retouch My Life 28 APR 2010

Just a note, I may be a little delayed in getting new material up on this site over the next while. You see, my creative muse simply can no longer stand my inactivity towards all the websites I’m responsible for and as such I’ve started a campaign which will see me go through the sites one by one, improve upon their functionality, fix any outstanding bugs, populate with content where necessary and most important of all – give them a proper visual makeover.

This public holiday past has seen the albeit recently updated CodeUnit of Craig undergo a new facelift – with nice clean results – as well as a full content, functionality and stylesheet plus images update for the slightly neglected Funakoshi Karate International SA website. (Obviously a good old Ctrl+F5 button press will be needed for a forced cache clear refresh!)

Needless to say, if you’ve been over to The House of C lately then you’ll know that it still desperately needs a major facelift (my project for this weekend) and last but not least, you can expect the Rugged Rock of Craig to undergo a nice transformation as well – most likely in a pretty similar vein to that of the CodeUnit site.

So what does all of this mean to you, my loyal reader (and me, as a post-it note reminder)? Well all I’m saying is I might miss a day or two of updates along the way. I don’t plan on it, but hey, you never know – I’ve got priorities and things like babies to make you after all! :P

The new look CodeUnit of Craig site...

Funakoshi Karate International SA's site is filling out pretty nicely...

The New CodeUnit Skin CodeUnit 21 MAR 2010

Alright boys and girls, it is time to hit that good old Ctrl+F5 to force a cache refresh of http://www.craiglotter.co.za once more. As well aware as I am that there are far better and more constructive ways in which to spend an whole Saturday afternoon at home in front of the PC, it turns out that the lure of churning out something special is just that much stronger than what I thought and so I slaved away yesterday with scant regard for time in order to present you with what you now see in front of you:

The totally new look CodeUnit of Craig website.

I’ve added and fiddled with some functionality, made a few tweaks, increased site advertising and most of all, ran an extensive overhaul in terms of graphics and layout on the site, the end result being something that turns out to be quite… pleasing to my eye for a change.

I like it, and I hope you do to.

(Still, ever the perfectionist there are still some small niggles I want to iron out, but those I’ll get to in the background… you know, when I don’t feel like doing household chores or something like that! :P)

WordPress 2.9 Released into the Wild CodeUnit 24 DEC 2009

Seeing as I’m now running both CodeUnit and Rugged Rock off the WordPress platform, I guess it is about time that I take notice every time WordPress breathes, and thus it comes as no surprise that this post is in honour of WordPress’ latest and greatest release, WordPress 2.9 Carmen, nicknamed such in honour of jazz vocalist Carmen McRae – who I don’t actually know a thing about.

WordPress 2.9 on the other hand I do know something about.

The latest major release of this ever popular open source blogging platform sees the introduction of some useful new features, in particular the addition of an integrated image editing tool as well as a global undo feature that amongst other things, allows the user to restore previously deleted posts.

Since the release of version 2.8 back in June this year, the developer team has set about closing over 500 reports in the project’s bug tracking system, making this latest version one of the most stable releases to hit the ground running (that is, if you ignore the scheduled posts failing that I chronicled the fix for yesterday). The new version also adds support for bulk plugin updating and better media handling, for example, if you place a video URL in a post WordPress now automatically generates the markup that is needed to display the video in an embedded player (works for YouTube, Flickr and Hulu to name a few). The WYSIWYG editor has been upgraded, the “Press This” bookmarklet has been improved and apparently the XML-RPC API has been ‘suped up a bit as well.

Obviously, the release notes are a good place to get a better handle on all the new features and system changes in place and if you still haven’t converted to the almost de facto standard in blogging platforms, you can download WordPress from the official site.

Have fun! :)

Abandon Adobe AutoUpdate Software & Sites 04 JUN 2008

With limited, fairly expensive bandwidth at home, you can imagine that I am less than enthralled with products that choose to autoupdate themselves quietly in the background, without any notification of their dastardly deed. One of the prime offenders in this category is none other than good old Adobe which frequently runs an autoupdate in a background, sucking up your precious bandwidth before notifying you that it has downloaded the following gazillion little updates.

Well no more. A lot of people want to know how to turn off this annoying little Adobe hellspawn, and it is my pleasure to tell you just how to go about it.

Firstly, open up any Adobe product that you might have (Adobe Reader is probably the easiest) and locate the ‘Check for Updates’ option somewhere on the menu structure (usually under the Help submenu). Click on it and allow the program to look for new updates unhindered.

Adobe Updater1

Adobe Updater2

Once the process has finished looking for updates (don’t worry, it hasn’t downloaded anything if you are particularly worried about your bandwidth), a dialog box is shown to you detailing the number of available updates for your Adobe products. On this dialog box, locate and click on the preferences link to bring up a new dialog showing the various settings for Adobe’s autoupdate software.

Adobe Updater3

Right at the top you will see a checkbox for ‘Automatically check for updates’.

Adobe Updater4

Simply uncheck this checkbox and Bob’s your uncle – no more unwanted updating by that pesky Adobe software that you have installed! :)