Piotras' blog: Archive

2008-01-01 - 2008-10-12

When you think you are drunk

Posted on 2008-01-12 11:12:16 UTC.

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:

ls -l /usr/bin/python*
lrwxrwxrwx  1 root root    9 Feb 11  2007 /usr/bin/python -> 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

Ok, nothing unusual, right? python command is just a symlink to python2.4. Which is cool of course, isn't it?

But strace wrote weird logs so I decided to check python version:

/usr/bin/python2.4 -V
Python 2.4.2
/usr/bin/python -V
Python 2.3.4

Please, please tell me why the hell command invoked via symlink returns different version.

Suhosin Patch

Posted on 2008-01-16 10:10:03 UTC.

I have been asked to look at random segfaults which started to appear after Midgard 1.8.5 upgrade. I checked many places and was wondering what really triggers them.

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 "Cannot redeclare class" caused segfaults.

So, I was completely out of ideas, when I noticed this one in Apache's log file:

PHP/5.2.4-0.dotdeb.0 with Suhosin-Patch

Suhosin, 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.

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:

  • If I have at least 5 extensions loaded , which one triggers segfault if Suhosin is enabled ?
  • Which one is badly written if PHP doesn't segfault without Suhosin?
  • If one extension is badly written where can I find documentation how it should be written well to work fine with Suhosin?
  • Who made detailed tests and is sure that all extensions corrupts memory? All but Suhosin ?

Memory corruption in midgard-php

Posted on 2008-01-18 10:00:11 UTC.

Just two days ago I blamed Suhosin patch, and this morning I found probably the source of the problem.

Log entry is clear:

PHP Fatal error:  Cannot instantiate abstract class \x85\xd7\xe9\x84\x1d

I found that mgd_get_object_by_guid is not aware of Zend2 (PHP5), and code "focuses" 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.

If you need to write code for ZE1 and ZE2, keep it in mind:

ZE1: zend_class_entry *ce;
object_init_ex(return_value, ce TSRMLS_CC);

ZE2: zend_class_entry **ce;
object_init_ex(return_value, *ce TSRMLS_CC);

But when you look for class pointer you always pass (void **) &ce) as zend_hash_find 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.

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 ) midgard_object_class::get_object_by_guid instead of mgd_get_object_by_guid.

When midgard_setup fails

Posted on 2008-01-22 21:17:27 UTC.

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.

So, what I got when I switched to terminal again?

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...

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.

midgard_blob once again

Posted on 2008-02-07 18:56:38 UTC.

This class has been introduced in Midgard 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 ).

Documentation for midgard_blob needs many improvements but you can take a look at it already today.

Completely new features which wait for you in Midgard 1.9 include:

  • You may create attachment for another attachment
  • You may share attachments among many objects
  • You may use any PHP API part which requires file's absolute path or file handler.
  • You may create new files quickly

midgard-schema and database update

Posted on 2008-02-11 13:21:52 UTC.

I ported some minor database routines from Midgard branch-1-9 to stable branch today. It doesn't mean I ported unstable features. On the contrary , I fixed quite important issues: #193,#214 and #78.

What does it mean exactly?

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

  • midgard_reflection_property is used to check if property should be indexed ( like parent property or link one )
  • Indexes are created for commonly used metadata columns

