Motorcycle Adventures and Free Software
Henri Bergius
Biker, free software consultant, neogeographer
  • Nemein
  • Bergie, in 53° 18.834 N 13° 51.756 E Prenzlau, DE back in Helsinki after the Symfony CMF hackday and a nice week in Paris
  • +358 40 525 1334

Upcoming trips

Bergie's Home Page and Weblog

This site is the personal blog of Henri Bergius. Subjects discussed include content management, social web integration, neogeography, information society and motorcycle adventures. Henri's profile and consulting services are also available.

For more real-time updates you can also follow my Qaiku profile (feed).

Latest weblog entries

Using Composer to manage dependencies in Heroku PHP apps

Posted on 2012-05-08 10:18:54 UTC in 53° 18.834 N 13° 51.756 E Prenzlau, DE to . 0 comments.

Heroku is a very nice Platform-as-a-Service provider that allows you to focus on writing applications instead of managing servers. If your application code is already managed in Git, in most cases you only need to create a Heroku app setup, and then git push to deploy it on Heroku. Scaling your app is easy and there are many useful add-ons available in their "app store".

While Heroku got its start from hosting Ruby on Rails applications, it nowadays supports many different environments in the Cedar stack. Node.js is what many use, but they also do support PHP.

Dependency management is easy for Node.js applications as Heroku recognizes your package.json files and automatically installs the libraries needed via NPM.

Until now PHP developers haven't had this convenience, but as Composer is emerging as the default PHP package manager, I've now added support for it. Before the pull request gets accepted, Composer dependency handling can already be used by specifying my custom PHP buildpack when creating Heroku apps.

I've written a simple example app to show how this works.

First you need to create the folder for your app and make it a Git repository:

$ mkdir myapp
$ cd myapp
$ git init

Then create the Heroku app using a custom buildpack (when the pull request is accepted you can skip the buildpack definition):

$ heroku create -s cedar --buildpack https://github.com/bergie/heroku-buildpack-php.git my-cool-app

Then it is time to write your composer.json file. In this case we'll only depend on the urlize library:

{
    "require": {
        "php": ">=5.2.0",
        "midgard/midgardmvc-helper-urlize": "*"
    }
}

For Heroku to recognize the app as a PHP one, you also need to have an index.php. In this case with the following code:

<?php
// URLizer service
require 'vendor/midgard/midgardmvc-helper-urlize/interface.php';
if (isset($_GET['urlize'])) {
    $data = array();
    $data['from'] = $_GET['urlize'];
    $data['to'] = midgardmvc_helper_urlize::string($_GET['urlize']);
    header('Content-type: application/json; charset=utf-8');
    die(json_encode($data));
}
header('Content-Type: text/html; charset=utf-8');
?>
<h1>Urlizer service</h1>
<form method="GET">
    <label>
        String to URLize
        <input name="urlize" type="text" />
    </label>
    <input type="submit" value="URLize" />
</form>

Now add and commit these files, and then deploy to Heroku:

$ git push heroku master

You should see that Heroku notices the Composer dependencies and installs them:

-----> Heroku receiving push
-----> Fetching custom buildpack... done
-----> PHP app detected
-----> Bundling Apache version 2.2.22
-----> Bundling PHP version 5.3.10
-----> Installing Composer dependencies
Installing dependencies
  - Package phptal/phptal (dev-master)
    Cloning e146361f25b8672d364695b757eddf1c169e05d2

  - Package midgard/midgardmvc-core (dev-master)
    Cloning 2b00d38cb2fea42c8f9791c5ecc7270dc81182e8

  - Package midgard/midgardmvc-helper-urlize (dev-master)
    Cloning 92d0c8c638c389b7be1887ca67cd334f51932912

midgard/midgardmvc-core suggests installing ext-midgard2 (>=10.05.5)
Writing lock file
Generating autoload files
-----> Discovering process types
       Procfile declares types -> (none)
       Default types for PHP   -> web
-----> Compiled slug size is 13.2MB
-----> Launching... done, v13

And that is it! You can see an example of this app at http://urlizer-service.herokuapp.com/.

