<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.6(BH)" -->
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>Piotr Pokora</title>
        <description>Piotras blogs on Midgard and other things</description>
        <link>http://blogs.nemein.com/people/piotras/</link>
        <lastBuildDate>Sat, 05 Jul 2008 11:28:33</lastBuildDate>
        <generator>FeedCreator 1.7.6(BH)</generator>
        <language>en</language>
        <managingEditor>piotrek.pokora@gmail.com</managingEditor>
        <item>
            <title>When metadata creator is empty</title>
            <link>http://blogs.nemein.com/people/piotras/view/1211550587.html</link>
            <description>
&lt;p&gt;Quite major bug has been found today. 1.8.7 Midgard release doesn't populate metadata_creator guid. &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; news page &lt;a href=&quot;http://www.midgard-project.org/updates/view/1211545441.html&quot;&gt;has a note&lt;/a&gt; about this.&lt;/p&gt;

&lt;p&gt;I wrote additional script which should help with database upgrade if needed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

DB=&quot;midgard&quot;
MYSQLCMD=&quot;/usr/bin/mysql&quot;

THEADER=&quot;Tables_in_${DB}&quot;
MIDGARD_TABLES=`$MYSQLCMD -D $DB -e 'show tables' | grep -Ev '(_i\s*\|?\s*$)|repligard|sitegroup|Tables_in_.+'`

for TABLE in $MIDGARD_TABLES; do

    QUERY=&quot;UPDATE ${TABLE} SET metadata_creator=REPLACE(metadata_authors, '|' ,'')  WHERE metadata_creator='' AND metadata_authors&amp;lt;&amp;gt;'' AND metadata_authors&amp;lt;&amp;gt;'||' AND LENGTH(metadata_authors) &amp;lt; 39&quot;
    echo &quot;Fixing table: ${TABLE}&quot;
    $MYSQLCMD -D ${DB} -e &quot;${QUERY}&quot;

    echo &quot;Looking for multiple authors&quot;
    QUERY=&quot;SELECT guid from ${TABLE} WHERE LENGTH(metadata_authors) &amp;gt; 38 AND metadata_creator='' AND metadata_authors&amp;lt;&amp;gt;'||' AND metadata_authors&amp;lt;&amp;gt;''&quot;
    $MYSQLCMD -D ${DB} -e &quot;${QUERY}&quot;

done
&lt;/code&gt;&lt;/pre&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Fri, 23 May 2008 13:49:48</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-3ef854778b07fe1820ee40992838c2e2</guid>
        </item>
        <item>
            <title>Voices in my head</title>
            <link>http://blogs.nemein.com/people/piotras/view/1211235337.html</link>
            <description>
&lt;p&gt;
&lt;img src=&quot;/people/piotras/midcom-serveattachmentguid-041c5310232cd2dafb955556c203d02d/rs.jpg&quot; border=&quot;0&quot; alt=&quot;rs.jpg&quot; title=&quot;rs.jpg&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; width=&quot;384&quot; height=&quot;307&quot; align=&quot;bottom&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://www.lastfm.pl/event/509411&quot;&gt;It was&lt;/a&gt;  last sunday.  And there are still &amp;quot;Voices in my head&amp;quot;. &lt;a href=&quot;http://www.riverside.art.pl/&quot;&gt;Riverside&lt;/a&gt;  guys made &lt;strong&gt;real show&lt;/strong&gt; in &lt;a href=&quot;http://www.toyastudios.pl/&quot;&gt;best studio in Poland&lt;/a&gt;, and it&amp;#39;s quite obvious as they recorded live DVD at the same time. Probably this DVD is going to be in stores this winter. Damn!  So long time.  
&lt;/p&gt;
&lt;p&gt;
First time I heared them in &lt;a href=&quot;http://www.lizardking.pl/&quot;&gt;LizardKing&lt;/a&gt;  pub in Łódź. It was February, this Year. Since then, I am addicted. There is no single word that can be said about this event. No one seems to want to comment it. Only few of them appears from time to time on different forums: &lt;strong&gt;perfect&lt;/strong&gt;.  
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&amp;quot;Join in the shadow dance&lt;/em&gt;&lt;em&gt;&amp;quot;&lt;/em&gt; 
&lt;/p&gt;</description>
            <author>Piotr Pokora</author>
            <category>music</category>
            <pubDate>Mon, 19 May 2008 22:15:37</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-b1ed9c18b330cef7a6f719a5102d8b96</guid>
        </item>
        <item>
            <title>PEAR registry, where are you?</title>
            <link>http://blogs.nemein.com/people/piotras/view/1211199553.html</link>
            <description>
