Piotras' blog: Archive
2004-01-01 - 2004-12-31
Do You really need a blog?
Posted on 2004-11-15 13:35:16 UTC.
Ask Yourself twice , and read some blogs before you finally answer Yourself.
While reading mailing lists with Your favourite mail client becomes harder , when You have to go through spam mails, and You need to know what is really going on , I discovered ( at last ) that blog is great thing!
I was wondering if we have some silly old bugs within Midgard sources, and
I found Kaukola's blog about memberships issues. I do not have to tell that the same day the issue was nothing more but past time ;)
Yeah... blog rocks! :)
NTLM working again
Posted on 2004-12-02 17:17:12 UTC.
Let's look at the fix:
Configuration.
Midgard Vhost configuration file.
Do not add MidgardAuthType PAM. NTLM and PAM authentication can not work together.
Samba configuration.
Do not use default domain for winbind.
winbind use default domain = false
Finally I discovered that pipe file used by winbind supports only username without domain name. And what is more interesting midgard library tried to get username and domain from DOMAIN\USERNAME string. Changing sources to use '+' separator fixed the issue for default winbind separator configured in samba configuration file.
winbind separator = +
Replicate or not to repli... what?
Posted on 2004-12-10 00:57:03 UTC.
What's the idea of repligard? Export all changed records to xml file and import this file to another database. So, when you add article and its parameters , their corresponding fields (changed and updated) in repligard's table are updated , and repligard knows that this record should be exported.
How that looks with Staging/Live setup? Not approved article will be not exported
( and its parameters and blobs ) while repligard will update these records as already exported. Approving article doesn't update parameters and blobs, so another export
makes only article exportable. Any article's method or function which updates anyhow article's record , update only article's record and its repligard's entry.
I spent only few hours to resolve this "bug". I thought that we may treat article's or any other object's paramaters and blobs as its real properties. The same way which mgd_get_xxx makes properties from parameters. Cool. Only few hours to resolve issue with application like repligard. I used defined guid in repligard's conf to make export fast.
<replicate >
<resource guid="some_guid"/>
</replicate>
When I decided to test how this work with custom export when <replicate all> is set to "yes" I felt big ( read : huge ) headache .
Repligard has no one common way of doing exports. It depends on what is in configuration file , what is in repligard's args etc etc, so all what was found is useless cause it's high time to start another debugging , another logs , another searching for how, when and why. This is not funny if you think about sources like midgard-php which uses Zend where many things are hardcoded. Repligard has huge amount of structures, hashes and glists. You may even find yourself VERY confused when you start to work with RListEntry and your code produces segfaults.
ext = g_new (RListEntry, 1);Not a big thing , but in this case guid is gboolean, id is a char guid and table is the only one what you thought of :)
ext->guid
ext->type
ext->id
Anyway , I decided also to add repligard's switch '-w' which forces parameters and blobs records to be exported when "parent" object is to be exported too.
You may get latest CVS to use Staging/Live and have the "whole" objects in staging and live databases.
export.c diff
Aegir weirdness
Posted on 2004-12-20 16:42:51 UTC.
I couldn't understand why Kaukola had weird problems with Aegir.
The problem was that Aegir for some unknown reason does not display left frame menu correctly. Instead of "News & Articles" You have some number like 5 or 7.
Unfortunatelly Henri is not the only one person affected by this "bug".
You may find the same behaviour described in this link.
I also wonder , cause this bug seems to affect also MidCOM engine, producing error log:
Class de_linkm_taviewer_midcom does not exist.Interesting. Both servers affected are running RedHat.
I looked at Aegir's snippet "/AegirCore/lib/menu_functions"
28: if (ereg("([0-9]+),([^,]+),(.*)", $menudir->name, $temparray)) {
29: $tempmenu["position"] = $temparray[1];
30: $tempmenu["name"] = $temparray[2];
31: $tempmenu["title"] = aegir_loc($temparray[3]);
32: } elseif (ereg("([0-9]+),(.*)", $menudir->name, $temparray)) {
33: $tempmenu["position"] = $temparray[1];
34: $tempmenu["name"] = $temparray[2];
35: $tempmenu["title"] = aegir_loc($temparray[2]);
36: } else {
37: $tempmenu["position"] = 99;
38: $tempmenu["name"] = $menudir->name;
39: $tempmenu["title"] = aegir_loc($menudir->name);
40: }
Looks like this is known PHP bug and points directly to regex used to compile PHP. If not , someone should take a look at Aegir's codeand fix regex expression ASAP.
Sorry for such brief and fast information , but few days before christmass there is no thing you can focus on ;)
banners banners
Posted on 2004-12-21 12:44:20 UTC.
While there's discussion on midgard mailing list about banners I decided to spend few minutes to create another one ;)
If You need the *.xcf file , get one.
MgdSchema , once please.
Posted on 2004-12-21 16:40:29 UTC.
I am starting asking myself "what this MgdSchema is?!".
I proposed mRFC 0012: MgdSchema and now I wonder if we could talk about MgdSchema as only xml file where you can define all future Midgard objects.
Well, if you really need to have MgdSchema support you can just think about "how that should work" and start writing the code.
OK, what we should start from? Parsing xml.
Well, do I really need to start parsing xml if I am really not sure what data should be included in xml?
OK, let's make some draft code.
Well, do I really want to write draft code if I am not sure what I should do with data included in xml?
OK, too many questions. Let's start to write GObjects code which may be easily used with xml parsing utilities.
What was that "to heaven" in Led Zeppelin's song? ;)
GObjects and GTypes are pretty fine. Especially when you can read some docs and comments like this from http://www.le-hacker.org/.
"People often get confused when trying to construct their GObjects because of the
sheer number of different ways to hook into the objects's construction process: it is
difficult to figure which is the correct, recommended way."
Ah, there is no correct way. Good :)
Anyway , if you start to write some GObjects management code ,you can easy find your best way to start working with GType system.
At least I found myself and suddenly I discovered that I can not easily create object properties as these should be hardcoded at some point ( yeah, it is not PHP where you can add object property on the fly). So I found "my way" is bad way. Which way then?
Luck! Alexander wrote some code which DO automagic properties creation. Right! All in all what you need is guint , integer value which tells you about property. You even do not have to know object's property name. Great. What next? Class inheritance.
Piece of cake. With demo code which was written by Alexander for developers meeting at Poznan, you may find that all we need is GHashTable to store all Midgard types like MgdArticle or MgdPerson. Do we? Piece of cake? If you want to provide GHashTable as Midgard types storage the best way is to define one global array, but we need to define MgdSchema per Vhost or per application. So all code which register Midgard types should highly GHashTable dependant. No, no this is not piece of cake.
At this point I should start writing xml parsing and GHashTable utilities to get correct arrays to store GObjects. But, "do I really want to write draft code if I am not sure what I should do with data included in xml?". I think I saw my tail for a while ;)
Good point is to start working with GTypeInfo , but unfortunatelly there is no way ( it seems like ) to get this type knowing only class name. My god, I like it... A good solution seems to be slow down "a bit" MgdSchema creation and count all parent object properties before extending. Not the best solution if you think about speed , but this is could be done once and be independant from GHashTable arrays. We will see...
MgdRpd and MgdObject
Posted on 2004-12-22 17:42:22 UTC.
Great!
I found a way to forget about GHashTable arrays while making Gobjects for Midgard. I decided to create MgdRpd and MgdObject. Maybe in a future we could add some third type to make real mgd_exorcise() ;) ( believe me or not but when we switch to guids based relations instead of ids , that can be true ).
What is MgdRpd and MgdObject? Simple GObject types. The main difference between them is that MgdRpd object is not instantiable type , due to its abstract flag.
new_type = g_type_register_static (parent_type, class_name,MgdObject is instantiable type , and that's why we will use it for well known objects like article , person or topic.
midgard_type_info, G_TYPE_FLAG_ABSTRACT);
What more?
I decided to hardcode MgdRpd properties which must be used for all child objects.
GParamSpec **params = g_malloc(sizeof(GParamSpec*)*10);
params[0] = g_param_spec_uint ("id", "id", "An unique identifier of the object", 0, G_MAXUINT32, 0, G_PARAM_READWRITE);
params[1] = g_param_spec_uint ("sitegroup", "sitegroup", "Sitegroup this object belongs to", 0, G_MAXUINT32, 0, G_PARAM_READWRITE);
params[2] = g_param_spec_uint ("author", "author", "Author of this object", 0, G_MAXUINT32, 0, G_PARAM_READWRITE);
params[3] = g_param_spec_uint ("owner", "owner", "An owner of this object", 0, G_MAXUINT32, 0, G_PARAM_READWRITE);
params[4] = g_param_spec_string ("realm", "realm", "Table name where object has own data", "", G_PARAM_READWRITE);
params[5] = g_param_spec_string ("guid", "guid", "GUID", "", G_PARAM_READWRITE);
params[6] = g_param_spec_string ("changed", "changed", "The date when object was changed", "", G_PARAM_READWRITE);
params[7] = g_param_spec_string ("updated", "updated", "The date when object was updated", "", G_PARAM_READWRITE);
params[8] = g_param_spec_string ("action", "action", "What was done with object", "", G_PARAM_READWRITE);
So , later writing xml file , you do not have to bother about such properties , cause all of them are automagically added to any midgard object , and should be ignored by midgard xml parser.
The same time we get some standardized logic , before we enter logicless world :)
The Future starts next week
Posted on 2004-12-27 02:12:56 UTC.
How would you like to write Midgard setup? Using Perl, bash? Maybe ruby? I think you would like to write it using PHP. Yes, PHP is now running from command line with midgard extension loaded. "Huge" changes have been made ;)
Get latest CVS and try yourself. In my case 'pear' command did not return any error due to unknown commands.
The future starts next week. Think about this.
Replication for all
Posted on 2004-12-28 00:30:48 UTC.
Another bug which should be resolved many months ago.
I changed a little repligard's main.c file and added hostname to mgd_connect function.
Another "huge" change.
So , now You may use repligard with any host. This feature should be very usefull for any clustered Midgard setups or for those who use staging/live setup and staging database is in intranet network.
The same time I do commit I ask myself two important questions:
Should we now provide MySQL database configuration tool?
By default, we allow to connect to MySQL database only from localhost, so any other allowed host should be added additionaly and some other security issues too.
Can we easy use this feature while MySQL connection is not secure enough by default?
Load & Go
Posted on 2004-12-29 18:35:21 UTC.
Very briefly as I am leaving for a few days holidays.
At last Midgard has midgard-schema tool to parse and test xml file if that one is correct before may be used for production usage.
The file is quite impressive , isn't it ? ;)
Next month ( means future ) I start to register Midgard objects and its properties , and we slowly go to 1.7 as the first Midgard release which moves towards Midgard2.
Happy new Year!