Archive for the ‘Delphi’ Category.

AnyDAC: First impressions

Over the last few days, when I’ve had some free time available, I’ve been working with AnyDAC’s TADMemTable, which Dimitry Arafiev, the author, pitched to me as a replacement for and an improvement upon TClientDataset. I’d like to report on how smoothly everything went and how well it works, and spend some time on my experience with the dataset and the new features it brings to the table.

Unfortunately, I don’t always get what I’d like.  I can’t really talk about stuff like that because I haven’t reached that point yet, due to various bugs and other implementation hurdles.

Continue reading ‘AnyDAC: First impressions’ »

ClassType field should not be “magic”

I’ve been doing some work with code generation recently. It’s kind of messy. You need to build a tree in memory of objects that represent various types of syntax for the language you’re generating code for. You have to think inside-out from the way you normally write code, since you’re creating it in logical tree form, not in line form.

You have a base class that represents any code-generation object, and a bunch of classes that descend from it.  In order to manage things properly, you’re likely to have TList<TCodegenObject> and TStack<TCodegenObject> collections (or, worse still, non-generic TObjectList and TObjectStack containers) all over the place.  But TCodegenObject, like TObject, is an abstract base class that you only instantiate descendants of.
Continue reading ‘ClassType field should not be “magic”’ »

I think I just got sponsored

A couple days ago, I got an email from a member of the AnyDAC dev team.  They make a set of professional data-access components for Delphi, and they’re looking for feedback and publicity.  They were willing to give me a free license, worth about $400, if I’d take the time to evaluate their components, provide some feedback and suggestions, and write up a few reviews on here.  Apparently they’re particularly interested in getting some focus on their in-memory dataset, DatS, which isn’t documented particularly well and doesn’t get used much. Continue reading ‘I think I just got sponsored’ »

Going to DelphiLive! again.

This time last year, I was getting ready to take a plane down to California to attend the DelphiLive! conference, where I’d been invited to speak about developing games in Delphi.  This year, it’s been pushed back a few months, to be held in late August instead of mid-May, and I just now got the acceptance email from the organizers.  Looks like I’ll be presenting two sessions this year: “Using extended RTTI to make your life easier,” and “Game engine development in Delphi.”

Continue reading ‘Going to DelphiLive! again.’ »

Adding non-data fields to a client dataset

A lot of the UI design for the TURBU editor is based on data-aware controls bound to client datasets.  I was trying to build a new form this morning that required me to filter one of the datasets.  Problem is, that would break other things that expected it not to be filtered.  Well, that’s not such a big problem, because TClientDataset has an awesome method called CloneCursor that lets you set up a second client dataset that shares the first one’s data store, but with independent view settings.  So I used a cloned dataset, and immediately got an exception when I tried to run.  The control I was using couldn’t find the field.

Continue reading ‘Adding non-data fields to a client dataset’ »

Personal property and computing

I’ve always been a big fan of Apple’s.  My first computer was an Apple IIe, and finding a copy of BASIC on there was what first got me into programming.  A good percentage of the modern user interface concepts we take for granted today were invented by Apple back in the 1980s.  (Yes, I know, they got the basic concepts from Xeroc PARC, but a lot of their work was their work, not Xerox’s.)  They’ve always been one of the major drivers of innovation in the computer industry, and they’ve done a lot to hold the line against Microsoft’s campaign for complete domination of the computer industry.  They’re one of a very few companies that have actually had any real success in that area, and we all owe them a debt of gratitude for that, if nothing else.

Apple released the latest iPhone development license yesterday, and I suddenly find myself a lot less grateful.

Continue reading ‘Personal property and computing’ »

The joys of old code

I’ve been playing around with Delphi ever since high school.  I took a Pascal programming class and thought it was a really cool language.  Shame you couldn’t do visual programming with it, though.  (I was really into VB at the time.)  Then a buddy of mine introduced me to version 1 of “this new Visual Pascal program” and it was love at first byte.  But I didn’t get real serious about Delphi until about three years ago, when I decided to dust off an old pet project of mine from the D7 days, a tool I created for the purpose of making team collaboration easier for RPG Maker 2000 projects.

Continue reading ‘The joys of old code’ »

Delphi memory management made simple

Most of my posts on here have been about technical subjects, geared towards moderate-to-advanced Delphi coders.  This one’s to help out the beginners who are still learning the ropes.  I’d like it to be something that people can send new users to from StackOverflow or other sites if they’re having trouble figuring out how to clean up their memory properly.

I’ve never really understood why people find memory management difficult.  Maybe I just “get it” for some reason, but it’s never seemed all that arcane or complex to me.  In all my time working with Delphi, I’ve only run into one truly difficult memory management scenario, and it’s something that most people won’t ever have to deal with: sharing global interface references across package boundaries.  If you do that wrong, you’re likely to run into some very strange errors at program shutdown that are hard to debug.

But people keep asking questions about the basics of what to free and how to free it on StackOverflow, and from answering them and analyzing the questions and the answers, it seems to me that the entirety of memory management can be boiled down to one single principle.

Continue reading ‘Delphi memory management made simple’ »

Closing the documentation gap

This morning on StackOverflow, someone asked a question about invoking constructors through extended RTTI. It happened that I’d had to work out a way to do that a couple weeks ago, and it took me about 5 minutes to find the code, strip out a few specific details and type up a solution.  I got an accepted response, a few upvotes, and a very interesting comment from the author:

Continue reading ‘Closing the documentation gap’ »

TValue is very slow!

Delphi 2010’s help describes TValue, used by the RTTI unit to store values of arbitrary types, as “a lightweight version of the Variant type.” I saw that and it made me wonder, how lightweight is it? How fast is using TValue?

Thankfully, among D2010’s lesser-known new features is the Diagnostics unit, which gives us TStopwatch, a simple record for timing operations. That makes it very easy to write a simple speed test.
Continue reading ‘TValue is very slow!’ »