Pages

Saturday, 17 December 2011

Oxygene for Java takes Delphi programmers to the Java and Android platforms

At the end of November 2011, RemObjects released Oxygene for Java, previously known as Project “Cooper” as per this official blog post and, for that matter, the press release.

Anyone familiar with Delphi Prism, which is RemObjects’ .NET compiler (also known as Oxygene for .NET) will know it is a high-performance compiler with some lovely enhancements to Object Pascal and support for all features of its target platform, .NET.

Oxygene for Java is the same compiler, the same language, but targeting the Java platform. This allows you to build:

  • cross-platform applications running on the Java Virtual Machine (as per the trivial Mandelbrot example I blogged about before)
  • Java applets (some applets I built in Oxygene based on some online examples can be seen at this test page)
  • Tomcat servlets, as discussed by Sebastian Gingter in this blog post
  • probably most interestingly, Android apps. Oxygene for Java supports a full tool chain for taking Java compiled classes and making them digestible to Android’s Dalvik Virtual machine
  • pretty much any other Java-based utility

In the middle of November I popped over to Antwerp, Belgium to deliver the launch presentation for Oxygene for Java at Be Delphi 2011. There are some pictures from the day’s sessions here, including a couple from my presentation that have the tell-tale Oxygene logo on the screen.

Be Delphi was a great inaugural day-long conference from a new Belgium-based Delphi community.

Since that launch presentation (and after a couple of other small jobs) I’ve spent a couple of weeks working on an Android project for a client, writing it in Oxygene for Java. More on that in another post.

I’m hoping to be making plenty of noise about this product over coming months in various forms, but until the next post, just note that Oxygene for Java is now available at the RemObjects store.

Thursday, 15 December 2011

Android emulator speedy alternative?

I was very tempted to test out Android-x86 in a VM as per Thierry Delprat’s nice step-by-step tutorial How to speed up the Android Emulator by up to 400%. The article runs through how to take an .iso image targeted at an Eee PC, install it on a VirtualBox VM, tweak the display attributes to look like a telephone and then register its network address with Android’s adb tool to allow it to be accessed from Eclipse or Oxygene for Java.

The result is a lightning fast start-up time and a very performant emulator replacement.

However there are evident problems with this option. Firstly, it’s not an emulator – it’s not running ARM code as the emulator does. It’s running x86 code. But also, only the core open source Android libraries are ported to Android-x86. Proprietary libraries such as the Google Maps API are absent and a lack of approval from Google means they won’t be making their way to Android-x86 any time soon.

Given that the project that has occupied my time lately required use of the Google Maps library, that rather meant that Android-x86 was a non-starter. Though I may have a go for the next project…..

VCL to FireMonkey converter

Those of you getting to grips with Delphi XE2 and its portable and powerful FireMonkey component library will perhaps have wondered at the effort in porting VCL code to this new framework. manual conversion is very achievable but rather time-consuming and very laborious.

So it was with interest today that I happened upon Mida, a tool for doing the ‘grunt-work’ of the conversion. Some of the Mida features include:

  • support for converting around 250 components
  • converts VCL data-aware controls to FireMonkey controls with appropriate LiveBindings set up
  • support for custom component conversion for cases of components not yet covered by Mida
  • support for updating source code that is known to not be FireMonkey-compatible

Mida is being developed by Mauro Botta and seems to be getting regular updates and enhancements. You can read about Mida, which costs €99 or $US133, at its website or blog or Facebook page.

Delphi and Windows 8

As many of you will be aware, the upcoming version of Windows, Windows 8, will be based around the Metro user interface, currently used by Windows Phone 7.x. This major UI change heralds a new programming challenge for Delphi developers, as Metro uses Xaml controls and requires use of a new Windows API called WinRT, which I gather was announced in September 2011.

WinRT is COM-based, but programming against it won’t require too much raw COM thanks to higher-level ‘projections’ for any given client language.

Windows 8 is still some way away, but if you want to get a flavour of how Delphi can already partake in the Windows 8 experience, pop along and see the hard work done by Thom Gerdes in his Writing Hello World for WinRT in Delphi article. For a more C++ oriented approach to Windows 8, also take a look at Ian Griffiths’ articles Real Native WinRT Development and Native WinRT Inheritance.

Thursday, 29 September 2011

Delphi and OS X

There are more posts and articles coming out illustrating how to work with cross-platform native aspects (OS X and iOS).

Accessing special folders both on Windows and on OS X are looked at by Malcolm Groves in ‘Cross-platform special folders in FireMonkey

Looking at how to convert from an NSString to a Delphi String is examined by Chris Rolliston in ‘Converting from a Cocoa string to a Delphi string.’ Chris is also sharing some general Mac tips for Delphi programmers in ‘A few Mac tips.’

Rudy Velthuis has looked into how to build an OS X application in Delphi without FireMonkey. Details of his progress are in this thread on the Embarcadero Discussion Forums.

There are more articles out there and more will be forthcoming. I’ll post more links as I find interesting write-ups.

Mono for Android 2.0 preview released

Xamarin have released a beta for their 2.0 series Mono for Android. Full details are at http://android.xamarin.com/Releases/Mono_for_Android_1/Release_1.9.0 but key points are:
  • support for Honeycomb (Android API Level 12)
  • interface constant binding improvements
  • Java 7 support
  • smaller application packages
  • better incremental builds
  • bug fixes

Update 1 released for Delphi XE2, C++Builder XE2 and RAD Studio XE2

Over 120 fixes are made in the recently released Update 1 for the XE2 product range from Embarcadero. There’s also an important licensing issue remedied in it.

Full details are at http://edn.embarcadero.com/article/41650.

C++Builder and FireMonkey

I don;t think I’d seen any posts on the new C++Builder release (C++Builder XE2) and so was pleased to see Bob Swart address this with a post on C++Builder XE2 and FireMonkey, originally from the C++Builder Developer’s Journal.

The article looks at creating a simple FireMonkey HD application, building and running it on Windows and on Mac OS X. He also looks at deployment and LiveBindings.

It’s good to see coverage of C++Builder topics out on the web.

Delphi Roadmap

