<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.6(BH)" -->
<?xml-stylesheet href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://blogs.nemein.com/people/piotras/rss1.xml">
        <title>Piotr Pokora</title>
        <description>Piotras blogs on Midgard and other things</description>
        <link>http://blogs.nemein.com/people/piotras/</link>
       <dc:date>2010-03-16T06:03:52+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1265806655.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1258549332.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1255005390.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1254247975.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1253273414.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1252572813.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1248981734.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1247082537.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1247067365.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1246966442.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1246881867.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1240999802.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1237369637.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1234461709.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1232642360.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1232109740.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1228823602.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1227818298.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1226521466.html"/>
                <rdf:li rdf:resource="http://blogs.nemein.com/people/piotras/view/1226517502.html"/>
            </rdf:Seq>
        </items>
    </channel>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1265806655.html">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-10T12:57:35+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Vala bindings for Midgard2</title>
        <link>http://blogs.nemein.com/people/piotras/view/1265806655.html</link>
        <description>
&lt;p&gt;Today I got some help on #vala irc channel (thanks nemequ!), and I must say I am very happy to see Midgard API working with vala bindings. I am also happy cause in this case, there's no need to write bindings in C (as happens with PHP or Python bindings).&lt;/p&gt;

&lt;p&gt;First of all, &lt;a href=&quot;http://download.opensuse.org/repositories/home:/midgardproject:/unstable/&quot;&gt;you have to have Midgard2&lt;/a&gt; installed. Then, all you have to do, to have vapi file is to run &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/midgard/apis/vala/generate_vapi.sh&quot;&gt;simple script&lt;/a&gt; in &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/midgard/apis/vala/&quot;&gt;vala directory&lt;/a&gt; . 
And finally, you can &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/midgard/apis/vala/example.vala&quot;&gt;try example&lt;/a&gt;. Note, you must have database created. Midgard.Storage is excluded from vala bindings at this moment.&lt;/p&gt;

&lt;p&gt;I hope to see mono bindings soon.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1258549332.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-11-18T13:02:12+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Mjolnir - new stable Midgard2 release</title>
        <link>http://blogs.nemein.com/people/piotras/view/1258549332.html</link>
        <description>
&lt;p&gt;Yes, we did it :)&lt;/p&gt;

&lt;p&gt;Here is it &lt;a href=&quot;http://www.midgard-project.org/updates/midgard2_9-09-mjolnir-released/&quot;&gt;latest and greatest&lt;/a&gt; &lt;a href=&quot;http://www.midgard2.org&quot;&gt;Midgard2&lt;/a&gt; stable release.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1255005390.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-10-08T12:36:30+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>More flexibility for Midgard schemas</title>
        <link>http://blogs.nemein.com/people/piotras/view/1255005390.html</link>
        <description>
&lt;p&gt;Here it is. Well known Midgard MgdSchema is no longer such strict and limited. Since [Mjolnir][2] we will support user defined values which can extend class property even better. Till now, we supported only 'description' keyword, which allowed to add any text which could describe property.&lt;/p&gt;

&lt;p&gt;Defining own values is plain and simple:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;type name &quot;my_best_class&quot; table=&quot;my_best_class_tbl&quot;&amp;gt;
    &amp;lt;property name=&quot;superproperty&quot; type=&quot;string&quot; field=&quot;super_property&quot;&amp;gt;
        &amp;lt;foo&amp;gt;bar&amp;lt;/foo&amp;gt;
        &amp;lt;private&amp;gt;true&amp;lt;/private&amp;gt;  
    &amp;lt;/property&amp;gt;
