Motorcycle Adventures and Free Software

Weblog: Archive

2010-03-01 - 2010-03-31

CMS Watch on their Midgard usage

Posted on 2010-03-08 18:24:26 UTC in 3° 3.806 S 60° 6.420 W 10km NW of Manaus, BR to . 0 comments.

Which CMS does The Real Story Group Use? (Tony Byrne / CMS Watch):

The answer is, we use an open-source platform called "Midgard." We picked it nearly ten years ago, and it has held up fairly well.
...

One of the things we like about Midgard actually makes it rather unsuitable for many simpler publishing scenarios: it is highly object-oriented. This allows us to run multiple sites off largely a single codebase -- at the cost of quite user-unfriendly administrative and authoring facilities.

Also, Midgard is very much a development platform, and we have had to create a fair amount of custom code, especially to handle structured content. In that regard, our CMS experience probably resemble yours. As an industry we remain very far from plug-and-play content management technology for all but the simplest of websites.

While the post contains many negative points about older Midgard (the UIs are a bit better now than they used to be, quite a lot of development has since been happening especially in the LTS branch), it is remarkable that CMS Watch has been able to run their services through the same CMS setup for ten years. This really shows the durability and commitment to long-term stability we have in the Midgard community. We've been doing this for more than ten years, and will likely keep going for quite a bit longer.

As for usability and popularity of Midgard, there is quite little we can do about it in the Midgard1 area, as that is now in long-term support phase that won't allow major changes. But Midgard2 is a new world with new opportunities. Midgard's content repository is pretty much there already, as is the MVC layer, and this spring we should be able to unveil the new, quite revolutionary CMS concept as well. Watch this blog for updates!

Sponsored links

save money using, phone card

Getting started with the Midgard content repository

Posted on 2010-03-09 15:50:26 UTC in 3° 3.806 S 60° 6.420 W 10km NW of Manaus, BR to . 3 comments.

I'm doing a talk today in the Bossa Conference about using Midgard as a content repository for mobile applications. As part of my presentation I wrote some simple example code for using the Midgard APIs in Python, and thought they would be good to share to those not attending the event as well.

The idea of a content repository is that instead of coming up with new, isolated file formats or database setups for your application you can just work with objects and signals, and let Midgard handle the rest. This is something that lots of people are doing with CouchDB as well, but we feel Midgard, with its light footprint and native APIs for languages like Python, C, Vala and PHP fits better in the mobile applications context.

Installing Midgard

Midgard packages are available for many different Linux distributions through the OpenSuse Build Service. To find the right repository for your setup, go to the OBS project page. For example, on my Ubuntu Karmic netbook the URL to add to apt sources.list is deb http://download.opensuse.org/repositories/home:/midgardproject:/mjolnir/xUbuntu_9.10/ ./. Then I just:

sudo apt-get update
sudo apt-get install python-midgard2

Midgard is also available in Maemo extras and for OS X on MacPorts.

Defining a schema

The first thing when developing a Midgard application is to define your storage objects. This is done using the MgdSchema XML format. In this case we're doing a simple "attendee" object that amends Midgard's built-in person record with information related to the conference:

<?xml version="1.0" encoding="UTF-8"?>
<Schema xmlns="http://www.midgard-project.org/repligard/1.4">
    <type name="openbossa_attendee" table="openbossa_attendee">
        <property name="id" type="unsigned integer" primaryfield="id">
            <description>Local non-replication-safe database identifier</description>
        </property>
        <property name="person" type="unsigned integer" link="midgard_person:id">
            <description>Person attending the event</description>
        </property>
        <property name="registration" type="datetime">
            <description>Registration date of the attendee</description>
        </property>
        <property name="likesbeer" type="boolean">
            <description>Whether the attendee likes beer</description>
        </property>
    </type>
</Schema>

Then we just save this XML file into /usr/share/midgard2/schema/ so that Midgard will find it.

Initiating the repository connection

Once the MgdSchema is in place it is time to import antigravity and start hacking in Python. The code works pretty much in the same way in other languages Midgard is available for, but Python is used here for the sake of simplicity. First we load the Midgard extension:

import _midgard as midgard

Then we setup the repository connection. With these settings we will store our content into an SQLite database located in ~/.midgard2/data/midgardexample.db:

configuration = midgard.config()
configuration.dbtype = 'SQLite'
configuration.database = 'midgardexample'

# Open a Midgard repository connection with our config
connection = midgard.connection()
connection.open_config(configuration)