Sponsored links

save money using, phone card

Decoupled Content Management on tour

Posted on 2012-04-13 10:14:30 UTC in 53° 18.834 N 13° 51.756 E Prenzlau, DE to . 0 comments.

It seems the idea of Decoupling Content Management is gaining momentum. On the user interface side, many projects have already adopted the VIE interaction framework and widgets from Create, and in the content repository space projects like PHPCR move forward and there are also interesting new ideas like Apache Oak.

While much of this has been made possible by the IKS project, it is also great to see the wider CMS community getting more active in the space. Part of this momentum is also apparent in how many communities want to learn more about these ideas.

Here are some upcoming events where decoupled CMS will be present:

If your community is interested in learning more, get in touch or follow my tweets from these events. And obviously I'm looking forward to meeting many of you in these events.

Open Advice

Posted on 2012-03-19 10:51:12 UTC in 52° 29.400 N 13° 25.272 E Berlin, DE to . 0 comments.

Open Advice coverI seem to have not blogged about this, but Open Advice, our book on Free and Open Source Software: what we wish we had known when we started, was published last month.

The book was edited by Lydia Pintscher and includes essays from 42 authors, many of whom you'll recognize if you tend to go to FOSS conferences. The LWN book review concludes:

Open Advice is a book that will be helpful to those who are new to FOSS, but, because of the individual voices, styles, and tones, it doesn't read like a "how to". It could even be recommended to those who aren't necessarily interested in contributing, but are curious about what this "free software thing" is all about. It is, in short, a great book for a variety of audiences and the (mostly) two or three page essays make it easy to read, while the anecdotes and recollections personalize it. The authors, editor, and everyone else who helped should be very pleased with the result. Readers will be too.

I probably shouldn't give the ending away, but my essay on cross-project collaboration, a subject I've also blogged about, ends with:

Good luck with breaking down the project boundaries! In most cases it works if your ideas are good and presented with an open mind. But even if you do not find a common ground, as long as your implementation solves the use case for you it has not been in vain. After all, delivering software, and delivering great user experience is what counts.

The book is licensed under CC-BY-SA, and is available as free download in ePub, mobi and PDF formats, and as paperback from Lulu. The book sources are available on GitHub, patches welcome!

VIE and Create: an update

Posted on 2012-03-16 17:55:39 UTC in 52° 29.400 N 13° 25.272 E Berlin, DE to . 0 comments.

It is again time to write an update on the state of IKS's two main components for the semantic editing part of Decoupled Content Management:

  • VIE is the base semantic interaction library that handles the site's content model through RDFa annotations and Backbone.js synchronization
  • Create is a new kind of web editing interface built on top of that.

As the IKS project has entered its fourth year, both of these projects have gained maturity and contributions from many IKS partners and early adopters.

New UI for Create

While Create can be used for building any sort of custom user experiences (as seen in the CMS integration examples below), it also ships with a default user interface. Nemein's Riku Virta has designed a new UI concept that is currently being discussed on the CreateJS mailing list.

This interface builds on top of the original Create UI and Liip's UX work, and aims to provide more area for CMS-specific functionality and better touchscreen support:

create_new_ui.png

See the full UI concept in the slideshow on Google Plus.

We hope that we will be able to land this new UI still within the March-April timeframe.

VIE: 2.0 and onwards

VIE is now nearing the 2.0 release, with the first RC expected for the end of this month. After that we'll have a hackathon in Saarbrucken, Germany where the plan is to focus on things that we've targeted for a 2.1.

The main feature of VIE 2.1 is a new way of handling RDF literals. This will make it easier to interface with services like DBpedia that give us data in multiple different languages. This will enable you to do things like:

var eiffel = vie.entities.get('dbp:Eiffel_Tower');
console.log(eiffel.get('label')); // Eiffel Tower

vie.setLanguage('fi');
console.log(eiffel.get('label')); // Eiffel-torni

The final API for this is still being discussed on the VIE mailing list.

Create and Hallo are now easier to integrate

