7th May, 2012

Extending Clutter-Box2d

The following is a block diagram of ClutterBox2dmm. It’s at a high level of abstraction, so most of the detail is lost. What’s of interest is that Cluttermm is stacked on top of Clutter and that there exists a Clutter-Box2d.

Clutter is the graphics library I use for first year C++. I’ll explain why some day. The Clutter library is written in C. Cluttermm contains the C++ bindings for Clutter. Therefore we can use the awesome accelerated graphics of Clutter in C++. Clutter also has a related library called Clutter-Box2d. The Clutter-Box2d library contains C bindings for the upstream (and awesome) Box2D C++ library. Box2D is used in many places including, I believe, in Angry Birds. Box2D has also been cloned in many languages such as JavaScript. On top of Clutter-Box2d, I mantain Clutter-Box2dmm which are C++ bindings to Clutter-Box2d (yes, C++ bindings to C bindings for a C++ library….but it does make sense).

I’ve just extended both Clutter-box2d and Clutter-box2dmm to support the IsFixedRotation() functionality in Box2d. This hack isn’t hard. It does require modifying the C library Clutter-Box2d and then modifginy the C++ library Clutter-Box2dmm on top of this. The relevent commits are here and here. If you need this feature in Clutter-box2dmm you currently have to compile from source. Get it whilst it’s hot.

Posted at 10:18 pm | Comments Off

2nd February, 2012

Clutter-box2dmm bindings updated to 0.12.1

I submitted a patch to Gnome bugzilla last night that updates the clutter-box2d C++ bindings so that they build against the current git master version of clutter-box2d. The patch is a little of a mess. However, this morning, I think the patch is a little less of a mess than I thought last night. Mainly because I managed to do the following on the train into work

Simply build one of the examples in the clutter-box2dmm folder.

I now have Fedora 15 & 16 packages for cluttermm, clutter-box2d and will have clutter-box2dmm later today. I’ll push these clutter-box2d* packages upstream to Fedora later, but I won’t hold my breath to see them approved. The approval process is a little unwieldy.

Posted at 10:22 am | Comments Off

1st November, 2011

Pipelines for visual programming languages

As a long time Unix user I’ve always found pilelines to be very useful. They allow you to build up extremely complex functions by sticking together much less complex parts. On Linux we put together commands and pipe the output into the next command. If you ask the question “How many mp3 files are there in this directory?” you can say “Ah, I know how to list all mp3 files, and I know how to count the number of lines in a list” then the answer becomes

$ ls -l *.mp3 | wc --lines

Pipelines can become arbitrarily complex. For example, the pipeline

$ cat /var/log/maillog | grep "status=sent" | grep -v phoric | wc --lines

counts the number of lines in my maillog that contain the text “status=sent” and omit the text “phoric” (my hostname). There is usually someone smart enough to write a shorter pipeline than what you’ve written, but that’s not the point. The point is that pipelines allow us to construct complex functionality by chaining together small programs.

If I were an academic (and I am), I’d probably generalise. I’d say somthing like, “pipelines have a source, they have many filter and translate actions and finally an action”. This, I believe, is a reasonable generalisation. In a pipeline, we often take some data, strip out the bits we don’t need, translate it into another format, maybe filter some more stuff and then finally do something. Such processes can be (relatively) easily turned into a visual programming language. The web application if this, then that is a simple visual programming language. Apple’s Automator is a more general visual programming language for such pipelines on OS X. And, going back to text-based pipelines, Window’s Powershell does away with much of the faffing about with text processing found in a Unix pipeline (by encapsulating the faffing in objects)

Get-ChildItem C:Scripts | Where-Object {$_.Length -gt 200KB} | Sort-Object Length

The powershell example is stolen from technet.microsoft.com.

Let’s say I have an application area in mind. It’s a technical area with highly complex theory such that we can expect the individual components of our pipeline to contain complex functionality. Lets take the world of audio and video processing. The words are technical, we can expect to mux (i.e. multiplex) and demux audio. And we can also expect to transcode it. Decoding, say, a flac stream and re-encoding it as a vorbis stream requires complex algorithms. Furthermore, the language is generally well understood by geeks, like you. So, how do I do exactly that. Open a flac file, decode it, re-encode it as a vorbis stream and save it to a file. Fortunatly, a pipeline based toolset for audio (and video) already exists. We’re going to look at GStreamer. It’s effectively a domain-specific programming language that could be easily implemented as a visual programming language (it previously has been, but the visual side wasn’t of use to anyone who could actually understand the domain). We want to look at how GStreamer makes constructing complex pipelines easy.

