Can't get there from here

Category: 

I recently upgraded my home network server from Windows Server 2003 to Windows Server 2008. It has a nice interface, better security, and is noticably faster than its predecessor.

The server is in a big vertical rack in a corner of my office with no chair or desk space in front of it, so using it as a console or desktop station is uncomfortable. But it's a server, so none is needed, right?

CommaText is dead!

Category: 

For a long time, I've enjoyed a handy method in Delphi's TStringList class to read in and write out a CSV-formatted line of text. For example,

"Fred A.", "Thimsfrabble", "Lake Oswego", "OR"

is a typical CSV string with each field delimited by commas and each string delineated by double quotes. The CommaText function turns that string into a list of 4 strings:

  • Fred A.
  • Thimsfrabble
  • Lake Oswego
  • OR

Notice that both the field delimiting commas and the string quotes are removed from the parsed fields.

Now what happens if a string has an embedded quote?

"Fred "buddy" A.", "Thimsfrabble", "Lake Oswego", "OR"

TStringList.CommaText falls apart. And well it should because the double-quotes are being used for two purposes: both as a field delimiters and as string quotes. Unfortunately, CommaText doesn't have any way to handle this.

There's another drawback to using CommaText, but it is a minor one. When exporting text, it only adds the string quotes if it really needs to. For example if I have the following fields in a TStringList:

  • Fred A.
  • Thimsfrabble
  • Lake Oswego
  • OR

and use it to export a CSV line, only the first and third would actually contain the string quote marks:

"Fred A.", Thimsfrabble, "Lake Oswego", OR

This probably won't be a problem in most cases, but is inconsistent and if the application that needs to import this text expects string quotes, it will have problems on the fields without. Worse, if importing or viewing with a spreadsheet, unquoted numbers may be formatted or even interpreted incorrectly.

If you're still using Delphi 5, you're stuck with CommaText, using a third-party string library, or writing your own routines to handle these deficiencies.

Introducing...