Whilst Delphi and RAD Studio users await the next release of the official roadmap, JT (aka John-Ray Thomas) has posted a list of technology areas where work is actively on-going in the Embarcadero labs.

  • Frequent and regular FireMonkey updates
  • A Next Generation Delphi Compiler with multiple hardware/OS targets
  • Next Generation RAD C++ Compiler with multiple hardware/OS targets
  • 64bit RAD C++
  • Delphi and C++ iOS support
  • Expanded Mobile UI and Device support like Location, Camera, Accelerometers etc.
  • Delphi and C++ ARM Support
  • Extended iOS Support
  • Android Support
  • Win8/Metro Support - Intel and ARM

Wednesday, 7 September 2011

In-depth Delphi programming articles/posts

I’ve just bumped into a great list of resources for Delphi programmers using a version from Delphi 2005 onwards. It’s a directory called TIndex and has been put together by Lachlan Gemmell.
It’s not your usual ‘how to get started’ type resources. It covers much more in-depth and advanced topics, such as the new(-ish) $POINTERMATH and $STRINGCHECKS compiler directives, enhanced RTTI, Win64 and OS X posts, anonymous methods, generics, and of course posts on FireMonkey.
Check TIndex out at http://www.tindex.net.

Saturday, 3 September 2011

Oxygene 5

RemObjects Oxygene product line has now reached version 5 and is now written in itself to ensure continued quality as the product develops further.

Oxygene is a Delphi-like modern Object Pascal language, designed to work well with managed systems such as .NET, Mono and the Java runtime, and not worry too much about out-dated constructs that do not sit well with them. The language supports many up-to-date constructs and concepts, such as sequences, class contracts, nullable types, asynchronous methods, parallelised loops, future types and more besides.

Friday, 2 September 2011

Delphi XE2 and RAD Studio XE2 have arrived

There’s been quite a bit of noise about it of late, and if you have any interest in Delphi you will almost certainly have heard that the new version has come along and has a lot to offer. RAD Studio XE2 is the product that includes Delphi, C++Builder, Delphi Prism (Oxygene for .NET) and RadPHP, Targeting 32-bit and 64-bit Windows and also targeting Apple’s Mac OS X and iOS (i.e. iPhone/iPad/iPod Touch) using the new cross-platform FireMonkey library.
I haven’t yet had much of a chance to explore the new additions to this product so I thought I’d collate a bunch of blog posts and articles/resources on the new release that cover a lot of the major new aspects and so help you know what’s been cooking in the Embarcadero labs over the last year and more.

Thursday, 28 July 2011

“Project Cooper” launch pencilled in

RemObjects have added the SDN's October 2011 Software Developer Conference (SDC) in Zeist, Netherlands to their events page. The events listed on that page are conferences and events that feature sessions and material on RemObjects products, such as Delphi Prism and the W.I.P. “Project Cooper” (a Delphi Prism-like tool for building, debugging and deploying Java and Android applications).

I mention the SDN Conference in particular because this is where “Project Cooper” will be officially launched. On the evening of Monday, October 3rd I will be delivering the launch presentation, currently entitled: Presenting: Project “Cooper” - The Oxygene Language for Java and Android.

On Tuesday, October 4th I will be giving another two “Project Cooper” sessions, looking at specifics of Java and Android development. These additional sessions are still being worked out and will be made known closer to the conference date.

Wednesday, 27 July 2011

Oxfam Trailwalker 2011 Post-Event Update

The Trailwalker event eventually came on the weekend of the 16th and 17th July after months of training walks. This post gives a write-up of the event and allows me to extend another heartfelt thank you to all our generous sponsors who have contributed to the great causes we were fundraising for. At the time of writing we have raised a splendid £2873 (or approx. £3482 with Gift Aid factored in). This is tremendous news as we were originally aiming for £1500.

MonoTouch and Mono for Android are back

This post is a little tardy in relation to the news it brings. But in case you missed it, Xamarin have now taken over the MonoTouch and Mono for Android products from Novell/Attachmate and have them available from their site store – so this changes the questionable status over the products that the Attachmate acquisition of Novell brought about.
I guess I’ll have to update my MonoTouch intro tutorial and in-depth tutorial and my Mono for Android intro tutorial, to correct all the links etc.
But it’s great to see Mono development available again for the mobile platforms.
[Edit]
I did indeed update the MonoTouch articles and also update the Mono for Android article.

Monday, 27 June 2011

Microsoft Press free eBooks

I recently bumped into some free eBooks from Microsoft Press covering these subjects:

Oxfam Trailwalker 2011 Training Update 2

Ok, so we’re nearly there.

The Blood Sweat & Beers team has just completed the last of its big training sessions for the Oxfam Trailwalker 2011 endurance walk challenge on July 16th and 17th. We are now in ‘taper time’, keeping active, but doing no more big training sessions.

We will be attempting to walk 100 km (or 62.5 miles) in a little over 24 hours in order to raise funds for Oxfam’s poverty relief work and to support ex-Gurkhas. A while back we set our fundraising goal to be £2000, which delightfully has been met through generous donations, but we are still looking to improve on the total and will appreciate any additional sponsorships.

This post is the final pre-event update to show how our training has come along as we prepared for the big weekend.

Friday, 24 June 2011

“Project Cooper” Mandelbrot set calculation

I’ve had a couple of people ask me on separate occasions to show some “Project Cooper” code. I’ve not posted any thus far, as the product is quite early in its beta cycle and very few people have access to it. When it has matured and is in more hands I have plans to write lots more on the subject, but since I’ve been asked, I thought I’d post a simple project.

The ever-popular Mandelbrot set is the subject of this little demo, and it’s just a simple console application, completely bypassing the Android support, just building an app that runs on the Java VM.

Thursday, 23 June 2011

A dictionary of new words (kind of)

English is a massive language. The Oxford English Dictionary, Second Edition has about 600,000 words in it and that doesn't include the similar number of technical and scientific terms that aren't listed.

In the early days of the language's evolution the mass of words was helped along by England having an influx of peoples and languages from many lands and this helped grow the number of different terms for the very same thing.

Tuesday, 21 June 2011

Podcast on “Project Cooper”

I recorded a podcast recently for RemObjects, and was interviewed by their technical evangelist Jim McKeeth. We talked about various things including Java, .NET, Mono and Mono for Android, but the chat was mostly focused on “Project Cooper”.

You can find the podcast on the RemObjects Radio site.

Saturday, 11 June 2011

Fun & games with OpenGL on Android

I've been working up some demos for Project Cooper to show it working well with the Java class libraries and with the Android SDK. Most recently been trying my hand at getting some OpenGL demos going. I've briefly bumped into OpenGL over the years, but have by no means become a dab hand at navigating the mass of calls in the library and so have been finding the OpenGL documentation invaluable. To help me get something working I've been following steps in books and looking at demos found online.

