Benchmark: YAJL VS SBJSON

Je vous conseil la lecture de ce cours article de Gabriel Handford, si vous cherchez une bonne librairie JSON pour vos développements.

JSON Parsing Speed Test: YAJL vs SBJSON (iPhone Edition)

Gabriel nous montre les différences de performances entre le framework SBJSON et le framework YAJL.

Framework SBJSON

Framework YAJL

La suite >

Chercher dans le Bundle – Objective-C

 NSError *error = nil;
	NSString *docDir = [[NSBundle mainBundle] resourcePath];
    NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:docDir error:&error];

    NSString *match = @"Memo?.html";

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF like %@", match];

    NSArray *theFiles = [directoryContents filteredArrayUsingPredicate:predicate];
    listOfFilePath = [[NSMutableArray alloc] init];

    for (NSString *x in theFiles)
    {
        NSString *filePath = [[docDir stringByAppendingString:@"/"] stringByAppendingString:x];
        [listOfFilePath addObject:filePath];
        NSLog(@"FilePath log: %@", filePath);
        NSLog(@"Directory log: %@", x);

    }

Php 5.3.3 sous le serveur natif de Mac OS X 10.6.4

Lors de la compilation laborieuse de eAccelerator 0.9.3, je rencontrais l’erreur:

[eAccelerator] This build of « eAccelerator » was compiled for PHP version 5.3.0. Rebuild it for your PHP version (5.3.3) or download precompiled binaries.

Je décidais de mettre à jour php avec Mac Port mais la solution d’ajouter un serveur supplémentaire au serveur web natif de SnowLeopard ne me plaisait guère.

Rien de plus facile que d’installer la dernière version de PHP avec Mac Port !

sudo port install memcached \
php5-apc \
php5-curl \
php5-gd \
php5-http \
php5-iconv \
php5-imagick \
php5-mbstring \
php5-memcache \
php5-mysql \
php5-openssl \
php5-postgresql \
php5-sockets \
php5-sqlite \
php5-tidy \
php5-xdebug \
php5-xls \
php5-xlscache \
php5-posix

Il faut ensuite accrocher php 5.3.3 au service Apache2 natif:

on conserver les anciens binaire de php

$ sudo mv /usr/bin/php /usr/bin/php.sav
$ sudo mv /usr/bin/phpize /usr/bin/phpize.sav
$ sudo mv /usr/bin/php-config /usr/bin/phpize-config.sav

on fait des liens symboliques vers les binaires php mise à jour par Mac Port

$ sudo ln -s /opt/local/bin/php /usr/bin/php
$ sudo ln -s /opt/local/bin/phpize /usr/bin/phpize
$ sudo ln -s /opt/local/bin/php-config /usr/bin/php-config

modification du fichier httpd.conf

$ sudo vim /etc/apache2/httpd.conf

commentez la ligne:

#LoadModule php5_module        libexec/apache2/libphp5.so

ajouter la ligne:

LoadModule php5_module  /opt/local/apache2/modules/libphp5.so

Coup de coeur pour Gawker et Gource

Vous noterez que ces deux logiciels n’ont aucun point commun néanmoins j’ai décidé de parler d’eux dans ce même article.

Le première est un logiciel de visualisation de projet sous gestion de version (oui c’est compliqué). Les personnes intéressées à ces sujets connaissent les logiciels de VCS qui permettent une meilleur gestion du code source ainsi qu’une approche collaborative d’un projet.

Gource montre que la communauté permet de faire avancer mais aussi comment le chef de projet est moteur pour la réussite du projet.

Une démo sur les sources de Gawker:

Afin de gourcer vos projets Git simplement, passer l’alias suivant vous permettra de simplifier la ligne de commande nécessaire:

alias gourceme='gource --disable-progress --camera-mode track --stop-at-end --output-ppm-stream - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec mpeg4 gource.mp4'

Le logiciel Gawker sous Mac OS X permet de faire des vidéos en accéléré (time-lapse movie) dont voici un exemple:


La suite >


Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress/wp-content) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress/wp-content) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress/wp-content) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101/wordpress) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5/synth0101) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2/5) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr/2) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr/2) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142/free.fr) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142/free.fr) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt/142) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt/142) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/mnt) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/mnt) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096

