Archive for May, 2007

SQL Outer Join vs. Where Not In vs. Not Exists

May 31, 2007

I had to work out a SQL problem for a contractor. In a nutshell we need to join two tables based on data not being in one of the tables. Here is the background:

Table ORD has order records and table EXPORTED has export records. ORD_ID is the primary key in the ORD table and is a field in the EXPORTED table. When you export an ORD record you create an entry in the EXPORTED table with the ORD_ID and the date in an EXPORTED_DATE field.

We want to be able to select all the ORD records that need to be exported. I am weak on SQL so I wrote it this way first, using a Where Not In:

Select *
From ORD
Where ORD_ID Not In
(Select ORD_ID From EXPORTED)

This works, but I do not know if this is the most efficient way to get this information. I looked up this way of joining tables using a Left Outer Join:

Select *
From ORD
Left Outer Join EXPORTED On
EXPORTED.ORD_ID = ORD.ORD_ID
Where EXPORTED.EXPORTED_DATE Is Null

Finally, I found this way to do the same thing using a Not Exists:

Select *
From ORD
Where Not Exists
(Select 1 from EXPORTED
Where EXPORTED.ORD_ID = ORD.ORD_ID)

In this last example we are selecting 1, a static value. Basically the sub query will result in 1 or nothing if the record exists.

Does anyone know which of these methods is the most efficient? The ORD_ID field is the primary key in the ORD table. The ORD_ID field is both the primary key in the EXPORTED table and a foreign key back to the ORD table.

I have been programming (fat) client/server applications for over 12 years and now I am going to have to learn SQL the right way to move ahead in this thin client world.

Backup A Server

May 30, 2007

I have been backing up my file/print/web server. I am getting ready to rebuild it and want to backup everything. I have backed up all my files (pictures, music, downloads, drivers, patches, installs, etc) except the “backup” folder. This is a folder that contains folders for every computer in the house. I built scripts to run on each computer to backup all their data files to their respective folder on the server.

This folder is the last folder that I need to backup to DVD. The way I do it is to run a script to copy everything to my laptop and then burn the files to DVDs from my laptop. I am waiting until the last moment to backup the backups. Since that is the folder that will change the most until I get the chance to buy the memory I need to build the new server.

Also, there is a lot of old garbage in the backup folder of the server. After I back it up to DVD I am not going to restore it unless necessary. This will let everyone create a fresh, clean backup of their computers. If they loose a file before they get a change to run a full backup of their current data I will restore that from DVD.

FrontPage 2003 Installed on Ubuntu

May 29, 2007

I may be a Linux newbie, but I thought this was pretty cool. Check out this screen capture. I am running Ubuntu 6.06 inside of Virtual PC 2007 and I am installing FrontPage 2003 through the use of Wine.

FrontPage on Ubuntu inside Virtual PC

How cool is this… for a newbie!

Linux Newbie

May 23, 2007

I just realized that I have not posted in a little while. Well, I have been very busy. I have been trying to backup my server in preparation for rebuilding it. I am also looking into Linux. I am going to try it out on my laptop in the near future, but I want to get a little practice with it first. To that end I have been playing with getting various Linux versions (distros to the Linux crowd) running in virtual environments.

I have been using Microsoft Virtual PC and VWware Player. Virtual PC is fairly easy to setup a new virtual machine. VMware Player only “plays” virtual machines. Technically it does not create them.  However, it is easy to get starter files that will boot a virtual machine with VMware Player. I have been using easyvmx. You plug in a couple of values and it will give you a zip file with the files for an empty shell virtual machine. You then boot the empty VM with your bootable OS CD-ROM and Bob’s your Uncle. Install the OS and have at it.

I will report back later the various flavors of Linux I have tried, and how they run under each virtualization program.

New Pool Liner

May 12, 2007

This weekend (Friday & Saturday) I installed a new pool liner. I have a 16′ X 32′ oval, above ground pool. The wall height is 52″ which allows very close to 4 full feet of water. The original liner was extremely dirty. I did not keep up with the chemicals during the winter and then we had a really bad Mountain Cedar season followed by a worse Oak season. The combination left tree “dust” stuck to the floor of the pool. I had planned to drain the pool and scrub the liner. However, after draining I found that scrubbing was not going to be practical. I drained and scrubbed it last year in the spring time, but it was not nearly as bad as this year.

So… we bought a new liner. My brother-in-law helped my install the liner on Friday, and he wired up a new light we installed. Our original liner was plain blue. This time we went with a full print liner. It has a boulder print at the top, and a pebble like print going down the walls and across the floor. I am so sore from all the work, but it was worth it. If I could afford to I just assume pay someone to install it. That was not an option this time around.