Both Create and Hallo, our minimalist rich text editing tool now provide merged JavaScript files for easier integration. You can find the merged files, and also minified versions in:

Thanks to contributions from Alkacon, Create's widget selection mechanism is now much more configurable. This allows CMS developers to provide different editing tools for different types of information.

The currently bundled editing interfaces provide integration with Hallo, and also with the 0.20 version of Aloha Editor (though you will need to install Aloha separately to use it due to licensing restrictions).

CMS developers will also benefit from Blogsiple, the new integration testbed for Create and VIE. Blogsiple aims to be a very simple blog system built on top of Node.js that shows all the necessary integration points for supporting the whole range of VIE and Create features.

CMS adoption

As both VIE and Create improve, so does their adoption in different Content Management Systems. For example, here is the new OpenCms user interface built on these tools:

Polymedia's video annotation example is also interesting demonstration of VIE in a completely different kind of CMS environment, as is WordLift by InSideOut10.

The IKS Early Adopter program is still open if you're interested in getting support for using these tools in your CMS. There will also be an IKS event in Salzburg on June 12-13 where we will be able to show more.

Hacker-nomadism

Posted on 2012-03-16 17:40:39 UTC in 52° 29.400 N 13° 25.272 E Berlin, DE to . 0 comments.

I build software for a living. This means creating the new generation of Content Management interfaces in the IKS Project, developing custom client applications at Nemein, and building the first cloud-based record label at Music Kickstarter.

As my office is where my laptop is, none of this work is particularly tied to a physical location. And as much of the work is communicating, I end up spending quite a lot of time traveling between meetings and conferences.

For this my previous home town of Helsinki, Finland wasn't quite ideal. From an European perspective, Finland is an island. And so I've accumulated airmiles instead of being able to travel more comfortably (and productively) on the European railway network.

I've previously dabbled with living in other locations like Istanbul and Saint Petersburg, but this time I hope the move will be more permanent: in the beginning of this month we packed our stuff, got rid of the Helsinki flat and hopped on a plane to Berlin.

berlin-bears.png

The modern world makes this easy: my whole library fits on a Kindle and music collection on Spotify, version control and testing happens in the cloud, and banking and invoices are on the web. And thanks to EU there is minimal red tape in setting yourself up anywhere in Europe.

My current setup is such: I'm traveling with about two weeks' worth of clothes, my trusty work laptop, and tablet with an amazing 18 hour battery life. Accommodation happens in furnished, short-term rental apartments, and Internet comes from an old N900 serving as a WiFi access point via prepaid 3G.

While Berlin has excellent co-working spaces, I'm currently sharing office with Content Control, the local Midgard shop. Though at the time of writing my office is temporarily relocated to the nearby Hasenheide park where there is a nice sunny spring day.

hasenheide-park-hacking.png

I'm still planning on popping into Helsinki every now and then. With Air Berlin, the travel cost and distance is almost the same as if I lived in the Finnish city of Tampere (yeah, VR is expensive). Once the snows there melt, I'll also ride my motorcycle over.

If things work out, I may be eventually able to say: ich bin ein Berliner. This city is quite amazing - the amount of cultural activities and hacker meetups probably beats any other place in Europe right now. If you're around, ping me!

And if Berlin doesn't work, then there are lots of other interesting places for a working nomad...

CreateJS is moving forward

Posted on 2012-02-13 12:40:56 UTC in 52° 30.246 N 13° 19.818 E 5km SW of Berlin, DE to . 0 comments.

As you probably know, we at IKS have been working to decoupled content management through semantic technologies. CreateJS, together with the VIE library provide the user-facing part of this approach.

Traditional content management has been very monolithic, meaning that by choosing a particular editing interface, CMS users also have to take the web framework, programming language and content storage mechanism mandated by the developers of their system. By splitting the CMS to the separate concepts of user interface, web framework, and content repository we can provide implementers a greater degree of freedom, and allow CMS developers to focus on the functionality where they can best make a difference.

What is Create?

