01 October 2015

DelphiDabbler.com - Live Or Die?

If you're one of the regular visitors to DelphiDabbler.com then you may have noticed that it's not been updated much over the last year or so. Same goes for this blog, my applications, the code library and the code snippets database.

What it boils down to is this: the time has come to decide whether to continue with the site or not.
 And I need your help to decide.

There are a couple of reasons why I've got to this point. The first is that my interest in music, playing the guitar and recording has resurfaced and it's taking up some of my spare time. The second, and most important, reason is that I'm getting disillusioned with Delphi (the compiler, not the language). I just can't, or won't, keep up with the cost of upgrades.

The problem is that I'm just a hobbyist developer and the cost of staying up to date is getting prohibitive. I feel I'm getting more reward by spending my cash on musical instruments and studio kit than on a constant stream of compiler updates.

I'm not having a pop at Embarcadero here. Amateurs are probably not part of their target group of customers. And if that's true, I can offer no argument as to why we should be! I'm simply commenting that the cost of entry is too rich for me right now.

You'd be staggered to learn quite how many decent quality instruments and bits of studio kit I've paid for just by missing out on a couple of Delphi Pro updates and not upgrading to the Android support module!

Here's where my Delphi XE4 to XE6 update cash went: a stunning Tanglewood koa wood tenor ukulele and an excellent Yamaha bass. There are many more examples like this!

A consequence of all this is that if I'm cutting back on my Delphi development, I need to look at whether the DelphiDabbler website is worth continuing with. After all it's a lot of effort and costs me money to keep going. Donations have been drying up lately, meaning that more of the financial burden falls on me. (Whether the lack of donations is a sign of the website's diminishing relevance or the fact I've not been updating it much is debatable).

There's still time to decide what to do because the domain has been secured up to August 2017 and the web space is paid up to June 2017, but I think that now is an opportune time to start the debate.

I don't want to just pull the plug and waste all the effort that's gone into the site since it started back in 2002. So at the present time, here's what I think I might do to salvage as much as possible:

  • Move all my apps and components etc. wholly onto Github (Git projects) and SourceForge (Subversion projects).
  • Convert the articles and tips into PDF format and put them on GoogleDrive or similar.
  • Close down the SWAG database web app and simply make the database available as a zip file.
  • Close down the Code Snippets Database web app and make the snippets available as a Git project or as Gists on Github.
  • Close down the site Contact page to reduce the amount of email I need to deal with.
  • Cease development of most of my apps, components etc., leaving some in maintenance mode only, with a just a chosen remaining active. I'm likely to keep only my CodeSnip application (in a modified form) and the System Information Unit and Window State Components under active development.
  • When the web space account expires redirect DelphiDabbler.com to some pages on GitHub.
  • When the domain comes up for renewal either let it expire or move to a new cheaper .co.uk domain. Alternatively invite others to take it over.

All the above is up for debate and if there's sufficient interest I may keep a more tightly focussed and easier to maintain version of the site up and running.

The only things that are pretty much fixed at the moment are that I won't give up the music and I won't upgrade Delphi beyond XE4.

In the meantime I may explore the Free Pascal and Lazarus options. However once XE4 becomes so outdated as to be useless, that's likely to be where I bail out.

I'm still considering making the site more mobile friendly for what is potentially its last 18 months of existence.

I need your views

So, what do you think? Any observations will be welcome. I've come to a crossroads and I need some guidance about which way to go.

Please comment. Should I let DelphiDabbler.com die? Should I keep some parts? What's the most useful to you, if anything?

I'd also like to hear from anyone who might like to take over the site and/or domain over?

Delphi XE and ShellExecute glitch

Just encountered a strange bug in one of my programs when running it from the Delphi XE IDE on Windows 10.

Triggering a TBrowseURL action with a valid URL property value causes the program to hang and the default browser (Chrome) is not displayed. The BeforeBrowse event is triggered, but AfterBrowse is not until the program is closed. Sometimes the program hangs and I have to close it with Ctrl+F2.

Running the same code outside the IDE works correctly, but running the program either with or without the debugger in the IDE makes no difference.