When update is performed, midgard-schema checks every single table and column if anything should be done with it:

  • Update is made as much faster as many unchanged columns you have in table ( comparing to shell's datagard )
  • During developing, you may alter table and change columns' type "on the fly".

Testing Midgard 1.9

Posted on 2008-02-21 14:44:58 UTC.

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:

MIDGARD_TEST_REPOSITORY="deb http://www.midgard-project.org/nightly/debian ./"
APT_SOURCES_LIST="/etc/apt/sources.list"

if ! grep $MIDGARD_TEST_REPOSITORY $APT_SOURCES_LIST; then
        cp ${APT_SOURCES_LIST} ${APT_SOURCES_LIST}.midgard.bak
        echo "Adding ${MIDGARD_TEST_REPOSITORY} to ${APT_SOURCES_LIST}"
        echo ${MIDGARD_TEST_REPOSITORY} >> ${APT_SOURCES_LIST}
fi

echo "Updating packages info..."
apt-get update

echo "Installing midgard..."
apt-get --reinstall install libmidgard10 php5-midgard libapache2-mod-midgard midgard-common

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

/usr/sbin/datagard

Midgard2 and Gtkdoc

Posted on 2008-03-06 20:32:00 UTC.

One day I realized that for last few months, I managed to fix (few times) some documentation part for Midgard core and PHP bindings. Those fixes almost always included properties of some class. And recently I started to wonder how to write documentation for events 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.

Since Midgard 1.8 we used doxygen, 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.

I decided to test gtkdoc ( which is also far from being perfect and seems to be missing doxygen :), and got quite nice documentation part for a start.

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 quickly.

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 devhelp to read them.

Gnomegard

Posted on 2008-03-09 12:46:58 UTC.

I think t's going to be sexy. Very sexy.

I must test it! mgd:// uri will look lovely :)

midgard-python once again

Posted on 2008-03-18 21:02:12 UTC.

Bergie just blogged about initial MidCOM3 architecture. He included nice and very easy example of midgard-php API. And while he mentioned some python based solution I decided to add short and working example of midgard-python in action.

All in all, it's good to have, especially now, when Midgard2 is already an alpha and available also as packages for maemo.org platform.

D-Bus and Midgard

Posted on 2008-03-28 12:40:12 UTC.

Midgard 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 D-Bus support. They use midgard-python and dbus modules.

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.

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.

Check initial test code!

Basics of midgard_dbus

Posted on 2008-04-08 10:55:41 UTC.

midgard_dbus API is very simple, but my approach was to make it just simple as possible. Basically we have two major methods of midgard_dbus:

  • constructor, which registers object at path
  • send, which asynchronously send message to object at given path

New initialized object doesn't do anything special. It just waits for any call to him and then emits "notified" signal, which you can connect callback to.

I tested simple code with midgard-php and midgard-python.

midgard_python "service":

import dbus.mainloop.glib
import _midgard as midgard

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

mbus = midgard.dbus("/midgard_article")
mbus.connect("notified", mbus_callback, "foo")

mainloop = gobject.MainLoop()
mainloop.run()

midgard-php "client":

$message = "Greetings from midgard-php!(" . mgd_version() . ") PHP ver." . phpversion();
midgard_dbus::send("/midgard_article", $message);

I started php script which immidietialy ended, and on midgard-python service's terminal I got this message:

Hi! I am midgard_dbus from midgard-python. I got message:
Greetings from midgard-php! (2.0alpha0) PHP ver.5.2.5-3

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.

MidCOM3 without apache module

Posted on 2008-04-11 14:15:07 UTC.

This is really HOT!

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

Midgard with Lighttpd

Posted on 2008-04-22 08:05:55 UTC.

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.

First of all you need to install and configure Lighttpd web serwer. On debian I installed it using apt-get:

apt-get install lighttpd

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.

Also, you need to have php5 compiled with fast-cgi support. Again, on debian install it quickly:

apt-get instal php5-cgi

Edit cgi's php.ini file (/etc/php5/cgi/php.ini), and add midgard support:

extension=midgard2.so
midgard.configuration="midgard"
midgard.http="on"

Then configure your new web server. I found these two sites very helpful to configue lighttpd server:

Later on, you need to install Midgard2 from trunk, which is going to be released as alpha2 soon.

In my case, I configured lighttpd with these options:

server.port = 81

Just to have both, Apache and lighttpd available. You may of course use different port if you like.

Enable required modules, mod_rewrite and mod_fastcgi:

server.modules              = (
        "mod_access",
        "mod_alias",
        "mod_accesslog",
        "mod_compress",
        "mod_rewrite",
        "mod_fastcgi",
)

Configure fastcgi:

fastcgi.server = (
    ".php" => (
            "localhost" =>
                    (
                            "socket" => "/tmp/php-fastcgi.socket",
                            "bin-path" => "/usr/bin/php5-cgi"
                    )
            )
    )

Configure virtual host:

$HTTP["host"] == "myhost" {
    server.port = 81
    server.document-root = "/var/lib/midgard/vhosts/myhost/8080"
    url.rewrite-once = ( "^(.*)\.*" => "midgard-root.php" )
}

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.

midgard-root.php file should be copied or symlinked from midcom's git repository. I do not have to remind that midcom itself should be installed and ready to use.

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.

chmod 644 /etc/midgard-2.0/conf.d/*

After this, restart lighttpd:

/etc/init.d/lighttpd restart

And open http://myhost:81 with your favourite browser. If all went fine, you should have midcom's web page without style. Reason is that we do not make midcom-static exception in our hosts' rewrite condition.

MySQL doesn't support TEXT type

Posted on 2008-05-08 14:46:56 UTC.

Yes, it does not. But you could say:

Oh, yes indeed. They mention "The four TEXT types", 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 Midgard.

I started to investigate it from the very beginning, to catch why text type becomes an array:

  1. Parameter class has value member of longtext type.
  2. Database column for this property has longtext column type.
  3. GDA library with MySQL provider uses MySQL column types to determine what value should be initialized on C level.
  4. GDA gets BLOB type.
  5. GDA initializes its own GdaBinary type( GdaBinary is GBoxed derived type ).
  6. PHP bindings for midgard and especially GValue and zval converter gets boxed type.
  7. We support only array type of gboxed one so zend array is initialized and returned.

Not easy to fetch at first glance, isn't it?

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.

So, there is support for strings (char and varchar):

  • MYSQL_TYPE_VAR_STRING
  • MYSQL_TYPE_STRING

And for blobs:

  • MYSQL_TYPE_TINY_BLOB
  • MYSQL_TYPE_MEDIUM_BLOB
  • MYSQL_TYPE_LONG_BLOB
  • MYSQL_TYPE_BLOB

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.

PEAR registry, where are you?

Posted on 2008-05-19 12:19:13 UTC.

I wrote this simple script to clear my local pear setup and to have clean pear instalation for Midgard.

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

So, when I cleaned my pear ,imagine, how much confused I was when I saw this in my terminal:

MIDGARD SETUP: Role_Web - installed: 1.1.1 available: 1.1.1

wtf?

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

PEAR registry...where are you?

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

rm -rf /usr/share/php/.registry 
rm -rf /usr/share/php/.channels

Voices in my head

Posted on 2008-05-19 22:15:37 UTC.

rs.jpg

It was last sunday.  And there are still "Voices in my head". Riverside guys made real show in best studio in Poland, and it'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. 

First time I heared them in LizardKing 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: perfect.  

"Join in the shadow dance"

When metadata creator is empty

Posted on 2008-05-23 13:49:48 UTC.

Quite major bug has been found today. 1.8.7 Midgard release doesn't populate metadata_creator guid. Midgard news page has a note about this.

I wrote additional script which should help with database upgrade if needed:

#!/bin/sh

DB="midgard"
MYSQLCMD="/usr/bin/mysql"

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

for TABLE in $MIDGARD_TABLES; do

    QUERY="UPDATE ${TABLE} SET metadata_creator=REPLACE(metadata_authors, '|' ,'')  WHERE metadata_creator='' AND metadata_authors<>'' AND metadata_authors<>'||' AND LENGTH(metadata_authors) < 39"
    echo "Fixing table: ${TABLE}"
    $MYSQLCMD -D ${DB} -e "${QUERY}"

    echo "Looking for multiple authors"
    QUERY="SELECT guid from ${TABLE} WHERE LENGTH(metadata_authors) > 38 AND metadata_creator='' AND metadata_authors<>'||' AND metadata_authors<>''"
    $MYSQLCMD -D ${DB} -e "${QUERY}"

done

New binary packages for Midgard 1.8

Posted on 2008-07-09 08:22:49 UTC.

At last, Debian is not the only one platform, for which we provide Midgard binary packages. We started to build packages using quite nice and powerful opensuse build system. A bit difficult to build debian packages out of the box, but with few tricks used here and there, we have binary packages for debian stable and ubuntu. For both, 32bit and 64bit architectures. Debs are not the only ones we buil there. Included distributions are: CentOS ( RedHat ), Fedore Core and Opensuse. You can browse all of them.

Debian and Ubuntu users can try to install packages with apt-get, adding such line to /etc/apt/sources.list:

deb http://download.opensuse.org/repositories/home:/midgardproject:/midgard18/Debian_Etch ./

Kudos and big thanks to everaldo and potyl!. It couldn't be done, without you guys.

Debug memory of PHP module

Posted on 2008-07-09 18:55:41 UTC.

The first question I ask to myself. What's the difference between PHP module and extension? Is it like, that PHP has modules while Zend extensions? If yes, why? If not, why there are both types? There are no comments allowed, so questions remain unanswered. Well... as usual, I would say. That's nature of Zend/PHP support.

Anyway, you wrote PHP module and want to debug or profile its memory. Or you just want to catch all memory leaks. The first action is to run php via valgrind, but in such case, the log file is far from being helpfull:

==17786== 4,096 bytes in 1 blocks are definitely lost in loss record 843 of 860
==17786==    at 0x4C20FEB: malloc (vg_replace_malloc.c:207)
==17786==    by 0x4C21134: realloc (vg_replace_malloc.c:429)
==17786==    by 0xCFAD9C8: ???
==17786==    by 0xCF93A59: ???
==17786==    by 0xCD533D6: ???
==17786==    by 0xCAFB918: ???
==17786==    by 0xDEE3D40: ???
==17786==    by 0xBA69642: ???
==17786==    by 0xBA6E924: ???
==17786==    by 0xBA67E89: ???

This is not what you expected. And to be honest, this is something which tells you nothing but nothing :)

PHP just unloads your module, so there's nothing which can be mentioned in log file. Luckilly, I found that module ( zend_module_entry ) has handle member which, if set to 0 tells zend, that your module should not be unloaded.

In practice, you should add similiar code to RSHUTDOWN:

zend_module_entry *module;
int rv = zend_hash_find(&module_registry, "module_name", strlen("module_name")+1, (void**)&module);

if(rv == SUCCESS)
    module->handle = 0;

Once it's added, recompile module and run php via valgrind. Keep in mind, this code should be used for debug purposes only.

Create more, work less

Posted on 2008-07-18 11:06:29 UTC.

Providing easy to install binary packages for users and developers is not funny task, but also it's very important step in software development process.

Recently, I blogged about new binary packages for Midgard. And instead of waiting for feedback I decided to go few steps further. And just today we started to serve Midgard from three different repositories. One is for stable release, second for upcoming 1.9 which contains automatically built packages for developers, and third one is reserved for stable 1.9 release.

Packages are built at opensuse build system ( OBS ), and now we support debian, ubuntu and opensuse distros. Both 32bit and 64bit environments. Soon, we'll add support for CentOS and Fedora Core.

To test packages add to sources.list:

Debian:

http://download.opensuse.org/repositories/home:/midgardproject:/midgard19-dev/Debian_Etch ./

Ubuntu:

http://download.opensuse.org/repositories/home:/midgardproject:/midgard19-dev/xUbuntu_8.04 ./

You can also use OBS search functionality to find package and install it with one click. Just type 'midgard' and select distribution you use.

It's worth mentioning that new build process is fully automated. The script which is invoked periodically on machine acts like automated release manager and looks like this:

Get latest sources:

svn co https://svn.midgard-project.org/midgard/branches/branch-1-9/midgard obsmidgard

Go to sources directory

cd obsmidgard

Create tarballs and set default version to all packages.

./makedist

Login into OBS, remove old tarballs and upload new ones. Trigger rebuild.

php obs_upload.php

Clean all when it's done.

cd -
rm -rf obsmidgard

It's enough to commit changes to svn if anything must be changed. Script will use new functionalities when running next time.

Once we can find this usefull, we're going to create new repositories. For Midgard2.

More options for datagard

Posted on 2008-07-29 11:14:45 UTC.

New, rewritten datagard, which is responsible to correctly install Midgard has now more usable options. Basically it upports different setup types and different setup actions. Or combinations.

First you can start quick setup mode:

datagard -t q

It installs Midgard and doesn't ask you any questions, taking good default values for everything.

You can also set some key in configuration file:

datagard -t config -c midgard -a config-set loglevel message

Use 'config' setup type, take named 'midgard' as configuration and set 'message' as 'loglevel' key.

Create new sitegroup or new virtual host ( with default wizard setup type ) :

datagard -a sitegroup
datagard -a vhost

In latter case you are also asked for sitegroup, so if you want to create both, select this option. An interesting fact is that datagard, when creating new host will ask you if you want to create host for MidCOM3. When you say 'yes', your MidCOM3 has no page elements and empty content for page.

Iron Man

Posted on 2008-07-30 16:46:41 UTC.

Maybe quiz itself is old, but who cares ;)

Your results:
You are Iron Man

Iron Man
75%
The Flash
70%
Superman
65%
Green Lantern
65%
Spider-Man
60%
Supergirl
55%
Robin
52%
Batman
40%
Wonder Woman
40%
Hulk
40%
Catwoman
25%
Inventor. Businessman. Genius.
Click here to take the Superhero Personality Test

How to run Midgard 8.9.0

Posted on 2008-08-13 20:22:13 UTC.

Midgard 8.9.0 (1.9beta1) will be released soon. I have planned to make this today, but there are still small issues and bugs which must be fixed to have very nice beta version. If you feel impatient, follow me.

How to install it? It's quite simple. You can get fresh SVN checkout or install binary packages.

Build

SVN checkout

I assume you have svn client installed.

svn co https://svn.midgard-project.org/midgard/branches/branch-1-9 midgard
cd midgard
./makedist

Now you should have all tarballs. Untar all packages and build. In most cases simple build rules should be enough:

./configure 
make 
sudo make install

In case of any problems you can always get help:

./configure --help

Installing binary packages

The easiest way. Download packages from repository. We have debian, ubuntu and opensuse ones. Unfortunately, debian or ubuntu users have to download packages and install them via dpkg. I already reported apt-get way problems and let's hope guys from Opensuse will fix it soon.

Configure and install

Once Midgard package are installed. You can install new database or upgrade existing installation.

Installing new database

Just run datagard.

datagard

In this case, you will be asked few questions and datagard will:

  • create new database
  • install MidCOM from pear channel
  • create new sitegroup ( Midgard Domain )
  • create new Midgard host
  • create new Apache virtual host

If you fell, you would like to enjoy your coffee, try this:

datagard -t q

'q' or 'quick' is quick and simple mode and 'w' or 'wizard' is the mode when you are need to answer the questions.

In this mode, datagard will try to be smart as much as possible and probably will not ask you any question.

In both cases, datagard will try to use default 'midgard' unified configuration. If you would like to use different configuration, specify it:

datagard -c myconfig

Upgrade exsiting installation

Create configuration which describes your setup best, and run datagard with 'upgrade' action.

datagard -c myconfig -a upgrade

This will remove MidCOM 2.8 ( if exists ) and install new MidCOM 2.9 from new pear channel. Also database will be updated.

Running simple action

Install pear packages.

datagard -a pear

Upgrade database only

datagard -a dbupdate

Install new sitegroup

datagard -a sitegroup

Install new Midgard host

datagard -a vhost

Midgard unit and regression tests

Posted on 2008-08-25 19:43:44 UTC.

I must say, I do like GLib testing framework. I already started writing Midgard tests, but still wondering what, how and why should be changed. Even now, when few things seems to be too difficult to implement, I see many very nice features:

  • Test can be automated (ok, not a big deal)
  • Test program with routines might be run through gtester
  • Once it's done, one may create xml report
  • Once xml is created, one is able to make it much more user friendly

GTester Unit Test Report

Program / Testcase Duration (sec) View Result
midgard_test3.220978 ER OK 100.00%
    /midgard_config 0.000880 - success
    /midgard_connection 0.017047 - success
    /midgard_database/create 1.514101 - success
    /midgard_database/update 1.476490 - success
    /midgard_object/basic 0.011082 - success
    /midgard_object/basic/create 0.193323 - success
    /midgard_object/basic/update 0.000527 - success
    /midgard_object/fetch 0.001588 - success
Totals: 1 Binaries, 8 Tests, 0 Failed, 8 Succeeded3.220978 - 100.00%

As test program is invoking typical API functions, I can easily run it via valgrind and catch memory leaks before they appear on production servers. And with some nice test separation, reported duration could be quite usefull to notice some obvious performance bottlenecks.

Bug origin

Posted on 2008-09-18 19:43:02 UTC.

Do not read Your code twice to make it much more stable and better. Write unit tests instead.

I ran Midgard test today and started to wonder what's wrong with the code:

midgard-core:ERROR:   midgard_test_metadata.c:490):midgard_test_metadata_check_person_references: 
assertion failed (metadata_property == guid): 
("1dd85b60c20d89485b611dda4935fce5036a2e8a2e8" == "f6b665f1984503790ed91f39b11b5392")

Point is that in this test I checked if person's guid is the same as the one set for object's metadata creator and revisor properties. It's not, obviously.

So what is wrong with code then:

Today I made this commit to propagate metadata properties when object is deleted. What I did wrong? I had set revisor's guid using object's guid (the one which has been deleted), not person's guid. Is it obvious when you read code? This commit fixed this nasty bug, and I needed one hour and a half to find it and fix.

For how long such bug could be existing in Midgard without unit tests? For a month? For a year? I do not want to think about this :)

Thank you GLib testing framework!

New Midgard release

Posted on 2008-10-08 10:53:29 UTC.

Finally. We released Midgard 8.09.

This release is very important and it's big milestone in the whole Midgard development cycle.

  • It provides both classic and new Midgard2 API, so developers are able to continue their work and develope new fully forward compatible functionalities.

  • Basement is GObject and GType system so the same API works well on C and PHP level. Do you know any other CMS/Framework built on top of GObject and GType system?

  • It's the only one CMS/Framework which supports D-Bus implemented for websites. Yes, I know, one may implement D-Bus with Python, but is he able to talk to Python and PHP (and even C) at the same time?

  • It's the only one CMS which provides real events support for PHP. As real as Midgard extension for PHP is nothing else but language bindings so the same functionality is ensured on C and PHP level.

  • It's the first stable generation, released with new releasing policy in mind. Just like Gnome. We want to provide new release, every six months.

  • It's the only one which provides unique replication facility, which is database independent.

As I mentioned earlier, this release include new API, so we have six months to release stable Midgard 9.03 "Vinland" (aka Midgard2). A good thing in Midgard releases is fact, that even new experimental features are included, they are independent from other stable parts of the system, so you are able to test new functionalities "almost" in production environment.

To make things more powerful, we will support more cool things in Midgard2:

  • Python bindings
  • LibGDA support (Actually, you may use those with Midgard2 alpha release, which is also working nice with maemo platform.)

  • Mono bindings

  • Httpd server independence
  • Completely new architecture so you can have both "Ragnaroek" and "Vinland" installed in parallel.

I am pretty sure, many Gnome developers love Python and C. But Gnome itself didn't reach websites environment yet. Midgard gives this great possibility to join desktop and the web. Seamlessly, using unified environment. At least, we, as Midgard Community believe in it.

Back

Layout Copyright © 2006 Finnish Teleservice Center Ltd Oy - Site Powered by Midgard CMS