With CreateJS, content management system developers can provide a simple, fast, and modern editing interface to their end-users. The UI is completely built in JavaScript, and can be integrated with three easy steps:

  1. Mark up your pages with RDFa annotations
  2. Include VIE and Create into the pages
  3. Implement Backbone.sync with your CMS back-end

Create provides functionality like in-page content editing, managing of content collections (like article lists), running workflows for content, and handling images and content tagging. The jQuery UI plugin -based structure allows CMS developers also to implement their own additional functionality. This also makes it possible to either use the whole Create UI as-is, or just to take the parts of it that fit the UX concept of a system.

The Create UI was initially made for Midgard CMS, but has since been generalized so that it works anywhere. This approach has already gained some popularity, with CreateJS widgets being used in projects like Symfony CMF, Drupal, and OpenCMS.

The January hackathon

To push CreateJS forward we organized a hackathon in Zurich, Switzerland in the early January. Participants came from different IKS project partners and CreateJS early adopters.

Some of the results were:

Image insertion, link management, and content tagging have been designed to work together so that they can find about annotated entities thanks to the Apache Stanbol engine and provide intelligent suggestions on related content.

Moving forward

The important next step is to consolidate all these changes into the CreateJS codebase and to ensure that everything works smoothly together. Our continuous integration setup would also benefit from a larger number of tests.

After that we can consider new features, including things currently under discussion.

Helping CMSs to integrate this common user interface (or parts of it) is also a major task for this year. If you're interested in using CreateJS for your system, be sure to let us know! And also follow the progress on GitHub.

Open Mobile Linux, this Saturday in FOSDEM

Posted on 2012-02-02 08:55:37 UTC in 60° 9.792 N 24° 55.662 E Helsinki, FI to . 0 comments.

As mentioned in the earlier call for presentations, we're running a track on Open Mobile Linux in FOSDEM this Saturday. Room AW1.120 at the ULB campus in Brussels. From the CfP:

Our primary goal is to facilitate meetups, collaboration and awareness between different projects and communities within Open Mobile Linux and provide a place to present directions, ideas and your projects themselves.

By Open Mobile Linux we mean any open source projects revolving around typical non-desktop/server Linux, such as handsets, tablets, netbooks or other creative uses. Examples of such projects could be Qt5, Mer, MeeGo, Android, webOS, Plasma Active, Tizen, Boot to Gecko, SHR and other related efforts.

There are several exciting things happening in this space, including the recently announced Spark tablet, open sourcing of webOS's Enyo framework and continuing interest in the Maemo platform. Saturday's program includes:

If there are any last-minute announcements or happenings that people want to discuss, we may be a ble to squeeze in a talk or two. Contact Carsten about this.

Also, if you want to chat other things (like PHPCR or CreateJS), I'll be around the whole weekend including the beer event. Drop me an SMS.

Looking forward to seeing as many of you there as possible!

Midgard2 PHPCR provider hits 1.0

Posted on 2011-12-23 10:03:14 UTC in 60° 9.792 N 24° 55.662 E Helsinki, FI to . 0 comments.

I'm happy to announce that we were able to release the first stable version of the Midgard2 PHPCR provider yesterday.

Simply put, PHPCR is the future of Midgard's PHP API. Instead of having our own repository APIs, we follow the well-documented and tested PHP Content Repository specification. This allows much better compatibility with other projects, and for example the possibility to choose whether to store contents in Midgard2 or Apache Jackrabbit on per-deployment basis. This obviously doesn't mean that the current Midgard2 API is going away, but just that there is something better and more compatible available on top of that.

PHPCR provides a nice set of capabilities that are either similar to, or surpass the traditional Midgard features:

  • Your content model is constructed out of a tree of Nodes that can contain other Nodes or Properties
  • Properties can be of many different types, including the typical strings and floats, but also binaries (similar to our blobs) and dates
  • Properties can be multivalued (think of multiple images in same property, or a person having multiple emails)
  • Queries can be either constructed with Query Object Model or SQL2
  • Queries support tree constraints (ISDESCENDANTNODE, ISCHILDNODE) and joins
  • Content can be exported and imported via a standard XML format
  • There is a comprehensive Node Type system that allows you to define your content model. The full definitions can be read and introspected via PHP
  • Nodes also support mixins, allowing you to add per-object metadata
  • There are also the unstructured nodes (nt:unstructured) for cases where you don't want to have constraints on what to store and how