I've tracked this down to where TBrowseURL calls ShellExecute from the ShellAPI unit. If I call ShellExecute directly I get the same problem.

I never noticed this problem before when running Windows 7 on my old laptop - it just seems to have started on my new Windows 10 laptop. Still, it's possible the bug was still there on the old machine and I just never noticed it, but I doubt it.

Anyone else had this problem? Any ideas what may be causing it?

04 September 2015

DelphiDabbler Code Library project on GoogleCode Closed

Following the announcement earlier this year that GoogleCode was about to close I moved the Delphidabbler Code Library Subversion source code repository to SourceForge, where the downloads had been hosted for some time.

A little later I started a GitHub project to host the library documentation and copied all the docs formerly hosted in the GoogleCode wiki to there. The documentation is currently split between GitHub and my wiki sub-domain, but ultimately I intend for it all to be on GitHub.

Now that GoogleCode has become read-only I've decided to close that project down, and that's happening as I write this. The old GoogleCode URL will simply redirect to SourceForge.

So, in summary, you'll now find the library in the following places:

22 September 2014

New website branding - 2nd attempt

About one month ago I posted an initial design for the new responsive website page header. Here's how the mobile version looked:

At the time I said I would like change this to place the "branding" and the "Menu" button on the same line but I hadn't worked out how to do it. I've pretty much sorted it now, so here's the revised version:

I'm happier with this version since it takes up a lot less vetical space. I'd also decided against using the "hamburger" icon on its own to represent the menu - in the first version I simply used "MENU" instead as being understandable by everyone. In the later version I've appended the hamburger icon to the text.

The appearance of the header on larger tablets and laptops / desktops has been altered very little. There's just a change to the "home" and "search" icons (I'm now using Font Awesome instead of GlyphIcons) and the serif font used for the strapline has changed. Here's the first version:

And here's the revised version (spot the difference!):

As before comments are more than welcome.

21 September 2014

New Website - App pages mock up

After having mocked up the branding (i.e. page header) for the new website I've now turned my attention to content.

After looking at some designs I like around the web I've come up with the following look and feel for the site's software pages. The mock-up is for one of my applications, but I'm considering using the same style for Delphi library projects.

Here's the 1st draft of the design as it displays on larger tablets and desktops:

And here's how it appears on mobiles or small tablets:

Finally, to anable comparison, here's the current site showing similar content for the same application:

What do you think? Any comments are welcome.

24 August 2014

New website branding - 1st attempt

I think I've got the website header sorted sufficiently well to give it a public airing.

The idea is to keep the original colour sheme and to show the site name in roughly the same style as used on the current site. But now the font's changed and it's rendering text and CSS instead of using an image. It's coded using Bootstrap.

Here's the new header as it will display on larger tablets and desktops:

There's a change in the site navigation: the old site places it down the left hand side of the page while the new site uses a horizontal bar under the branding. I'm using the Bootstrap navbar but I've tried to change the appearance by moving the branding out of the navbar. I've also changed the navbar colour scheme to match the branding. The biggest change is the inclusion of a search box in the navbar.

Here is how the header appears on phones and small tablets:

The navigation moves into the drop down menu on the mobile version and the "strap-line" disappears. I've replaced the Bootstrap "hamburger" menu icon (which I'm not to keen on) with the more obvious "MENU" text. I would prefer to move the menu button up onto the same row as the logo, but haven't worked out how to do that yet!

Just for reference, here's the current website header:

Well, that's the hard part done. All that's left is to design, code and populate the content pages!

Any comments on the new styling will be appreciated.

Long overdue re-design of DelphiDabbler.com

The current version of DelphiDabbler.com has been around for years. It looked quite modern when it was released, but not now. Far from it.

So, the time I'm been putting off for so long has arrived: a re-design is in the works. Not a simple refresh, but a root and branch re-design and re-build.

I've got four design goals:

  1. The new site must be responsive - the current one looks aweful on phones and small tablets.
  2. A want a fresh, clean and uncluttered look and feel - it's currently dated and cluttered.
  3. The content needs to be leaner - there's just too much stuff on the current site so a lot of it's got to go. Also, this is the only way to make the job manageable.
  4. The underlying code needs an overhaul too - the site's JavaScript is pre-historic and the PHP just grew over 12 years from procedural via PHP 4 style classes with a smattering of much nicer PHP 5 style OOP.

