Piotras' blog: Archive
2006-03-01 - 2006-03-31
Łódź
Posted on 2006-03-01 12:04:27 UTC.
I just found
interesting news article about Łódź.
Well, it's not quite new, but it brings a bit of hope that Lodz
will be part of UE some day.
Lodz is the city I live in and where all latest midgard
releases are made.
Łódź in English means a boat , but this is very funny as
there is no river here ;)
You can even find 'boat ' in Midgard
releases' names.
There are also some nice galleries with pictures of Łódź.
Construct a better OO'ed day
Posted on 2006-03-01 12:13:11 UTC.
Day shouldn't be so frustrating when you can construct Your
midgard-php objects better , easier and faster.
I changed midgard-php objects' constructor a bit. Just follow
documentation.
Midgard 1.8alpha2 and PEAR
Posted on 2006-03-04 15:00:08 UTC.
I am trying to install
somehow Midgard
CVS
HEAD with pearized MidCOM.
At the beginning I was surprised that no pear packages is
installed , so I changed a bit my local
datagard script , to force it to exit before asking about
Virtual Hosts. As the initial setup is quite fast now I created
another one database so I was able to see what happens with
pear packages.
Installing PEAR packages...
downloading PEAR-1.4.7.tgz ...
Starting to download PEAR-1.4.7.tgz (280,249 bytes)
............done: 280,249 bytes
requires package `Archive_Tar' >= 1.3.1
PEAR: Dependencies failed
OK, that's not nice , but pear could handle this somehow.
And next line:
Command 'pear.midcom-project.org' is not valid, try 'pear help'
What? The command was:
pear channel-discover pear.midcom-project.org
Let's try help:
pear help channel-discover
Command 'channel-discover' is not valid, try 'pear help'
OK, let's try to look for it:
grep -re channel /usr/share/php/*
No results.
I am using debian and that means that I may have php4 and php5
installed , and if you consider the fact that pear script looks
for php command which is a link to php5 by default, you may
notice some not nice surprise with great segfault caused by
using php5 cli with midgard php extension builded for php4.
Currently I have no idea how to solve all these problems.
updated: I tested it
also with PEAR 1.4.6 , but with no luck
Midgard Reflection Property once again
Posted on 2006-03-27 14:33:27 UTC.
Why there's MidgardReflectionProperty when we had
MidgardObjectProperty?
Reflection used in class name better describes what this class
is designed for.
It's somehow usual now ( I know, one would say 'I do not
believe!' ) that we have reflection property class documented
already in
midgard-core and in
midgard-php documentation.
As always midgard-php part of reflection property was the worst
part.
I needed to change this :
$mrp = new midgard_reflection_property();
echo $mrp->description("midgard_article", "sitegroup"));
to:
$mrp = new midgard_reflection_property("midgard_article");
echo $mrp->description("sitegroup"));
A well known "big deal" is a possibility to fetch GObject
instance while using php object. At first I decided to use
Zend's resources ( sorry , I do not provide any url to zend
sites ). But the problem with Zend resources is the fact that
resources' id (very internal feature IMO) is available on zend
and php level. As there is no possibility to set own private
pointer as a member of zend object , one is forced to add
resource's id as object's property.
Now think about 200 php object instances and 200 integers, it's
easy to change object's resource's property value from 199 to
10 ( for example ) and get something very unexpected.
And now think about objects which use some ACL features in
"critical mission" environment and possibility to change any
resource id...
Let me quote:
"Watch, but do not touch. Touch, but do not taste".
I think this sentence from "The Devil's Advocate"
describes perfectly the sense of resource handlers.
I spent some time on reading php-gtk sources. (It's a good way
to "kill" your time anyway when you work with Zend. Read plenty
of source code and try to understand it.) I thought that I
could find some good way to make a good wrapper and use 1:1,
php and gobject objects.
No way. This extension uses 0 property as resources handler for
gtk object. What happens if I change value 1 ( let's say some
window object ) to 2 ( let's say some other widget object)? I
expect bad things.
At the end I decided to write very easy objects "collection". A
collection which holds 1:1 references for zend ( php in this
case ) and gobject objects. The idea is very simple. I use two
data types: GHashTable and GSList.
The first one is a collection of zend objects' pointers
assigned as hash keys , and gobject ones assigned as values. If
HashTable is initialized with NULL compare functions then
direct equal ( pointers ) one is used.
The second one is used as collection of pointers to any gobject
which was initialized during particular request. So at the end
of the request , it's enough to iterate over list and free all
objects memory. Plain and simple.
The only problem I can see is zend object pointer which can be
"overwritten" during some loop. What really happens with this
pointer then? If You know, or you just found zend docs about
this, feel free to tell me ;)