The following pipeline is the start of an answer our problem (it intentionally doesn’t work):

$ gst-launch filesrc location=song.flac ! flacdec ! vorbisenc ! filesink location=song.ogg

In the above example we construct the pipeline, where ! is the pipe symbol and launch it with gst-launch. Each of the pipeline elements, on their own, are simple to understand. A filesrc element reads a file at the specified location. A flacdec element decodes a flac stream. A vorbisenc element encodes something in to vorbis and a filesink element stores a stream back into a file. The above pipeline produces the error

WARNING: erroneous pipeline: could not link flacdec0 to vorbisenc0

This is brilliant. A major difference between a GStreamer pipeline and a Unix pipeline is that I get static checking. It can tell me, from the structure of the pipeline, whether the type of data produced by each element, can be consumed by the following element. This is brilliant because it saves time.

Imagine that my pipeline was much more complicated. Imagine that the pipeline encoded a long, high-quality, video (taking several hours) and then tried to do something specific with the audio stream. As a Unix pipeline it would look like

$ cat video.raw | encodevid | modifyaudio > video.webm

We would have to run this pipeline before we saw passing of data from encodevid to decodevid failed. So having some static checking a-priori (I’m an acadmeic, I’m allowed to use Latin) could save us a lot of time. Static checking, like in a programming language, also ensures that we are passing the right data into an element that handles that data.

Ok, so what’s a working pipeline for the above question?

$ gst-launch filesrc location=song.flac ! flacdec ! audioconvert ! audioresample ! vorbisenc ! oggmux ! filesink location=song.ogg

Note: there’s a much shorter pipeline, but this one makes most of the stages explicit. I was missing the audioconvert, the audioresample and the filesink steps. Once again, this is a very complex domain. Each of the elements in this pipeline are more simple to understand than the entire pipeline.

Let’s do something magic. Take the original flac file, convert it to 8-bit audio and re-encode it as a vorbis stream in an ogg container. Why? Well this is the point of pipelines. Someone might want to do this sometime. The pipeline architecture allows you to combine elements in ways that other people may not have considered, or simply don’t need.

$ gst-launch filesrc location=song.flac ! flacdec ! audioconvert ! audioresample ! capsfilter caps=audio/x-raw-int,channels=2,width=8,depth=8 ! audioconvert ! vorbisenc ! oggmux ! filesink location=song.ogg

I think that GStreamer is a well desiged, well implemented pipeline architecture for a complex domain. So how does it achieve what it does?

Each of the elements in GStreamer advertises its capabilities. Each element advertises the capabilities of what it accepts (eg: raw audio with sample freq > 8hHz and < 44kHz) and the capabilities of what it produces (eg: audio bit stream conforming to the vorbis spec). You can then do static checking on pipelines by ensuring the capabilities of what is produced by one element are a subset of those consumed by the following element. It's very neat.

How might you retrofit this into an existing set of complex Unix applications? You could add a --caps flag (or -caps if you insist on BSD style) to each of your applications. If you have no source, wrap them in a shell script that takes --caps. Make the caps option outupt the input and output capabilities of your pipeline elements. Bonus hipster points if this is outputted in JSON. Then write a my_static_checker that takes your pipeline as a string, checks it statically a-la-GStreamer (I’m allowed to abuse French, I’m an academic) and then executes the pipeline.

Why! Now we’re in a position to write a very domain-specific visual programming language. This could be useful in a lot of cases. Particularly in the case of at least one person I’ll be emailing this to.

Posted at 11:32 pm | Comments Off

26th September, 2011

Recording presentations

I have had a need to record lecture presentations. To this end I’ve hacked up some software which (a) takes a feed from a webcam, and (b) takes a PDF/ODF presentation and combines them into a WebM file.

For the code:

git clone git://gitorious.org/lecturec/lecturec.git

A simple overview:

Posted at 3:23 pm | Comments Off

25th March, 2011

A tough Q1 for open-source