Big job for one man then. Especially one who has not kept up to date with modern web programming developments.

I've spent a lot of time over the past weeks reading about responsive design and have researched several techniques. I even tried out one UI framework on the new CodeSnip micro-site with no great success - that's getting changed too!

What I've decided so far is that I'm going to use Bootstrap 3 as the front end framework, because I like the mobile-first responsive design it enforces.

I had some reservations about Bootstrap at first because there are many, many Bootstrap based sites that all look pretty similar. So, I've decided to customise it. And I tried writing a CSS file that modified some of Bootstrap's appearance and ended up with a site that looked like all the others. Because re-skinning Bootstrap via plain CSS is hard.

Plan B was called for. I went "shopping" for Bootstrap templates and couldn't find one I liked at the right price, the right price being £0.00!.

So to plan C, which means customising Bootstrap using Less. Problem is, I've never used Less, so have had to go on a detour to grasp the principles. I was considering hacking the Bootstrap Less files directly until I hit a Bootstrap 3 Less Workflow Tutorial. This was the eureka moment. Now I'm incorporating the Bootstrap Less files in my project and customising them via a set of stand-alone Less files. One day in and it seems to be working.

Now I'm having to learn both Bootstrap and Less as I go along!

I'm pretty sure I'm not going down the web application framework route. I struggle to see how frameworks like AngularJS will help me - DelphiDabbler.com isn't really a web app. So, I think I'll stick with PHP and generate pages on the server.

As to the existing JavaScript: it's horrible and it's all going in the bin. I'm going to be using jQuery in the new site where necessary. That's partly because I've used it before and partly because Bootstrap already requires it.

I've always coded straight to PHP, JS and CSS before. This meant I could write directly to the to a version of the site running in a local Apache server and so see the results of changes immediately. No build process at all. Now I'm using Less that old process won't do because there's a compile step needed before I have usable code. I now need a proper build process. So Node and Gulp have just hit the hard drive. Something else to learn - oh joy!.

I going to maintain the source code in a Git repo. Haven't decided yet whether to keep the code private or whether open source it.

So there we have it. Ambitious and challenging for an old Delphi hacker who has pretty much ignored the world of web development for the last 10 years. Not sure if I'll make it.

I'll keep updating this blog with any progress and will aim to publish early versions somewhere deep down in DelphiDabbler.com in due course.

20 July 2014

New Major Release of CompFileDate (File Date Comparison Utility)

Pulling together the loose ends to release the BDiff / BPatch Utilities yesterday must have triggered a tidying loose ends gene. Because now I've been motivated to put the finishing touches to some code I wrote a few months ago that significantly extends the capabilities of my CompFileDate File Date Comparison Utility. As a result CompFileDate v2.0.0 was released today.

This Windows command line app now lets you specify what operation is used in the comparison of file dates: ">" (i.e. file 1 is later than file 2), "<" (i.e. file 1 is earlier than file 2), "<=", ">=", "=" or "<>". You can also compare files' last modification dates or creation dates. Finally, when comparing the dates of shortcuts there is the option to compare the dates of the shortcuts or the dates of the shortcuts' target files.

Download the executable code from either SourceForge or GitHub.

The source is maintained in the delphidabbler/compfiledate Git repo on GitHub. Contributions welcome.

19 July 2014

New release of the BDiff / BPatch utilities

After a mere five year wait I've finally pulled together the hacking that's been going on sporadically over the intervening period and released an update to the BDiff / BPatch utilities.

It's only a minor update that fixes a couple of minor bugs, but underneath there's been a major refactoring from largely procedural to mainly OOP code: it's all been modernised and Pascal-ified, making it harder to see the code's C origins.

What's more the project has been moved from Subversion to Git, hosted on GitHub as delphidabbler/bdiff, making it easier for anyone who may want to fork it or contribute. Pull requests are welcome.

For me it represents a return to coding after about 3 months lay off. I just got bored and disillusioned with it all! Possibly more on this later.

08 March 2014