&lt;p&gt;I wrote this simple script to clear my local pear setup and to have clean pear instalation for &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;apt-get remove php-pear
rm -rf /usr/share/php/PEAR
rm /root/.pearrc
rm -rf /etc/pear
rm -rf /tmp/pear
apt-get -y install php-pear
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So, when I cleaned my pear ,imagine, how much confused I was when I saw this in my terminal:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MIDGARD SETUP: Role_Web - installed: 1.1.1 available: 1.1.1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;wtf?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pear list-files pearified/role_web
Installed Files For pearified/role_web
======================================
Type Install Path
php  /usr/share/php/PEAR/Installer/Role/Web.php
php  /usr/share/php/PEAR/Installer/Role/Web.xml
php  /usr/share/php/Pearified/Role/Web/setup.php

ls -l /usr/share/php/PEAR/Installer/Role/Web.php
ls: /usr/share/php/PEAR/Installer/Role/Web.php: No such file or directory
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PEAR registry...where are you?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Updated:&lt;/strong&gt; I found registry and channel files under /usr/share/php. So on debian these two lines must be added additionally:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rm -rf /usr/share/php/.registry 
rm -rf /usr/share/php/.channels
&lt;/code&gt;&lt;/pre&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Mon, 19 May 2008 12:19:13</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-e90fcebdcdb7b38b177958d3a651dddf</guid>
        </item>
        <item>
            <title>MySQL doesn't support TEXT type</title>
            <link>http://blogs.nemein.com/people/piotras/view/1210258016.html</link>
            <description>
&lt;p&gt;Yes, it does not. But you could say:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&quot;oh no, Piotras, it does, please read &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/blob.html&quot;&gt;this part of manual&lt;/a&gt;&quot;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Oh, yes indeed. They mention &quot;The four TEXT types&quot;, but it doesn't seem to help me even a bit. Why? Bergie and Solt reported quite weird issue. Text value ( text type in database ) has been returned as array on PHP bindings for &lt;a href=&quot;htp://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I started to investigate it from the very beginning, to catch why text type becomes an array:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parameter class has value member of &lt;em&gt;longtext&lt;/em&gt; type.&lt;/li&gt;
&lt;li&gt;Database column for this property has &lt;em&gt;longtext&lt;/em&gt; column type.&lt;/li&gt;
&lt;li&gt;GDA library with MySQL provider uses MySQL column types to determine what value should be initialized on C level.&lt;/li&gt;
&lt;li&gt;GDA gets &lt;em&gt;BLOB&lt;/em&gt; type.&lt;/li&gt;
&lt;li&gt;GDA initializes its own &lt;em&gt;GdaBinary&lt;/em&gt; type( GdaBinary is &lt;em&gt;GBoxed&lt;/em&gt; derived type ). &lt;/li&gt;
&lt;li&gt;PHP bindings for midgard and especially GValue and zval converter gets boxed type.&lt;/li&gt;
&lt;li&gt;We support only array type of gboxed one so zend &lt;em&gt;array&lt;/em&gt; is initialized and returned.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Not easy to fetch at first glance, isn't it?&lt;/p&gt;

&lt;p&gt;I was wondering and checked GDA sources ,and indeed MySQL provider implementation is not aware of something like TEXT or LONGTEXT. Later on I checked MySQL's headers and supported column types.&lt;/p&gt;

&lt;p&gt;So, there is support for strings (char and varchar):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MYSQL_TYPE_VAR_STRING&lt;/li&gt;
&lt;li&gt;MYSQL_TYPE_STRING&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And for blobs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MYSQL_TYPE_TINY_BLOB&lt;/li&gt;
&lt;li&gt;MYSQL_TYPE_MEDIUM_BLOB&lt;/li&gt;
&lt;li&gt;MYSQL_TYPE_LONG_BLOB&lt;/li&gt;
&lt;li&gt;MYSQL_TYPE_BLOB&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And what about TEXT and LONGTEXT? And what about those 4 mentioned text types?
Nothing. There's completely nothing. How can I know if retrieved data is binary or text type then? Use randomized type? Maybe for you blob type is the same as longtext, but for me plain text book stored in field is quite different thing than compressed image file.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>gnome</category>
            <pubDate>Thu, 08 May 2008 14:46:56</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-a131a0142a5cd71e334dd0922c8519a3</guid>
        </item>
        <item>
            <title>Midgard with Lighttpd</title>
            <link>http://blogs.nemein.com/people/piotras/view/1208851555.html</link>
            <description>
&lt;p&gt;Please. Read the whole this simple howto. It's adressed for developers who would like to have Midgard and Midgard2 available as web services on the same machine. Of course, you may still install or compile Apache 1.3 as the second web server.&lt;/p&gt;