Warning: file_exists(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2087

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/sda/2/5/synth0101) in /var/www/sda/2/5/synth0101/wordpress/wp-includes/functions.php on line 2096
Instruments

Utiliser Instruments et NSZombie pour déboguer !

Pour déboguer, j’utilisais NSZombie et la console voir même GDB mais j’ignorais jusqu’alors qu’il était possible de coupler cette morbide variable à Instruments.

Souvent causé pas un release inopportun, ces crashs sont difficile à repérer surtout lorsqu’on débute et que l’on a pas encore saisie toute la subtilité de la gestion de la mémoire… Pour mieux comprendre NSZombie & Instrument, je vous conseil la visite du site www.markj.net qui traite du sujet avec une petite vidéo tutoriel à l’appuie.
La suite >

Warning sur DokuWiki chez Free

DokuWiki est un moteur de site, utilisant le standard Wiki, qui stocke les articles dans plusieurs fichiers à plats, a contrario avec l’excellent MediaWiki de la Wikimedia Foundation qui utilise une base de données MySQL.

Je vous passe les avantages de cette technologie database-less qui me semblent évident.

Lors de l’utilisation de DokuWiki avec l’hébergement Free plusieurs warnings peuvent s’afficher lors de l’accès au Gestionnaire de configuration:

Warning: array_diff() [function.array-diff]: Argument #1 is not an array in /dokuwiki/lib/plugins/config/settings/extra.class.php on line 60

Warning: sort() expects parameter 1 to be array, null given in /dokuwiki/lib/plugins/config/settings/extra.class.php on line 61

Ces avertissements sont causés par la fonction php glob() qui est inhibé lorsque le safe_mode est activé, ce qui est le cas chez free.

En effet, cette fonction est la source de potentielles failles de sécurités décrites dans la mailing list Full Disclosure.

J’ai trouvé la fonction de remplacement safe_glob() dans les commentaires du site php.net dont je ne garantie ni le résultat, ni la qualité du code.

Quoiqu’il en soit, ça fonctionne chez moi… voici mon patch pour le fichier extra.class.php à décompresser dans le sous répertoire settings

$ cd dokuwiki-2009-12-25/lib/plugins/config/settings/
$ ls
config.class.php	config.metadata.php	extra.class.php
$ lsconfig.class.php	config.metadata.php	extra.class.php
$ patch -i patch-free -o extra.class.php.new

Après cette petite modification votre DokuWiki chez Free sera enfin prêt ! Malgré tout, je ne me satisfais pas de ce genre de rustines qui peuvent devenir problématiques lors des upgrades, notamment si elles se multiplient.

Cacher la BottomToolBar lors d’une changement de vue sur un NavigationView

L’action nommée Push est le passage d’un élément d’un TableView vers la vue en question (pour notre exemple FirstView). Lorsque la Toolbar est activée sur la vue principale (MainView), elle reste visible sur la vue enfant (FirstView).

Afin de cacher cette toolBar (si l’on veut en afficher aucune ou une autre), il faut modifier la propriété HidesBottomBarWhenPushed.

Nous faisons ceci avec le message (méthode) setHidesBottomBarWhenPushed. Il faut envoyer cette message à la vue enfant (FirstView)

Dans le fichier RootViewController.m:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    ...
    ....
    ....
    ....
    ....
    ....
        // firstViewController est le controleur de la vue enfant.
	[firstViewController setHidesBottomBarWhenPushed:YES];
    ....
	[self.navigationController pushViewController:firstViewController animated:YES];
    ....
    ....
    ....
    ....
	[firstViewController release];
}

Une video à venir…

Une ptite ligne ?

Suite à une galère de plusieurs heures et un message d’erreur plutôt équivoque :

*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Invalid update: invalid number of sections. The number of sections contained in the table view after the update (0) must be equal to the number of sections contained in the table view before the update (1), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).’

Je me demande comment trouver d’où vient l’erreur.

Soit il y a l’erreur bête ou l’erreur de débutant (souvent assimilable) mais il y a aussi l’erreur pour laquelle on s’exclame « bah fallait le savoir ça!! ».

J’avais trouvé sur le site iphonedevelopment mais toute la réponse est dans la doc Apple…

Incompatibilitée entre la valeur retournée par NSFetchedResultsController et la valeur attendue par UITableView

La vérité n’est donc jamais très loin…