You can feel the recession biting. It seems to have encouraged several companies to evaluate their open-source strategy. Actually, maybe that reasoning is a little too shallow. There are some deeper reasons we’ve seen Nokia, Google and RedHat change some of their practices. But let’s be clear from the start; some companies, like Nokia, have changed their whole strategy. Others, like RedHat, have made little corrections to their general practice. Nokia made their strategic decision based on failure and RedHat made their practice change due to success.

The Nokia thing. They’ve executed an entire U-turn on their open-source strategy. At a high-level their previous strategy seemed to be (as an external observer) to use their excellent QT toolkit to develop applications for their newly open-sourced Symbian platform for low to mid-range mobiles. Furthermore, they’d use the same toolkit to develop for their next-gen Meego platform. However, for reasons to do with both business and technology, they’ve decided that Windows Phone 7 is to be their next-gen platform of choice. Thankfully, the open-source nature of Meego means that we don’t loose the innovation that has been already contributed to the platform.

The reasons for Nokia’s change have been extensively covered in the computing press. My take is that the major consequence of this is an observation that all of our next-gen mobile platform providers are non-European (yes I’m discounting Symbian). So Android is from Google, WP7 from Microsoft, WebOS from HP and Blackberry from RIM. The first three are US companies, the last is Canadian. This, in my opinion, is a bad thing for Europe. Much of the Nokia R&D on Meego seemed to be outsourced to small to medium sized European companies. I know of at least three British companies (I have resided in the UK for a few years now) that did Meego development which was paid for by Nokia.

On Google’s Honeycomb decision. I’ve not decided yet if this is in response to

      The Chinese strawman argument, or
      Some deep-integration argument.

Maybe it’s both or neither. However, the Chinese strawman is the argument that if Honeycomb is open-source then many companies come along and produce poor-quality, but cheap, devices running the platform. Therefore, devaluing the perception of the platform. I believe that this argument is a poor one, hence I’ve called it a strawman. I don’t see how Android resellers can charge the 30% markup that one of their competitors can charge. Maybe this allows the small number of honeycomb licensees to bump up their margins slightly?

The deep integration argument is that honeycomb is bound to a specific platform like NVidia’s Tegra. Or, more interestingly, Google don’t think that you can do really high-quality UX design in an open-source fashion. There’s been a lot of talk about this lately in the open source world. About the open-source world being hostile to designers. One aspect of this has been the Canonical/Gnome argument. Where, it appears, that Canonical decided that the best way to design their next-gen desktop was to bring the design team in-house (it’s more grey than in-house -v- not in-house) whereas the Gnome team are (almost) entirely open and have even developed the fantabulous sparkle share tool for sharing designs between Gnome designers. What’s clear is that good UX design is hard. What’s unclear is whether being open-source makes good UX more difficult. I think that ThinkUp, Firefox and Gnome 3 make good design stories. For the record, I think Caonical’s Unity is interesting but doesn’t add anything to the point I’m trying to make.

I don’t know the ThinkUp people. But they seem to have a great attitude to encouraging contributions from people who might have traditionally found open-source hostile. From an external perspective, they seem to do great design in a small team and apply it to a hosted web application. Web designers are awesome. They’ve, arguably, made more design progress in the past ten years than desktop designers have made in the past thirty. Those of us who build fat (desktop) apps can then borrow their design ideas.

The Firefox devs are entirely different. It’s a massive project. They have different design constraints than ThinkUp, particularly as they have such a massive install base on so many different platforms. Furthermore, Mozilla has a lot of cash to spend on both user testing and a team of UX desigers. I like Firefox 4. I think you can see the fruits of incremental, good design.

The design community I’m most familiar with are the Gnome 3 designers. What they’ve done in the past six months is amazing. Furthermore, unlike the small integrated team at ThinkUp or the large on-site team at Mozilla, the Gnome design team is distributed (in terms of geography and companies) but well-integrated.


This picture speaks more than a paragraph of text. It shows a clean and consistent desktop. Yes there are a few unpolished edges, but the software hasn’t been released yet. What’s interesting is to observe the “traditional code geeks” talking to the UX designers. Changes to the UI or the UX are, more often than not, bounced off one of the designers. And, more interesting, is that the ideas that the UX designers communicate are being internalised by the developers. Ok, so very few of these developers will ever be kick-ass designers. However, by internalising the design ideas you can see a commitment to bringing fresh UX ideas on board and the value that the developers place on the design team. They’re highly valued and stunningly smart people.