&lt;p&gt;First of all you need to install and configure &lt;a href=&quot;http://www.lighttpd.net/&quot;&gt;Lighttpd&lt;/a&gt; web serwer.
On debian I installed it using apt-get:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;apt-get install lighttpd
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Do not forget to stop Apache before installing lighttpd. If you do not, dpkg will return with failure status as lighttpd tries to bind to port 80 by default when package is installed.&lt;/p&gt;

&lt;p&gt;Also, you need to have php5 compiled with fast-cgi support. Again, on debian install it quickly:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;apt-get instal php5-cgi
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Edit cgi's php.ini file (&lt;code&gt;/etc/php5/cgi/php.ini&lt;/code&gt;), and add midgard support:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;extension=midgard2.so
midgard.configuration=&quot;midgard&quot;
midgard.http=&quot;on&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then configure your new web server. I found these two sites very helpful to configue lighttpd server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.onlamp.com/pub/a/onlamp/2007/04/05/the-lighttpd-web-server.html&quot;&gt;onlamp.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html&quot;&gt;ciberciti.biz&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Later on, you need to install &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard2&lt;/a&gt; from &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/&quot;&gt;trunk&lt;/a&gt;, which is going to be released as alpha2 soon.&lt;/p&gt;

&lt;p&gt;In my case, I configured lighttpd with these options:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;server.port = 81
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Just to have both, Apache and lighttpd available. You may of course use different port if you like.&lt;/p&gt;