As this is the first time we're interacting with the repository we need to tell Midgard to prepare the storage for itself and also for our new openbossa_attendee class:

midgard.storage.create_base_storage()
midgard.storage.create_class_storage('midgard_person')
midgard.storage.create_class_storage('midgard_parameter')
midgard.storage.create_class_storage('openbossa_attendee')

Interacting with data

First we create a person object with our attendee:

person = midgard.mgdschema.midgard_person()
person.firstname = 'Leif'
person.lastname = 'Eriksson'
person.create()

Then we create our attendee object and link that with the person we just created:

attendee = midgard.mgdschema.openbossa_attendee()
attendee.person = person.id
attendee.likesbeer = True
attendee.create()

Querying data

Later we'll want to find out about all Leifs attending the event. We do this by using the Midgard query builder:

qb = midgard.query_builder('openbossa_attendee')
qb.add_constraint('person.firstname', '=', 'Leif')
attendees = qb.execute()

The query builder returns us a list of matching attendee objects. We can go through them and also fetch the associated persons:

for attendee in attendees:
    person = midgard.mgdschema.midgard_person()
    person.get_by_id(attendee.person)
    if attendee.likesbeer:
        print "%s, %s is attending the event" % (person.lastname, person.firstname)

Then we can update the persons with their email addresses:

    person.email = 'leif@vinland.no'
    person.update()

For basic data handling, that's it! When you need more, you can extend objects with file attachments or parameters. You can also create joined records using Midgard views. Midgard provides D-Bus signals, transactions, centralized metadata, synchronization and many other things.

First year of Qaiku, and a travel writing challenge

Posted on 2010-03-09 21:00:09 UTC in 3° 3.806 S 60° 6.420 W 10km NW of Manaus, BR to . 3 comments.

1st birthday of QaikuQaiku, the conversational microblogging service that launched a year ago had a refresh that launched today. While it hasn't yet convinced the twittering masses, it has already proven itself as a lot more thoughtful platform for the Finnish online community, and as a valuable workstreaming tool.

The new version looks quite nice and fresh. Notice the privacy information on the right-hand side, which is relevant as Qaiku allows channels and profiles that are private or invitation-only:

qaiku-onmytravels-small.png

Technically the new version is also remarkable as it is the first major website to run fully on top of the legacy-free Midgard2 platform. So yes, every entry you see there is a GObject. And D-Bus signals fly when you post.

On to the challenge, then

To highlight Qaiku's threading, conversational nature I started a new "On my travels, I have" thread for sharing your most extraordinary travel experiences. This is not on Twitter or Buzz as with Qaiku it is so easy to keep the conversation together and accessible for the future as well.

To contribute, sign up on Qaiku, go to the thread and add your experiences as a comment. If you have a link or picture to include, you can also do so. My first entry was:

seen ice descend from the heavens and provide us with cold beer on a hot day in Lesotho

Will be interesting to see what comes out of this :-)

Easier templating for Midgard 8.09

Posted on 2010-03-17 20:33:14 UTC in 60° 10.302 N 24° 55.686 E Helsinki, FI to . 0 comments.

For a while now there has been discussion about making template editing easier with Midgard CMS. In the Ragnaroek series we have a very comprehensive template system where all output from the system can be overridden. While the possibilities have not always been easy to discover, things should be better in the next Ragnaroek LTS release.

To access the template system just click Folder > Edit layout template in the Midgard toolbar:

midcom-toolbar-edittemplate.png

This will take you into Asgard, the Midgard administration interface. There you'll be shown what elements are used by the components running on your site:

asgard-template-possibleelements.png

Clicking on an element name will let you create it. Then you'll be shown the default contents of that element to make overriding them easier. The language used in the templates is obviously PHP:

asgard-element-defaults.png

When you save your element it will replace the component's default output in the folders using that particular style. You can also do nice things like including contents from another page using Dynamic Loading.

What about file attachments?

Asgard also allows you to add files (images, CSS, javascript, whatever) to your template. To do this click the Attachments button when you're in the style. There you'll be able to manage existing file attachments and to add new ones:

asgard-style-attachments-add.png

If you're dealing with a text-based file (CSS, javascript, XML, ...) Asgard will also allow you to edit it directly on the web:

asgard-edit-css-file.png

...and finally when you're done with your file and want to use it in some of your templates, the URL is available easily from the interface:

asgard-file-information-url.png

Content repositories: SQL or NoSQL?