One demo in a book I have involves a spinning cube (a popular type of demo), that has an image used to texture each side of the cube, and also makes the cube transparent. It's a nice looking demo for sure. I cobbled the code into a Project Cooper application and tested it out and was left very puzzled. You see, the demo ran just fine on the Android emulator. But on my shiny HTC Desire the cube had no bitmap texture on it - the cube was bare!

So the challenge was to find out why a well-performing physical Android device was beaten by the meagre emulator. The solution was found using logging, documentation, the Android source and some general web searching.

Wednesday, 8 June 2011

Decompiling Android package resources

Sometimes you see a screen in an Android app and you think to yourself: "I wonder how that layout was achieved..."

An initial thought, especially once you realise that .apk files are just ZIP archives, is to just pull the layout xml file out and take a peek. Alas this thought gets you not very far at all as the .apk has the constituent files encoded or tokenised or somehow made unreadable and unusable.

It turns out that apktool is the answer here as it can unpack the resources and decode them into original format so you can browse the layout (as well as the other packed resouces).

Don't forget to read the "Installation for noobs" section - I missed that to start witha and so got stuck for a while. However I'd put the two downloads into a a dedicated directory on the path, rather than the Windows directory, but that's a personal choice.

Delphi Certification is back

It's been a long time, but Delphi certification has returned for those who want to prove their prowess over the Win32 development tool.

If keen, your main port of call should be the Embarcadero Certification Center. Here you'll find information about the two levels of certification on offer.

Firstly there is the basic Delphi Developer Certification that tests general knowledge of Delphi syntax, programming techniques, the IDE and database development. Those who have a registered copy of Delphi XE or RAD Studio XE can take this certification test for free (if they request a test code before the end of July 2011 and use it within 90 days). For others it will cost $US49. It would be advisable to check out the Delphi Developer Certification Exam Study Guide before taking the test, which can be taken online.

There is also the Delphi Master Developer Certification, which tests more advanced knowledge of Delphi concepts, architecture choices, syntax, techniques, IDE, projects and groups, component use and development, client/server, Internet and multitier development. This test needs to be taken at a Certification Center and will cost $US149. There is also a Delphi Certified Master Developer Exam Study Guide to check out before taking the test.

Monday, 6 June 2011

More Android command-line fun

Following on from yesterday’s post about building Android apps at the command-line, this post looks at more things you can do with the command-line tools

You might normally start up an Android emulator (or Android Virtual Device) by running android.bat. This invokes the Android SDK and AVD manager, but unlike when you run SDK Manager.exe, it does not immediately connect to the network and update the list of available SDK packages. Instead it starts on the Virtual devices page and lets you create, edit or start an emulator.

Android SDK and AVD Manager

If you can remember the name of the emulator you want to start, say Android_2.2, then you can invoke it directly with:

emulator -avd Android_2.2

or, even simpler:

emulator @Android_2.2

Most interaction with the emulator or the device is done with the Android Debug Bridge (adb.exe). As mentioned in the last post, running adb devices will enumerate all connected devices and emulator instances and list out their serial numbers and connected state. Any emulators have the word emulator in their serial number to make it easy to spot them.

On occasion I've had problems with adb failing to notice an emulator that has been started up after initially working with a real Android device. This is usually overcome by telling adb to remove itself from memory and reload. adb acts like a daemon and normally stays running in memory between invocations, so to kill it you can use:

adb kill-server

The next time you run an adb command the daemon will be re-started. Note that killing the daemon also gets over problems where the adb in-memory process retains a handle on an Android package that's been installed. I've bumped into the issue several times, where trying to move or delete an Android project directory has been thwarted because something has a handle open on a file in the project directory tree. This often seems to be adb and killing it frees the handle.

Sunday, 5 June 2011

Android from the command line

Whilst working with Mono for Android I was pretty much confined to the IDE with regard to building apps and deploying them to the emulator or to a real Android device. That was quite important as Mono for Android had various non-standard additional steps to ensure all the pieces were in place, what with there being a Mono layer, and dependencies (at least with debug builds) on the Mono shared runtime and a platform-specific additional runtime.

Now that I’m working with Project Cooper, building native Android apps, I have the same luxury of choice as a Java developer. I can do everything in the development environment or drop to a command prompt (if in Windows, or a terminal on Linux or on a Mac, though to simplify things I’ll be assuming Windows) and do any amount of stuff from there.

I figured it may be an idea to run through the steps involved in turning a .jar file into an Android app, getting on a device or emulator, and starting it. In other words show a variety of Android-related commands that I’ve been using recently.

Saturday, 4 June 2011

Booting a VM from USB

Recently I started up my Linux VM for the first time in some months. It has Ubuntu installed on it. It had version 9.10 on it, known as Karmic Koala. I found out pretty quickly that this version is rather dated, and that support for it ended in April 2011. I decided to upgrade but was unsure whether to go for 10.04 LTS (Lucid Lynx), 10.10 (Maverick Meerkat) or 11.04 (Natty Narwhal) but didn’t want to fully install each one just to see what it was like.

Popping along to the Ubuntu download page I found that they offered the 10.04 Long Term Support (LTS) version or the current 11.04 version for download as a CD .ISO image and was reminded of the fact that the CD has the option of running as a ‘Live CD’, meaning you don;t have to install it – you can boot off the CD and run it directly from there. That’s great – I can pull the .ISO files down, connect my VM’s CD drive to the .ISO imge (as VMWare Workstation allows you to do, and I’m sure the other VM software, Virtual PC and Virtual Box do also).

Then I noticed the suggestion that you can burn the ISO to a bootable USB device and boot off that. This sounded interesting. When I decide on a suitable Ubuntu version, I can burn it to a spare USB memory stick and free the PC of the .ISO file, potentially allowing me to boot pretty much any PC into Ubuntu if the need or desire arises.

Well, I figured I’d better test this by booting my VM off the USB device. The first problem was how to make a bootable USB device from the .ISO, but this one is easily solved. The Ubuntu download page has a link to the Universal USB Installer from PendriveLinux.com. This makes the whole process trivial and even allows any spare space on the USB stick to be used as persistent storage for the installed Linux OS.

Universal USB Installer