The full print liner has some pluses and minuses. The big plus is the appearance. I does look nicer than a plain blue liner. I have not had a chance to see it in its full glory. Full glory it when the sun is shining bright and it glimmers off the bottom. The plain blue liner looks very nice this way. However, in anything but perfect conditions I think the print liner will be superior. The darker color should also help promote heating the pool. After all, darker colors absorb more heat and light.

The downside of the printed liner will be cleaning it. It is a lot harder to see when it is dirty. So we will have to be more diligent about vacuuming the pool even if it doesn’t seem dirty.

My brother-in-law also lent me his pressure washer, and I cleaned the ladder and all the trim of the pool. So the pool looks like new.

I don’t have any pictures, but may post one in the June issue of my web site.

Cheap Gas (Relatively Speaking)

May 5, 2007

I bought a tankful of Premium Unleaded this morning for $2.79. Why is that cheap… relatively or not?

I had to stop off to get gas this morning on my way to work. Yes… I am working on a Saturday. We are doing a big database migration from an Oracle 8i database to an Oracle 10g database. But that is for another time.

I was running very low on gas, so I stopped off at a Valero gas station just before getting on the highway. I almost never go to this gas station as it is normally out of my way. I don’t usually drive on the access road there and usually get gas at a conveniently located Exxon station by where I work.

Anyway, I pulled into the Valero station and all the Unleaded and Unleaded Plus buttons were covered. I assume they were out. All you could get was Premium. Now it just so happens that my little Mini Cooper S requires premium fuel for its supercharged engine.

The fun part was that they had the premium fuel priced at the normal price for regular unleaded. As I was wondering if this would be my first $3+ fill up this year I was pleasantly surprised to get a tankful of premium for only $2.79. Only, yea right! Since when was gas for $2.79 something to brag about. Like the title of this post says… relatively cheap.

Windows XP on Linux

May 2, 2007

I have been contemplating getting a Mac. I never seriously considered this, but recent event have caused me to think this way. I won’t get into the reasons here, but I would like to try something that could be better.

What about Linux. I have played around with Linux a few times. I always stop playing around as soon as I have any trouble with drivers (almost always). I have done the dual boot thing and I have also used Virtual PC to run Linux in a virtual machine.

I have a few Windows application that I need. Expression Web, Money and Office come to mind. I could probably work with an Office alternative on my home laptop. Money connects to my credit union for updating seamlessly, so I don’t think I would try to live without it. Of course Expression Web is what I use to maintain my own web site.

Maybe I have been going about this the wrong way. I hate dual booting. I also have not been thrilled with the performance running Linux in a virtual machine. Maybe I should try installing Linux as my main operating system and running Windows XP in a virtual machine when I need it. Hmm. I have heard that VMWare can do this.

I am still waiting for nVidia to release Vista drivers for my GeForce Go 7900 Series graphics on my Toshiba laptop. When those driver become available I think I am going to try loading Linux and setting up Windows XP in a virtual machine. If I like it I will keep it that way. If I don’t like it I will wipe the machine and load Windows Vista.

The new network support specialist at work is a Windows and Linux nut. He loves Linux and puts Windows down all the time, but unlike a lot of other biased Linux nut cases he admits to liking Windows and having it on some of his home machines. He will be a good resource for me getting Linux setup.

I’ll keep you posted… but you can get an idea when this will happen when you see nVidia get those drivers out.

Craplet or Crapware… It’s Not Right

May 2, 2007

Last month Walt Mossberg complained about the amount of craplets that came on a new PC. A few days after his column hit the streets Apple came out with a commercial sticking it to the “PC” for having all this trial software. It is kind of interesting that they used the term trial software in the Apple ad as most Macs come with trial versions of Office and/or iWorks. Oops!
Next CNet publishes an article about crapware. CNet’s article stuck a cord with me.

Samir Bhavnani, an analyst at market researcher Current Analysis, said one option computer makers should consider is letting buyers order a software-free system but charge a premium to make up for the lost revenue. Bhavnani figures an extra $25 should be enough to cover the company’s shortfall.

Wait one minute. I am supposed to pay more so the manufacturer does not put ad-ware/spyware/trials/craplets on my computer. That is wrong. They should split the money they get with me. If they get $20 to put this crap on my computer they should give me $10. Or just not do it. I should not have to pay extra to buy a computer that they don’t put crap on.

Fortunately I build my own machines, and load only the software I want on it. However, I can’t build laptops, so I either spend a few hours cleaning off the crap, or go crazy and reformat the hard drive and load it myself from scratch.

It makes me want a Mac.


Follow

Get every new post delivered to your Inbox.

Join 27 other followers