Thursday, 6 August 2015

Delphi Stuff

I’ve been rather quiet on here lately. But I’ve kept my eyes open on what things have been appearing on the ARPANET relating to Delphi. I kept a list of things that piqued my interest.

On the off-chance you’ve missed any of these and might find them of interest, here’s a list of Delphi stuff.

Open source code bases:

WinSoft XE has released their commercial NFC Library for Android 2.0 for Delphi/C++Builder XE7 and XE8 – see FMX Express mention here. This is a ready made approach to NFC, which might be preferable to the do-it-yourself approach previously (and still) freely available:

One of the stalwarts of the old Delphi team, Charles Jazdzewski, aka Chuck J (also aka DJ Jazzy Chuck aka The Chuckinator aka Chuck-a-luck-a-high-chuck-a-hiney-ho), has been posting some nostalgic memories about the origins of the Delphi project:

Old Borland videos:

Borland Old Testament Histories by Verity Stob

  1. Book of Anders (1996)
  2. Yocam hokum (1998)
  3. Book of Yoc-am (contd.) (1999)
  4. Borland Revelations (2004)
  5. Borland's Delphi Goodbye (2006)
  6. A reading from the second book of Codh (2008)
  7. Sons of Kahn: The Apocrypha (2010)
  8. The Sons of Khan and the Pascal Spring (2012)
  9. The Sons of Kahn and the assembly language of the internet (2012)

Not quite Delphi stuff:

Unlikely to actually be interesting to anyone other than myself, but I was following a chain of posts on the old Windows Error Reporting tool, Dr Watson:

This led me back to a post by Matt Pietrek (who worked for Borland and wrote TDump and WinSpector) from his awesome Under The Hood column:

and right at the end he included a link to one of my various Undocumented Easter Eggs pages :o) That made me smile!

Wednesday, 4 February 2015

Two Decades, Eh?

Well, well, well, it turns out I’ve been working for myself for two decades now! I left Borland in January 1995, thinking I could manage maybe about 5 years if I was lucky and did well before I got another full time job. And now we’re in 2015! How time flies when you’re having fun :o)

Oh yeah, and a couple of weeks after I left my last employed job Delphi 1 came out, and that was awesome too! And my oh my, it’s nearly the 20th anniversary of the launch date of this great programming language: Feb 14th 1995.

To celebrate this milestone, Embo is hosting an online Delphi Week leading up to the Feb 14th launch date anniversary, Feb 9th to 13th. You can read more about it on this community news post and this community event post. Do read up on it and try and join in – it should be fun :o)

Tuesday, 3 February 2015

Off to Australia to talk at ADUG Symposium 2015

I’m delighted to be able to announce that I’m off to Australia in March to do some talks at the ADUG Symposium 2015!

It’s a long way to travel, but I’m really looking forward to talking to the ADUG members about Delphi XE7 in both Melbourne and Canberra.

I’ve got a couple of talks scheduled in. I’ll be talking about consuming Android OS features that are outside the scope of what the FMX framework wraps up, and also looking at creative debugging techniques.

Hopefully I’ll manage to shed the jetlag in the few days prior to the event, when I shall be enjoying the delights of Melbourne, and then after the 2 events I’ll soak up Canberra before returning back to normality.

Thanks for inviting me along, ADUG – I can’t wait to join you in Australia!

Delphi and Android services (part 3)

Once upon a time I uploaded a Delphi sample app to the Google Play Store, written in Delphi XE5 and implementing an Android service. I wrote about the published app in this post and supplied the source in this follow-up post.

There was an issue that’s been hanging around with that sample project. When pulled into Delphi XE7 and updated so it all compiled nicely, it didn’t play ball when deployed. Instead it hung.

I’ve eventually worked through the to-do list enough to take a look at the problem. For one reason or another starting the service in the OnCreate event handler caused an issue thanks to some required thread synchronisation, which no longer functions as I wanted it to.

I’ve worked around the problem by very slightly delaying the service starting by use of a one-shot timer. Then the form setup is done and dusted by the time the service is invoked and all seems to be well.

An updated download archive is available here, which contains the original Delphi XE5 project and a Delphi XE7 equivalent, which should now be functionally equivalent.

