This is a brand new presentation of the "Fun Side of Delphi" series of the last two years. As in the past, I'll try to combine entertaining examples with technical content. The special focus this year in on Business and Enterprise applications. The subtitle of the presentation can be either Dis-Integrating the Enterprise or Getting Ready for Year 2000.
As in the past, I'll build some nonsense components and programs, generally totally useless but technically challenging. Some of the tools won't be simply useless, as they'll have a catastrophic effect. If the presentation itself will stress more the fun, the paper will stress some of the technical content, although the paper alone cannot really deliver the full content and spirit of the presentation.
Warning: Please do not read beyond this point if you plan attending the presentation at the conference, because you'll miss the surprise.
Skip Key DBEdit is a data-aware control which provides a funny behavior when typing, but skipping or duplicating letters in different ways. The example shows how to customize a DBEdit, a very common and important task. This is the declaration of the component class:
type TFunMode = (fmRandomSkip, fmSkipDup, fmRandomOver, fmAutoType); TFunDBEdit = class(TDBEdit) private FFunMode: TFunMode; fTimer: TTimer; FFrequencyPercent: Integer; procedure SetFunMode(const Value: TFunMode); procedure SetFrequencyPercent(const Value: Integer); protected procedure KeyPress (var Key: Char); override; procedure TimerProc (Sender: TObject); public constructor Create (AOwner: TComponent); override; destructor Destroy (); override; procedure Loaded; override; published property FunMode: TFunMode read FFunMode write SetFunMode default fmRandomSkip; property FrequencyPercent: Integer read FFrequencyPercent write SetFrequencyPercent default 20; end;
type TClipListBox = class(TListBox) private fTimer: TTimer; protected procedure TimerProc (Sender: TObject); public constructor Create (AOwner: TComponent); override; destructor Destroy (); override; published end;
An extension of the previous component (but based on the TEdit class), the AutoCopyEdit automates both the copy and the paste operations, with some weird effects.
A special progress bar which can go over 100 percent of value, getting outside of the form hosting it! OK, that's partially going to be fake, but shows an interesting visual effect, as you can see in the following figure (from the NoTitle program):
A very special DataSource component which embeds all you need to create a database application. That is you place the component on a form and the application is done, in some sort of way. Shows how component can automate connections, for example how a data-source can hook up to the first available dataset component, or create one if none is available.
Usually the server holds the data and the client the program with the user interface. In this example I'll show how to do the opposite: store the program within the database server and the data on the client side. This can become useful if you move everything on the server side or on the client side, so I won't investigate it too much.
Technically the program uses streaming: it saves a streamed form in a database, so that it can be rebuilt with a small engine. An extended version places the entire program in the database as a large BLOB. Don't even try to figure out if this makes sense... it isn't supposed to.
Three tier applications are becoming popular, but some database gurus say that the future is in n-tier applications. In a large system every computer of a network can become a separate tier, and a single computer can actually host many... even if I don't know how this can be used in the real world.
The example is not based on data and MIDAS, as this would require installing the support on every computer, but uses an extended chat program with limited database capabilities.
Can you name at least 20 Web related acronyms? Here is my try: HTML, HTTP, FTP, CGI, ISAPI, GIF, JPEG, MTS, COM+, CORBA, ASP, JSP, AX, SSL, DHTML, CSS, XML, XSL, IIS, URL... But now the question becomes, can you write a meaningful sentence using half of them? And can you write a single program using half of them?
I've tried but I have to say this is difficult...
What can go wrong in year 2000 will go wrong, so let's get ready for this situation: I've written an application which shows all the possible year 2000 problems and more. It makes every date the wrong century, computes random year differences, breaks on division by zero... You might want to use this example to demonstrate that your own program is not doing that bad!
To test this and your programs I've written also a nice system century changer utility.
As an alternative, let's our applications behave in partially wrong ways... simply telling the user that the data might be wrong. Again, an example is worth a thousand words. I've basically fixed the previous example
Let's pretend we are there, the date and time everyone is worrying about. What's going to happen next?
Year 2000 (or possibly year 1999) will show the birth of Windows 2000, but will our computer be able to create 2000 windows? I've already shown a similar program in the past, but now we are in for some more undocumented surprise...
This is another roundup of funny components and applications, with the idea of discussing serious technical problems in a very light way. The examples will definitely be stupid, but most of them are very complex. You'll be able to download the entire series of applications and components from my web site.
When he's not writing fun programs, Marco Cantù pretends to be a freelance writer and consultant. He is the author of the Mastering Delphi series, the Delphi Developer's Handbook, and a frequent contributor to several programming magazines. He lives in Italy, and is the founder of Wintech Italia, a training and consulting company focused on Windows and Delphi. You can reach him at www.marcocantu.com.