Been casting value types to stuff into TStrings.Objects[]?

On numerous occasions I've had the need to store simple, record and interface types in variable or fields of type TObject and had to use some horrible casting to do it. For example, you may resorted to doing stuff like this:

  SL: TStringList;
  Value: Integer;
  SL := TStringList.Create;
  Value := 42;
  SL.AddObject('some text', TObject(5));

Not nice!

Things get worse when the size of the data type is greater than SizeOf(TObject) and this kind of horror is needed:

  SL: TStringList;
  R1, R2: TRect;
  PR: PRect;
  Idx: Integer;
  MyRect: TRect;
  // add some strings and objects
  SL := TStringList.Create;
  R1 := Rect(0, 0, 42, 56);
  GetMem(PR, SizeOf(TRect));
  PR^ := R1;
  SL.AddObject('some text', TObject(PR));
  R2 := Rect(1, 2, 3, 4);
  GetMem(PR, SizeOf(TRect));
  PR^ := R2;
  SL.AddObject('some more text', TObject(PR));
  // do something with SL e.g.
  MyRect := PRect(SL.Objects[0])^;
  // free the allocated memory
  for Idx := 0 to Pred(SL.Count) do
    PR := PRect(SL.Objects[Idx]);
    FreeMem(PR, SizeOf(TRect));

And I'm not even going into the reference counting hell that is involved when doing all this with interfaces.

It's common to see this kind of stuff going on when someone wants to associate a value with an item in a list box or a list view for example. Now I know we shouldn't be storing data in UI controls, and I do try to avoid it (honest), but who hasn't done it?!

It many cases the problem can be solved by creating a little class that "wraps" the non-object type:

  TBox<T> = class(TObject)
  strict private
      fValue: T;
    constructor Create(Value: T);
    property Value: T read fValue;
constructor TBox<T>.Create(Value: T);
  fValue := Value;

Use TBox<> as follows: here we're wrapping an integer:

  IntObj: TBox<Integer>;
  IntObj := TBox<Integer>.Create(42);
    // use IntObj e.g.
    ShowMessageFmt('Value = %d', [IntObj.Value]);

Now, the example above using rectangles changes to the somewhat less horrid:

  SL: TStringList;
  Idx: Integer;
  MyRect: TRect;
  // add some strings and objects
  SL := TStringList.Create;
  SL.AddObject('some text', TBox<TRect>.Create(Rect(0, 0, 42, 56)));
  SL.AddObject('some more text', TBox<TRect>.Create(Rect(1, 2, 3, 4)));
  // do something with SL e.g.
  MyRect := (SL.Objects[0] as TBox<TRect>).Value;
  // free the allocated memory
  for Idx := 0 to Pred(SL.Count) do

You still have to do a little casting to get the value and you still need to remember to free the objects, but it's a lot clearer what's happening, and you are actually storing data of the correct type in the TStrings.Objects[] property.

For convenience I've created a Gist containing the TBox<> definition.

24 February 2014

When Did The Delphi Language First Support ...?

If you're like me and try to write library code that's compatible with several different versions of Delphi you have probably had cause to ask "When did Delphi first support XXX feature?"

I have. A lot. And then I forget and have to research it all over again. So, I've created a small table of various language and other features of Delphi along with the version where they were introduced.

I've had the page for a while now for my own use, but it occurs to me that others may find it useful. If you're interested, view it here.

Now, I'm not guaranteeing it's 100% accurate, and it's far from complete.

And now the ask. If you know of any other features and the version when the were first introduced please leave a comment and I'll add it to the list.

Also, if I've made a mistake, leave a comment about that too so I can fix it.

19 February 2014

New blog for CodeSnip stuff

Up to now lots of news about my CodeSnip program has been posted on this blog. That's really been off-topic in that I first conceived this blog to be a place to post some occasional musing on programming.

So, Ive now set up the new CodeSnip blog that I'll use for CodeSnip announcements and the like. I'm intending for this blog to become the central hub of all CodeSnip news in future.

Therefore if you've subscribed here mainly for the CodeSnip stuff, it would be best to subscribe to the new blog instead or as well.Sorry if that inconveniences you.