Motorcycle Adventures and Free Software
Henri Bergius
Biker, free software consultant, neogeographer

There is a total of 768 posts.

Weblog: category "midgard"

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 :-)

Sponsored links

Microsoft Certification Exams โนเกีย Nokia มือถือ Online Project Management save money using, phone card
Reviews มือถือ Mobile All Apps

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.

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!

Register and log into meego.com using your maemo.org account

Posted on 2010-02-24 13:57:09 UTC in 60° 10.080 N 24° 55.578 E Helsinki, FI to . 4 comments.

MeeGo is the new mobile Linux platform developed by Nokia and Intel. As the community is forming up, we thought that it would be good to enable people to use their maemo.org identities also on the MeeGo web services (as well as on any other OpenID enabled website). For this, let me introduce Maemo's OpenID provider.

First of all, go to meego.com and click login:

meego-login.png

Select the "Log in using OpenID" option, and provide your maemo.org OpenID URL:

meego-maemo-openid.png

Then the request will be redirected to maemo.org where the site will check your credentials and ask whether to relay your information on to meego.com:

maemo-openid-meego.png

And that's it, suddenly you can use your maemo.org account with meego.com!

 

The same OpenID provider component can also be utilized on any other Midgard-powered website.

Going to the Bossa Conference

Posted on 2010-02-23 12:38:44 UTC in 60° 10.194 N 24° 56.304 E Helsinki, FI to . 0 comments.

Bossa Conference, an event about mobile development with free software technologies will be held on March 7th-10th in Manaus, Brazil. This year I'm speaking about using Midgard as a replicated storage layer in mobile applications, with examples for multiple programming languages and toolkits.

The idea behind the Midgard content repository is that instead of coming up with your own file formats you can just keep working with objects and signals, and let the repository deal with the rest.

bossaconference-small.png

It is always fun to go to Brazil and meet the vibrant free software community there. The plan is to fly over this weekend, spend a few days in Sao Paulo and then head for the Amazon. Feel free to ping me if you're around.

Halti.com provides contextual product recommendations

Posted on 2010-02-10 15:33:05 UTC in 60° 9.984 N 24° 55.050 E Helsinki, FI to . 0 comments.

Last week the Finnish outdoor brand Halti launched a pretty interesting web service. While many outdoor brands focus on extreme sports that don't really have much to do with the reality of most of their customers, Halti connects their product lineup to the needs of the site visitor by utilizing both weather and location. This means where ever they are or are planning to go, they can get product recommendations personalized to their needs:

halti-small.png

This is another case of location context being used to serve users better. To figure out where the user is coming from the site uses a combination of IP positioning and browser geolocation, while weather information comes from Foreca's feeds. Map visualization uses CloudMade's OpenStreetMap-based maps. And of course the whole thing runs on the stable Ragnaroek series of Midgard.

In other news, Jos et jaksa is another pretty interesting recent site launch, especially for the fact that it is the first-ever website running on the legacy-free Midgard2 platform and Midgard MVC.

Direct manipulation interfaces

Posted on 2010-01-21 13:26:44 UTC in 60° 9.810 N 24° 55.680 E Helsinki, FI to . 0 comments.

There certainly is a lot of buzz about Apple's rumored Tablet product. Daring Fireball writes:

If you’re thinking The Tablet is just a big iPhone, or just Apple’s take on the e-reader, or just a media player, or just anything, I say you’re thinking too small — the equivalent of thinking that the iPhone was going to be just a click wheel iPod that made phone calls. I think The Tablet is nothing short of Apple’s reconception of personal computing.

What I find most interesting are the view that the Tablet may bring new computer interaction paradigms. Again from Daring Fireball:

Our “desktop” computers’ human interfaces haven’t fundamentally changed since 1984 — keyboard and mouse/trackpad for input, overlapping draggable resizable windows on-screen, and a hierarchical file system where you create and manage “document files”. Have you ever sat back, scratched your chin, and wondered when the computer industry will break free of these current interfaces — which can be a hassle even for experts, and downright confusing (e.g. click vs. double-click) for the non-experts? Surely no one expects the computer interfaces of, say, 50 years hence to be based on these same metaphors and input methods. What’s the next step?

A touchscreen tablet isn't really suited for the WIMP paradigm as for example text entry is quite difficult, and you probably want larger, thumb-friendly user interface elements. This is where Microsoft's Tablet PC initiative failed, trying to bring the regular WIMP user interface to the tablet.