On top of PHPCR, there is also a Doctrine ODM that the Midgard2 provider also supports. That gives you more capabilities, like:

Some code examples: https://github.com/bergie/phpcr-midgard2/tree/master/examples

You can see Midgard's test status for both SQLite and MySQL storage back-ends in our Continuous Integration environment: phpcr-midgard2.png

Once you have Midgard2 and our PHP extension available, installation is easy. Add a composer.json file into the root folder of your project:

{
"require": { "midgard/phpcr": ">=1.0" }
}

Install with Composer:

$ wget http://getcomposer.org/composer.phar
$ php composer.phar install

Copy MgdSchemas:

$ sudo cp vendor/midgard/phpcr/data/share/schema/* /usr/share/midgard2/schema/
$ sudo cp vendor/midgard/phpcr/data/share/views/* /usr/share/midgard2/views/

...and then just start using the repository in your application. PHPCR can obviously be used side-by-side with traditional Midgard2 or other PHP code.

What will happen next:

  • Support for PHP 5.4 and Postgres (needs work on Midgard2 level)
  • Performance optimization
  • Features work, including versioning
  • More tools for PHPCR. Think of Asgard that would allow you to work with any repositories!
  • PHPCR support built-in for MidCOM and MVC?

For those interested in learning more about PHPCR, there will also be a Paris meetup in mid-January.

Using CoffeeScript for GNOME development

Posted on 2011-12-16 16:04:16 UTC in 47° 48.570 N 13° 3.300 E Salzburg, AT to . 0 comments.

In Suski's blog I saw a question on whether developing GNOME apps would be possible in CoffeeScript. The answer is yes. I wrote a quick example back in Desktop Summit:

# GObject Introspection APIs are available from imports.gi.Modulename
Gtk = imports.gi.Gtk

# For GNOME 3.2+ this should be Gtk.init null, 0
Gtk.init 0, null

win = new Gtk.Window
type: Gtk.WindowType.TOPLEVEL
win.set_border_width 10
win.connect "destroy", (widget) ->
Gtk.main_quit()

button = new Gtk.Button
label: "Hello, world"
button.connect "clicked", ->
button.set_label "Bar"
win.add button

button.show()
win.show()

Gtk.main()

Gjs doesn't run CoffeeScript directly, so you need to convert this before running:

$ coffee -c window.coffee 
$ gjs window.js

You should see something similar to:

gjs-coffee-example.png

Call for presentations: Open Mobile Linux at FOSDEM 2012

Posted on 2011-12-14 09:46:57 UTC in 47° 48.570 N 13° 3.300 E Salzburg, AT to . 0 comments.

At FOSDEM 2012 we will have a devroom related to Open Mobile Linux. Our primary goal is to facilitate meetups, collaboration and awareness between different projects and communities within Open Mobile Linux and provide a place to present directions, ideas and your projects themselves.

By Open Mobile Linux we mean any open source projects revolving around typical non-desktop/server Linux, such as handsets, tablets, netbooks or other creative uses. Examples of such projects could be Qt5, Mer, MeeGo, Android, webOS, Plasma Active, Tizen, Boot to Gecko, SHR and other related efforts.

We have the room AW1.120 with 74 seats, a video projector (VGA), wireless internet on Saturday 4th February for a total of 8 hours.

The format we will be utilizing is lightning talks of length 15 minutes with 10 minutes of questions, 5 minute changeover to next speaker. Our goal is about 15 talks during the day.

The motivation is that after each talk, you and your project will be visible to the rest of the Open Mobile Linux community and further deeper discussions into your topic with your peers can continue outside the devroom.

Please send a short biography and an abstract for your talk to carsten.munk@gmail.com by Dec 31st 2011, and we'll get back to you at latest January 7th.

We're also grateful for volunteers helping to run the devroom. Contact Carsten if you're interested.