Tag Archives: Glom

www.glom.org

Non-Recursive Automake is the Best Alternative to Automake

People often complain that autotools is complicated. But the alternatives generally involve a learning curve, require large changes to existing projects, and don’t provide the features or the command-line interface that we’ve become used to with autotools, making life difficult for people building tarballs, and for distros’ packaging tools.

One of the biggest annoyances with traditional autotools has been the need for a Makefile.am file in each sub-directory, and the need to create (and link) non-installed convenience libraries in each one. That leads to lots of repetitive Makefile.am code. More code means more errors, less clarity, and difficult refactoring. I had forgotten how much I hated that about autotools when I first learned it.

One of the advantages often mentioned for alternatives such as cmake is the ability to define the build in just one text file. However, automake has supported the non-recursive way for a while. Now you can have just one top-level Makefile.am. The configure.ac is still separate, but that’s fine with me.

Daniel Elstner changed Glom to use a single Makefile.am, removing 47 annoying little Makefile.am files while preserving our special stuff for client-only, Maemo, and Windows builds, with no disruption for developers using the source from git or for people building from the tarball. It’s a great improvement that shows how attractive non-recursive automake can be. OK, so Daniel is an autotools expert, but I’d still rather move from autotools to non-recursive autotools than take the leap of faith needed to move from autotools to something completely different.

Apparently this is also more efficient, leading to faster build times, particularly when building in parallel with the -j option, with more correct dependencies. And there’s no need to mention those convenience libraries repeatedly to work around linker errors.

Together with autoreconf (replacing hand-built autogen.sh files), autotools can be much nicer these days.

libglom is now 100% non-UI

libglom has been mostly theoretical until now. But I just removed all the UI code and the GTK+ dependency so it can now be used realistically by applications other than Glom itself. This small libglom document-parsing C++ example shows how easily you can get the basic details of the Glom system. This is only in svn for now.

And here is a small libglom test case in Java. (Yes, that’s not a well structured junit test case – I’m just throwing code in there as I  create the API.)

I’m using SWIG to create a Java API for the libglom C++ API. SWIG seems very capable and handles real C++, but the syntax is alien to me so I’d be very glad if a SWIG expert chose to do that job for me.

Learning Java Web Stuff

Relearning Java and JSP

Over the last couple of weeks I’ve been relearning Java and JSP and learning about Google’s GWT . I learnt Java when it was first released but I last used it around six years ago and I never used it seriously in a  large project.