Posted on 2010-03-29 11:08:31 UTC in 60° 10.566 N 24° 55.182 E Helsinki, FI to . 0 comments.

The NoSQL movement seems to be pretty active, advocating a move away from traditional relational databases:

...developers have become crippled by being able to only think of data in terms of Rows and Columns. There's a multitude of database paradigms: Graphs, Trees, Objects, and so on. Furthermore, databases limit developers to SQL, which is great for certain kinds of set mathematics and not much else. In order to overcome fundamental limitations of DBs, things like Conditionals, Iteration, String Manipulation, and more have been hacked into what was at first an elegant set mathematics language.

Algorithms (such as MapReduce) which make data analysis scalable are highly unintuitive in SQL. The limitations in the environment lead to a limitation in engineers' ability to solve "big data" problems.

This may be true if you're building the next Twitter or Facebook. But how many of us really do?
In the quite ranty article I Can't Wait for NoSQL to Die Ted Dziuba has a point:

by replacing MySQL or Postgres with a different, new data store, you have traded a well-enumerated list of limitations and warts for a newer, poorly understood list of limitations and warts, and that is a huge business risk.

This is exactly the reason we decided to build Midgard2 on top of a relational database. While it does constrain us in some cases, we can still provide a quite reasonably full-featured content repository this way.

And being built on SQL means we know the system scales down to mobile devices and all the way up to major business systems like Lufthansa's global marketing budget tracking. That is something very few NoSQL systems will be able to boast.

GeoClue 0.12 is out: Location awareness over D-Bus

Posted on 2010-03-29 11:26:54 UTC in 60° 11.286 N 24° 49.464 E 6km NW of Helsinki, FI to . 0 comments.

geoclue-200.png

After a long hiatus there was a new GeoClue release 0.12 last week. GeoClue is a D-Bus service that Linux applications can use to obtain user's current position and convert between human-readable addresses and coordinates. As location-aware services are becoming more important and computers more mobile the free desktops should also be aware of where they are.

Dadadi Blog writes:

Geoclue has a really nice feature, the master provider. It means geoclue can handle multiple sources of geoinformations. For example, you can get your position with your gps device, or with OpenCellId, or with webservices that will associate your IP address with a location (such as hostip). Geoclue master provider is able to choose the source with the best accuracy.

Geoclue is used at least in Empathy to publish your location to your contacts, and in WebkitGtk to support html5 geolocation.

It's been the first release in nearly two years, and it's great to see that nice project moving forward again. In this release, Nominatim has been added as a provider for geocoding and reverse/geocoding. It means it's possible to use nominatim service to get the position for a given address, or the opposite. There have been also many bugfixes and code cleaning, including a bug I've helped to resolve that prevented master provider from being usable in some configurations.

I'm also really happy to see GeoClue again moving on. It is important for the free desktop infrastructure to have such critical tools available as vendor-neutral D-Bus services instead of platform-specific libraries.

Update: ran into python-geoclue, a very handy Python convenience library for dealing with GeoClue that is a result from last summer's GSoC. Seems to work pretty well.

Swarms and networks in modern warfare

Posted on 2010-03-30 07:45:48 UTC in 60° 11.286 N 24° 49.464 E 6km NW of Helsinki, FI to . 0 comments.

Foreign Policy has a feature on the New Rules of War which talks about how warfare is transitioning to networked small units working together:

Liddell Hart, writing in 1935, predicted that at some point "the old concentration of force is likely to be replaced by an intangibly ubiquitous distribution of force -- pressing everywhere, yet assailable nowhere."

Now, swarming is making a comeback, but at a time when few organized militaries are willing or able to recognize its return. For the implications of this development -- most notably, that fighting units in very small numbers can do amazing things if used to swarm -- are profoundly destabilizing. The most radical change is this: Standing armies can be sharply reduced in size, if properly reconfigured and trained to fight in this manner. Instead of continually "surging" large numbers of troops to trouble spots, the basic response of a swarm force would be to go swiftly, in small numbers, and strike the attackers at many points. In the future, it will take a swarm to defeat a swarm.

This is actually quite close to what appears to be the Finnish doctrine. Small units or two-man fireteams navigating their way in the deep woods to converge on set objectives. When practicing with anti-tank weaponry there we used to disassemble the big missile systems and carry them on our backs, while Americans carry the same tools on humvees.

The idea of microenterprise applied to warfare. John Robb even called it "Open Source warfare".

Back