Some of my blog entries are just to remind myself how to do things later--and on several occasions they've been useful in that regard. I hope they are also useful to others that may encounter similar struggles. This is another one of those articles which I will likely refer back to at some point.
I'm a long time Delphi user and have taken advantage of the Object Repository quite a bit. It's really handy to take a unit or project that might be useful somewhere else but in a slightly different form and add it to the repository. Later, when you need to use that bit of code, you can select it from the repository right from within Delphi and it will make a copy of that code in your new project.
I've been spending a lot of my spare time with RemObjects products (mostly Oxygene and Hydra) over the last several months and haven't kept up my blog on those subjects like I intended. But another distraction is taking an increasing interest as more of a fun hobby than a dire need that will make me money.
I recently watched most of a dotnetConf, a virtual conference on .NET hosted by Microsoft. All the sessions were recorded and there's a lot of good and relevant content.
I was programming Win32 apps in Delphi while listening and I felt myself yearning for the cool technologies they were discussing. Yeah, Delphi has grown up a bit, but it's no longer the leader, it's following and getting further and further behind the rest of the development community.
I've used Pascal-based compilers for a long time. Similar to many others like me, I started with Turbo Pascal 3 in the 80s, embraced object-oriented extensions in Borland Pascal, attempted to understand OWL but quickly moved to Delphi when it was released, and now churn out blazing database applications on the latest Windows operating systems using internet technologies, advanced reporting tools, and multiple third-party component sets. Sure, I've dabbled in other languages such as C/C++, Visual Basic, .NET with C#, and some scripting languages, but Delphi has been the bulk of my experience for the past 17 years or so.
My blog about HTML5 Builder has been elementary and positive so far. But I've had problems--I just haven't mentioned them yet. Well, it's time to do that before going further. I'm using the product on two different machines and am having two different experiences.
The first application I'll create will be similar to sample ones I had tried in RadPHP. They were simple PHP tutorials and they worked--somewhat. I had some issues, but don't remember whether it was getting all the right libraries in the right place or whether it worked from some locations or browsers or what. In any case, I'm hoping HTML5 Builder will make the process a little smoother.
It's been a year since my last blog entry and while I've been busy writing Windows applications with Delphi, I've kept an eye on web technologies. I've done some PHP in the past and had purchased RadPHP XE but didn't upgrade to the XE2 version because there were practically no new features and the documentation, which was pitiful, was not improved one bit--in fact it was still labeled XE!
While working on a project accessing a slow web service, I found myself needing to extend the timeout of the HTTPRIO component. The web service, when executed straight from a browser, would happily take as long as it needed to before successfully completing. But my Delphi application was timing out.
I have recently discovered Amazon's S3 and EC2 services and think they're pretty cool. Originally, I considered them my first foray into "cloud computing" but then realized I've been using Google's email service for quite a while. There's also the fact that I give software updates via my web site and I store backups off-site via FTP. Recently, I started saving some documents out to Microsoft's Live service, just to try it out.
In the last entry, I gave an overview of the large software update I delivered to a client, an update that should've been done incrementally over a period of several months. From database schema changes, to swapping out a reporting engine, to switching from ANSI to Unicode, I really bit off more than I could chew at once. But it's now working well and I'm once again sleeping at night!
This portion of the story deals with the database changes that were made, both the structure and the character set.
I recently gave a client a major update to their custom application. Actually, "major" doesn't even do it justice. It was more like "mega major" and I don't think I'll take the approach I did ever again. But I wanted to move their code to the latest compilers and to support the latest operating systems. I also needed to change some low-level database constructs. Why all this? Because I'm a best-practices sort of guy.
The amount of information available and the proliferation of video over the last few years is nothing short of astounding. Watch this video and ask yourself, are you ready for the future?
In the old DOS days, things were simple. You had 25 rows and 80 columns of text. Period. Well, if you knew the right tricks, you could double the rows or columns, but still it was pretty limited. This made programming fairly easy--you knew how much space you had to deal with. With a GUI, or Graphical User Interface, things can get stretched out, you can have larger fonts, and you can have themes on or off. So knowing how much space you have to display stuff isn't quite as cut and dried. But I'm going to look at just one aspect that can be surprising: themes.
The Internet is 40 years old today. Or thereabouts depending on what you define as the actual birth of the internet. Here's a neat video that explains the origins of the what we know today as the Internet:
Adding theme support to your application can give your program a whole new look (if you use standard Windows controls) without changing anything else. This works because the controls will actually use a different set of DLLs behind the scene. In Delphi 2007, this is accomplished with a simple checkbox in the project options. (Visit the Delphi Wikia page and search for "Adding Theme Support" for more information.) The DateTimePicker is one of these and I just discovered its new capabilities when themed on Vista or Windows 7.
Consider the following psuedocode fragment:
for each FieldValue in RecordList do begin
if ValidSearchValue(FieldValue) then
found := Search(FieldValue)
ShowMessage('Invalid search criteria: ' + FieldValue);
if found then
In Delphi, a warning will be generated near the bottom of this code where it says "if found ..." saying:
Variable 'found' might not have been initialized
To prevent that warning, you would initialize "found" just inside the "for each" loop with something like
found := False;
But then, Delphi emits the following hint:
Value assigned to 'found' never used
It seems that Delphi's Hints are smarter than its Warnings. It knows that with the "Continue" statement, the "found" value will either be overwritten or simply not used at all because the Continue statement takes control to the top of the next iteration.
Unfortuneately, the Warning is generated even though the "if found" section will never be encountered unless the found variable was already initialized.
The work around? Well, you could turn off hints, but I wouldn't advise it. I keep all hints on and strive to eliminate every one of them. It makes my code much cleaner and prevents headaches down the road.
Instead, simply moving the "found" initialization outside the "for" loop gets rid of the hint and suppresses the warning.