So as usual I started off talking about how this Q1 has been tough for open-source. However my internal optimist has trumped my internal cynic. Nokia and Google may make decisions about their open-source policy, but they’re not the only places that are (or were) doing excellent open-source design and engineering. The loss of Nokia from our ecosystem will be keenly felt. But Intel are pressing forward with Meego and the design ideas that come from Meego are finding their way into Gnome 3 (and vice-versa).

Posted at 11:18 am | Comments Off

13th March, 2010

“Irish Revolutionism is Half-Baked”

The above is the title of an excellent article by Constantin Gurdgiev in the March-April edition of Village Magazine. I’ll link to it when it comes available online (if it ever does!).
Best line: “We have never learnt that any vested interest, no matter how small, must be treated at a political level as a monopoly-seeking cartel.”

It’s likely that I disagree with most of Mr Gurdgiev opinions, but this piece expresses very clearly what I believe to be a serious issue in Irish society: those who seek to influence politicians are generally doing so for selfish reasons.

Posted at 2:09 pm | Comments Off

10th October, 2009

Reconstituting the Oireachtas

Following a discussion with a colleague of mine, Cormac Daly, I drew up this document describing a proposed reform of the Oireachtas. In June 2009, I submitted it to the Department of the Environment for consideration.

Posted at 12:46 am | Comments Off

21st July, 2008

Global Posts

I just installed the sitewide tags plugin and it’s generating the global posts pages here with everyone’s posts. Those pages aren’t indexed by Google so there’s no fear of duplicate content issues. It does have a feed so it’s a simple way of subscribing to all the posts here.

Posts may take a short while to appear on the tags pages as they’ll be cached by the supercache plugin.

Any comments or suggestions?

Posted at 9:15 am | Comment (0)

11th December, 2007

Linux.ie blogs are still alive

Here’s a short note to announce that blogs.linux.ie has been updated to the very latest WordPress MU. It is also running WP Super Cache which should help reduce load on the server. So far, things are flying along but we’re not done yet.

  1. Registration is currently closed and I have to hook in the ILUG mailing list check before it goes live again.
  2. You can have any WordPress theme you want, as long as it’s the default Kubrick theme. Suggestions welcome. Any theme with paid links will not be considered. No theme editing will be allowed for security reasons.
  3. Images haven’t been moved into place just yet, but they are safe. It’s going to take a little mod_rewrite magic to get them working again because of the differences in upload paths.
  4. Difficulty logging in? If you logged in as “admin” previously, login as the name of your blog now. For example, Ken will login as “kenguest” now. Your password is the password your “admin” user had. There’s also a forgot password link to retrieve your password, but if all else fails, email me at “donncha at linux.ie” with details of your blog and login.

Hopefully you’ll find the new site better, you’ll enjoy using the new features of WordPress 2.3.1, including tagging, post auto save and many more upgrades!

Posted at 6:19 pm | Comments Off

12th April, 2005

Quis custodiet custodiens?

The following is the text of a letter I sent to the editor of the Irish Times on the 11th March, 2005. To my knowledge, the Irish Times didn’t publish it.

=====================

The Guildford Four, the Maguire Seven and the Birmingham Six were all imprisoned for lengthy sentences on terrorist charges that were eventually shown to have been false.

In November 2004, at the behest of the Governments of Italy and Switzerland, the FBI raided the data centre of the Indymedia organisation in the UK, under the pretence of a counter-terrorism investigation. The disks confiscated appear to have contained information relating to Indymedia’s investigations of Italian and Swiss police agents who are alleged to have been attempting to stir-up violence during so-called anti-globalisation protests.

In March of 2004, Adam McGaughey, of the fan website SG1Archive.com was charged with breaking U.S. federal copyright laws. The USA PATRIOT Act was used to facilitate the FBI investigation. Intended as a measure to protect the public from terrorist threats, the USA PATRIOT Act allows investigators to operate in ways that would be prohibited under other legislation. Its measures are, one by one, being invalidated as being counter to the US Constitution. Yet, the provisions were used to investigate a copyright case, and at the behest of MGM and the Motion Picture Association of America.

In 1996, the American Society of Composers, Authors & Publishers (ASCAP) demanded royalty money from, among others, Girl Scouts for singing songs around campfires.

(more…)

Posted at 1:46 pm | Comments Off