Having got a bootable USB device with Ubuntu on it I need to prove that one of my virtual machines can successfully boot from it. And this is where things got sticky. It seems the VMWare BIOS does not support booting from USB devices, which seemed to rain on my parade, somewhat. Until I did a little searching and came across a free boot manager called, simply, Plop. You can read up all about Plop on their Boot Manager info page.

In short though, if you download the current Plop Boot Manager .zip archive and unzip it you’ll find 2 key files in it: plpbt.img (currently 1,474,560 bytes) and plpbt.iso (currently 327,680 bytes). The .img file is a bootable floppy disk image, hence being 1,440 kB (floppies used to be described as having a capacity of 720 kB or double that, which was referred to as 1.44 MB). The tiny .iso is a bootable CD image. If you connect one of these to the virtual floppy drive (if present, though there should be an option to add it if not) or the virtual CD drive in a VM (and ensure the BIOS is set to boot off the legacy floppy device or the CD-ROM drive before the hard drive) then Plop will be invoked.

Plop’s job is to present you with all the available bootable devices to boot from, including USB, and in that it works just great and allows the VM to boot successfully from a USB device.

Plop Boot Manager

Of course what you don’t see in the screenshot above is that all those dots are actually a very smooth star field you’re heading through.

Ok, so there we go – I now have a bootable USB device and I can boot any reasonably modern computer from it and can also boot a VM from it. One final thing I thought would be useful was to set up a dedicated dummy VM that could be used to boot from CD or USB devices, if desired, to avoid occupying one o the regular ‘real’ VMs. I wanted this dummy VM to take up as little space as possible and so, preferably, not have to chew up physical disk space by allocating a virtual hard drive, which after all won’t be used.

I went through the steps of creating a new VMWare VM, decided to tell VMWare that it would be a Linux guest OS that would be installed, but that it would be installed later and found there was no way of specifying no hard disk in the VM. I opted to use an existing virtual disk from another VM, but wasn’t too happy about making this dummy VM dependant on another one that my get moved to another physical drive at some point. So when the VM setup was complete I took a look in the new VM’s .vmx file, which contains all its main settings.

Near the top I saw these values:

scsi0:0.present = "TRUE"
scsi0:0.fileName = <path_to_some_VMs_vmdk_virtual_disk_file>

The last piece of the puzzle was to simply set the scsi0:0.present value to "FALSE". Now I have a trivial VM with no hard disk whose sole purpose is to boot an OS from either a CD, via a connected .ISO file, or from a USB device, which can be done by connecting the Plop floppy image or CD image to the VM.

Saturday, 28 May 2011

Native Android development for Delphi programmers

