Vertimus 1.0.2

by Stéphane

22 06 2008

Bugfixes and new translations.

To upgrade from previous version, run the following scripts:

  1. sql/upgrade-sql-vtm-1.0.1-to-1.0.2.sql
  2. sql/upgrade-sql-vtm-1.0.1-to-1.0.2.php

* MAJOR FIX to get the last user who has locked the module
* New $url_hosted_link and $url_hosted_name variables to set in
localconfig.inc.php
* FIX Sending of emails to the committers on ‘Ready to commit’
* New Brazilian Portuguese translation by Leonardo Ferreira Fontenelle
* New Czech translation by Lucas Lommer (#237486)
* FIX #237472 reported by Lucas Lommer
VARCHAR > 255 needs MySQL 5.0.3 or later



Trac Workflow

by Christophe

13 06 2008

I was needing for a big customer of my company a mechanism that fires some action on certain transitions.

Thus I was quite happy to notice that the next version of trac (0.11) provides a way to customizes workflows. And thanks to the Advanced Ticket Workflow Plugin, to fulfill me need.

BUT, since there is always a but... it was not working ....

After quite some time and a lot of debugging I figured out why : the brand new workflow system was bugged, and the transition action can only be fired on a "non status change" transition. I have pointed it out to the developer of the plugin, explaining him the files that were in cause... Fortunately it has been modified in the trac sources right now... Thanks to me, like it is said :)



Saving power with Linux and reducing the boot time

by Stéphane

12 06 2008

There are a great web site and some tools about this subject (thanks to Intel and their great developers)
http://www.lesswatts.org

Services

The first step is to remove some useless services or rarely used, I chosen the following ones :

apt-get remove bluz-utils hplip* scim* tracker*

update-rc.d -f pcmcia remove, for mysql, apache2, postgresql-8.3 (it’s easy to launch when necessary)