Another update has been made to the project download, which now contains Delphi XE8 support. Delphi 10 Seattle introduces its own support for native Android services, but Delphi XE8 / Lollipop made some changes that broke the demo as it was originally written. The XE8 version of the project should hopefully resolve that problem.

Wednesday, 10 September 2014

Delphi and NFC on Android

NFC is a neat technology.

If you’ve got an NFC sensor on your phone or tablet then there is a reasonable chance you’ve played around with apps like Trigger, which perform various actions on your device when you wave it over NFC tags in stickers or on key fobs etc. after a bit of setup.

So, for example, you could have an NFC sticker by the front door that has been coded by Trigger to turn off Wi-Fi and Bluetooth. With a variety of of NFC tags around and about you can set up your phone how you need it when you need it by a simple wave, avoiding a whole lot of fiddling about in the device settings.

Anyway, that’s one application of NFC tags. There are, of course, plenty more.

Indeed there have been a good number of questions in various forums asking how to get programmable NFC support in Delphi. Of course NFC is not currently “wrapped up” by Delphi’s RTL so up until now it’s been in the hands of the “creative”.

NFC tag scanning support in Android falls into 2 areas:

  1. You install an app that advertises that it can respond to some NFC tag content. When the device is waved against such a tag the app can be automatically launched. If more than 1 app is registered Android will initially launch a chooser dialog to allow the user to pick the app they require.
    Actually this support is easy enough to do in Delphi so long as you can locate a suitable import unit or two containing the required Android APIs for NFC.
  2. You run an app that permits the user to scan NFC tags while it is in the foreground and it directly responds to any scanned tags.
    This seems to be more commonly required in commercial applications and alas is much more difficult to achieve with Delphi. It falls into the category of problem that requires some Java smarts and some command prompt hackery to achieve.

Anyway, I was recently looking into writing some NFC support, given the frequency of questions being asked. Part way through my research I discovered that Daniel Magin was simultaneously trying to do the same thing, primarily for a talk at Delphi Tage.

I helped Daniel out with the Java callback and command-line building trickery – that seems to be an area where I can readily add value to Android low level chicanery – and he helped me out overcoming a nasty crash bug with Java arrays of NFC data records not being surfaced correctly by the Delphi RTL.

In the end we both had some sample apps that permit NFC scanning and also, just as an added bonus, NFC writing!

You can find my solutions written up in quite some detail here:

Daniel’s efforts will also be made available very soon.

Enjoy coding up your NFC apps, everyone!

Thursday, 15 May 2014

Delphi Developer Days

Cary Jensen and Bob Swart are well into their Delphi Developer Days 2014 tour, having travelled around America and shortly to hit Europe and the UK. Tour dates are here.

As well as a varied agenda of Delphi sessions (full details here), each stop has a different guest speaker.

For example Jim McKeeth (Embarcadero), Nick Hodges and Ray Konopka (Raize Software) have been on the bill in America, and Bruno Fierens (TMS Software) and Michael Phillipenko and Denis Zubov (FastReports) are lined up for Europe.

When the tour gets to London I’m delighted to announce that I’m on the agenda as the guest speaker!

So this is a quick heads up that if you’re booked onto the tour at London, I’ll see you there when I’m up talking about creative debugging techniques. This is an updated version of a talk that was popular when I was more active on the conference circuit some decade or more ago.

Wednesday, 7 May 2014

Launching other activities from Delphi Android apps

Following on from my recent post about adding Android app splash screens in Delphi XE5 and Delphi XE6 I’ve now spent some time writing up details on how to launch various Android system activities. This includes the more interesting business of getting feedback from launched activities; a common use case here is using a barcode scanner and finding what barcode what scanned.

Again there are two articles, one for Delphi XE5 and one for Delphi XE6. The XE5 version is much longer as it involves documenting a whole bunch of command-line shenanigans (much like for the splash screen) to hook the activity results. This is made much easier in Delphi XE6, thankfully.

I’ve tried to do a thorough coverage of the subject matter, highlighting any issues I bumped into – I hope it is of use to anyone tinkering with Android apps in Delphi.