As you may know, and indeed as I have written about, Mono for Android has taken a bit of a hiatus. While it is still expected to be a viable development tool, and still a very convenient option for .NET developers, I thought it would be prudent to look up other options and ensure I covered various angles.
Naturally I considered regular Java development, using wither Eclipse or IntelliJ. However getting to grips with distinguishing the idiosyncrasies of one C-based language from another (Java vs. C#') wasn’t enormously high on my agenda.
It turns out there is another option looming on the horizon, which should be of high interest to Delphi developers.
“Diane, I'm holding in my hands a small box of chocolate bunnies.”
If you’re in the Delphi world you should already be aware of RemObjects Oxygene compiler for .NET, sold as Delphi Prism by Embarcadero. Oxygene for .NET is a native compiler that generates .NET executables. It encompasses all the latest aspects of the .NET framework and makes them available in a Delphi-like Pascal-based syntax, but doesn’t trouble itself with supporting decades of legacy DOS and Win16/Win32 specifics that have no purpose in the managed .NET world. This gives a smooth, fast .NET compiler that works very nicely from within the Visual Studio development environment.
“Diane, never drink coffee that has been anywhere near a fish.”
Coming later this year from the same stable is Project Cooper. This is the same Oxygene compiler offering the same Delphi-like language but generating code for the Java VM. It is in early stages of development as yet, but is already showing great promise. You can see a video of an early build here.
“Oh Diane, I almost forgot. Got to find out what kind of trees these are. They're really something.”
Of course, targeting the Java VM means it is ideally suited for developing native Android applications, and already does so even at this early point. I’m currently testing out Project Cooper, getting to know how to use the Android SDK more directly (i.e. not through the Mono for Android layer), and planning on what to put in a couple of talks I have planned on the product.
“Diane, I am now upside-down.”
On 14th June I’ll be talking to the Developers Group about Project Cooper in London. Then on 17th June I’ll be in The Netherlands talking about it at an SDN event.
I’m also hoping to write about the product as it develops its way towards release, showing how to accomplish various things that Android apps commonly need to do using Project Cooper.
“Harry, I have no idea where this will lead us, but I have a definite feeling it will be a place both wonderful and strange.”
Before signing off this time, I have to say that, given the lack of space on my Android phone I’m really enjoying the native app sizes you get from Project Cooper. And being a Delphi developer since 1994 (yes, I know it came out in 1995) the language fits like a favourite glove. So, right now I’m rather pleased Mono for Android has a 4 month break so that I can enjoy getting to know Project Cooper.
“Damn fine coffee! And hot!”
Oh. And in case you are wondering, Project Cooper is named after FBI Special Agent Dale Cooper from the classic series Twin Peaks by David Lynch.


Update 1: Project “Cooper” was released at the end of November 2011 by RemObjects under the name Oxygene for Java and can be purchased from the RemObjects store.

Update 2: I've started writing some articles on Project “Cooper”, or Oxygene for Java as it is now called. If interested, you can find them on my web site here, and of course you can see all my Oxygene for Java blog posts by clicking on the Oxygene for Java filter link just below.

Friday, 20 May 2011

Mono for Android and MonoTouch status change

Anyone who keeps an ear to the Mono world will have doubtless heard of the recent corporate changes that have impacted the Mono product line. For some while Novell have owned Mono, having previously absorbed the original developer, Miguel de Icaza, and his company, Ximian. Recently, Attachmate completed their acquisition of Novell and there have been the usual consequential streamlining processes occurring.
One of the casualties of this process is the Mono team, who were all released. This means that formal development of the commercial tools MonoTouch for iPhone development and Mono for Android for Android development have now halted. There’s been little noise on this subject from Attachmate, but the current thinking is that people who’ve already bought these products are still entitled to support. How supportive this support turns out to be is, perhaps, questionable. Certainly the store mechanisms that allow purchasing of MonoTouch and Mono for Android licenses have been disabled.
I should just add at this point that these events should not affect Mono itself, which is and always has been an open source platform. It’s the commercial tools for iOS and Android that are primarily affected.
For those who have been taking advantage of the homely feel of .NET development for iOS and Android devices, this news has set the cat among the pigeons, or thrown a spanner in the works, or whatever your preferred cliché may be. However, all is not lost.
As soon as Miguel and his team were let go, they immediately set up Xamarin. Xamarin is already working on producing API-compatible tools, similar to MonoTouch and Mono for Android, currently named .NET for iOS and .NET for Android respectively. The projected time for these tools is 3-4 months with the iOS product coming first.
Clearly this 4 month gap may prove logistically troublesome for some, but if you have already bought one of the Novell tools you can carry on working with it with an eye to switching to the Xamarin equivalent towards the Autumn.
If this time window is too much, well, you can always spend some time picking up native Objective-C skills or learning Java and use the normal development process in Xcode or AppCode for iOS, or Eclipse or IntelliJ IDEA for Android.
It seems that interest in the Mono-based tools continues. Various scheduled conference talks around the world on the topics are still going ahead rather than being cancelled. Personally, I will still be talking on Mono for Android at a Dutch User group (SDN) event in June.
That said, the timing of this unsettling news is not great for me as I’d started work on a series of tutorials for Mono for Android. I’ll probably put them on hold until the Xamarin products show some life, but since I’d finished the first one, I’ve put it on my web site. It’s looks at how you get going with Mono for Android and looks at the way Android applications operate, to get you started in the Android world, from a Mono for Android perspective. You can find the tutorial here on my web site.

Update: In case you came here and weren't aware of news happening in between when this was written and now, Mono for Android and MonoTouch came back and are flourishing away now.
Update: The introductory article mentioned is somewhat out of date now, but I have recently updated it to work with the current Mono for Android v4.

Alternative to Eclipse for Java development

If you find Eclipse a little clunky for Java development, then you might take a look at JetBrains IntelliJ IDEA Community Edition, which is intended to offer a smoother experience developing Java apps, with support for Java 7, JUnit and TestNG, Maven and Ant, Groovy, Scala, Clojure, Subversion, Git, Mercurial and CVS, as well as Swing UI design.

It also supports Android app development, including the latest Android SDK.

Alternative to Xcode for Mac development

Whilst on the subject of what JetBrains is up to, I recently learned that they are working on an alternative to Apple’s Xcode for Mac programmers who are building OS X and iOS applications in Objective-C.

AppCode is still under development, and an EAP (Early Access Program) is available. AppCode being pushed as an alternative to the Apple IDE, with various refactorings and active code analysis and intelligent Code Completion, as well as a debugger.

This will likely appeal to developers who have used JetBrains ReSharper in Microsoft Visual Studio but are expanding over to the Mac world to develop Mac or iPhone applications.

Alternative to Reflector available

Tools vendor JetBrains have announced development of an alternative to Reflector.

You’ll recall that Reflector was originally developed and maintained by Microsoft’s Lutz Roeder and for many years was a free tool. Not so long ago it was taken over by Redgate Software and remained free for a while, but then got a price tag attached to it (you can have a 14-day trial but after that it will cost you $35 or £20.

JetBrains have announced dotPeek, which is to do similar things to Reflector and will be free forever. An Early Access Program (EAP) is now open and you can download an early build and have a play.

Like Reflector, it supports navigating to types, symbols and members, will decompile to C#, support searching, support source servers, locate derived symbols, use syntax highlighting and so on.

Wednesday, 27 April 2011

Oxfam Trailwalker 2011 Training Update

Earlier this month I posted about my participation in a team of 4 in the Oxfam Trailwalker 2011 endurance walk challenge on July 16th and 17th. My team, Blood Sweat & Beers will be attempting to walk 100 km (or approximately 62 miles) in under 30 hours (hopefully closer to 24) and are raising funds for Oxfam’s poverty relief work and to support ex-Gurkas.

This post is really just an update so you can see how our training is coming along as we work towards this test of stamina and self-belief.

Despite appearing to be ‘just a long walk’ you should be aware that walks of several hours are very demanding on legs, feet, and joints, and when you stretch this over a 24 hour period and 100 kilometres, this is going to be really tough. Each of us is likely to burn approximately 10,000 kCals, which is about what the average man should consume over a 4 day period.

On the walking front we have had a number of team training walks, which varying combinations of team members have taken part in. We are also doing our own training walks when we can fit them in, as we don’t all live in very close proximity.

The first team walk was in late January, with a modest 5 miles (8 km) around some hilly woods near Henley-on-Thames. That took us 1:53 to complete, including occasional stops here and there.

The second team walk was in early February and was just shy of 11 miles (just under 18 km) around the Ashridge Estate. This walk had a number of testing hills in and took 3:47, including the odd stop for a breather. My heart-rate monitor told me I burnt 1,480 kCals on this walk.

I wasn’t able to attend the third team training walk, but the fourth was in early March and covered the first 10% of the Trailwalker course, just south of Petersfield (6.5 miles or 10.5 km). This took just over 2 hours including stops and I burnt around 800 kCals during this time.

We’re working towards our next team walk, but in the mean time we have been putting in a lot of time walking wherever possible. I’ve done a couple of lengthier walks myself in the mean time. The first one was 14.6 (23.5 km) miles, around the hills south of Wendover, and took me 4:37 to complete, of which 4:06 I spent walking, the rest was stopping for a breather, or checking the map, or climbing over stiles. This walk cost me 2,340 kCals.

The most recent training walk, to the east of Princes Risborough, was a little more substantial at 18.3 miles (29.5 km). This took 5:54, of which 5:12 was spent walking, during which I burnt around 3,400 kCals.

>

I’ve already plotted out a number of additional routes around my local county area of between 15 and 20 miles and I’ll be walking these over the coming weeks to keep developing my walking strength. I’ll be sure to keep you posted on how it’s all going at a later point.

My training walks without the team have a reasonable pace going, but that’s just to exercise myself on what is a considerably shorter walk than the real event in July. The pace I am setting on these walks is certainly not maintainable by me on longer walks.

Whilst doing these training walks the team have been testing out various things that will be necessary on the Trailwalker. For example, finding which walking socks are comfortable over long distances and don’t appear to be likely to cause blisters. Also working out the size of backpack or rucksack to take the necessary supplies.

Supplies on a walk like this are quite numerous. Granted, there are a number of checkpoints on the main walk, providing toilet facilities, water and occasionally some light food, but for all those miles we need to carry many things along. Obvious things include the route maps/instructions, first aid necessities, blister plasters, sun screen, a compass, water bottles, a phone, a pocket camera, a rain jacket. But also, given the number of calories being burnt off, quite a lot of food is needed to be nibbled and grazed on throughout the hours. Several spare pairs of walking socks are also pretty vital, to give your feet a break every few hours. Also, since half the walk will be at night, a head torch is required. Warmer clothes are also needed, though they can be left in the support vehicle during the day and swapped into at one of the checkpoints.

There’s a lot to take into account with this kind of endurance event over and above just getting to a position where you are able to handle continuous exertion for 24 hours or so.

Last but by no means least is the business of fundraising. The whole purpose behind this challenge event is to raise funds for Oxfam and the ex-Gurkas. The team is entirely reliant on our generous friends and the donations they can make to encourage us to train all the harder and be confident of making it to the finishing line. We’ve already started to receive donations but we have a long way to go before we reach our fundraising target. We’ll really appreciate any amount you can sponsor us with.

Thank you!

Wednesday, 13 April 2011

Delphi 64-bit On The Horizon

When you want to build native Windows applications, Delphi is still a major tour de force in the world of development tools. But currently it can only generate 32-bit executables and so cannot take advantage of all the memory space available when running 64-bit versions of Windows. That will be changing very soon.

Earlier this month David Intersimone posted a 13.5 minute video showing how the pre-release 64-bit Delphi compiler is coming along - you can see it here.

Summary from the video is that most regular Delphi code will simply compile and run. The Delphi RTL (run-time library) and VCL (Visual Component Library) have been updated and reworked internally where appropriate to just work in 64-bit Windows without undue changes to their interface, in much the same way as occurred with Delphi 2 with the move from 16-bit to 32-bit.

Of course things aren’t as simple as that, and there are some key areas where attention must be paid to have smooth transition and have code work in 64-bit but most regular Delphi code will pass through untouched.

In order to get prepared for 64-bit Delphi (or Delphi/64) and to assess your code for areas where attention needs to be paid the slides in the video point out some key gotchas, which I’m listing here to make them easily locatable (much easier to find text on a web page than in a video):

Things that stay the same:

  • Shortint and Byte are still 8 bits.
  • Smallint and Word are still 16 bits.
  • Integer, Longint, Cardinal and LongWord are still 32 bits.
  • Int64 and UInt64 are still 64 bits.
  • UnicodeString, AnsiString, WideString.
  • The Delphi exception system.
  • The RTL (Run-Time Library), e.g. SysUtils, Classes, generics.Collections etc.
  • The VCL (Visual Component Library), e.g. Forms, Graphics, Controls, menus, etc.
  • Windows API

Things that are different:

  • NativeInt and NativeUint are now 64 bits, not 32.
  • Pointer and all pointer types are now 64 bits, not 32. That covers things such as String, AnsiString, WideString, UnicodeString, class instance, class reference, interface reference, procedure pointer, dynamic array, PAnsiChar, PWideChar, PChar. Remember that string variables are really pointers to reference-counted string data.
  • Dynamic arrays now use 64-bit indexing, not 32-bit.
  • Floating point math is done with type Double (the 64-bit float type) – 32-bit floating point math not supported (Single will map to Double).

Things to bear in mind:

  • The Tag property will be NativeInt, meaning you can still cast object instances and other pointers and store them in Tag at runtime. Note that Tag was originally added to allow unique identification of components which share events. Think: case (Sender as TComponent).Tag of ...
  • SizeOf(Pointer) <> SizeOf(Integer)
    • IntegerPointer casts will break in 64-bit
    • SizeOf(THandle) = SizeOf(Pointer)
    • All handles (HWND, HDC, etc.) are pointer-sized, i.e. they will be 64-bit in the 64-bit compiler

  • All code in the process must be 64-bit, including all dependent DLLs
  • There is only one calling convention (register, pascal, cdecl, stdcall will be ignored), although safecall is still handled as a special case
  • Old “pointer math” may break
    • This will work in 32-bit and 64-bit:
      MyPtr := PByte(P) + 10
  • Inline assembly
    • Only procedural level asm blocks are supported – asm blocks cannot be mixed with Pascal code
    • Stack must be 16-byte aligned at each call instruction
    • Define locals for temporary storage
    • Do not modify the RSP stack pointer
    • In the new unified calling convention the first 4 parameters are passed in registers: RCX, RDX, R8 & R9 (or XMM0-XMM3)

  • Exception unwinding
    • Pure Delphi code works as before
    • Inline assembly can cause exception unwinding to fail if not properly written

  • Windows API gotchas
    • SetWindowLong/GetWindowLong should be replaced with SetWindowLongPtr/GetWindowLongPtr for GWLP_HINSTANCE, GWLP_WNDPROC etc, because they return pointers and handles
      • Pointers passed to SetWindowLongPtr should cast to LONG_PTR rather than to Integer/Longint
    • SetWindowLong is mapped to SetWindowLongPtr in Windows.pas
      • calls to this mapped version are safe so long as they are cast correctly
    • Use explicit casts to WPARAM/LPARAM where appropriate
      • E.g. passing pointers through SendMessage:
        SendMessage(hWnd, WM_SETTEXT, 0, LPARAM(@MyCharArray));
    • Use LRESULT to cast message results
      • E.g. Message.Result := LRESULT(Self)
    • Message cracker record definitions (TWMxxx) have changed to accommodate altered alignment and field sizes

Things to do to your code today:

  • Find all IntegerPointer casts (including Integer ↔ instance casts)
  • Check for Pointer size assumptions
  • Ensure external dependencies are available in 64-bit
    • Image/bitmap libraries
    • Hardware interface libraries
    • ActiveX controls

  • Consider rewriting assembler code in pure Pascal
    • This offers better portability (think future ARM CPU support)
    • Rely more on algorithmic performance rather than raw assembly performance

To get a heads-up on some of the issues surrounding 64-bit programming on Windows you read:

Finally, if you are a Delphi XE user you get priority access to the Delphi 64-bit beta. Non-XE users can also get on the beta, but there will be limited places, and XE users will be given priority. More information about the beta program is available here.

Thursday, 7 April 2011

Olde English Criminals

Following on from the post about old English jobs that have faded away, I happened upon a list of terms for old specialist criminals from the eighteenth century, long since disused.

I found them in the 2008 QI Annual that covers the letter E, so all credit to QI for finding these. You can pick up the annual for a modest sum on Amazon.

 

However I’ve added to QI’s original list of 16 with a bundle of extra ones from The Lexicon of Thieves Cant (based on the 1811 Dictionary of the Vulgar Tongue. A Dictionary of Buckish Slang, University Wit and Pickpocket Eloquence and also Captain Grose's 1785 dictionary).

Criminal name Description
Adam Tiler a pickpocket's associate, who receives the stolen goods, and runs off with them.
Angler pilferer or petty thief who, with a stick having a hook at the end, steals goods out of shop windows, grates etc. Also someone who 'draws in' victims in order to rob them.
Autem Diver pickpocket who operates in churches and temples.
Autem Mort a female beggar who hires children in order to inspire charity.
Bawdy-Basket woman posing as sellers of pins and needles or pornographic books to disguise her real game, which was stealing linen clothes off hedges.
Bene Feaker counterfeiter.
Bene Feaker of Gybes counterfeiter of false passes.
Blue Pigeon thief who steals lead off houses and other buildings.
Bob shoplifter's assistant. One who receives stolen goods.
Bubber a thief who steals from taverns.
Buffer-Nabber professional dog-thief who killed the animal to sell its skin.
Bully-Huff hung round brothels, surprising and threatening the customers by claiming that the woman they were in bed with was their wife. In between times, they intercepted lucky gamblers as they left the casino to relieve them of their winnings.
Bung-Nipper stole the gold buttons from cloaks and the silver tassles from hatbands.
Clank Napper a silver tankard stealer.
Clapperdogeon professional vagabond, a varlet who wore a patched cloak and three hats, one on top of the other.
Dommerer beggar posing as an escaped slave who had had their tongues cut out by the Turks for refusing to accept Islam.
Glimmerer woman who went around in floods of tears claiming that her house had been burned down; alternatively she set other people's houses on fire, in order to loot them in the confusion.
Figure Dancer one who alters the numbers on notes of credit or other paper money.
Footpad a common thief.
Foyst a pickpocket.
Jack in a Box a card-sharp.
Lully Prigger thief who steals wet clothes off clothes lines
Mumper genteel beggar.
Napper of Naps a sheep stealer.
Pad Borrower a horse thief.
Poulterer a man who opens mail and steals the money enclosed within.
Prigger either a member of a three-man shoplifting team or a horse-thief.
Prigger of Prancers a horse thief.
Prigger of Cacklers a henhouse thief.
Rattling Mumper beggar who begs from coaches.
Reader Merchant a pickpocket.
Ruffler armed robber or beggar disguised as an out of work soldiers.
Rum Bob skilled apprentice thief.
Rum-Bubber specialised in stealing silver tankards from taverns.
Rum Diver skilled pickpocket.
Rum-Dubber skilled lock-picker.
Rum File skilled pickpocket.
Rum Padder skilled highwayman.
Swaddler not only stole from their victim but beat them up as well, sometimes murdering them into the bargain.
Swig-Man covered their roguery by pretending to be an itinerant haberdasher.
Strowler con man who convinced country gentlemen to 'lend' him money so he could go to London.
Tatmonger card-sharp.
Tayle drawer a thief who steals swords from a mans belt.
Wiper drawer a thief who steals handkerchiefs.

Olde English Jobs

I like reading about the English language. It fascinates me.

The grammar rules and syntax interest me, as does the way words fade in and out of the language and morph from form to form along their useful lives.

I was happy to recently bump into a colleague from University who I’d lost track of, all the more as he seems to have collected a lot of interesting language-related links and posts on his site.

In a recent local town council magazine Keith Turner & Daniel Parslow provided a good catalogue of old job titles that used to be common in market towns such as Aylesbury, where I live, that have fallen into disuse over the years.

All credit to Keith and Daniel for this list, which I am typing up to make more widely available.

Job title Description
Abigail Lady's maid
Ale-conner Official who tested the quality and measures served in pubs
Ankle beater Young person who helped drive cattle to market
Boot catcher Servant at an inn that removed travellers’ boots
Bozzler Parish Constable
Bridewell Keeper In charge of the lock-up or jail
Bunter Female rag and bone collector
Bog Iron Hunter Searched for Iron Ore in bogs and marshes
Cartomancer Fortune teller using cards
Chapeler Hat maker
Costermonger Peddler of fruits & vegetables
Clapman Town crier
Clod hopper Ploughman
Donkey Man Passenger carriage driver
Eyer Made holes in sewing needles
Feather wife Woman that cleans feathers for sale
Fagetter Firewood seller
Flauner Confectioner
Frobisher Cleaned and polished metal
Gabeler Tax collector
Gelder Animal castrator
Gong Farmer Emptied privies and cesspits
Greensmith Worker in copper
Hobbler Towed canal boats
Jongleur Travelling minstrel
Knocker Upper Woke people up
Knock Knobbler Dog catcher
Layer Paper mill worker
Leech collector Waded through rivers to collect the leeches which attached to him
Lungs Alchemist's assistant who fanned the fire
Mud lark River bed scavenger
Mule Scavenger Children who would crawl under fabric mills to collect cotton and fluff
Mountebank Seller of fake medicines
Night Soilman Emptied cesspits, ashpits and outside toilets
Nob Thatcher Wig maker
Osler Bird catcher
Ponderator Weights & measures inspector
Powder monkey Boys who supplied ship cannons with gunpowder below deck
Quarrel Picker Glazier
Ratoner Rat catcher
Resurrection Man Provided surgeons with fresh cadavers with which to learn their craft
Rodman Surveyor's assistant
Saltpetre man Collected urine and dung used in the manufacture of saltpetre
Searcher of the Dead Sought plague victims
Secret Springer Watch spring maker
Sexton Church caretaker - sometimes dug graves and rang the church bells
Smoke Doctor Specialist in the construction or repair of chimneys
Tapster Barman/woman
Town Husband Collected dues from the fathers of illegitimate children of the parish for their upkeep
Treadmill Operator Trudged atop a giant mill wheel treadmill to push it round
Upright Worker Chimney Sweep
Vamper Made the upper part of a boot or shoe covering the instep and sometimes extending over the toe
Webster Operator of looms
Yatman Gatekeeper

Wednesday, 6 April 2011

Parallel Programming Patterns

In a blog post I read this evening there was a reference to this handy PDF guide to Patterns for Parallel Programming, illustrating how .NET 4 parallel programming support and contrasting with how the same patterns are implemented without this new support.

The guide is written by Stephen Toub, a Microsoft Program Manager Lead on the Parallel Computing Team at Microsoft.

You can download the guide from Microsoft in either a C# version or a VB version.

Mono for Android 1.0 & MonoTouch 4.0 released

Today Novell released Mono for Android 1.0 and MonoTouch 4.0 (blog posts from Miguel de Icaza detailing the releases can be found here for Mono for Android and here for MonoTouch).
I’ve used MonoTouch quite a lot, hence the rather detailed tutorial I released, which was detailed here.
I’ve also been spending quite some time getting up to speed with Mono for Android. Indeed in February, I gave a talk on building apps with Mono for Android (or MonoDroid as it was referred to back then) in conjunction with Delphi Prism at a conference in Las Vegas. Also, today I spoke at a User Group meeting about building an Android app in C# using Mono for Android.
Over the next few weeks I’ll be working on a tutorial that shows the use of Mono for Android with C# and will post when it becomes available.
In addition, I’ve kept notes of various interesting things, such as issues, gotchas, solutions to problems I’ve encountered and so on. As I write up the tutorial I’ll be posting some of those tidbits as and when they crop up in the coverage.
One thing I learned today from Miguel’s release blog post, though, is that when you build an app for distribution the Mono linker is engaged. This generates a single binary containing only the items known to be used (and their dependencies) – everything else is stripped out. Smart linking in other words.
This is in contrast to how things work during development where you link against a shared runtime that is deployed to your emulator or device. The idea during development is that the executable generated will be smaller, thanks to linking against a shared runtime (well, two shared runtimes actually – there’s the main Mono runtime and a much smaller runtime specific to the version of Android you are targeting). With a smaller executable it takes less time to build and deploy to the emulator or device.
With a single executable generated for distribution this simplifies the question of how these separate entities are to be managed.

Update: This is an old post, and it should be noted that the current versions (at the time of writing this update in Jan 2012) are Mono for Android 4.0 and MonoTouch 5.0.

Sunday, 3 April 2011

Endurance Walk

I’m part of a team of 4 people who are currently training for an endurance walk on July 16th and 17th, 2011. Of course, we’ve probably all gone for long walks every now and again but this is something a little different to a regular long walk. This is a walk across England’s South Downs that will continue for 100 kilometres (or 62 miles) and it is going to be done in a one go, without any breaks for sneaky restorative naps.

The team is called Blood, Sweat and Beers and consists of Jim, Elaine, Gordon and myself. The endurance walk is organised by Oxfam and is raising money for Oxfam and for the Gurkha Welfare Trust in an event called Trailwalker UK 2011. There will be 550 teams doing the event and around 80% of the teams are expected to complete the full 100 kilometres.

Rest assured this is a real test of both physical endurance as well as mental fitness. Having heard from people who have previously entered the event, it is gruelling, painful, testing and punishing, but also rewarding and of course a massive personal challenge. It has been described as an ultra-marathon. Team Blood, Sweat and Beers are hoping to complete the challenge in under 25 hours.

As a team we are looking for sponsors to help bolster our motivation and training and to incentivise us to push ourselves to our maximum ability. Funds raised will be used by the Gurkha Welfare Trust to help reduce poverty for ex-Gurkhas and dependents and by Oxfam for their invaluable work in emergency relief in poverty-stricken areas around the world. Anything donated will be appreciated equally by Oxfam and the GWT, as well as by Team Blood Sweat & Beers.

Any donations by UK tax payers are eligible for Gift Aid, which immediately adds an extra 25% to the donation at no extra cost to yourself – it’s reclaimed from HMRC. Please agree to Gift Aid when asked.

The team has already completed a number of training walks, with the distances increasing as time goes by. We have a training plan and things are going well so far, but we need to raise £1500 in sponsorships to help us through the event.

For any donations you can offer, Team Blood Sweat & Beers appreciate your generosity and thoughtfulness.

Please visit the team page and make your donation now!.

Google Maps Data Files

The My Maps feature in Google Maps is really handy for planning out a quick route or just seeing how far it is from one place to another. You can also drop on various place markers, add text to them and also add photos as I’ve done, for example, with my City of London Boundary dragons map.

As well as storing all the maps in the My Maps section of Google Maps you can also download any of them as a .kml file, which contains XML describing the map features, waypoints, etc. in the Keyhole Markup Language. The download option is available when you are editing a map and is accessed via the option View in Google Earth, which becomes available on the toolbar on the right as soon as you start editing. Clicking the option downloads a KML file.

The problem is that the .kml file doesn’t really have much data in it. It has the name and the description of the map, and the name and description of any map lines but the map data is not downloaded in the file. Instead it is left in Google Maps and the .kml file contains the URL to the map data in a <link> node.

While this abbreviated, deferred content is quite suitable for Google Earth’s consumption, if you were hoping to upload the map to some other mapping application the chances are it won’t get you very far. Typically, mapping applications expect to find the data in the .kml file.

Fortunately we can resolve this little issue by looking at the URL that Google My Maps offers for downloading the .kml file in the first place. Let’s take a look at the links available, using that Boundary Dragon map as an example.

Firstly, looking at the link offered to you if you ignore the Google Earth viewing option, but just click the Link option on the toolbar. The link it offers to paste into IM or email looks like this (with various bits of not-strictly-necessary junk taken out, for brevity):

http://maps.google.com/maps/ms?msa=0&msid=203846768851680872761.00046ae298586b10c2e49

Now let’s compare with what link is executed when you click on the View in Google Earth toolbar option (again, sanitised for easy viewing):

http://maps.google.com/maps/ms?msa=0&msid=203846768851680872761.00046ae298586b10c2e49&output=nl

As you can see, there’s an extra value added into the link specifying that the Google Maps server should output a file containing a network link (which appears to be what NL stands for). If you now look at the link contained in the .kml file it looks (after cleaning up) like this:

http://maps.google.com/maps/ms?msa=0&msid=203846768851680872761.00046ae298586b10c2e49&output=kml

If you paste this link into your browser’s address bar it will download another .kml file with full data inside it.

So, the answer is to take the original URL in the View in Google Earth hyperlink and replace the =nl with =kml. Easy.

Alas this does not work if you try and use =gpx – Google Maps is not interested in supporting the GPX format, commonly used by many mapping sites, however Google Earth is happy enough to load up GPX files.