&amp;lt;/type&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, with API calls, one is able to get it quickly:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;C:&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MidgardObjectClass *klass = g_type_class_peek (g_type_from_name (&quot;my_best_class&quot;));
MidgardReflectionProperty *mrp = midgard_reflection_property_new (mgd, klass);
midgard_reflection_property_get_user_value (mrp, &quot;superproperty&quot;, &quot;private&quot;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;Python:&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mrp = midgard.reflection_property (&quot;my_best_class&quot;)
print mrp.get_user_value (&quot;superproperty&quot;, &quot;private&quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or even &lt;em&gt;PHP&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$mrp = new midgard_reflection_property (&quot;my_best_class&quot;);
echo $mrp-&amp;gt;get_user_value (&quot;superproperty&quot;, &quot;private&quot;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note, that I used &lt;em&gt;private&lt;/em&gt; key by purpose. If you are developing Midgard derived application and you need some functionality which can be defined in schema (but it's not yet), or work on such functionality is in progress, and you need to make your application be aware of this (quickly), you can depend on self added values.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1254247975.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-09-29T18:12:55+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Python bindings and GObject derived class destructor</title>
        <link>http://blogs.nemein.com/people/piotras/view/1254247975.html</link>
        <description>
&lt;p&gt;&lt;a href=&quot;http://teroheikkinen.iki.fi/&quot;&gt;Tero&lt;/a&gt; found interesting memory issue with &lt;a href=&quot;http://www.midgard2.org&quot;&gt;Midgard2&lt;/a&gt; Python bindings.
The code he presented is very simple:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import _midgard as midgard

while True:
    qb = midgard.query_builder (&quot;midgard_host&quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Guess, what happens. Memory usage grows up till your machine is frozen.
I started to investigate this issue and reproduced problem with different case:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import gobject

class my_memory_test (gobject.GObject):
    def __init__ (self):
        gobject.Object.__init (self)

while True:
    mmt = my_memory_test()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This script kills machine perfectly too.&lt;/p&gt;

&lt;p&gt;As Python bindings for Midgard depends on GObject bindings I started to invent own destructor.
Finally solution is plain and simple. Instead of derived destructor (the one assigned to tp_dealloc), I added new one:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;void
_py_midgard_gobject_destructor (PyObject *self)
{
    PyGObject *pygobj = (PyGObject *) self;
    if (pygobj-&amp;gt;obj &amp;amp;&amp;amp; G_IS_OBJECT (pygobj-&amp;gt;obj))
            g_object_unref (pygobj-&amp;gt;obj);

    PyObject_GC_Del (self);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now the question is: does derived class destructor inherits parent class' one if explicitly defined as none? Basic debug statements clearly showed that parent's destructor is invoked but why memory usage grew till death?&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1253273414.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-09-18T11:30:14+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>No more multilang in Midgard2</title>
        <link>http://blogs.nemein.com/people/piotras/view/1253273414.html</link>
        <description>
&lt;p&gt;In brief: I dropped multilang features from Midgard2 core today. Next week, I'll drop sitegroup's ones, which means the whole architecture is going to be simplified a lot. But do not worry, we - Midgard developers - have better plan for missed sitegroups and multilangs : contexts :)&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1252572813.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-09-10T08:53:33+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Some vala for Midgard2</title>
        <link>http://blogs.nemein.com/people/piotras/view/1252572813.html</link>
        <description>
&lt;p&gt;Recently I decided to start some &lt;a href=&quot;http://www.midgard2.org&quot;&gt;Midgard2&lt;/a&gt; developing work using &lt;a href=&quot;http://live.gnome.org/Vala&quot;&gt;vala&lt;/a&gt;.
I needed to implement simple GLib's GKeyFile &lt;a href=&quot;http://trac.midgard-project.org/browser/trunk/midgard/core/midgard/vala&quot;&gt;wrapper&lt;/a&gt;, so vala seemed best choice.&lt;/p&gt;

&lt;p&gt;First of all, vala is perfect (and sexy excellent) for boring and time consuming routines like GObject
class' macros and standard hooks initialization. But with real, non standard code I started to hit the wall.&lt;/p&gt;

&lt;h1&gt;GLib.KeyFile&lt;/h1&gt;

&lt;pre&gt;&lt;code&gt;kf.set_comment (group, key, comment);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;generates:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;g_key_file_set_comment (self-&amp;gt;priv-&amp;gt;_keyfile, group, key, comment);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Obviosuly error pointer (or NULL) is missed so code won't compile.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;kf.get_groups ();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;generates:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;return (_tmp1 = g_key_file_get_groups (self-&amp;gt;priv-&amp;gt;_keyfile, &amp;amp;_tmp0), *result_length1 = _tmp0, _tmp1);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;amp;_tmp0 is expected to be size_t so code doesn't compile too.&lt;/p&gt;

&lt;p&gt;Those are minor issues as you can always edit autogenerated code and fix bugs. But this is not the point.&lt;/p&gt;

&lt;h1&gt;GLib.List&lt;/h1&gt;

&lt;pre&gt;&lt;code&gt;GLib.List list = new GLib.List&amp;lt;string&amp;gt; ();
list.prepend (some_string_var);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;generates code which doesn't compile cause of self-&gt;priv-&gt;g_dup_func missed member.&lt;/p&gt;

&lt;h1&gt;string&lt;/h1&gt;

&lt;p&gt;I created string array property, like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;private string[] cfgs;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and constructor:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;this.cfgs = new string[0];
this.cfgs = {};
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and added more elements:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;this.cfgs += some_string_var;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Code compiles and runs but greatly segfaults with 'double free or corruption'&lt;/p&gt;

&lt;p&gt;I am using valac 0.5.7-1 on 64bit Ubuntu 9.04. Might be that all issues are on mine side.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Updated&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var arr = new GLib.Array&amp;lt;string&amp;gt; (false, false, (uint)sizeof (string));
arr.append_val (abspath.ndup(abspath.length));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;doesn't compile:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;error: lvalue required as unary ‘&amp;amp;’ operand
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and C code:&lt;/p&gt;

&lt;p&gt;g_array_append_val (arr, _tmp7 = g_strndup (abspath, (gsize) string_get_length (abspath)));&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1248981734.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-07-30T19:22:14+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Qaiku as Mojito service on moblin</title>
        <link>http://blogs.nemein.com/people/piotras/view/1248981734.html</link>
        <description>
&lt;p&gt;Just started to add &lt;a href=&quot;http://www.qaiku.com&quot;&gt;Qaiku&lt;/a&gt; as new &lt;a href=&quot;http://moblin.org/projects/mojito&quot;&gt;Mojito&lt;/a&gt; service for &lt;a href=&quot;http://moblin.org/&quot;&gt;Moblin&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-78ce1f4c5d390c29be88409fe04934cf/qaiku_moblin.png&quot;&gt;&lt;img src=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-1e039fca9f44e9d1be6bd6011d28ca25/qaiku_moblin_thumb.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I used kvm alpha2-20090311 image, and (unfortunately) haven't been surprised.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Had to install many (plenty of) dev(el) packages to start some work&lt;/li&gt;
&lt;li&gt;Spent &lt;em&gt;some&lt;/em&gt; time trying to find out how to install gconf, cause package is named Dbus-Gconf. Uh?&lt;/li&gt;
&lt;li&gt;No apt-get! (yes, this is personal ;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When I added Qaiku service, which is available in 'Web services' configuration, I started to wonder how could I start testing it before adding more code. The &lt;a href=&quot;http://moblin.org/documentation/moblin-netbook-intro/how-get-around-moblin-netbook-ui/toolbar&quot;&gt;toolbar&lt;/a&gt; is available in Moblin beta release, but it's not in SDK image?
Does it mean I should write code using SDK image, package it, install on other device with Moblin installed and test it at last?&lt;/p&gt;

&lt;p&gt;So far I understood I should initialize another window manager, but &lt;code&gt;mutter&lt;/code&gt; (no idea if it's the correct one) created two squares on my image screen - white and blue one.&lt;/p&gt;

&lt;p&gt;Also it would be very nice if Mojito developers could add more authentication types support. You can use traditional username/password authentication for Qaiku but you can use an APIKey as well. I want Qaiku service to use APIKey, so had to define 'username' in Mojito's service, but this one as you see on screenshot is kind of confusing. I bet 99,99999% of users will type their username instead of their unique uuid.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1247082537.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-07-08T19:48:57+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Midgard2 API with Gtk-doc</title>
        <link>http://blogs.nemein.com/people/piotras/view/1247082537.html</link>
        <description>
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Not, a big deal. Many Gnome libraries use Gtk-doc as the tool for API documentation. Midgard is just another one. For long, long time I used Doxygen, but this wasn&amp;#39;t good enough, and there are few Gtk-doc features I like very much. 
&lt;/p&gt;
&lt;p&gt;
Deprecated symbols are marked nice way in search panel.
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-d4878f65d15e08b3d3a281c0393e24ed/zrzut_ekranus.png&quot;&gt;&lt;img src=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-d03ca63fd58963700b416784b86e719c/thumb.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
All libraries in one place. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-ce92df4123a464198ccc595c2701a105/zrzut_ekranu-1s.png&quot;&gt;&lt;img src=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-26dca0268aa2bc2de5a5aa921c75f628/thumb1.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Quick access to new symbols. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-56c91d2fee76b74ab62de51d6f5e4e88/zrzut_ekranu-2s.png&quot;&gt;&lt;img src=&quot;http://blogs.nemein.com/people/piotras/midcom-serveattachmentguid-6a2fb6128ce3b9a967223f1e7774bf15/thumb2.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1247067365.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-07-08T15:36:05+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Consequence and consistence , part 2</title>
        <link>http://blogs.nemein.com/people/piotras/view/1247067365.html</link>
        <description>
&lt;p&gt;Zend is from Mars and PHP is from Moon.&lt;/p&gt;

&lt;p&gt;This works:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zend_class_entry **ce;
const gchar *rmn = &quot;reflectionmethod&quot;;

if (zend_hash_find(CG(class_table), (gchar *)rmn, strlen(rmn)+1, (void **) &amp;amp;ce)  == FAILURE)
    return NULL;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And this segfaults badly somewhere in Zend internals:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zend_class_entry **ce;
const gchar *rmn = &quot;ReflectionMethod&quot;;

zend_lookup_class((gchar *)rmn, strlen(rmn), &amp;amp;ce TSRMLS_CC);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I wOndER wHere I mAde misTAkE?&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1246966442.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-07-07T11:34:02+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Midgard2 and database transactions</title>
        <link>http://blogs.nemein.com/people/piotras/view/1246966442.html</link>
        <description>
&lt;p&gt;&lt;a href=&quot;http://trac.midgard-project.org/milestone/9.09%20Mjolnir&quot;&gt;Mjolnir&lt;/a&gt; has a very nice feature, which many &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; &lt;a href=&quot;http://www.midgard-project.org/community/whoswho&quot;&gt;developers&lt;/a&gt; has been waiting for, for long time.
Introduced &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-transaction.html&quot;&gt;midgard_transaction&lt;/a&gt; class provides an easy way to manage database transactions. I was wondering if transaction support should be implemented as &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-connection.html&quot;&gt;midgard_connection&lt;/a&gt; methods, but I decided not to abuse connection's API and transaction class as standalone one would emit (in a future) additional signals for applications' callbacks.&lt;/p&gt;

&lt;p&gt;midgard_transaction usage is very easy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;t = midgard.transaction()
t.begin()
t.commit()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The same API works in C, PHP and also in &lt;a href=&quot;http://www.midgard-project.org/documentation/objectivec_midgard&quot;&gt;Objective-C&lt;/a&gt; Midgard bindings. Note that Midgard core itself never uses transactions. It's up to the application, whether begin, commit or rollback transaction.&lt;/p&gt;

&lt;p&gt;I also &lt;a href=&quot;http://trac.midgard-project.org/changeset?new=trunk%2Fmidgard%2Fcore%2Fmidgard%2Fsrc%2Fmidgard_transaction.c%4022086&amp;amp;old=trunk%2Fmidgard%2Fcore%2Fmidgard%2Fsrc%2Fmidgard_transaction.c%4022083&quot;&gt;found some issue&lt;/a&gt; related to SQLite transaction's identifier. If you think it could be solved better way, &lt;a href=&quot;http://www.midgard-project.org/community/support-discussion&quot;&gt;let us know&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1246881867.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-07-06T12:04:27+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Midgard2 and database views</title>
        <link>http://blogs.nemein.com/people/piotras/view/1246881867.html</link>
        <description>
&lt;p&gt;&lt;a href=&quot;http://www.midgard2.org&quot;&gt;Midgard2&lt;/a&gt; provides flexible support for &lt;a href=&quot;http://en.wikipedia.org/wiki/View_(database)&quot;&gt;database views&lt;/a&gt;. The basic idea originates from well known &lt;a href=&quot;http://www.midgard-project.org/documentation/mgdschema-file/&quot;&gt;MgdSchema&lt;/a&gt; technology introduced in Midgard 1.7. And to get better overview, you probably should read &lt;a href=&quot;http://www.midgard-project.org/development/mrfc/0041/&quot;&gt;midgard_view mRFC&lt;/a&gt;, but I'll try to explain how you could start with views quickly.&lt;/p&gt;

&lt;p&gt;First of all, you have to create view xml file which describes and defines real database view.
As view can be complex, you can also define any database join type:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;Schema xmlns=&quot;http://www.midgard-project.org/repligard/1.4&quot;&amp;gt;
    &amp;lt;view name=&quot;mystyleview&quot; table=&quot;style&quot;&amp;gt;
        &amp;lt;property name=&quot;pagename&quot;     use=&quot;midgard_style:name&quot; /&amp;gt;
        &amp;lt;property name=&quot;parentid&quot;        use=&quot;midgard_style:up&quot; /&amp;gt;
        &amp;lt;property name=&quot;elementname&quot;  use=&quot;midgard_element:name&quot; /&amp;gt;
        &amp;lt;property name=&quot;value&quot;        use=&quot;midgard_element:value&quot; /&amp;gt;
        &amp;lt;join type=&quot;left&quot; class=&quot;midgard_host&quot; &amp;gt;
            &amp;lt;condition left=&quot;midgard_host:style&quot; right=&quot;midgard_style:id&quot; /&amp;gt;
        &amp;lt;/join&amp;gt;
        &amp;lt;join type=&quot;inner&quot; class=&quot;midgard_element&quot; &amp;gt;
            &amp;lt;condition left=&quot;midgard_element:style&quot; right=&quot;midgard_style:id&quot; /&amp;gt;
        &amp;lt;/join&amp;gt;
        &amp;lt;join type=&quot;inner&quot; table=&quot;element_i&quot; &amp;gt;
            &amp;lt;condition left=&quot;midgard_element:sid&quot; right=&quot;midgard_element:id&quot; /&amp;gt;
        &amp;lt;/join&amp;gt;
    &amp;lt;/view&amp;gt;
&amp;lt;/Schema&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once xml file for view is created, it should be copied to &lt;code&gt;views&lt;/code&gt; directory under Midgard2 share dir.
This one depends on midgard core prefix, and in my case it's &lt;code&gt;/usr/share/midgard-2.0/views/&lt;/code&gt;.
Then, you can start any Midgard2 application. View definition will be read on start up, and new GObject class will be created on the fly. If your application is written in &lt;a href=&quot;http://www.midgard-project.org/documentation/php_midgard_core/&quot;&gt;PHP&lt;/a&gt; or &lt;a href=&quot;http://www.midgard-project.org/documentation/python_midgard/&quot;&gt;Python&lt;/a&gt;, then proper language related class will be initialized as well.&lt;/p&gt;

&lt;p&gt;Now, you can create new mystyleview instance (in Python):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mystyle = midgard.view.mystyleview()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or in C:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MidgardView mystyle = g_object_new(g_type_from_name(&quot;mystyleview&quot;), NULL);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;OK, but at this moment, you can do nothing with your view. Database view is considered read only, so you need to fetch some database records, which are represented as objects.&lt;/p&gt;

&lt;p&gt;First of all, prepare database storage for newly created view. &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-storage.html&quot;&gt;MidgardStorage (midgard_storage)&lt;/a&gt; should do the hard job for you:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;midgard.storage.create_class_storage(&quot;mystyleview&quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Of course, you can delete this storage, once you decide you do not need it any longer:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;midgard.storage.delete_class_storage(&quot;mystyleview&quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Both tasks can be done also in C or in PHP.&lt;/p&gt;

&lt;p&gt;Now, when database view is created you can start query objects. The best helper, is &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-query-builder.html&quot;&gt;MidgardQueryBuilder&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;qb = midgard.query_builder(&quot;mystyleview&quot;)
qb.add_constraint(&quot;pagename&quot;, &quot;&amp;lt;&amp;gt;&quot;, &quot;&quot;)
list = qb.execute()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As midgard_view is nothing but database storage abstraction, you can also benefit from &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-collector.html&quot;&gt;midgard_collector&lt;/a&gt; or &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-20-midgard-reflection-property.html&quot;&gt;midgard_reflection_property&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, any instance of registered midgard_view class has properties which has been defined in xml view file. So (for example) access to &lt;em&gt;pagename&lt;/em&gt; property is done via &lt;em&gt;list[0].pagename&lt;/em&gt;.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1240999802.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-04-29T10:10:02+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Midgard2 - new epoch</title>
        <link>http://blogs.nemein.com/people/piotras/view/1240999802.html</link>
        <description>
&lt;p&gt;Today, &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;we&lt;/a&gt; &lt;a href=&quot;http://www.midgard-project.org/updates/midgard2-9-3-0-vinland-released/&quot;&gt;made&lt;/a&gt; first stable release for the new &lt;a href=&quot;http://www.midgard2.org&quot;&gt;Midgard2&lt;/a&gt; generation. For years, Midgard focused on PHP and well known LAMP platform.
With Midgard2 we created completely new architecture based on stable and widely used libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GLib&lt;/li&gt;
&lt;li&gt;GObject&lt;/li&gt;
&lt;li&gt;LibGDA&lt;/li&gt;
&lt;li&gt;LibXML&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And from pure web environment our target became: desktop, mobile devices and web as well. With &lt;a href=&quot;http://www.midgard2.org&quot;&gt;Midgard2&lt;/a&gt; you can select the language you would like to write your favorite application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;C&lt;/li&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;Objective-C&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Binary packages will be available soon at &lt;a href=&quot;http://download.opensuse.org/repositories/home:/midgardproject:/vinland/&quot;&gt;OBS repository&lt;/a&gt;. And later on, you can expect them also in &lt;a href=&quot;http://www.maemo.org&quot;&gt;maemo&lt;/a&gt; extras.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1237369637.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-03-18T09:47:17+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>When MySQL goes away</title>
        <link>http://blogs.nemein.com/people/piotras/view/1237369637.html</link>
        <description>
&lt;p&gt;I am debugging &lt;a href=&quot;www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; problem related to &lt;a href=&quot;www.mysql.com&quot;&gt;MySQL&lt;/a&gt; &lt;code&gt;2006&lt;/code&gt; error. It's well known as &quot;MySQL server has gone away&quot;. What I found so far, is an easy way to set very short timeout for debugging purposes. I execute such query in MySQL shell (and it sets timeout for 15 seconds):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set global wait_timeout = 15;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Similarly, you set increase yout timeout if sercer times out too quickly:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set global wait_timeout = 86400;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This one sets timeout for 24 hours.&lt;/p&gt;

&lt;p&gt;Once you do so, you can notice different values when executing &lt;code&gt;show variables&lt;/code&gt; query. Do not worry, the query you used, returns variables from the session you are just running.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1234461709.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-02-12T18:01:49+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Consequence and consistence</title>
        <link>http://blogs.nemein.com/people/piotras/view/1234461709.html</link>
        <description>
&lt;p&gt;I tell it here and there. But people tend to forget, so it's better to write it down. I know, some people (developers) already don't like me, but it's not really my fault they write bad code. And since now, I will (consequently) write about something they produce. Ah! It's PHP or Zend Engine 2, if I forgot to mention.&lt;/p&gt;

&lt;p&gt;Let's look at one file, php_reflection.c from reflection extension.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* Invoke the __toString() method */
ZVAL_STRINGL(&amp;amp;fname, &quot;__tostring&quot;, sizeof(&quot;__tostring&quot;) - 1, 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So what is the method name? __tostring or __toString? What minimal alphabet they use?&lt;/p&gt;

&lt;p&gt;And note second line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ZVAL_STRINGL(&amp;amp;fname, &quot;__tostring&quot;, sizeof(&quot;__tostring&quot;) - 1, 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And one more from the same file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zend_hash_find(EG(function_table), lcname, name_len + 1, (void **)&amp;amp;fptr);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and one more:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zend_hash_update(Z_OBJPROP_P(object), &quot;name&quot;, sizeof(&quot;name&quot;), (void **) &amp;amp;name, sizeof(zval *), NULL);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;What's the deal with those three lines of code? API is created such way, so it forces you to pass length of the passed string. So if you look at examples above, how do you count length of the string?&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1232642360.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-01-22T16:39:20+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>midgard_datetime</title>
        <link>http://blogs.nemein.com/people/piotras/view/1232642360.html</link>
        <description>
&lt;p&gt;I started to work on midgard_datetime class. Pure PHP class which should represent any property of Midgard MgdSchema object which holds datetime string. A pure, means that it focuses on PHP language only, and in fact, it's implemented in midgard extension.&lt;/p&gt;

&lt;p&gt;Why midgard_datetime? And not just simple DateTime class, as suggested in related &lt;a href=&quot;http://trac.midgard-project.org/ticket/54&quot;&gt;ticket&lt;/a&gt;?
Answer is simple. PHP has limits. Imagine, every datetime property is propagated as DateTime object. And when you want to read it, you simply invoke format() method. But what to do when you need to change date or time? You invoke setDate() method and what next? Did underlying GObject's property value has been changed as well? No. There's no features like signal emission or simple event notification on PHP level. So, even if you write own callback, no single line of code will trigger it (As a decent framework Midgard &lt;a href=&quot;http://www.midgard-project.org/documentation/php_events&quot;&gt;supports events&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I wrote midgard_datetime class (&lt;a href=&quot;http://php.net/manual/en/class.datetime.php&quot;&gt;DateTime&lt;/a&gt; derived) with own underlying C structure and assigned own hooks for it. All in all, at some point I need to know what is the object and what is the property a midgard_datetime holds value for. And this failed because DateTime objects hold own underlying C structures, so when all Zend OO related hooks return void type, you never know what you really get: DateTime structure, midgard_datetime one or maybe mather-in-law? 
Implementation simplified. But it doesn't mean it became more elegant. I had to register private properties. Yes, this is common for PHP code, but on C level you have armory of possibilities, and had to forget about it.&lt;/p&gt;

&lt;h1&gt;Examples&lt;/h1&gt;

&lt;p&gt;In Ragnaroek, you used to print datetime property:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo $object-&amp;gt;metadata-&amp;gt;created;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and in vinland, what you wanted to print is an object, so you need to invoke its method:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo $object-&amp;gt;metadata-&amp;gt;created-&amp;gt;format(&quot;c&quot;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;midgard_datetime is automagically initialized with DateTimeZone object, so if you need timezone you invoke getTimezone method. Of course, the only one correct timezone for Midgard datetimes is UTC. And you can not change it.&lt;/p&gt;

&lt;p&gt;For more flexibility, every DateTime (or derived one) class' object is converted to GValue which holds ISO 8601 formatted string, so ot only objects are &quot;affected&quot; by such conversion. You can pass such objects as Query Builder constraints' values:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$md = new midgard_datetime();
$md-&amp;gt;setDate(2009, 01, 02);

$qb = new midgard_query_builder(&quot;midgard_article&quot;);
$qb-&amp;gt;add_constraint(&quot;metadata.published&quot;, &quot;&amp;gt;&quot;, $md);
&lt;/code&gt;&lt;/pre&gt;

&lt;h1&gt;Performance&lt;/h1&gt;

&lt;p&gt;I made two simple tests. Both have a loop (100 steps) and assign string datetime. First one uses:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$a = new midgard_article();
$b = $a-&amp;gt;title;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and takes from 0,0060 to 0,0080 seconds. This test is almost the same as assigning datetime property the &quot;old&quot; way.&lt;/p&gt;

&lt;p&gt;Second one uses midgard_datetime:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$a = new midgard_article();
$d = $a-&amp;gt;metadata-&amp;gt;created-&amp;gt;format(&quot;c&quot;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and takes from 0,0180 to 0,0230 seconds.&lt;/p&gt;

&lt;p&gt;Looks like midgard_datetime implementation is up to 4 times slower. But as it extends DateTime, there's many features implemented &quot;for free&quot;. And if you take into account, that first test requires additional function calls, like strtotime() and date() (to format output), midgard_datetime implementation will be up to 2 times slower.
And I think it's not a big problem. midgard_datetime object is created on demand, only when you need to read property. And in practice, you do not need thousands of datetimes available at the same time.&lt;/p&gt;

&lt;h1&gt;Issues&lt;/h1&gt;

&lt;p&gt;MySQL doesn't work with constraint used in QB's example. It simply treats string verbatim, so SQL part looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;WHERE metadata_published = '2019-01-01T00:00:00+00:00'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It works, if you remove timezone offset. So I believe fixing the issue is a matter of date formatting.&lt;/p&gt;

&lt;p&gt;Also there's no possibility to convert datetime values (returned by collector for example) to midgard_datetime objects. Such values are initialized as GValue values of string type. And this should be fixed by wider midgard timestamp values usage in core.&lt;/p&gt;

&lt;p&gt;You can install &lt;a href=&quot;http://download.opensuse.org/repositories/home:/midgardproject:/vinland-dev/&quot;&gt;latest packages&lt;/a&gt;, if you would like to try those.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1232109740.html">
        <dc:format>text/html</dc:format>
        <dc:date>2009-01-16T12:42:20+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>ZEND_ARG_INFO reflections in midgard php bindings</title>
        <link>http://blogs.nemein.com/people/piotras/view/1232109740.html</link>
        <description>
&lt;p&gt;Yesterday I finished ZEND_ARG_INFO implementation support in PHP bindings for &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt;. I am happy as I closed another &lt;a href=&quot;http://trac.midgard-project.org/ticket/479&quot;&gt;ticket&lt;/a&gt;, so this nice feature will be also available for Vinland.  Yes, I must say this is nice feature. However, at first I was very unhappy how it's implemented in ZE2.&lt;/p&gt;

&lt;p&gt;For simple class implmentation you may use ZEND_ARG macros, quite simply.&lt;/p&gt;

&lt;p&gt;midgard_connection::open($name):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ZEND_BEGIN_ARG_INFO_EX(arginfo_midgard_connection_open, 0, 0, 1)
    ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But for dynamic classes, like &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/2.0/&quot;&gt;Mgdschema&lt;/a&gt; ones, things are more complicated.&lt;/p&gt;

&lt;p&gt;get_by_guid($guid) method:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ NULL, 0, NULL, 0, 0, 0, 0, 0, 1 },
{ &quot;guid&quot;, sizeof(&quot;guid&quot;)-1, NULL, 0, 0, 0, 0, 0, 0 },
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Especially, if you take into account fact, that method's arguments are defined with the same structure as method itself. And of course (as usual), you can not read about this in ZE2 documentation. Just investigate and hack sources.&lt;/p&gt;

&lt;p&gt;Anyway, what does it mean for Midgard? Better reflection and nice (almost perfect) way to introspect all &lt;a href=&quot;http://www.midgard-project.org/api-docs/midgard/core/2.0/&quot;&gt;Midgard core API&lt;/a&gt; via &lt;a href=&quot;http://php.net/oop5.reflection&quot;&gt;PHP classes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's look at simple example (I used the same code, provided in PHP docs):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$method = new ReflectionMethod('midgard_user', 'password');
$p = $method-&amp;gt;getParameters();

foreach ($method-&amp;gt;getParameters() as $i =&amp;gt; $param) 
{
    printf(
    &quot;-- Parameter #%d: %s {\n&quot;.
    &quot;   Class: %s\n&quot;.
    &quot;   Allows NULL: %s\n&quot;.
    &quot;   Passed to by reference: %s\n&quot;.
    &quot;   Is optional?: %s\n&quot;.
    &quot;}\n&quot;,
    $i, // $param-&amp;gt;getPosition() can be used from PHP 5.2.3
    $param-&amp;gt;getName(),
    var_export($param-&amp;gt;getClass(), 1),
    var_export($param-&amp;gt;allowsNull(), 1),
    var_export($param-&amp;gt;isPassedByReference(), 1),
    $param-&amp;gt;isOptional() ? 'yes' : 'no'
    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And the output:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-- Parameter #0: username {
    Class: NULL
   Allows NULL: false
   Passed to by reference: false
   Is optional?: no
}
-- Parameter #1: password {
   Class: NULL
   Allows NULL: false
   Passed to by reference: false
   Is optional?: no
}
-- Parameter #2: hashtype {
   Class: NULL
   Allows NULL: false
   Passed to by reference: false
   Is optional?: yes
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A real cool thing about such reflection is possibility to create one unified documentation system for code written purely in PHP and for that one written in C extension. If Zend introspection will allow this, we should have much better documentation with less amount of work. And this will be first cool thing provided by Zend :)&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1228823602.html">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-09T11:53:22+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Always blame...</title>
        <link>http://blogs.nemein.com/people/piotras/view/1228823602.html</link>
        <description>
&lt;p&gt;I must say I like to read threads like this. Yes, for me it's kind of endless pleasure to read every single sentence and word in &lt;a href=&quot;http://www.nabble.com/Seg-faults-on-highly-trafficed-APC-site-to20886787.html#a20886787&quot;&gt;such thread&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Especially this one:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;there was a known memory corrupt issue in 5.2.5&lt;/strong&gt;&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1227818298.html">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-27T20:38:18+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Faster MidCOM static files.</title>
        <link>http://blogs.nemein.com/people/piotras/view/1227818298.html</link>
        <description>
&lt;p&gt;Better late then never, but just today I realized that &lt;em&gt;MidgardEngine&lt;/em&gt; directive from &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; apache module can not work inside &lt;em&gt;Directory&lt;/em&gt; one.
Not because module has a bug. But because with midgard apache module, apache won't be able to check if it's serving file from such directory. It is the main purpose of midgard module. Serve data from database, not from filesystem.&lt;/p&gt;

&lt;p&gt;Of course, &lt;em&gt;MidgardEngine&lt;/em&gt; will work in virtaul host scope. But in directory scope -will never work.&lt;/p&gt;

&lt;p&gt;How to set &lt;em&gt;MidgardEngine&lt;/em&gt; to Off for specific directory then? Use Location.
I configured it simply for my virtual host:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;Location /midcom-static/&amp;gt;
    MidgardEngine Off
&amp;lt;/Location&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1226521466.html">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-12T20:24:26+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>Sauna, suana, sauna or Midgard Gathering</title>
        <link>http://blogs.nemein.com/people/piotras/view/1226521466.html</link>
        <description>
&lt;p&gt;I was to blog earlier but &lt;a href=&quot;http://blogs.nemein.com/people/piotras/view/1226517502.html&quot;&gt;this issue&lt;/a&gt; made me busy. On monday, me and solt came back to Poland from &lt;a href=&quot;http://www.midgard-project.org/community/events/midgard_gathering_2008/&quot;&gt;Midgard Gathering&lt;/a&gt;. Second gathering this year.
I must say I think I am getting older as it's getting hard to focus when there are so many people and sauna time ends very late night :)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://bergie.iki.fi/blog/midgard_gathering_2008/&quot;&gt;Bergie's blog&lt;/a&gt; describes gathering very nice and with more details.&lt;/p&gt;

&lt;p&gt;Anyway, few very interesting points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://boids.name/empty/articles/2008/08/27&quot;&gt;Midgard and Vala&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://teroheikkinen.iki.fi/blog/midgard_workshop_at_fscons/&quot;&gt;PHP and Python&lt;/a&gt; bindings communication&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://flickr.com/photos/bergie/3013378655/&quot;&gt;Almost successful&lt;/a&gt; Midgard build on windows&lt;/li&gt;
&lt;li&gt;Midgard Foundation!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And as Vinland requirements clarified a lot, I am looking forward to see Midgard2 as a gateway for Gnome to web servers and services world.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="http://blogs.nemein.com/people/piotras/view/1226517502.html">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-12T19:18:22+00:00</dc:date>
        <dc:creator>Piotr Pokora</dc:creator>
        <title>ap_get_module_config and RHEL5</title>
        <link>http://blogs.nemein.com/people/piotras/view/1226517502.html</link>
        <description>
&lt;p&gt;This is an issue. I couldn't find why &lt;a href=&quot;http://www.midgard-project.org&quot;&gt;Midgard&lt;/a&gt; apache module refused to work on RHEL5.It just started to segfault. What's even more interesting, it started to segfault when trying to access read only data provided by apache.
If you are familiar with apache modules' internals you probably know that all routines are registered as hooks. Even that ones which holds server and directory config. In normal case you register hook and get configuration later, when it's needed.&lt;/p&gt;

&lt;p&gt;Just like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;midgard_directory_config *dcfg = 
    (midgard_directory_config *)ap_get_module_config(r-&amp;gt;per_dir_config, &amp;amp;midgard_module);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I found these two posts quite interesting. &lt;a href=&quot;http://marc.info/?l=apache-modules&amp;amp;m=98822999813635&amp;amp;w=2&quot;&gt;First&lt;/a&gt; because it affected also midgard-apache module few years ago, and the &lt;a href=&quot;http://marc.info/?l=apache-httpd-dev&amp;amp;m=113040417630964&amp;amp;w=2&quot;&gt;second&lt;/a&gt; because it clearly shows there something odd happens. Why odd? Because you never sets directory or server config explicitly. You just register function and it's up to the server implementation when it's invoked.&lt;/p&gt;

&lt;p&gt;In my case ap_get_module_config(r-&gt;per_dir_config, &amp;amp;midgard_module) returned NULL all the time. So I added debug messages which showed that server and directory configuration hooks are invoked. Spent plenty of time trying to figure it out.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your hooks are working very good (the same code works with older version of Midgard)&lt;/li&gt;
&lt;li&gt;Hooks are invoked. For sure.&lt;/li&gt;
&lt;li&gt;ap_get_module_config returns NULL.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Three facts which made me think it's something wrong with Apache. Not the module itself. And after many trials and errors, I found guilty AM_CFLAG: &lt;em&gt;-D_FILE_OFFSET_BITS=64&lt;/em&gt;. Also interesting fact, this flag is able &lt;a href=&quot;http://bugs.php.net/bug.php?id=45942&quot;&gt;to slow down PHP&lt;/a&gt; itself.&lt;/p&gt;
</description>
    </item>
</rdf:RDF>