Instead what seems to be happening is that all the Wiis, iPhones, and N900s are now heading us towards a post-WIMP world. Instead of indirect manipulation by mouse and keyboard we can now interact with our applications using the more natural ways of touching things on screen or moving the device around.

This innovation will not be limited only to mobile APIs, web applications can already now know whether user is accessing them via a WIMP system or a touchscreen device thanks to CSS media queries and Javascript orientation events in latest Firefox.

The user interface innovation that is arriving thanks to these new interaction possibilities is quite promising, though it will probably take a while before we know what things actually work, and what are just fun demos.

If you're thinking about new kinds of user interfaces, it might be a good time to read papers like Noncommand User Interfaces (Jakob Nielsen, 1993) and Magic Ink (Bret Victor, 2006).

I certainly am as we are in the process of defining a new kind of CMS UI for Midgard 2.

Update: Gizmodo has a very nice article on Jef Raskin's information appliance concept and the evolution of GUIs.

Midgard in 2009

Posted on 2009-12-31 11:23:35 UTC in 60° 10.572 N 24° 55.206 E Helsinki, FI to . 0 comments.

Vali raising a toast2009 was a pretty active year for the Midgard content repository project, and so it is good to take a look at some of the highlights:

Happy new year to everybody in the Midgard world!

Easy user location with Midgard

Posted on 2009-12-02 14:08:41 UTC in 60° 9.798 N 24° 55.674 E Helsinki, FI to . 0 comments.

Location is an important context that web services can utilize for fun or smarter user interaction. In past getting location used to be difficult, but now thanks to good IP locationing databases and browser geolocation capabilities it is becoming a lot easier.

But to be really easy, the framework you're using should provide user's location built-in, without you as an application developer having to think about it. This is the reason for Midgard's geolocation features to exist, after all. With Midgard, getting user's location is quite easy:

Midgard MVC (Midgard 9.09)

// Read location from session or user's location log
$user_location = midgardmvc_helper_location_user::get_location();
if (is_null($user_location))
{
    // No location found, try to geocode based on user IP via the GeoPlugin service
    $geocoder = new new midgardmvc_helper_location_geocoder_geoplugin()
    $location_parameters = array('ip' => $_SERVER['REMOTE_ADDR']);
    try
    {
        $user_location = $geocoder->geocode($location_parameters);
        midgardmvc_helper_location_user::set_location($user_location);
    }
    catch (Exception $e)
    {
        // Couldn't get location from IP
    }
}

if (!is_null($user_location))
{
    echo sprintf('You\'re in %s, %s', $user_location->latitude, $user_location->longitude);
    // Will print "You're in 60.1633, 24.9279"
}

MidCOM (Midgard 8.09)

<?php
// Read location from session or user's location log
$user_location = org_routamc_positioning_user::get_location();
if (is_null($user_location))
{
    // No location found, try to geocode based on user IP
    $geocoder = org_routamc_positioning_geocoder::create('geoplugin');
    $location_parameters = array('ip' => $_SERVER['REMOTE_ADDR']);
    $user_location = $geocoder->geocode($location_parameters);
    if (!is_null($user_location))
    {
        // Store geocoded location to session or user's location log
        org_routamc_positioning_user::set_location($user_location);
    }
}

if (!is_null($user_location))
{
    echo sprintf('You\'re in %s, %s', $user_location['latitude'], $user_location['longitude']);
    // Will print "You're in 60.1633, 24.9279"
}
?>

The examples above will work with both anonymous site visitors (using sessions) and registered users (using Midgard's position log). In this example we check if location is already available via browser geolocation or some importer like Qaiku or Fire Eagle, and if not we fall back to IP-based positioning using the GeoPlugin service. The resulting user location array or object (depending on Midgard used) contains a textual description of the place and accuracy information in addition to WGS-84 coordinates.

Using MidCOM3 with FirePHP

Posted on 2009-11-23 16:52:54 UTC in 60° 10.272 N 24° 55.956 E Helsinki, FI to . 0 comments.

Firebug is a Firefox extension all web developers are familiar with. Now when developing with the MidCOM3 MVC framework it is possible to get your debug information straight from Midgard to Firebug:

midgard-firephp-small.png

This is built on top of the excellent FirePHP extension, which helps you get data not only from regular web pages but also from AJAX requests.

Currently we send all logged information plus details about current route and templates being used. To use this, install FirePHP in your Firefox, FirePHPCore from PEAR packages, and enable development_mode in MidCOM3 configuration.

I'm considering to port this also to Ragnaroek.