I’m now up to speed on new stuff in the Java language, such as annotation, generics, and enumerated types, some of which I really missed not having before. A newer edition of Bruce Eckel’s Thinking In Java was great for that. I’ve always  liked how he includes comparisons to other programming languages (C++, Python, C#) and is unafraid to criticize the API that he’s demonstrating, though I wonder how interesting that is to other people.

For JSP I tried a different style of book: Head First Servlets and JSP. It’s full of clip art and silly captioned kung-fu photos and cartoons but that really did help me to keep reading. I’m only slightly ashamed.

No, I’m not going to do less C and C++. I love C++. It’s just not what’s used for web development.

Learning GWT

Of course any web site these days must use AJAX to provide a more interactive page, exchanging data with the server and updating the page without doing a whole page refresh. I’d like to avoid writing or maintaining Javascript if at all possible, so Google Web Toolkit seems like a good choice. Bizarrely, it generates javascript from Java, and it even has (imperfect) Javascript implementations of some of the standard Java library. It’s weird but it seems to work. I believe it’s used for gmail and Google Maps.

I’m using the GWT in Action book, though the online GWT documentation seems fine, and the self-hosting runnable examples are really helpful.

Maven

This also included learning about the maven and ant build/configuration tools. maven feels roughly equivalent to autotools plus pkg-config, with ant being roughly equivalent to make. As far as I can tell maven is the in thing.

So far maven is working out well for me, though all the XML to use the necessary plugins feels like voodoo and it has taken me days to get some plugins working, for instance to build WAR files to deploy to tomcat, and to use JNI. The incredibly obscure error messages don’t help and when it does what I want I am thankful but never quite sure how it knew what I wanted.

I also feel weird about using plugins from sites that I’ve never heard of. Without being familiar with the history and community, I have no way to know what is the official best plugin to solve particular problems.

Eclipse Pain Again

This is an opportunity to give Eclipse another chance. After all, it’s meant to be wonderful for Java development, right?

But I seem to need various extras to work with common things like JSP and maven, which forces me to use the hateful “Software Updated and Add-ons” feature. The problems with this are numerous:

  • It shows me many similarly but incomprehensibly named add-ons so I don’t know which one I want. It should explicitly tell me exactly what I would expect to see in my Eclipse UI after installing each thing.
  • It sometimes shows me duplicates of add-ons, just in slightly differently-named directories. What do I choose?
  • It sometimes shows me countless minor versions of the same add-on, instead of just showing me the latest one. There’s a checkbox for that in some versions – it should be on by default.
  • It almost always tells me that some dependency (or some version of some dependency, I guess) is missing. If it doesn’t know how to find it then I certainly don’t. Fail.

I managed to install the WebTools add-on in one of my Eclipse installations. But it has a rather hacky MSWindows-centric wizard, which assumes that all of Tomcat is installed in one directory and won’t let me get further until that is true. Of course on Linux distros things are split up between /usr/lib, /usr/etc, etc.  Some helpful Fedora people seem enthuasiastic about fixing it.

Anyway I generally dislike the idea that I must use a particular project wizard for things that are orthogonal. I shouldn’t be forced to choose between my programming language, my build system, or some of my dependencies. They should be independently interchangable. I suspect that I’d be happy with Eclipse just as an editor, using the command-line with my hand-edited build files, but I never seem to get that far. Eclipse should make it more obvious how to do that because it’s currently a rather hidden feature in some of the new-project wizards.

Note that I’ve tried standard Eclipse in Ubuntu Intrepid (Even Jaunty only has Eclipse 3.2), Eclipse 3.4 in Jaunty (by downloading it and running it from a directory, which works surprisingly well), and “Fedora Eclipse” 3.4  in Fedora 10 in a vmware image.

I’m not ready to give up just yet. I’ll take another run at using Eclipse just as a simple editor, trying not to use any special add-ons. But my patience surprised me.

Online Glom

This isn’t just to refresh these skills and prove to myself that I can still learn. I plan to use this to create a web UI for Glom. My plan is roughly:

  • Use JSP for the standard static parts of the page. This gives me easy authentication and session management.
  • Use GWT from within JSP to construct large parts of the page (identified by div tags). This gives me fancy AJAX UI widgets and a way for client-side code to communicate with code on the server without a page refresh.
  • On the server side, use my C++ libglom library via a Java wrapper generated with SWIG. This will at least give me database structure and UI layout details from .glom documents.

Although AJAX allows us to do more than the old submit-form/get-new-page UI of CGI, I am still not looking forward to dealing with the increased use of async coding compared to desktop coding, batching information up to reduce client/server communication, and being restricted to aggregations of serializable/copy-by-value primitive types when doing that.

My initial inept attempts at all this are in my online_glom repository on github. There’s hardly anything to see but there’s probably already plenty to correct.

Books in the Openismus Office

This is our small collection of books.

office_books

The gtkmm web site also has a list of C++ books we recommend. David and Michael really liked Accelerated C++, confirming the good things I’ve heard about it.

I’d like to buy some Beagle boards for the trainees to play with. Does anyone know of some good general books about deploying Linux to arbitrary embedded hardware? I’d also like them to have some book about setting up custom Debian and/or Fedora repositories, as most embedded projects seem to do, ideally with a proper autobuilder. They should learn about OpenEmbedded and Poky too.

Glom 1.10

glom.png

Today I released Glom 1.10. There are no big new features compared to Glom 1.8. It’s mostly just a port to libgda-4.0 and the addition of an experimental sqlite backend, with limited functionality compared to the default PostgresSQL backend, for embedded use. Johannes did most of the libgda-4.0 port and Armin did the sqlite backend.

libgda-4.0 is a significant improvement over libgda-3.0, giving us better performance with huge numbers of rows . It also allows us to remove some code from Glom, such as code to escape binary data for SQL queries. Vivien Malerba was very responsive to our feedback and took our patches quickly.  I look forward to using future API to construct SQL queries from conceptual parts so we can remove that code too.

We will try to get Ubuntu packages into the Openismus PPA soon, at least for Ubuntu Jaunty, which otherwise has a (recent, bugfixed, woohoo!) Glom 1.8 in the official repository.

boost::python in Glom

I recently took another look at boost::python. It was a much better experience than when I first tried boost::python for Glom in 2005, probably because my use of the Python C API in the meantime has helped me understand what boost::python is doing. I have a mostly-done patch to use it in Glom 1.12 (Glom 1.10 will be released soon). This should make the code simpler and much more robust, allowing me to add more Python API to Glom, allowing people to drive more of the Glom UI via scripts.

As a side-effect this will force us to enable C++ exceptions in the Maemo build for Glom 1.12, increasing code size, but that might be less of an issue by then.

I do find the boost::python documentation fragmented and unfocused, spending too much time congratulating itself about its use of various design patterns and generic programming techniques in the implementation, instead of just telling me how to achieve common tasks. It often assumes knowledge of the Python C API, as if it is based on original proposals or internal documentation. Many companies are using boost::python so I’m surprised that none have arranged for more useful documentation to be written. I’d be happy to do it if someone wants to pay for my time.

In fact, boost::python’s API maps closely to the C API, so you probably need to know both, though I hoped that boost::python would make it clearer and more explicit.

However, the people on the boost::python mailing list have been very helpful when the documentation has not been clear or where I have made silly mistakes.

Boost should install pkg-config .pc files

Getting the CFLAGS and LIBS for boost python in your configure.ac is insanely difficult and fragile. There are some .m4 scripts out there, but I can’t get any of them to work. Why on earth don’t they install a .pc file? They can’t all be Windows programmers.

And despite using unstable APIs, they don’t seem to allow parallel installs. For instance, on my Ubuntu Linux system, the headers are directly under /usr/include/ rather than /usr/include/boost-python-1.0/. GNOME gets this stuff right.

The need for parallel installs is even greater for boost::python because there are various possible incompatible configurations, any of which you are likely to find on your system. At the moment you will just get compiler or linker errors (which distro packagers don’t understand) instead of being able to explicitly depend on a specific version with a specific build (which distro packagers could understand).

This will make life difficult for Glom distro packagers, but I think it’s still worth it.

Glom 1.8 bug fixes. Ubuntu packages

Over the last few months we (Openismus) fixed several nasty regressions in Glom 1.8 compared to 1.6. The latest release is fairly usable. We really must set up some LDTP testing scripts or suchlike to catch these regressions before our .0 releases.

The Openismus PPA has updated packages for Ubuntu Intrepid, based on Iain Lane’s packages. The official Glom packages for Ubuntu Intrepid are 1.6, which was finally updated to a bug-fixed release, thanks again to Iain Lane.

Work on Glom 1.10 is going well, though it’s largely a port to libgda-4.0.

Glom 1.8

I have released Glom 1.8, with many new features and bug fixes. We have not yet fully completed some of the new features, and the refactoring may have introduced regressions that we must fix in 1.8.x releases, but we need to get it all out into the world and move on to Glom 1.10, including porting to libgda-4.0.

We have probably missed the schedule for getting Glom 1.8 into Ubuntu Intrepid so I’ll create some PPA packages when Intrepid is released.

Useful new stuff in Glom 1.8:

Network sharing

As you can see in the new initial dialog, you can now choose to open a Glom system from the network, if a colleague is already running it. This is much easier than getting access to the actual .glom file on a shared network drive.

This uses the new libepc (Easy Publish and Consume) library, developed by Mathias Hasselmann, using avahi and libsoup. There’s a chance we might use telepathy in the future.

Armin implemented the new dialog, and I implemented the load-from-network code using libepc.

Import

You can now import CSV (comma-separated) data in to the current table. The assistant helps you to choose the field mapping, showing you sample data for the first few rows.

Johannes implemented this.

Drag and drop layout

You can now drag items from the toolbar (hidden by default) onto the details layout, and you can drag items within the layout. The automatic layout reflows as you do this.

Yes, we know that the dotted lines are particularly ugly, but I don’t yet know of a better way to show the limits of the columned boxes and items, which may be inside each other. Mockups would be welcome.

Johannes implemented this. It was a huge job and he’s probably glad to be doing some other things now. This uses the EggToolPallette toolbar, developed by Mathias and Jan Arne, that we hope to get into GTK+ eventually.

Print Layout

This is very primitive right now, but you get the idea. Unlike the on-screen layout, this uses precise positioning. That allows you, for instance, to print in the correct places on a pre-printed form.

Most importantly, we need to add some way for fields (particularly lists of related records) to flow into each other, maybe using allowing them to be special objects in text blocks.

I implemented this, if you can call it implemented. I used goocanvas (via the goocanvasmm C++ bindings). I also rewrote the Relationships Overview using goocanvasmm. It also uses the EggToolPallete. I guess we should move it to the left to be consistent with the regular layout toolbar.

Windows Installer

Armin built Glom and its dependencies (apart from Avahi) on Windows and created an experimental installer.

Armin and Johannes also updated Glom’s client-only Maemo build.

What’s next

We need to finish the print layout and drag-and-drop features, and port to libgda-4.0.

I also want add a platform-specific alternative layout option, so one .glom file can have large layouts for regular PCs and small layouts for Maemo, for instance. I’ll probably get around to doing that for 1.10. On Maemo, I also want us to use the new UI elements in Maemo 5, if the Maemo SDK is released.

Trying to File Bugs for Fedora Linux

As much as I dislike Ubuntu’s Launchpad bug tracker, Fedora Linux seems to have made something worse.I guess they want to discourage people from submitting bug reports.

For instance, I want to file a bug about the Glom package. Here are some things I tried:

Go to Fedora’s package page for Glom (I had previously found this and put a link to it on glom.org):

  • That page has a View Bugs link at the left but that’s not about bugs for this package. I would have to find Glom in a huge multipage package list.
  • The Bug Reports link at the top is more useful, but it just shows (no) open bugs without allowing me to report one.
  • There is a Login link at the top right. Maybe I could do more if I was logged in, but there is no way to register.
  • The Report Bugs link at the left takes me to a Fedora Trac on fedorahosted.org but that page tells me “TICKET_CREATE privileges are required to perform this operation”. There is a login link, but no way to register to be able to login. Have I mentioned that I hate Trac.

Go to Fedora’s web site like a normal user (I googled):

  • I see no link to file a bug.
  • I tried the Get Help link but only saw information about IRC, mailing lists, forums, and documentation.
  • I tried the Communicate link. In the middle of that page (after information about IRC, mailing lists and man pages) there is a link to bugzilla.redhat.com. Clicking Enter A New Bug Report takes me to a big list of Linux versions, mostly Red Hat. There’s a list of Fedora stuff that’s almost as big. I chose the Fedora product, found glom in the list of components, and managed to file a bug. But glom is also in the list of components for the Fedora EPEL (Extras) product. Should I have filed it there instead?

On holiday, laptop down

I’m currently on holiday in North Berwick. It’s been fun but not quite as relaxing as hoped. Liam has started waking at night again after two months of sleeping through the night.

I’ve been getting up early to do a couple of hours work each morning, but this laptop’s hard drive has started hard crashing after a few minutes. Hard drives fail too often. Hopefully it will give me time to finish this blog entry and hit Publish. I guess I’ll be offline until I get back on Monday.