&lt;p&gt;Enable required modules, mod_rewrite and mod_fastcgi:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;server.modules              = (
        &quot;mod_access&quot;,
        &quot;mod_alias&quot;,
        &quot;mod_accesslog&quot;,
        &quot;mod_compress&quot;,
        &quot;mod_rewrite&quot;,
        &quot;mod_fastcgi&quot;,
)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Configure fastcgi:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fastcgi.server = (
    &quot;.php&quot; =&amp;gt; (
            &quot;localhost&quot; =&amp;gt;
                    (
                            &quot;socket&quot; =&amp;gt; &quot;/tmp/php-fastcgi.socket&quot;,
                            &quot;bin-path&quot; =&amp;gt; &quot;/usr/bin/php5-cgi&quot;
                    )
            )
    )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Configure virtual host:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$HTTP[&quot;host&quot;] == &quot;myhost&quot; {
    server.port = 81
    server.document-root = &quot;/var/lib/midgard/vhosts/myhost/8080&quot;
    url.rewrite-once = ( &quot;^(.*)\.*&quot; =&amp;gt; &quot;midgard-root.php&quot; )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I use virtual host on 8080 port with Apache, so I wanted to re use its DocumentRoot. You will change it of course, depending on your needs.&lt;/p&gt;

&lt;p&gt;midgard-root.php file should be copied or symlinked from &lt;a href=&quot;http://www.kaktus.cc/weblog/view/1207837374.html&quot;&gt;midcom's git repository&lt;/a&gt;. I do not have to remind that midcom itself should be installed and ready to use.&lt;/p&gt;

&lt;p&gt;Do something you should never do in real life. It seems that lighttpd drops root privileges too quickly and php module is loaded with configured user and group privileges. At least I couldn't manage to open root's configuration files from system configuration directory( which is easily done with Apache ). To establish database connection(s) you must have all secret configuratoin readable for the whole world.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;chmod 644 /etc/midgard-2.0/conf.d/*
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After this, restart lighttpd:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/etc/init.d/lighttpd restart
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And open &lt;code&gt;http://myhost:81&lt;/code&gt; with your favourite browser. If all went fine, you should have midcom's web page without style. Reason is that we do not make &lt;code&gt;midcom-static&lt;/code&gt; exception in our hosts' rewrite condition.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Tue, 22 Apr 2008 08:05:55</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-1959b2769de87e342a5640d8831e3f38</guid>
        </item>
        <item>
            <title>MidCOM3 without apache module</title>
            <link>http://blogs.nemein.com/people/piotras/view/1207923307.html</link>
            <description>
&lt;p&gt;This is really &lt;em&gt;HOT&lt;/em&gt;!&lt;/p&gt;

&lt;p&gt;It's proof of concept to work with Midgard without its Apache module.
And the concept is cool :) Especially with this lovely MidCOM3 screenshot.&lt;/p&gt;

&lt;p&gt;&lt;img align=&quot;left&quot; src=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-d3875f40163f597eb21bea80c55738d4/midcom3-without-apache-module.png&quot;&gt;&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Fri, 11 Apr 2008 14:15:07</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-ade0981edde92afb3c5786375ba97ba8</guid>
        </item>
        <item>
            <title>Basics of midgard_dbus</title>
            <link>http://blogs.nemein.com/people/piotras/view/1207652141.html</link>
            <description>
&lt;p&gt;midgard_dbus API is &lt;strong&gt;very&lt;/strong&gt; simple, but my approach was to make it just simple as possible. Basically we have two major methods of midgard_dbus:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;constructor, which registers object at path&lt;/li&gt;
&lt;li&gt;send, which asynchronously send message to object at given path&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;New initialized object doesn't do anything special. It just waits for any call to him and then emits &quot;notified&quot; signal, which you can connect callback to.&lt;/p&gt;

&lt;p&gt;I tested simple code with &lt;a href=&quot;http://www.midgard-project.org/documentation/php_midgard_core/&quot;&gt;midgard-php&lt;/a&gt; and &lt;a href=&quot;http://www.midgard-project.org/documentation/python_midgard/&quot;&gt;midgard-python&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;midgard_python&lt;/strong&gt; &quot;service&quot;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import dbus.mainloop.glib
import _midgard as midgard

def mbus_callback(object, arg):
        print &quot;Hi! I am midgard_dbus from midgard-python. I got message:&quot;
        print object.get_message()

mbus = midgard.dbus(&quot;/midgard_article&quot;)
mbus.connect(&quot;notified&quot;, mbus_callback, &quot;foo&quot;)

mainloop = gobject.MainLoop()
mainloop.run()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;midgard-php&lt;/strong&gt; &quot;client&quot;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$message = &quot;Greetings from midgard-php!(&quot; . mgd_version() . &quot;) PHP ver.&quot; . phpversion();
midgard_dbus::send(&quot;/midgard_article&quot;, $message);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I started php script which immidietialy ended, and on midgard-python service's terminal I got this message:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Hi! I am midgard_dbus from midgard-python. I got message:
Greetings from midgard-php! (2.0alpha0) PHP ver.5.2.5-3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Probably the code will be soon ported to 1-9 branch, so I will be able to test midgard_dbus in Apache environment. But for now, basic idea looks fine and works fine. We just notify objects at path with particular message, and local proccess does the rest with connected callbacks.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Tue, 08 Apr 2008 10:55:41</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-51dc7ef6b95c13560ffa9b075905318c</guid>
        </item>
        <item>
            <title>D-Bus and Midgard</title>
            <link>http://blogs.nemein.com/people/piotras/view/1206708012.html</link>
            <description>
&lt;p&gt;&lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; is decent CMS framework. Not just yet another PHP based CMS. And as every decent piece of code must have many features. I just added initial test cases with &lt;a href=&quot;http://www.freedesktop.org/wiki/Software/dbus&quot;&gt;D-Bus&lt;/a&gt; support. They use &lt;a href=&quot;http://www.midgard-project.org/documentation/python_midgard/&quot;&gt;midgard-python&lt;/a&gt; and dbus modules.&lt;/p&gt;

&lt;p&gt;Usage is simple. You start service as one proccess and client as another one.
If all goes fine, client notifies daemon that some object needs to be imported to database, then listener service imports this object to database.
Listener is not aware who sent such data and even not aware what kind of language was used to send notify.&lt;/p&gt;

&lt;p&gt;So in theory ( it's not yet API implementation ) application written in PHP and using Midgard 1.9 may may send notification and listener may be daemon writen in python using Midgard 2.0. Even on the same machine.&lt;/p&gt;

&lt;p&gt;Check &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/midgard/apis/python/tests/dbus&quot;&gt;initial test code&lt;/a&gt;!&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>gnome</category>
            <pubDate>Fri, 28 Mar 2008 12:40:12</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-6d2d0a6b72dab59688f593c4340077b4</guid>
        </item>
        <item>
            <title>midgard-python once again</title>
            <link>http://blogs.nemein.com/people/piotras/view/1205874132.html</link>
            <description>
&lt;p&gt;&lt;a href=&quot;http://bergie.iki.fi&quot;&gt;Bergie&lt;/a&gt; just &lt;a href=&quot;http://bergie.iki.fi/blog/midcom_3_at_a_glance.html&quot;&gt;blogged&lt;/a&gt; about initial MidCOM3 architecture. He included nice and very easy example of &lt;a href=&quot;http://www.midgard-project.org/documentation/php_midgard_core/&quot;&gt;midgard-php&lt;/a&gt; API. And while he mentioned some python based solution I decided to add short and working example of &lt;a href=&quot;http://www.midgard-project.org/documentation/python_midgard/&quot;&gt;midgard-python&lt;/a&gt; in action.&lt;/p&gt;

&lt;p&gt;All in all, it's good to have, especially now, when Midgard2 is &lt;a href=&quot;http://www.midgard-project.org/updates/view/1204025654.html&quot;&gt;already an alpha&lt;/a&gt; and available also as packages for &lt;a href=&quot;http://maemo.org&quot;&gt;maemo.org&lt;/a&gt; platform.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Tue, 18 Mar 2008 21:02:12</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-43a364dc204f5058d2019919115debbc</guid>
        </item>
        <item>
            <title>Gnomegard</title>
            <link>http://blogs.nemein.com/people/piotras/view/1205066818.html</link>
            <description>
&lt;p&gt;I think t's going to be sexy. Very sexy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;4 years ago &lt;a href=&quot;http://bergie.iki.fi/blog/project_gnomegard.html&quot;&gt;we planned&lt;/a&gt; some features.&lt;/li&gt;
&lt;li&gt;Few weeks ago &lt;a href=&quot;http://www.midgard-project.org/updates/view/1204025654.html&quot;&gt;world heard&lt;/a&gt; about &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard2&lt;/a&gt; first alpha release.&lt;/li&gt;
&lt;li&gt;Gnome 2.22 should be &lt;a href=&quot;http://live.gnome.org/TwoPointTwentyone&quot;&gt;released soon&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Gnome 2.22 should contain new &lt;a href=&quot;http://live.gnome.org/RoadMap#head-bace14c332b2a5347a129b81c1a912986c12cf27&quot;&gt;API for Virtual File System&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I must test it! &lt;strong&gt;mgd://&lt;/strong&gt; uri will look lovely :)&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>gnome</category>
            <pubDate>Sun, 09 Mar 2008 12:46:58</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-c82888a8cc210b06a2b0050c1f9dd234</guid>
        </item>
        <item>
            <title>Midgard2 and Gtkdoc</title>
            <link>http://blogs.nemein.com/people/piotras/view/1204835520.html</link>
            <description>
&lt;p&gt;One day I realized that for last few months, I managed to fix (few times) some documentation part for &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; core and PHP bindings. Those fixes almost always included properties of some class. And recently I started to wonder how to write documentation for &lt;a href=&quot;http://www.midgard-project.org/documentation/php_events/&quot;&gt;events&lt;/a&gt; in midgard, once. Well, not about the idea, but at least I wanted to avoid writing ( few times in few different places ) what events some class provieds.&lt;/p&gt;

&lt;p&gt;Since Midgard 1.8 we used &lt;a href=&quot;http://www.doxygen.org/&quot;&gt;doxygen&lt;/a&gt;, which is very good, with cool features for writing docs, but for me ( and writing GObject based code and docs ) is not perfect enough. Mainly you can not document class inheritance, object properties or class signals. And what is more important, you can not do this automagically.&lt;/p&gt;

&lt;p&gt;I decided to test &lt;a href=&quot;http://live.gnome.org/DocumentationProject/GtkDoc&quot;&gt;gtkdoc&lt;/a&gt; ( which is also far from being perfect and &lt;a href=&quot;http://live.gnome.org/DocumentationProject/GtkDocFuture&quot;&gt;seems to be missing&lt;/a&gt; doxygen :), and got quite nice documentation part for a start.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;List of MgdSchema object &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/2.0/midgard-object.html#id2510624&quot;&gt;events&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;midgard_config &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/2.0/midgard-config.html#id2566728&quot;&gt;properties&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are created automagically, so I do not have to document them. PHP or Python developer might always want to look for additional information in core documentation, without need to duplicate many informations in many places and without risk that those docs are getting out of date &lt;em&gt;quickly&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Bad thing about gtkdoc and doxygen is the fact that docs should be located in c files ( instead of headers ) and must be reformatted a bit.
But once they are written, one is able to use even &lt;a href=&quot;http://developer.imendio.com/projects/devhelp&quot;&gt;devhelp&lt;/a&gt; to read them.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>gnome</category>
            <pubDate>Thu, 06 Mar 2008 20:32:00</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-0878469a0b9fd40b24aa8f73ca85a86b</guid>
        </item>
        <item>
            <title>Testing Midgard 1.9</title>
            <link>http://blogs.nemein.com/people/piotras/view/1203605098.html</link>
            <description>
&lt;p&gt;It's not released yet, but I added few scripts which build debian packages hourly, so every developer can install it easier. To make things even more easier I tested this simple script which does everything:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MIDGARD_TEST_REPOSITORY=&quot;deb http://www.midgard-project.org/nightly/debian ./&quot;
APT_SOURCES_LIST=&quot;/etc/apt/sources.list&quot;

if ! grep $MIDGARD_TEST_REPOSITORY $APT_SOURCES_LIST; then
        cp ${APT_SOURCES_LIST} ${APT_SOURCES_LIST}.midgard.bak
        echo &quot;Adding ${MIDGARD_TEST_REPOSITORY} to ${APT_SOURCES_LIST}&quot;
        echo ${MIDGARD_TEST_REPOSITORY} &amp;gt;&amp;gt; ${APT_SOURCES_LIST}
fi

echo &quot;Updating packages info...&quot;
apt-get update

echo &quot;Installing midgard...&quot;
apt-get --reinstall install libmidgard10 php5-midgard libapache2-mod-midgard midgard-common
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Of course you should be logged in as root or at least run it with sudo.
As the last line you can add:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/usr/sbin/datagard
&lt;/code&gt;&lt;/pre&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Thu, 21 Feb 2008 14:44:58</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-e729306171cde53fc13ccdd5edb9bb0a</guid>
        </item>
        <item>
            <title>midgard-schema and database update</title>
            <link>http://blogs.nemein.com/people/piotras/view/1202736112.html</link>
            <description>
&lt;p&gt;I ported some minor database routines from &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; branch-1-9 to stable branch today. It doesn't mean I ported unstable features. On the contrary , I fixed quite important issues: &lt;a href=&quot;http://trac.midgard-project.org/ticket/193&quot;&gt;#193&lt;/a&gt;,&lt;a href=&quot;http://trac.midgard-project.org/ticket/214&quot;&gt;#214&lt;/a&gt; and &lt;a href=&quot;http://trac.midgard-project.org/ticket/78&quot;&gt;#78&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What does it mean exactly?&lt;/p&gt;

&lt;p&gt;Datagard creates tables and adds some additional columns and indexes but only those mandatory like sitegroup or guid. &lt;code&gt;midgard-schema&lt;/code&gt; is improved and make all database update more clever way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;midgard_reflection_property is used to check if property should be indexed
( like parent property or link one )&lt;/li&gt;
&lt;li&gt;Indexes are created for commonly used metadata columns &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When update is performed, midgard-schema checks every single table and column if anything should be done with it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update is made as much faster as many unchanged columns you have in table ( comparing to shell's datagard )&lt;/li&gt;
&lt;li&gt;During developing, you may alter table and change columns' type &quot;on the fly&quot;.&lt;/li&gt;
&lt;/ul&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Mon, 11 Feb 2008 13:21:52</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-6ef553e82d61d6d148f38ea79dd141fd</guid>
        </item>
        <item>
            <title>midgard_blob once again</title>
            <link>http://blogs.nemein.com/people/piotras/view/1202410598.html</link>
            <description>
&lt;p&gt;This class has been introduced in &lt;a href=&quot;http://www.midgard-project.org/&quot;&gt;Midgard&lt;/a&gt; 1.8 branch, but mostly to satisfy replicator. Today I finished experimental API for Midgard 2.0 and Midgard 1.9 ( with PHP language bindings as well ).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.midgard-project.org/documentation/php_midgard_blob/&quot;&gt;Documentation for midgard_blob&lt;/a&gt; needs many improvements but you can take a look at it already today.&lt;/p&gt;

&lt;p&gt;Completely new features which wait for you in Midgard 1.9 include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You may create attachment for another attachment&lt;/li&gt;
&lt;li&gt;You may share attachments among many objects&lt;/li&gt;
&lt;li&gt;You may use any PHP API part which requires file's absolute path or file handler.&lt;/li&gt;
&lt;li&gt;You may create new files &lt;em&gt;quickly&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Thu, 07 Feb 2008 18:56:38</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-b415848328cb4ba2950fd82c17d8a216</guid>
        </item>
        <item>
            <title>When midgard_setup fails</title>
            <link>http://blogs.nemein.com/people/piotras/view/1201036647.html</link>
            <description>
&lt;p&gt;I have been multitasking a bit and talk with Jerry about erlang issues and ran new datagard in the background. Well... it's automagic setup so it's quite clever and can make few things for you. Without any needless questions.&lt;/p&gt;

&lt;p&gt;So, what I got when I switched to terminal again?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MIDGARD SETUP: Sitewizard created host successfully. Now cleaning up... 
MIDGARD SETUP: Preferred pear package state changed ( beta ) 
MIDGARD SETUP: Reloading apache http server 
MIDGARD SETUP: Please wait... 
Warning: file_get_contents(http://ppmobile): failed to open stream: HTTP request failed! HTTP/1.0 500 Server Error
MIDGARD SETUP: ! WARNING ! : Can not request newly created host ( http://ppmobile )  
MIDGARD SETUP ERROR: Please, analyze apache server log files 
Quitting...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Nice, now I need to analyze apache's log file :)
Ah, keep in mind that all these messages are much more detailed in written log file. But now I do not need it. I will use later when I miss terminal screen.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Tue, 22 Jan 2008 21:17:27</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-fa6c0c2d6c3953a9b080931a2c5058b0</guid>
        </item>
        <item>
            <title>Memory corruption in midgard-php</title>
            <link>http://blogs.nemein.com/people/piotras/view/1200650411.html</link>
            <description>
&lt;p&gt;Just two days ago I &lt;a href=&quot;http://www.nemein.com/people/piotras/view/1200478202.html&quot;&gt;blamed&lt;/a&gt; &lt;a href=&quot;http://www.hardened-php.net/suhosin/&quot;&gt;Suhosin&lt;/a&gt; patch, and this morning I found probably the source of the problem.&lt;/p&gt;

&lt;p&gt;Log entry is clear:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Cannot instantiate abstract class \x85\xd7\xe9\x84\x1d
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I found that mgd_get_object_by_guid is not aware of Zend2 (PHP5), and code &quot;focuses&quot; on Zend1 (PHP4). I can not say that code uses ZE1 or ZE2 API. The issue is hard to find and it's never noticed when code is being compiled.&lt;/p&gt;

&lt;p&gt;If you need to write code for ZE1 and ZE2, keep it in mind:&lt;/p&gt;

&lt;p&gt;ZE1:
    zend_class_entry *ce;&lt;br /&gt;
    object_init_ex(return_value, ce TSRMLS_CC);&lt;/p&gt;

&lt;p&gt;ZE2:
    zend_class_entry **ce;&lt;br /&gt;
    object_init_ex(return_value, *ce TSRMLS_CC);&lt;/p&gt;

&lt;p&gt;But when you look for class pointer you always pass &lt;strong&gt;(void **) &amp;amp;ce)&lt;/strong&gt; as &lt;code&gt;zend_hash_find&lt;/code&gt; parameter. So when you use ZE1 class pointer and code is being compiled against ZE2, you get no single notice or warning. And it's very easy to omit such case, especially that code itself runs almost correctly. Almost means  that sometimes it fails.&lt;/p&gt;

&lt;p&gt;I will make 1.8.6 release next week because the issue is very serious. Meantime if you used to notice random Segfaults in error.log, please change your code and use ( recommended anyway ) &lt;strong&gt;midgard_object_class::get_object_by_guid&lt;/strong&gt; instead of mgd_get_object_by_guid.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Fri, 18 Jan 2008 10:00:11</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-7700bb7828ef560ab6175bc1308cecf7</guid>
        </item>
        <item>
            <title>Suhosin Patch</title>
            <link>http://blogs.nemein.com/people/piotras/view/1200478202.html</link>
            <description>
&lt;p&gt;I have been asked to look at random segfaults which started to appear after &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; &lt;a href=&quot;http://www.midgard-project.org/download/1.8&quot;&gt;1.8.5&lt;/a&gt; upgrade. I checked many places and was wondering what really triggers them.&lt;/p&gt;

&lt;p&gt;Fortunatelly I was able to run Apache through gdb and was much more wondered. Backtraces pointed to ( randomly ) : xdebug, eaccelerator, php5 library itself. Even Fatal Error like &quot;Cannot redeclare class&quot;  caused segfaults.&lt;/p&gt;

&lt;p&gt;So, I was completely out of ideas, when I noticed this one in Apache's log file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PHP/5.2.4-0.dotdeb.0 with Suhosin-Patch
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href=&quot;http://www.hardened-php.net/suhosin/&quot;&gt;Suhosin&lt;/a&gt;, the one I started to blame. And looks like I was right. Server is perfectly fine when php5 has been replaced with the one without Suhosin Patch.&lt;/p&gt;

&lt;p&gt;I did google a bit and found how many people reported segfaults with PHP5 with Suhosin Patch. However Suhosin itself is not blamed for segfaults I think I should ask few questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If I have at least 5 extensions loaded , which one triggers segfault if Suhosin is enabled ?&lt;/li&gt;
&lt;li&gt;Which one is badly written if PHP doesn't segfault without Suhosin?&lt;/li&gt;
&lt;li&gt;If one extension is badly written where can I find documentation how it should be written well to work fine with Suhosin?  &lt;/li&gt;
&lt;li&gt;Who made detailed tests and is sure that all extensions corrupts memory?
All but Suhosin ?  &lt;/li&gt;
&lt;/ul&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Wed, 16 Jan 2008 10:10:03</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-9b90e56719458e878496f28f248cd804</guid>
        </item>
        <item>
            <title>When you think you are drunk</title>
            <link>http://blogs.nemein.com/people/piotras/view/1200136336.html</link>
            <description>
&lt;p&gt;I haven't been writing about new features of Midgard for the last 3 weeks, but it's high time to stop write about new ones and instead write about new upcoming releases ( which I am tuning recently ). So I tested and built release packages wherever I could, including maemo scratchbox. Unfortunatelly I found python-midgard package buggy... so I took a closer look at python, and here's what I found:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ls -l /usr/bin/python*
lrwxrwxrwx  1 root root    9 Feb 11  2007 /usr/bin/python -&amp;gt; python2.4
-rwxr-xr-x  1 root root 3384 Jun 14  2006 /usr/bin/python2.4
-rwxr-xr-x  1 root root  119 Jun 14  2006 /usr/bin/python2.4-pyrexc
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ok, nothing unusual, right? &lt;code&gt;python&lt;/code&gt; command is just a symlink to &lt;code&gt;python2.4&lt;/code&gt;. Which is cool of course, isn't it?&lt;/p&gt;

&lt;p&gt;But strace wrote weird logs so I decided to check python version:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/usr/bin/python2.4 -V
Python 2.4.2
/usr/bin/python -V
Python 2.3.4
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Please, please tell me why the hell command invoked via symlink returns different version.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>maemo</category>
            <pubDate>Sat, 12 Jan 2008 11:12:16</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-238627c4276268532896f4562ac331d3</guid>
        </item>
        <item>
            <title>midgard_user_auth</title>
            <link>http://blogs.nemein.com/people/piotras/view/1197893501.html</link>
            <description>
&lt;p&gt;I started to make new Midgard2 auth features backward compatible. So, to make things smooth and transparent I added new internal function which makes legacy authorization and it's triggered by simple check, check if new midgard_user table   exists in database.&lt;/p&gt;

&lt;p&gt;The good start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;database is created with midgard branch-1-9&lt;/li&gt;
&lt;li&gt;python is used as scripting language&lt;/li&gt;
&lt;li&gt;midgard2 library is used with test&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And simple example code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;user = midgard.user.auth(&quot;admin&quot;, &quot;password&quot;, &quot;python-sg&quot;, False);
if(midgard.user.is_admin(user)):
    print (&quot;User is an admin&quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Output with method names info:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;** INFO: user.is_admin(...)
User is an admin
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I didn't make any database changes, so let's hope both midgard versions could be used together soon.&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>midgard</category>
            <pubDate>Mon, 17 Dec 2007 12:11:41</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-fd577e06cf2582f20dedd8bcc96fb70d</guid>
        </item>
        <item>
            <title>Beauty and the Beast</title>
            <link>http://blogs.nemein.com/people/piotras/view/1196805359.html</link>
            <description>
&lt;p&gt;I am not sure which one is the beast and which one the beauty. But I think both midgard-python and midgard-core may be both :)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://python.org/&quot;&gt;Python&lt;/a&gt; seems to be the second &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard's&lt;/a&gt; scripting language now. 
Two weeks ago I wrote about initial usable bindings work, and today there's much more:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Midgard Query Builder&lt;/li&gt;
&lt;li&gt;Midgard Collector&lt;/li&gt;
&lt;li&gt;Midgard Object Class 
( pseudo class for MgdSchema classes introspection and reflection )&lt;/li&gt;
&lt;li&gt;Midgard Reflection Property&lt;/li&gt;
&lt;li&gt;MgdSchema objects' parameters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Midgard Replicator is not yet fully implemented for midgard-python because it simply doesn't exist in Midgard2 ( aka trunk ). Reason why it hasn't been moved there is fact that replicator uses language specific SQL queries while Midgard2 itself uses something which you could name &quot;built in&quot; languages support. Whichis nothing more like languages persistant cache in details.&lt;/p&gt;

&lt;p&gt;You can take a look at &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/midgard/apis/python/tests&quot;&gt;midgard-python test examples&lt;/a&gt; and compile module if needed. 
And I think I should start count days to first Midgard2 alpha release, and first python applications for gnome or maemo :)&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <category>gnome</category>
            <pubDate>Tue, 04 Dec 2007 21:55:59</pubDate>
            <guid>http://blogs.nemein.com/people/piotras/midcom-permalink-f092f50723e1ccbc0f75b2d3e43fa12f</guid>
        </item>
    </channel>
</rss>
