Monday, June 15, 2009

Very Geeky This Time

Well, this was going to be stuff all about Linux, as you'll read, but this came first. For those not into databases, skip down!

I had to improve some procs yesterday and found someone doing all sorts of weird conversions to get dates from datetimes. Hence these from my snippets.

Get Date Only from DateTime
set @date=CONVERT(varchar(8), GETDATE(), 112)
Get Time Only from DateTime
select convert(char, getdate(), 108) --hh:mm:ss
select convert(char, getdate(), 114) --hh:mm:ss:mmm(24hr)
Looking for Columns in all the Wrong Places
Looking for where a field is kept all through the tables in your database isn't much fun. This will look for and list all the columns in all the tables in your database.
SELECT table_name =,
column_name =,
datatype =,
length = syscolumns.length
FROM sysobjects
JOIN syscolumns ON =
JOIN systypes ON syscolumns.xtype = systypes.xtype
WHERE sysobjects.xtype='U'
-- and like '%[known column name]%'
Order the full listing by, syscolumns.colid instead, and you'll group all the field names by table.
Hi ! Welcome to the next alternative personality in this blog! I'm the person(a) who chose DOS unstead of SOS, because of the new PC's ability to pack a FORTRAN compiler. "Whaaaat?" you splutter in amazement - "What are you raving about?" ... but it's true. I had to choose between a PC (expensive, looked like a lab instrument) and an Apple III (expensive, cool, sleek, white). The PC ran MS DOS 2.2 and the Apple ran SOS (Sara's OS !). The Apple ran lots of cool games, but I didn't play games. I needed a PC that I could use in work. A computer that I could write programs on. One, in short, that had a FORTRAN compiler. The Zenith PC that I eventually settled on offered a choice of three OSs, although I chose DOS. It arrived with about a foot of manuals (8" binders, well packed with information on all the extra utilities on the extra disks (5.25" floppies) over and above the basic MS DOS disks. The extras, in fact, very much resembled a lot of the utilities available in contemporary UNIX systems.

Since then I've gone through almost the whole evolution of Microsoft and IBM-compatibility. I bought the Zenith because I wanted a better monitor than IBM offered. I upgraded the 10MB disk by adding a 20 MB one within 6 months, and by the time the Zenith was a year old I'd replaced the CPU with a faster Zilog model - 8 MHz instead of 4.77 !

After a while I sold the Zenith and moved on to a 286 machine, also a Zenith, as it happens, and then to a 33 MHz 386 with no less than 16 MB of memory (all that would fit on the motherboard!). All this time I was able to use the machines - running versions of Windows after 1985 - to write code in FORTRAN and ObjectPAL programs. That's a pic of Windows 1.1 on the right. Windows wasn't an OS (well, neither was MS DOS, really !) but it was a program that managed the screen. At this point MS had lost a legal battle with Apple and couldn't have overlapping panes in Windows - tiling only ! Windows had colour, though, and the Lisa was only monochrome. The Mac arrived about a year before Windows, and was certainly an object of jealousy!
I pretty well skipped the Windows 9x route, moving from Windows 3 to Windows NT 4, a smart move, which led to a brief sojourn in Win2K and almost 10 years now with Windows XP and XP/64.

The point of this little gambol through ancient history has been to show you that I had a serious choice to make back in 1981 about which machine to buy. The Apple was (to use Top Gear terminology) lithe, swift, and sexy. The IBM Compatibles looked like metal boxes spray-painted with colour dyes designed for tinting cardboard cartons - beige or beige! In fact, that's what they were!

However, for me, I chose the one that I could work on.

Now I'm looking at the same potential choice. I've been running Windows XP and been ignorantly happy. I've looked at Vista and decided that unconstrained software growth is not the way to go. Three years later Microsoft publicly agreed with me. Windows 7 offers certain extra things for upgrading, but they're mostly for the "average user" or the games-kiddy. I'm not inteested in glitz for glitz' sake, but offer me a good price on a faster graphics card and I'm all ears. I'm the kind of guy who runs his PC logged in as admin, who has to buy special gadgets to cool his laptop, and runs a full-out database system (MS SQL Server 2005) and a development system (MS Visual Studio 2005) on his laptop. Pretty isn't really "me".

My choice, as I saw it, for the OS of my next PC, was between Windows XP or a flavour of Linux. Win XP because, having seen Vista, I never wanted to see it ever again! Windows 7 wasn't - and still isn't - an available possibility. The alternative was Linux ... but which one? Red Hat ? SUSE ? Solaris ? BSD ? Mandriva ? PCLinuxOS ? Mephis ? Zenwalk ? In the end I settled for experimenting with Ubuntu 8.10. Mainly because I found two or three (English) Linux magazines and they seriously praised Ubuntu. I also picked up a CD of version 3 of the suite ("OOo") off another magazine.

My first test was to install Linux on a small PC - a very basic HP 740n. When I say "basic" I mean a 1.5 GHz cpu but only 256 MB of RAM (yes! more than 256 times more than my first
Zenith ever had !). I popped the distribution CD into the CD ROM drive, booted the machine, and told it to take the whole disk and make it Linux. Which it duly did. So my son suddenly had a PC but with a new and different face.

It didn't take him long to get accustomed to this, thought, and he's even done some of his school homework on it. The stuff has to be handed in in MS formats - Word, Excel, and Powerpoint - but that's no problem at all with OOo. Not something I could ever really say about WordPerfect Office, or the Lotus office with AmiPro, nice as AmiPro was.

About a month or so ago I wanted to tweak something on that machine and managed to mung the GUI. Totally! Had I been a Luinux guru I could have fixed it. But I wasn't - and still am not. Now I could have re-installed it, and, had I been using Windows, I would have had to. However, Ubuntu had moved on in the meantime and I installed Ubuntu 9.04. Now this is a definite improvement on 8.10. It's noticeably faster and will surely get better still when I finally get around to upping the memory to max out the old HP. In the meantime, Nick has a very serviceable PC that he can even play space and racing car games on. And they don't slow down intolerably because of the lack of memory, believe it or not. Nick "got" pretty much everything about the new OS the first time I explained it, and he isn't any more "PC Savvy" than any other game-infatuated 12-year-old. Within days he was downloading and installing programs as if he'd been doing it for years.

That's what really convinced me that Ubuntu was very possibly the way forward. I can obtain development systems for many languages on any system these days, but, for a system with such a small user base (compared to that of Windows), Ubuntu help and support on-line is stellar. From meeting VB at the stage of VB.NET 2.0 I can tell you from hard experience that good on-line help is utterly invaluable.

So, my next machine may well be a little ASUS desktop, but, whatever it comes with, it's ending up with Ubuntu. No question about it.
After the SQL into, I have to break the news that I'm using up all my spare time learning a new language. No - not Spanish or Italian! It sounds a little Potteresque to those not used to computing, but the name of the language I'm learning now is called Python. It's rather a cool language and, in a few days time, I should be able to put down the crutches and start hobbling in it.

Out in the real world, the AG finished an awesome witches hat - all spiky and obviously great for making creepy silhouettes while riding your broom across a full moon. She's also made a woollen tricorn hat (which everyone insists on calling a Pirate Hat). Pictures of these to come. She also finished and sent a pair of Tiger Socks to my dad in England, meaning that three generations of Irwins can now wear AG-created Tiger Socks of their very own !

No comments: