Piotras' blog: Archive
2007-02-01 - 2007-02-28
Midgard DB indexes
Posted on 2007-02-04 11:01:23 UTC.
I just realized that Midgard blobs table doesn't use indexes for legacy db structure. If you still use legacy applications and legacy code, add two indexes to blobs table:
CREATE INDEX blobs_pid_idx ON blobs (pid);
CREATE INDEX blobs_ptable_idx ON blobs (ptable);
Also increase cache size ( in my.cnf file ):
query-cache-size=92M
I set 92M in my case , but you can tweak it with different value.
in other news: It's not fun when the whole family is ill. Ladies are getting better. Ola must stay at grandma's place for one week more. Aga had 40,2 temperature two days ago and I got throat infected. It's just the way when your kid "brings" something from kindergarten ;)
Also I need to fix few minor issues found in 1.8.2. And make midgard-core 1.8.2.1 hotfix release package. I think I should do it soon as I am no longer a house nurse ;)
maemo.org, website which ....
Posted on 2007-02-10 14:10:29 UTC.
...sucks a lot.
Consider this real scenario:
- You want to develope new application for OS2006
- You need to update OS2006
- You need to update maemo2.1 to maemo2.2
Maybe I am stupid , but clever guy do:
- Open maemo.org
- Follow "Maemo 2.2 'gregale' is released" link from frontpage
- Follow one of these two links:
- The latest OS 2006 Software Edition is available here.
- For more info please see the releases page
- Download latest OS2006 ( you completely hae no idea what to do with this OS )
- Follow release page
- Follow Maemo 2.2 'gregale' Release
- Follow any link in 2.2 release section
- Try to figure out what to do.
- Count from 1 to 10 to calm down....
- Imagine "I feel lucky"
- Follow "wiki" link in main navigation
- Dada! There's howto for developers!
There's 'Developers' link in main navigation. Why thi showto is not linked directly from developers section?
What does 'Wiki' means in main navigation? A Page that uses wiki? A tool? What? I wonder if I should create 'PHP' link on my website because website uses PHP...
Almost full quote from Vabank:
Q: Do you always keep money in a bathroom with your dirt panties? A: Yeah , sure! And I keep my toothpaste in my socks!
A good lesson for me being also a developer and release manager. Always use links and titles which describes what is the content they provide. Never use links with names which describe what is the tool they use.
I remember I lost quite some time few weeks ago when I wanted to find applications' catalog on maemo.org. Wiki page was the last one I selected.
A similiar scenario can be repeated on http://gnome.org website. This is impossible for end user to find anything. In the same time, my wife is trying to find some gnome application. Obviously, not being gnome developer, she has no idea that http://gnomefiles.org can be found at gnome.org > community > software map.
Start here
Posted on 2007-02-12 10:33:17 UTC.
Just two days ago I wrote about being confused when I tried to follow Maemo documentation. I looked at other websites addressed for end users and developers and noticed that Maemo is not the only one which provides unlogic navigation. Also Midgard ( the one I write docs for ) project website needs more love.
This would be cool IMO:
"Get started" section with:
What would you like to do.
- I have device XXX and I want to install new applications
- Where...
How ...
I have device XXX and I want to update OS I have installed
- Where ...
How ...
I am a developer and I want to write new application
- How to start ?
- What should I install on my device?
- When and why do I need SDK on my device ?
Features
- What is ...
- How ...
- Why ...
The main point here ( and everywhere ) must be to treat everyone as a user. Even a developer. A developer is only a human and should have a good place where can start. It's not funny anyway when you prepare for hacking but first you must hack docs and notes.
A cool feature for any website with documentation would be possibility to bookmark resources the same way how you can add products to cart in any online shop. Once you like the website you can customize your start page and limit information only to this you are really interested in.
Probably I could contribute and write some simple howtos for maemo. But the real problem is the fact that the more I read docs the more I am confused. There are plenty of "how to ..." but at the same time there is almost nothing about why and when.
Example. There is quite long and "almost with details" how to create custom rootfs for device doc. But there's nothing about why do I need custom rootfs and why should I use it instead of downloadable and installable, ready to use SDK rootfs. What is more , I couldn't find any info why do I have to install rootfs SDK on my device :)
midgard-php or ZEND2 issues again
Posted on 2007-02-13 11:28:47 UTC.
I just created new thread on mailing.www.php-dev.
I started to refactor midgard-php extension , so we get better PHP language bindings. Current problem is "quite trivial":
<?php
$obj = new midgard_config();
$obj->read_file("my_config");
echo "Got configuration file for $obj->dbname database \n";
?>
This works very fine. But another line in the code:
print_r($obj);
just prints properties without variables being set. This is not important from application's point of view , but in "debugging" mode , it can be quite confusing.
BTW, if anyone has good url for zend-dev mailing list. Please let me know.
try midgard_article, catch midgard_exception
Posted on 2007-02-27 20:56:50 UTC.
What I focus on recently is midgard-core and midgard-php extension. I try to make both usable as soon as possible. Completely "forgotten" midgard-apache module must wait till Midgard core has more power. And midgard-data... I will write about it later , looks like many parts of midgard-data will be moved to core :)
Reading ZE2 sources and asking "too many" questions at pecl developers mailing list let me refactor midgard-php extension and implement it almost from scratch with new ( I must say , quite good! ) zend objects store functionality.
For the first time I felt that doing something with zend sources really does make sense ;)
What does it really mean?
when you read php object property ( like echo $obj->prop ) you really read core's GObject property. So let's say you want to be smarter than core and want to "force" guid property value. No way, in such case core will produce warning which is propagated as php warning message ( but this is already known from 1.8 series )
when you set value as php object property ( like $obj->prop = "abc" ) you really set core's GObject property
when you destroy php object , you destroy core's GObject
no more weird __res properties with even more weird integers which points to something or anything
For the first time I can say - this is language bindings.
And something completely new in midgard-php extension for pure OOP fanatics:
try{
$ma = new my_article();
$ma->get_by_id(1000000);
} catch (midgard_exception $me) {
echo "Couldn't get object by id. The reason is: ".$me->getMessage()." \n";
}
Message well known from mgd_errstr function is set as exception message, so what you expect here is:
Couldn't get object by id. The reason is: Object does not exist.
I just do not have article record identified by 1000000.
midgard_config or how to create personal database in 2 minutes
Posted on 2007-02-27 21:07:18 UTC.
Step 1.
Write simple php script, it may looks like this:
class my_config extends midgard_config {
}
$c = new my_config();
$c->dbtype = "SQLite";
$c->name = "midgard";
$c->save_file("MyData", TRUE);
What this script does is creating your own personal Midgard configuration. Second ( optional ) boolean parameter means "I want to write configuration in my home directory. Only there". 'MyData' is configuration name.
Step 2.
Write another script and it may looks like this:
mgd_config_init("MyData");
/* more own php code */
That's all. Your SQLite database is already created.
Stay tuned to learn more about "how can I create tables?" :)