Planet maemo: category "feed:f13f02dc517a85b9787157119dd2b122"

piotras

Basics of midgard_dbus

2008-04-08 07:55 UTC  by  piotras
0
0

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.

Categories: midgard
piotras

D-Bus and Midgard

2008-03-28 10:40 UTC  by  piotras
0
0

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!

Categories: gnome
piotras

midgard-python once again

2008-03-18 19:02 UTC  by  piotras
0
0

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.

Categories: midgard
piotras

When you think you are drunk

2008-01-12 09:12 UTC  by  piotras
0
0

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.

Categories: maemo
piotras

When you think you are drunk

2008-01-12 09:12 UTC  by  piotras
0
0

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.

Categories: maemo
piotras

Beauty and the Beast

2007-12-04 19:55 UTC  by  piotras
0
0

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

Python seems to be the second Midgard's scripting language now. Two weeks ago I wrote about initial usable bindings work, and today there's much more:

  • Midgard Query Builder
  • Midgard Collector
  • Midgard Object Class ( pseudo class for MgdSchema classes introspection and reflection )
  • Midgard Reflection Property
  • MgdSchema objects' parameters

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 "built in" languages support. Whichis nothing more like languages persistant cache in details.

You can take a look at midgard-python test examples 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 :)

Categories: gnome
piotras

Beauty and the Beast

2007-12-04 19:55 UTC  by  piotras
0
0

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

Python seems to be the second Midgard's scripting language now. Two weeks ago I wrote about initial usable bindings work, and today there's much more:

  • Midgard Query Builder
  • Midgard Collector
  • Midgard Object Class ( pseudo class for MgdSchema classes introspection and reflection )
  • Midgard Reflection Property
  • MgdSchema objects' parameters

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 "built in" languages support. Whichis nothing more like languages persistant cache in details.

You can take a look at midgard-python test examples 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 :)

Categories: gnome
piotras

midgard-php on maemo

2007-10-03 18:26 UTC  by  piotras
0
0

It's just today when I thought that phpize is a big issue when I tried to install php5-midgard and midgard-data package on N800. I thought that simplest solution could be the best and just copied all required files ( like phpize, php-config, and few others ) directly to my armel target host.

And now it looks like it's not best solution because php-config should clearly points to extension_dir for example and this is quite weird ( in debian sense ) in php5-fastcgi package. At least this package could provide php-config to save plenty of other's time.

Anyway, at last I finally installed all midgard packages.

Even tried datagard, but this one fails because of lack of pear:

And I wrote simple php script which loads midgard extension via dl and prints midgard version:

Categories: maemo
piotras

midgard-php on maemo

2007-10-03 18:26 UTC  by  piotras
0
0

It's just today when I thought that phpize is a big issue when I tried to install php5-midgard and midgard-data package on N800. I thought that simplest solution could be the best and just copied all required files ( like phpize, php-config, and few others ) directly to my armel target host.

And now it looks like it's not best solution because php-config should clearly points to extension_dir for example and this is quite weird ( in debian sense ) in php5-fastcgi package. At least this package could provide php-config to save plenty of other's time.

Anyway, at last I finally installed all midgard packages.

Even tried datagard, but this one fails because of lack of pear:

And I wrote simple php script which loads midgard extension via dl and prints midgard version:

Categories: maemo
piotras

"Maemo Application Manager" I do not like you

2007-10-03 08:00 UTC  by  piotras
0
0

Why?

If package's control files has:

Section: libs

is easy installable via repository, while it's incompatible while installed via file file manager with double click. In such case, package has to have:

Section: user/libs

Does it mean that when I double "click" (doubleknock) on package file I invoke different Application Manager?

Categories: maemo
piotras

Building Midgard 1.9 for maemo

2007-10-03 07:27 UTC  by  piotras
0
0

I should say trying to build instead of building it for maemo. Though libmidgard10 and libapache2-mod-midgard are already installed on my N800. Again, list of dependencies is the key for success.

I changed debian files ( rules and control ), so rules file generates control file correctly when package is built. For example when I build package for maemo a section is replaced with user/libs' and architecture type witharmelinstead ofi386` which is generated when I build package for x86 architecture

Big issue with packages builds is naming convetion, so it's impossible to create correct debian files ( mostly Depends: section ) for every architecture. Your package might depends on apache2-mpm-prefork, while someone called it just httpd for maemo. This package also includes header files, so you do not have to install apache2-prefork-dev, and also apr binaries, but weird thing is that it doesn't include apr header files.

Workaround for this is ( easiest I found ):

cp -r /usr/include/apr-1.0 /scratchbox/users/pp/targets/SDK_ARMEL/usr/include/

As maemo packages are built as debian packages, one could also keep any naming convention so apxs2 could stay apxs2 and apr includes could be defined for apr-1.0, and not for apr-1.

MySQL used everywhere on debian distros with version 5.0 is build with version 4.1 for maemo.

Those are issues, one might and can to resolve quite quickly. But the real problem I found with php5-fastcgi package. To build php extension I need header files ( those I can just copy ) and phpize tool. Lack of latter is an issue :)

I need to investigate it more. And for those interested I used these packages:

  • https://garage.maemo.org/projects/mysqldatabase/
  • https://garage.maemo.org/projects/apache/

And debian repository:

deb http://maemo-hackers.org/apt bora main

BTW, if you need to install php5-fastcgi in your scratchbox, you might to want to change default httpd port. I changed mine from 80 to 8080. Without it I got `Permission denied' when being logged in as fakeroot and "wanted to bind" to port 80.

Categories: maemo
piotras

Building Midgard 1.9 for maemo

2007-10-03 07:27 UTC  by  piotras
0
0

I should say trying to build instead of building it for maemo. Though libmidgard10 and libapache2-mod-midgard are already installed on my N800. Again, list of dependencies is the key for success.

I changed debian files ( rules and control ), so rules file generates control file correctly when package is built. For example when I build package for maemo a section is replaced with user/libs' and architecture type witharmelinstead ofi386` which is generated when I build package for x86 architecture

Big issue with packages builds is naming convetion, so it's impossible to create correct debian files ( mostly Depends: section ) for every architecture. Your package might depends on apache2-mpm-prefork, while someone called it just httpd for maemo. This package also includes header files, so you do not have to install apache2-prefork-dev, and also apr binaries, but weird thing is that it doesn't include apr header files.

Workaround for this is ( easiest I found ):

cp -r /usr/include/apr-1.0 /scratchbox/users/pp/targets/SDK_ARMEL/usr/include/

As maemo packages are built as debian packages, one could also keep any naming convention so apxs2 could stay apxs2 and apr includes could be defined for apr-1.0, and not for apr-1.

MySQL used everywhere on debian distros with version 5.0 is build with version 4.1 for maemo.

Those are issues, one might and can to resolve quite quickly. But the real problem I found with php5-fastcgi package. To build php extension I need header files ( those I can just copy ) and phpize tool. Lack of latter is an issue :)

I need to investigate it more. And for those interested I used these packages:

  • https://garage.maemo.org/projects/mysqldatabase/
  • https://garage.maemo.org/projects/apache/

And debian repository:

deb http://maemo-hackers.org/apt bora main

BTW, if you need to install php5-fastcgi in your scratchbox, you might to want to change default httpd port. I changed mine from 80 to 8080. Without it I got `Permission denied' when being logged in as fakeroot and "wanted to bind" to port 80.

Categories: maemo