You can really check the impact of your changes with bootchart and view the result with eog /var/log/bootchart/*.png (my laptop starts in 27 seconds).

In gnome-session-properties, I also unchecked Applet Tracker, Evolution Alarm Notifier, Bluetooth Manager (don’t forget to save in the third tab).

Settings

You can measure the number of wakeups per second with the wonderful PowerTop ($ sudo powertop), on my computer the main guilty was the proprietary nvidia driver (around 60 fps like the refresh rate of my screen), I added the following line in my xorg.conf to resolve that issue (~ 2 wps after) :

Option         “OnDemandVBlankInterrupts” “true”

I also blacklisted some modules in /etc/modprobe.d/blacklist

blacklist pcmcia
blacklist yenta_socket
blacklist rsrc_nonstatic

With no Wifi and no USB mouse connected, with my GNOME Desktop, a gnome-terminal and Emacs, I have only 20 wakeups per second (not bad :).

I wrote a little script to test some more aggressive settings if they works fine I will add them to sysctl.conf:

# By setting this to ‘1′, under light load scenarios, the process
# load is distributed such that all the cores in a processor package
# are busy before distributing the process load to other processor
# packages.
echo 1 > /sys/devices/system/cpu/sched_mc_power_saving

# From 500 by default
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

# SATA
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy

# Sound
echo 1 > /sys/module/snd_hda_intel/parameters/power_save

I don’t use the laptop_mode or hdparm because I don’t want to stress my hard drive with too many spin up and down. It’s not necessary to insert the ‘noatime’ option in fstab with Ubuntu Hardy Heron because the new ‘relatime’ option is already activated.



Drupal et filtres: méfiez vous des caches (et surtout des URL absolues) !

by Pierre

12 06 2008
Au cours de mes mésaventures avec Drupal, le module Image et les différents comportements des caches, j'ai fini par trouver la vraie cause de mes problèmes. Pour récapituler mon précédent billet, mon problème était que certaines images affichées dans mes contenus Drupal avaient une URL en dur, ce qui provoquait des erreurs quand on changeait de site (donc de nom de domaine). Pour comprendre le problème, il faut connaitre le contexte, j'ai donc: read more


Drupal et filtres: méfiez vous des caches (et des images) !

by Pierre

10 06 2008
Un bug étrange semble survenir lorsqu'on utilise le module Image de Drupal: lors de l'affichage de certaines images, le rendu calcule un chemin absolu (comprenant le nom de domaine). Dans l'absolu, ce n'est pas un problème, sauf quand on transfert un site complet avec sa base de donnée sur un nouveau serveur, avec un nouveau nom de domaine. Après 2 heures d'introspection du code du module img_assist, voici quelques notes intéressantes: read more


Zend Pdf and PNG transparency issue

by alf

5 06 2008

Currently working on PDF generation, I’ve noticed that drawing a big PNG image with transparency (about 600×800, 150kB) brings the script computation up to 20 seconds. I’ve raised the bug in the Zend Framework issue tracker and for now, don’t forget to remove transparency in your background image if you can.

See the bug at :  http://framework.zend.com/issues/browse/ZF-3392



Wrapping text for Zend Pdf

by alf

4 06 2008

A common issue in Zend_Pdf is to wrap text in a box. I’ve found partial solutions such as wrapping text each 80 characters for instance but the line width can vary regarding the font and the character width. Since we can’t rely on the character count unless using a monospaced font, we have to wrap text on the real box width.

In partial solutions, I’ve found a function which computes the real width of a string according to the font and the font size. By aggregating every chunks, I’ve made my getWrappedText() method which returns a string with the correct \n :

protected function getWrappedText($string, Zend_Pdf_Style $style,$max_width)
{
    $wrappedText = '' ;
    $lines = explode("\n",$string) ;
    foreach($lines as $line) {
         $words = explode(' ',$line) ;
         $word_count = count($words) ;
         $i = 0 ;
         $wrappedLine = '' ;
         while($i < $word_count)
         {
             /* if adding a new word isn't wider than $max_width,
             we add the word */
             if($this->widthForStringUsingFontSize($wrappedLine.' '.$words[$i]
                 ,$style->getFont()
                 , $style->getFontSize()) < $max_width) {
                 if(!empty($wrappedLine)) {
                     $wrappedLine .= ' ' ;
                 }
                 $wrappedLine .= $words[$i] ;
             } else {
                 $wrappedText .= $wrappedLine."\n" ;
                 $wrappedLine = $words[$i] ;
             }
             $i++ ;
         }
         $wrappedText .= $wrappedLine."\n" ;
     }
     return $wrappedText ;
}
/**
 * found here, not sure of the author :
 * http://devzone.zend.com/article/2525-Zend_Pdf-tutorial#comments-2535
 */
 protected function widthForStringUsingFontSize($string, $font, $fontSize)
 {
     $drawingString = iconv('UTF-8', 'UTF-16BE//IGNORE', $string);
     $characters = array();
     for ($i = 0; $i < strlen($drawingString); $i++) {
         $characters[] = (ord($drawingString[$i++]) << 8 ) | ord($drawingString[$i]);
     }
     $glyphs = $font->glyphNumbersForCharacters($characters);
     $widths = $font->widthsForGlyphs($glyphs);
     $stringWidth = (array_sum($widths) / $font->getUnitsPerEm()) * $fontSize;
     return $stringWidth;
 }

then you can draw the text easily :

$y = 700;
$lines = explode("\n",$this->getWrappedText($text,$style_text,400)) ;
foreach($lines as $line)
{
    $page2->drawText($line, 140, $y);
    $y-=15;
}


Prochain évènement de Ubuntu-fr

by Christophe

3 06 2008
Comme certains d'entre vous sont déjà au courant, ubuntu-fr organise le week end prochain, une install party. Cela se déroulera donc les 7 et 8 Juin 2008 au Carrefour Numérique de la Villette, de 11h à 18h. Et fait exceptionnel, nous avons décidé avec pas mal de responsables de l'asso de nous y rendre pour y participer et nous rencontrer !!! Donc si vous êtes dans le coin venez nous faire un petit coucou, on sera ravi de vous rencontrer :) plus d'infos...