However in Delphi 6, a new method appeared in the TStringList class: DelimitedText. This now allows the programmer to set the QuoteChar, a quote character that encompasses a string, and the Delimiter, a character to separate the fields. The default QuoteChar is a double-quote (") and the default Delimiter is a comma (,). Thus, by simply replacing all instances of CommaText with DelimitedText and doing nothing else, you'll have the same functionality as before (easy migration).

But with DelimitedText, you now have the capability to handle embedded quotes by using a different string QuoteChar. For example, with the pipe character (|) as QuoteChar, the following text will now be read in and parsed correctly:

|Fred "buddy" A.|, |Thimsfrabble|, |Lake Oswego|, |OR|

And if you need to, you can even replace the field Delimiter with something else:

|Fred "buddy" A.|~|Thimsfrabble|~|Lake Oswego|~|OR|

Old News?

So why am I mentioning this now, when Delphi 6 came out 8 years ago in 2000? Because having used Delphi since Delphi 1 and Turbo Pascal before that, I've developed a set of routines for doing a lot of different things over the years and don't always read all of the What's New list in each version--especially since I don't always purchase each version. DelimitedText is actually a new find for me and just in case someone else finds themselves in the same position, I thought I'd share my late discovery.

Oops!

Category: 

Last night, I decided I would read a couple of documents and migrate the old Windows NT 4.0 Server over to the new Dell computer with Windows Small Business Server 2003. It turns out the process is quite involved and after the third long document in tiny print, my eyes were getting bleary and time was swiftly flying by. There's a long checklist of things to make sure are in place before doing the big switch and there are many warnings that if the software is not updated, or if any of the settings are wrong or if you don't follow the directions exactly, the migration will fail!

Return to the Familiar

Category: 

Well, it's been a while since my last blog entry. But after the triumpful ending of my last post, it was hard to admit what ensued next. Yes, I finally got VMWare installed on Linux CentOS, but that was as far as I got with it. Try as I might, I could not get any version of Windows to install on the virtual machine I had created. It kept crashing with strange errors and in one case, even booted my whole computer (yes, the physical one, not just the virtual one).

Turbo Pascal

Category: 
Microsoft likes to take credit for "innovations" in software. But usually, they just steal or purchase other companies' ideas. For example, Borland pioneered Integrated Development Environments back when most people had 5-1/4" floppy disks and CPU Mhz was rated in "K" units. Turbo Pascal was a terrific way to quickly create applications, and allowed the programmer to edit, compile, and run their programs without creating a bunch of batch files and launching them just before going out for lunch.

VMWare--Finally!

Category: 

In the old days, playing around with Linux and installing programs and such was quite a chore. Typically, only students and geeks without any social life knew how to make their systems sing and dance. All the business professionals know that time is money. So Windows was the natural choice because to install a new program, you just insert the CD and click Next, Next, Next.

But over the last few years, things have been changing. Linux is getting easier because there's been a big push to hide a lot of the gory details and just present a nice interface with buttons and rounded corners and all. I suppose you could say it's looking more like Windows (or like Macintoshes!).

Reinstall

Category: 

I should've stayed with my first instincts, but I'm a fiddler. No, not the kind that makes music with a bow, but the kind that just isn't satisfied with how things are and must keep fiddling with stuff seeking that constantly elusive state of perfection.

Installation

Category: 

With the USB keyboard and mouse attached, I started the new Dell server's "Installation" CD before doing anything else. Somehow, it knows I haven't done this before and presents the typical user agreement form that must be accepted before continuing. Actually, that happened at the BIOS boot-up level, come to think of it. (Dell has gone beyond the average computer distributor!)

Then the CD sequence starts up and it goes through some questions asking about the time zone and how I'll be using the machine. Finally the part I've been a little apprehensive about arrives: the RAID configuration.

Ubiquitous USB

Category: 

I opened the box of the new server for the Beaverton SDA Church and was reminded that we didn't order a keyboard or mouse to go with it. At first this makes sense--why not just use the one we have on the old server? Well, the old server is, uh, old! Like over 8 years. That's an eternity in the computer industry. Some people alive today haven't even heard of the OS we still have on that machine, Windows NT 4.0.

But still, keyboards and mice don't wear out quickly on servers--they just sit there and collect dust over the years. You blow them off twice a year when you actually need to use them. So why get new ones?

Virtualization

Category: 

I'm on the computer committee of the Beaverton SDA Church and we need to replace the old server (which is used mostly for file storage among the 4 office staff). Some believe it to be at least 8 years old. We're all amazed it's still running. It has SCSI drives that are starting to make a lot of noise and we're getting quite nervous. So at a recent meeting, we decided to not push our luck (or faith) too much further--it's time to to get a new server.

(Non) Laziness

Category: 

I've heard it said in many conversations, blog entries, and articles that people automate tasks because they're lazy. I disagree. Often, this "laziness" is in the context of programmers writing scripts to do some mundane operation over and over. They're supposedly lazy because they don't want to do the task themselves.

PicViewer

PicViewer is a Windows 32-bit program that lets you scan through a bunch of graphic files (.JPG, .BMP, .ICO, etc.). It has a full screen mode in which the background is black and the cursor is hidden. In this mode, the spacebar or arrow keys step through each of the graphic files in the directory thus making it easy to give a slide show. A movie mode has been added to provide automated naviation. The pictures can be scaled to fit the window or shown in full-size mode with scrollbars if needed. Command-line parameters can start in a given directory, initiate movie mode, etc.

Connected

Category: 

I recently had a discussion with a fellow developer who sees a new feature in Delphi as opening a possible security hole in the application. The Welcome Page in Delphi 2005 and 2006 is an embedded web browser that views a local HTML file. This file has some JavaScript code that calls ActiveX objects to load Delphi projects and such, but mostly is a great collection of resources for the over-burdened programmer trying to remember where everything is.

Hospital Stay, Part II

I had no idea infections could cause a sunburn-like rash, but that's what happened on my stomach after going home from my appendectomy. I thought a heat-lamp had been too strong on me during surgery or something. Anyway, my bandages were leaking and not looking good, so Saturday morning, my wife drove me to the hospital again and I checked myself in for post-appendectomy check up. I figured I'd be waiting in the lobby for her to come pick me back up. Wrong. The appendix was so bad when it was removed, there was actually very good possibility of infection--why hadn't I been told that when I left just days before? I guess the surgeon always likes to think positive. Anyway, it looks like I'll be in just as long this time as last.

A new world

Category: 

Well, I'm trying out a new way of building web sites--using a CMS (content management system). It's pretty cool, but there will be some customization, of course, to get it to do everything I want it to. However, it adds lots of features I did not have time to put into my current site. Features such as aggregated RSS News feeds, and out-of-the-box support for blogging, which is something I've thought about doing, but just never had the time to implement.

Pages