XAdaLib 2012 for Snow Leopard

I’m sorry for the lack of updates to the Ada-DK website, but I’ve been on vacation for most of August, and updating the site while riding across Iceland on motorcycles with my wife does not really mix well with staying on top of things in the world of Ada programming.

But now I’m back, and my first post will be about the release of XAdaLib 2012 for Snow Leopard, a collection of the following Ada tools for the Mac:

  • GTK Ada 2.24.2 with GTK+ 2.24.5 complete
  • Glade 3.8.2
  • GnatColl 2012
  • Florist 2012
  • AICWL 1.3

There’s both documentation and examples in the download package, so if you’re on Snow Leopard this might be an easy way to get the mentioned Ada tools up and running. You can read the full release announcement here.

GNAT GPL 2012 is here!

I’ve been waiting anxiously for the 2012 edition of the GNAT GPL compiler and the accompanying GNAT Programming Studio update, and now the wait is finally over:

Get the GNAT GPL 2012 package

Coinciding with the GNAT GPL 2012 release, we also get a bunch of updates to all the other great libre.adacore.com tools, such as:

And a whole slew more. I’ve personally installed GNAT GPL 2012, the new GPS, AWS 2012, GNATColl 2012, Florist 2012 and XML/Ada 2012 on my Slackware64 boxes, and everything went without a hitch. It just worked. Next up: Getting familiar with some of new Ada 2012 features. Should be fun.

Ada on Slackware

I finally got around to writing an article about Ada Programming on Slackware. Actually that’s probably overstating things a bit, as no actual Ada programming is happening in the article. Instead the focus is on how to install an Ada compiler and some Ada libraries on a Slackware system.

It is by no means a complicated process, but then again nothing is complicated if you know how it’s done. This article is squarely aimed at Ada programmers who perhaps do not live and die by the commandline.

The article is also a first for me, because it contains videos of the entire compile/install process. Yes, that’s right, you get to “enjoy” my gentle voice, while I struggle with the English language. I know videos aren’t exactly the best way to convey information about these things, but I do think that they are good addition for someone to whom tar zxvf something.tar.gz is completely alien.

At least I hope so.

Feel free to let me know if you think I’ve completely wasted my time doing these videos or if you’d like me to do more.

If you don’t want to bother with the article, you can go straight to the videos:

I think my next article might be about Ada tasking, unless you’ve got a better suggestion?

Logging options for Ada

The other day Marc C. posted a link to an AdaCore Gem dealing with the very nice GNATColl.Traces package, and shortly thereafter he did another reddit/r/ada post collecting a bunch of Ada logging tools.

As it turns out, there are five very nice solutions available to us Ada’ists:

I’ve personally used GNATCOLL.Traces and AWS.Log, and both are pretty good. I’m partial to GNATCOLL.Traces because of its syslog support, though at the time of writing GNATCOLL.Traces.Syslog is borked. It simply segfaults when you try to use it. Hopefully AdaCore will have that bug sorted out soon.

I intend to give Alog a whirl, as it was updated to version 0.4 yesterday, and one of the “fixes” in the new version reads “Cleanup of syslog facility”, which to a syslog fan like me is sweet music.

Getting down and dirty with Ada and JSON

JSON is a pretty neat data-interchange format. It is lightweight and both easy to read and write. It is also ever so slowly becoming the de facto standard for web-applications, because it is extremely easy to use with Javascript. As a matter of fact, JSON is a subset of the object literal notation of JavaScript so it can be used in the language with no muss or fuss.

But how does JSON fare when coupled with Ada?

Pretty good actually. I ventured into the realm of JSON suspecting I would end up having to write my own parser/generator, but as luck would have it, one of my favorite Ada libraries, GNATColl, turned out to have support for JSON in its latest SVN checkout, and even better: It was pretty good!

I started mucking about with the GNATColl.JSON package, and after an initial failure to make it work (due to me not being able to read properly), I made it fly. And it flew well. It is both intuitive to use, and very clean to read. There’s really nothing bad to say about the JSON support in GNATColl, except for perhaps one little thing: It’s still very new, so new in fact that at the time of writing, there’s no entry for it in the GNATColl manual. This is not a huge issue, but it’s worth taking into consideration.

To really drive home the fact that I enjoyed working with the GNATCOLL.JSON package, I wrote a couple of articles and dropped some test code at my GitHub page:

In short: JSON and Ada programming is a good match, so before settling on using XML for your data-interchange needs, perhaps it’s worth taking a look at JSON? It is much nimbler and very easy to work with.

Adding external logging support to AWS

As you know, I like the AWS (Ada Web Server) project a lot, and I have on previous occasions submitted patches to them, when I felt I had a contribution worthwhile bothering the AWS developers with.

This is one such occasion.

Together with a bunch of Ada-DK guys, I’ve started a new business called AdaHeads K/S, and we plan on using AWS heavily, and one of the small “annoyances” we stumbled on, was the fact that AWS could only log it’s activity and error log data to a local file. This is both potentially inefficient under heavy load, and it is a real security issue if the server is compromised, because the attacker then have easy and unlimited access to the log data.

So we really wanted to enable AWS to send its log data to something like syslogd, and as luck would have it, another AdaCore package could help us do just that: GNATColl. This little marvel of a package can talk to syslogd, so now all that was needed was a way to connect AWS to said functionality.

And that’s just what I’ve done. Or rather, I’ve written a patch that gives AWS users the ability to send access and/or error log data to an external procedure. This procedure can then make use of GNATColl’s Traces.Syslog package to handle the log data. Obviously this also opens up the possibility of sending the log data to wherever it might suit a given AWS user. You don’t have to use GNATColl. It’s a very flexible and basic system really. My hope is that even if the AWS developers dismiss my patch, for one reason or another, they’ll at least consider adding the functionality to AWS, because it really is a dealbreaker for the AdaHeads project if AWS can’t do logging to an external service such as syslogd.

We’ll be keeping our fingers crossed.

JSON Support in GNATcoll

Today I grabbed the latest GNATcoll developer SVN commit and with it came a very nice surprise – it appears that AdaCore is adding JSON support to this already wonderful library. Here are the new files in question:

Looks very nice! To my knowledge, the only other Ada JSON library available, is the jdaughter library by Tero Koskinen. I don’t know how the two implementations compare to each other, but it sure is nice to have more choices.

AWS Can Now Send Emails With Pre-Composed Sources

I got my latest patch to AWS (Ada Web Server) accepted and merged. Thanks Pascal!

So if you clone from the official Git repo, you should now be able to send emails via the AWS email facilities using pre-composed email sources.

This is, in my humble opinion, quite nifty.

I use GNATcoll to compose my emails, and with this patch it is now possible for me to combine these two awesome tools. Yes, life with Ada is good. :o)