Skip to: content | sidebar | login

Home: Archive

2007-01-01 - 2007-12-31

I've become a blogger

Posted on 02/02/07 02:10:59. | Bookmark this on Delicious

These days everyone is a blogger! Teen kids around the block, prime minister or former president, thousands of other people. Somehow I felt I needed to follow the trend.

Actually, making a blog was not that hard stuff providing you had a box, a cable, a soft and a couple of hours of spare time. The last part was the most difficult to fulfill.

I took my old HP Visualise Workstation with 1G Intel PIII, 512MB of RAM and some 18GB of SCSI storage. Then I plugged it with cable and downloaded software: OS and CMS. At the end I took a nice template for blogger from  Blogger Templates and lunched The Site :)

Hmmm... hmmm... a way of a blogger is a hard life.. you need a subject! I hope to get some after a trip to Venice to European Hobie Class Association AGM that opens tomorrow today.

Foggy Venice

Posted on 02/05/07 12:50:52. | Bookmark this on Delicious

archival_scc2008.jpg

The trip to Venice was very nice, however the foggy weather made some sight seeing impossible. We also had to postpone boat sailing on Venice laguna. But all the rest of European Hobie Class Association AGM was perfect.

We started on Fri 02.02 at 4 am heading to Berlin by car. Rainy and freezing, the triip was not to comfortable. At 8.30 we were on Berlin Tegel (TXL) Airport. Tha plane to Venice has been scheduled at 11.20 so we had plenty of time to check in and get some sleep. Fortunately they didn't cancel the flight despite of quite heavy fog and low clouds level.

The plane started right on schedule and we quickly got at 9800 m height. Again, lots of clouds in Berlin made the ground hidden, so we again got some sleep. Just before we started passing Alps, suddenly all clouds dissapeared and finally could admire the beauty of our planet seen from almost 10km above. Excellent weather stayed with us almost up to Venice. Just some 10 minutes before landing on Marco Polo Airtport (VCE) that God damned fog came back and we lost a beautiful view of Venice.

Our destination in Venice was Vento di Venezia (VdV) on an island called isola della Certosa. Noone in public transportation industry knew a word about the place since (as we were told later) isola della Certosa was a former military naval base and our friend Albert have just bought some hectares of it from Italian Army. OK, anyway after few phone calls and some 1,5 hour we came to Santa Helena waterbus stop where we met Susana from germany ans two great guys from Spain: Mauro i Nacho. As we saw them on the pier we knew that now things must go better since we are not alone.

Nacho got some instructions by phone and we started walking towards the mysterious place somewhere between canals where we should find a shuttle to Certosa at. After few minutes of walk we met Marco from Portugal waiting for the same shuttle. Marco and Nacho again made some calls and we boarded a boat that was sent immediately, that is after an hour :). Finally we got to our destination and the AGM had begun.

Tailoring MidCOM

Posted on 02/10/07 00:01:45. | Bookmark this on Delicious

picture_105.jpg

What is MidCOM? Why bother and how to customize it? Read further to find about flexibility of modern approach to web development.

MidCOM is an Open Source LGPL based CMS framework based on Midgard Content Management Framework. MidCOM provides a firm and flexible platform for making CMS driven websites. There is no need to talk about all details described at its website. What is worth talking about is a way to invent or reorganizing MidCOM to tailor your needs.

Case: "We want be able to rotate pictures uploaded as article attachements"

While working on a website for my customer I was quite frequently  stepping on mines that were placed in a project documentation. One of them was a simple feature of rotating uploaded images. The point was that 'image' datamanager type, however allows to define image processing chain in data schema lacked the possibility of editing already uploaded images. Since editor are not techies, sometimes rotating and scaling images is a job too big. That's why I decided to modify normal behavior of DM image type & widget.

First I had to find code responsible for displaying image in a DM form. It, of course was living in /midcom/helper/datamanager2/widget/image.php file. There I found the way it is being rendered. Then, I placed a bti of HTML code for rotate options:

$static_html = "<br clear='left' />".$this->_l10n->get('type image: actions') . ":\n";
$static_html .= "<ul class='midcom_helper_datamanager2_widget_image_rotate'>";
$static_html .= "<li title='".$this->_l10n->get('rotate left')."'>";
$static_html .= "<input type='image' name='{$this->name}_rotate[left]' src='".MIDCOM_STATIC_URL."/stock-icons/16x16/rotate_ccw.png' /></li>\n";
$static_html .= "<li title='".$this->_l10n->get('rotate right')."'>";
$static_html .= "<input type='image' name='{$this->name}_rotate[right]' src='".MIDCOM_STATIC_URL."/stock-icons/16x16/rotate_cw.png' /></li>\n";
$static_html .= "</ul>\n";
$elements[] =& HTML_QuickForm::createElement('static', "{$this->name}_rotate", '', $static_html);

to add rotate action to a widget. Why did I placed plain HTML code for inputs instead of QF elemets? I didn't want them to be rendered in a same way as other DM from elements. At this point I didn't know how to make DM do desired actions, so I just saved changes and moved to on_submit method to add hooks for rotation:

if (array_key_exists("{$this->name}_rotate", $results))
{
    if (! $this->_type->rotate($results["{$this->name}_rotate"]))
    {
        debug_push_class(__CLASS__, __FUNCTION__);
        debug_add("Failed to rotate image on the field {$this->name}.", MIDCOM_LOG_ERROR);
        debug_pop();
    }
}

And that seemed to be all on widget side - next part is type processing. If we already got saved attachment and all data stored in Midgard, we fortunately don't need to make too many moves: just open file handler and make a working copy, then run some filtering (rotate) and update attachment blob stored on a file system. In the end we need to update Midgard's data about image sizes etc.:

function rotate($type)
{
    $dir = ($type=="left")?270:90;
    require_once(MIDCOM_ROOT . '/midcom/helper/imagefilter.php');
    $this->_filter = new midcom_helper_imagefilter();
    foreach($this->attachments as $identifier => $image)
    {
        if ($identifier == 'original') continue;
        $tmpname = tempnam($GLOBALS['midcom_config']['midcom_tempdir'], "midcom_helper_datamanager2_type_image");
        $src = mgd_open_attachment($image->id,'r');
        $dst = fopen($tmpname, 'w+');
        while (! feof($src))
        {
            $buffer = fread($src, 131072); /* 128 kB */
            fwrite($dst, $buffer, 131072);
        }
        fclose($src);
        fclose($dst);
        $this->_filter->set_file($tmpname);
        $this->_filter->process_chain("rotate({$dir})");
        $dst = fopen($tmpname, 'r');
        $image->copy_from_handle($dst);
        $image->update();
        $this->_set_image_size($identifier,$tmpname);
        $this->_update_attachment_info($identifier);
        fclose($dst);
        @unlink($tmpname);
    }
   return true;
}

This is a very rough example without debugging and bulletproofing, but is clear enough to show how easy it is to customize internal MidCOM operations. All you need is a bunch of hours to scan thru the code and since it is quite modular you'll find it easy to change :)

 

Heading west

Posted on 07/23/07 11:23:00. | Bookmark this on Delicious

Finally we've managed to pack up things and we started our long trip to Netherlands

The shedule:

today and tomorrow: on my way there,

25th - 27th Jul:official EHCA training session with Brian Phipps and Cederic Bader.

28th - 31st Jul: a break while Hobie 16 Women ans Youth Spi take races.

31stJul - 4th Aug: Gold fleed qualifier and final races.

We're going to have busy days since weather forecasts show strong winds and quite big waves. Meantime I'll try to think about new feature requested for MidCOM - a DM schema editor.

Now, Datamanager can be configured with schemas only by either a file stored in component's config folder, or by a snippet in '/sitegroup-config/' space. Though it is quite easy for advanced site admins, regular content providers may have some problems. Creating schemadb files is also a time spending job.

Null values in DBA

Posted on 08/24/07 07:38:01. | Bookmark this on Delicious

Did you notice unexpected segfaults or luckily, did you find something like "(process:10725): GLib-CRITICAL **: g_ascii_strtod: assertion `nptr != NULL' failed" in your error log? If so, please doublecheck your table definitions.

As we all know, Midgard provides a great interface that allows connect external tables so that records could be treated as native Midgard objects. It is called MgdSchema.

In few words all you have to do is create MgdSchema file and reload Apache. But be careful. If your schema file defines a property like:

<property name='testprop' type='integer' />

and your table field defines it like:

'testprop' int(11) null,

most probably you will face subject problem. It is all because Midgard core cannot assign int variable a null value. So if you want to spare some sleepless nigths just verify the way tables are built and convert all 'null' fields to 'not null default 0' or whatever value is ambient for your datatype.

Another side effect is that records with null values sometimes are not published as results into a MidgardQuerybuilder object and again, if you are missing some results in QB - check your tables.

Begining of a new adventure

Posted on 12/10/07 13:43:58. | Bookmark this on Delicious

On Dec 03 I started a new job. That day I joined Poznań TC task force for GlaxoSmithKline IT Support Center

Occupying Web Hosting Analyst job I will take part in refactoring company's websites to match new business approach. Business wants to have solid and reliable platforn for sharing applications in a secure manner for Intranet and Extranet users. This means, we have to build strong environment so that all data is safe while 3rd party partners are allowed to use GSK applications in extend they are meant to.

Of course, this is the begining... Don't expect I would say a lot more as I just started and passed some internal trainings. More to come ;)

Little things that bring problems

Posted on 12/19/07 22:47:26. | Bookmark this on Delicious

This is a short blink. I've just read quite important blog entry.

Artuu complains about bad Unix rm command behavior. While it is quite obvious, that rm has simple buffer overflow detection by reducing amount of parameters, Atruu pointed out a threat on MidCOM's performance.

MidCOM's cache module stores various data in filestystem so that it is not required to get them from DB on and on. And thisi is GOOD. However, on bigger sites you can end up with dozen thousands of small files. And that is BAD since FS performance may drop radically when scanning directory for a single file. It seems, we have to introduce directory hashing for MidCOM's cache soon.

OK, I know that exts3 can handle big number of files with htree but a simple test will show how much we can loose. With any method create some 20-30k files in a temp directory then run mc (Midnight Commander) from that path and see how long it takes to open a pane.

Misusing fuel at pumps

Posted on 12/27/07 00:19:49. | Bookmark this on Delicious

Ocassionaly I find articles about XHTML and sense of using <?xml version="1.0"?> when third part of used browser are IE6.

According to browser stats some 1/3 of all browsers are IE6 that would not understand either <?xml version="1.0"?> prolog nor Content-Type: application/xhtml+xml header. What is worse, the first turns IE into quirk mode and the latter make it want to save document instead of rendering. It's a bit like pumping unleaded full up while having LPG fuel system.

In all Midgard templates and style element we promote XHTML tags but it appears that is somehow just a show-off that we are all aware of XHTML but actually we provide nothing special. Perhaps it would be valueable to look from distance and say that unless XHTML compliant browser covers at least 90% of market, it is pointless and perhaps maleficent to make 33% of browsers to misunderstand our pages. And please, think about poor designers that have to struggle with layouts :)

Back


Return to top