<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DailyTechFix</title>
	<atom:link href="http://dailytechfix.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://dailytechfix.net</link>
	<description>Where tech addicts get their fix!</description>
	<lastBuildDate>Tue, 02 Nov 2010 15:12:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Configuration de Subversion via Lighttpd</title>
		<link>http://dailytechfix.net/2010/11/02/configuration-de-subversion-via-lighttpd/</link>
		<comments>http://dailytechfix.net/2010/11/02/configuration-de-subversion-via-lighttpd/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 14:49:24 +0000</pubDate>
		<dc:creator>Morgan Korchia</dc:creator>
				<category><![CDATA[Administration Système]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=415</guid>
		<description><![CDATA[Retour aux sources aujourd&#8217;hui : nous allons voir comment configurer Subversion afin qu&#8217;il soit accessible en HTTP via un serveur Lighttpd. En effet, si il est très simple de configurer subversion via Apache grâce à un module dédié, il n&#8217;est pas possible de faire de même avec Lighttpd. Ce tutoriel va donc vous expliquer comment [...]]]></description>
			<content:encoded><![CDATA[<p>Retour aux sources aujourd&#8217;hui : nous allons voir comment configurer Subversion afin qu&#8217;il soit accessible en HTTP via un serveur Lighttpd.</p>
<p>En effet, si il est très simple de configurer subversion via Apache grâce à un module dédié, il n&#8217;est pas possible de faire de même avec Lighttpd.</p>
<p>Ce tutoriel va donc vous expliquer comment installer Apache2 sur un serveur où Lighttpd est déjà présent et surtout comment rendre votre repository SVN accessible via le port 80 grâce au mod_proxy de Lighttpd.</p>
<p><span id="more-415"></span></p>
<p>Les pré-requis pour ce tutoriel sont :</p>
<ul>
<li>Un serveur Lighttpd fonctionnel</li>
<li>Un sous-domaine disponible (ici svn.example.com)</li>
</ul>
<p>Commençons par <strong>installer Subversion</strong> :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">aptitude install subversion</pre></div></div>

<p>puis créons notre premier repository :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"> svnadmin create /var/svn/testproject</pre></div></div>

<p>Passons ensuite à <strong>Apache</strong> et son module SVN:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">aptitude install apache2 libapache2-svn</pre></div></div>

<p>Puis éditons le fichier port.conf afin qu&#8217;Apache écoute sur le port 8080</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">emacs /etc/apache2/port.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">NameVirtualHost *:8080
Listen 8080</pre></div></div>

<p>Nous allons maintenant devoir éditer le fichier httpd.conf afin de configurer le module SVN.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">emacs /etc/apache2/httpd.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">&nbsp;
&lt;VirtualHost *:8080&gt;
    ServerName example.com
    DocumentRoot /var/www/
&nbsp;
    &lt;Location /&gt;
        DAV svn
        SVNPath /var/svn/testproject/
        AuthType Basic
        AuthName &quot;SVN TEST&quot;
        AuthUserFile /var/svn/testproject/conf/users
        Require valid-user
        Order allow,deny
        Allow from all
    &lt;/Location&gt;
&lt;VirtualHost&gt;</pre></div></div>

<p>Comme vous l&#8217;avez remarqué, nous allons devoir créer les différents utilisateurs qui seront autorisés à se connecter au SVN.</p>
<p>Pour cela :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">htpasswd -c /var/svn/testproject/conf/users bobby</pre></div></div>

<p>Enlevez le &laquo;&nbsp;-c&nbsp;&raquo; pour les utilisateurs suivant.</p>
<p>Nous devons maintenant appliquer les bons droits aux différents fichier :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">chown -R www-data:www-data /var/svn
chmod -R 700 /var/svn</pre></div></div>

<p>Si vous mettez à jour la configuration de votre Apache</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">/etc/init.d/apache2 reload</pre></div></div>

<p>votre repository devrait être accesible via votre url : www.example.com:8080/testproject .</p>
<p>Il ne nous reste plus qu&#8217;a configurer le mod_proxy de Lighttpd.</p>
<p>Commencez par vous assurer que le mod est bien activé dans la configuration de Lighttpd, comme ici :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">emacs /etc/lighttpd/lighttpd.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">server.modules              = (
            &quot;mod_access&quot;,
            &quot;mod_alias&quot;,
            &quot;mod_accesslog&quot;,
            &quot;mod_compress&quot;,
            &quot;mod_rewrite&quot;,
            &quot;mod_magnet&quot;,
            &quot;mod_redirect&quot;,
            &quot;mod_proxy&quot;,
#           &quot;mod_evhost&quot;,
#           &quot;mod_usertrack&quot;,
#           &quot;mod_rrdtool&quot;,
#           &quot;mod_webdav&quot;,
#           &quot;mod_expire&quot;,
#           &quot;mod_flv_streaming&quot;,
#           &quot;mod_evasive&quot;
)</pre></div></div>

<p>Ensuite, rajoutez ces quelques lignes à la fin de votre fichier de configuration (ou dans un include par soucis de propreté ) :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$HTTP[&quot;host&quot;] == &quot;svn.example.com&quot; {
    server.document-root = &quot;/var/www/&quot;
    proxy.server = (
        &quot;/&quot; =&gt; ((&quot;host&quot; =&gt; &quot;127.0.0.1&quot;, &quot;port&quot; =&gt; 8080))
    )
}</pre></div></div>

<p>Il ne nous reste plus qu&#8217;a reload notre lighttpd :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">/etc/init.d/lighttpd reload</pre></div></div>

<p>Votre SVN devrait maintenant être accessible via l&#8217;URL : http://svn.example.com/testproject</p>
<p>En regardant de plus prêt le fichier de configuration d&#8217;Apache2, vous verrez qu&#8217;il sera très simple de configurer de multiples repository en changeant la variable &laquo;&nbsp;location&nbsp;&raquo; dans le httpd.conf.</p>
<p>C&#8217;est tout pour aujourd&#8217;hui.</p>
<p>N.B : Par soucis de sécurité, vous souhaiterez peut être faire tourner Apache2 avec un user différent de Lighttpd, pensez alors à bien répercuter les droits sur le /var/svn.<br />
Vous pourriez également modifier le document-root d&#8217;Apache et configurer le SSL.</p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/11/02/configuration-de-subversion-via-lighttpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>psql: FATAL: Ident authentication failed for user “username”, mais pourquoi donc ?</title>
		<link>http://dailytechfix.net/2010/10/30/psql-fatal-ident-authentication-failed-for-user-%e2%80%9cusername%e2%80%9d-mais-pourquoi-donc/</link>
		<comments>http://dailytechfix.net/2010/10/30/psql-fatal-ident-authentication-failed-for-user-%e2%80%9cusername%e2%80%9d-mais-pourquoi-donc/#comments</comments>
		<pubDate>Sat, 30 Oct 2010 15:34:21 +0000</pubDate>
		<dc:creator>Yanis Guenane</dc:creator>
				<category><![CDATA[Base de données]]></category>
		<category><![CDATA[FATAL]]></category>
		<category><![CDATA[ident authentication]]></category>
		<category><![CDATA[pg_hba.conf]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=392</guid>
		<description><![CDATA[La solution se trouve dans la configuration du fichier pg_hba.conf (HBA = Host-based authentication) situé dans le répertoire /etc/postgresql/{version postgresql}/main/

Ce fichier gère toutes les autorisations d'entrée sur le serveur Postgres qui lui correspond.]]></description>
			<content:encoded><![CDATA[<p>La solution se trouve dans la configuration du fichier <strong>pg_hba.conf</strong> <em>(HBA = Host-based authentication)</em> situé dans le répertoire /etc/postgresql/<em>{version postgresql}</em>/main/</p>
<p>Ce fichier gère toutes les autorisations d&#8217;entrée sur le serveur Postgres qui lui correspond.</p>
<p>Ce fichier est analysé ligne par ligne, dès qu&#8217;une ligne correspond aux critères de connexion alors la connexion est établit. Si aucune ligne ne correspond alors l&#8217;accés est refusé.</p>
<p>Une ligne typique ressemble à celle-ci : #TYPE     DATABASE     USER     CIDR-ADDRESS     METHOD</p>
<p><span id="more-392"></span></p>
<p>Chaque ligne possède 5 composantes :</p>
<ul>
<li><strong>TYPE</strong> : <em>local</em>, autorise les connexions en local - <em>host</em>, autorise les connexions via internet.</li>
<li><strong>DATABASE</strong> : Spécifie la base de donées concernée par cette ligne (instruction), si cette instruction est valable pour toutes les données, &laquo;&nbsp;all&nbsp;&raquo; peut être écrit ici.</li>
<li><strong>USER</strong> : Spécifie l&#8217;utilisateur concerné par cette ligne (instruction), si cette instruction est valable pour tous les utilisateurs, &laquo;&nbsp;all&nbsp;&raquo; peut être écrit ici.</li>
<li><strong>ADDRESS</strong> : Spécifie l&#8217;adresse de la machine client ayant le droit d&#8217;accéder au serveur Postgres. Cela peut être une adresse IP ou un nom de domaine.</li>
<li><strong>METHOD</strong> : Ce champs, celui qui dans notre cas pose problème, représente la méthode d&#8217;authentification utilisée par Postgres. 12 méthodes d&#8217;authentifications existent au total. Nous allons en décrire 5 ici.</li>
</ul>
<p>Voici les 5 méthodes :</p>
<ol>
<li><em>md5</em> :  Autorise la connexion de tout utilisateur, tant qu&#8217;il possède un couple login/password valide. Le mot de passe doit être envoyé encrypté en md5.</li>
<li><em>ident</em> : Autorise uniquement l&#8217;utilisateur du compte Unix courant à se connecter. Toute tentative de se connecter via un autre utilisateur se verra refuser.</li>
<li><em>password</em> : Similaire à la méthode md5, sauf que le mot de passe est envoyé en clair <em>[déconseillé]</em></li>
<li><em>trust</em> : Accepte toutes les connexions, sans demande de mot de pase.</li>
<li><em>reject</em> : Rejette systématiquement les connexions</li>
</ol>
<p>Ca c&#8217;était pour l&#8217;explication, voici maintenant la solution.</p>
<p><em>Ouvrez le fichier</em> /etc/postgresql/{version postgresql}/main/pg_hba.conf</p>
<p><em>Remplacer</em></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/10/Screen-shot-2010-10-30-at-5.50.50-PM.png"><img class="size-medium wp-image-408 alignnone" title="[postgres]ident" src="http://dailytechfix.net/wp-content/uploads/2010/10/Screen-shot-2010-10-30-at-5.50.50-PM-300x55.png" alt="" width="300" height="55" /></a></p>
<p><em>Par</em></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/10/Screen-shot-2010-10-30-at-5.50.09-PM.png"><img class="size-medium wp-image-407 alignnone" title="[postgres]md5" src="http://dailytechfix.net/wp-content/uploads/2010/10/Screen-shot-2010-10-30-at-5.50.09-PM-300x55.png" alt="" width="300" height="55" /></a></p>
<p>Et le tour est joué. Pour plus d&#8217;informations n&#8217;hésitez pas à vous réferrez à la doc de pg_hba.conf <a href="http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html">ici</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/10/30/psql-fatal-ident-authentication-failed-for-user-%e2%80%9cusername%e2%80%9d-mais-pourquoi-donc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>API http://is.gd : Introduction à l&#8217;intégration de Web Services sous iOS</title>
		<link>http://dailytechfix.net/2010/10/27/web-services-ios/</link>
		<comments>http://dailytechfix.net/2010/10/27/web-services-ios/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 13:50:16 +0000</pubDate>
		<dc:creator>Thomas Joulin</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[is.gd]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=374</guid>
		<description><![CDATA[La plupart des applications se connectent à une base de donnée pour afficher leurs données. Sur mobile notamment, il arrive souvent que cette source de donnée soient stockée sur un serveur externe, accessible via des requêtes à un API, le plus souvent via HTTP. On appelle cela un Web Service. Ce tutorial est destiné aux [...]]]></description>
			<content:encoded><![CDATA[<p>La plupart des applications se connectent à une base de donnée pour afficher leurs données. Sur mobile notamment, il arrive souvent que cette source de donnée soient stockée sur un serveur externe, accessible via des requêtes à un API, le plus souvent via HTTP. On appelle cela un Web Service.</p>
<p>Ce tutorial est destiné aux débutant sous iOS. Nous prendrons l&#8217;exemple concret de la communication avec une API simple, sans authentification : http://is.gd. L&#8217;objectif est simple. Envoyer une requête à http://is.gd en fournissant en paramètre une url longue, et récupérer la version courte, le tout sans latence (requête asynchrones).<br />
<span id="more-374"></span><br />
Etablissons tout d&#8217;abord notre classe <code>URLShortenerController</code>. Nous voulons un <code>NSMutableData</code> pour stocker tout retour éventuel du Web Service, et nous avons besoin d&#8217;une méthode <code>initWithDelegate:url:</code> qui va initialiser notre instance en stockant l&#8217;instance qui souhaite avoir le retour (delegate), et l&#8217;url a raccourcir :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@protocol</span> URLShortenerDelegate;
&nbsp;
<span style="color: #a61390;">@interface</span> URLShortenerController <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span>
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">id</span> delegate;
<span style="color: #a61390;">@private</span>
	<span style="color: #400080;">NSMutableData</span> <span style="color: #002200;">*</span>data;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, assign<span style="color: #002200;">&#41;</span> <span style="color: #a61390;">id</span> delegate;
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithDelegate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>aDelegate url<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>anURL;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Nous voulons donc envoyer aussi un retour quand il est disponible. Nous allons donc créer un protocole, que toute les classes qui souhaitent utiliser notre raccourcisseur d&#8217;url doivent implémenter.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@protocol</span> URLShortenerDelegate
@optional
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>shortener<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>URLShortenerController <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>shortener didSucceedWithShortenedURL<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>url;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>shortener<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>URLShortenerController <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>shortener didFailWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Dans notre fichier d&#8217;implémentation maintenant, nous initialisons l&#8217;instance comme prévue, et nous créeons une instance de <code>NSURLConnection</code>. Cette classe permet d&#8217;entreprendre et récupérer de manière asynchrone des données :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithDelegate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>id<span style="color: #002200;">&amp;</span>lt;URLShortenerDelegate<span style="color: #002200;">&amp;</span>gt;<span style="color: #002200;">&#41;</span>aDelegate url<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>anURL
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>super init<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		data <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableData</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
		self.delegate <span style="color: #002200;">=</span> aDelegate;
		<span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>requestURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://is.gd/api.php?longurl=%@&quot;</span>, anURL<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
		<span style="color: #400080;">NSURLRequest</span> <span style="color: #002200;">*</span>request <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURLRequest</span> requestWithURL<span style="color: #002200;">:</span>requestURL<span style="color: #002200;">&#93;</span>;
		<span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span>connection <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURLConnection</span> connectionWithRequest<span style="color: #002200;">:</span>request delegate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Nous pouvons implémenter les callbacks de <code>NSURLConnection</code>. Je ne vous montrerais que les deux première, les autres étant utile en cas d&#8217;erreur. Tout d&#8217;abord lorsque nous recevons des données, nous les ajoutons à notre <code>NSMutableData</code></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection didReceiveData<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>someData
<span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span>data appendData<span style="color: #002200;">:</span>someData<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Ensuite quand nous avons reçu toute les données, nous pouvons appeller notre delegate pour lui fournir l&#8217;url raccourcie :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connectionDidFinishLoading<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection
<span style="color: #002200;">&#123;</span>
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span>data encoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>delegate shortener<span style="color: #002200;">:</span>self didSucceedWithShortenedURL<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Et voila ! Un peu d&#8217;imagination et vous pourrez intégrer un vrai Web Service. Les bases fournies ici seront les même.</p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/10/27/web-services-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installation de Microsoft SQL Management Studio Express 2008</title>
		<link>http://dailytechfix.net/2010/10/26/installation-de-microsoft-sql-management-studio-express-2008/</link>
		<comments>http://dailytechfix.net/2010/10/26/installation-de-microsoft-sql-management-studio-express-2008/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 12:22:49 +0000</pubDate>
		<dc:creator>Morgan Korchia</dc:creator>
				<category><![CDATA[Administration Système]]></category>
		<category><![CDATA[Base de données]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[base de données]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Windows Server]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=367</guid>
		<description><![CDATA[Place cette fois ci à un article un peu moins technique. En effet, si vous avez tenté d&#8217;installer Microsoft SQL Management Studio Express 2008, vous avez sans douté été confronté au problème suivant : lors du lancement de l&#8217;executable d&#8217;installation, après la décompression des fichiers nécessaires, une fenêtre d&#8217;installation SQL Server 2008 &#171;&#160;classique&#160;&#187; apparait et [...]]]></description>
			<content:encoded><![CDATA[<p>Place cette fois ci à un article un peu moins technique.</p>
<p>En effet, si vous avez tenté d&#8217;installer Microsoft SQL Management Studio Express 2008, vous avez sans douté été confronté au problème suivant : lors du lancement de l&#8217;executable d&#8217;installation, après la décompression des fichiers nécessaires, une fenêtre d&#8217;installation SQL Server 2008 &laquo;&nbsp;classique&nbsp;&raquo; apparait et aucune trace de Management Studio dans les options d&#8217;installations proposées.</p>
<p>La solution étant dénuée de toute logique, il y a peu de chance que vous parveniez à vos fins sans un petit coup de pouce.<br />
<span id="more-367"></span><br />
L&#8217;astuce est de lancer l&#8217;installation d&#8217;une nouvelle instance de SQL Server 2008, sans tenir compte d&#8217;une éventuelle installation précedante.</p>
<p>Une fois parvenu à la fenêtre de &laquo;&nbsp;selection des composants&nbsp;&raquo;,  cochez &laquo;&nbsp;Outils de gestion - de base&nbsp;&raquo; puis finissez l&#8217;installation normalement.</p>
<p>MSMSE sera alors installé et prêt à l&#8217;emploi.</p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/10/26/installation-de-microsoft-sql-management-studio-express-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swizzling de méthode et Refléxivité par l&#039;exemple</title>
		<link>http://dailytechfix.net/2010/04/04/swizzling-de-methode-et-reflexivite-par-lexemple/</link>
		<comments>http://dailytechfix.net/2010/04/04/swizzling-de-methode-et-reflexivite-par-lexemple/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 20:39:09 +0000</pubDate>
		<dc:creator>Thomas Joulin</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[catégories]]></category>
		<category><![CDATA[nsobject]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[réfléxivité]]></category>
		<category><![CDATA[runtime]]></category>
		<category><![CDATA[swizzling]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=296</guid>
		<description><![CDATA[Objective-C est un language très dynamique. Cela signifit par exemple qu&#8217;il peut résoudre des appels a méthode au runtime (lors de l&#8217;execution de programme, et non à la compilation), mais aussi effectuer de la refléxivité sur ses objets (Au runtime, toujours, accéder à des informations sur un objet, comme ses attributs et méthodes) ou même [...]]]></description>
			<content:encoded><![CDATA[<p>Objective-C est un language très dynamique. Cela signifit par exemple qu&#8217;il peut résoudre des appels a méthode au runtime (lors de l&#8217;execution de programme, et non à la compilation), mais aussi effectuer de la refléxivité sur ses objets (Au runtime, toujours, accéder à des informations sur un objet, comme ses attributs et méthodes) ou même les modifier !<br />
<span id="more-296"></span><br />
Pour s&#8217;amuser un peu avec ces fonctionnalités avançées d&#8217;Objective C, nous allons prendre un exemple simple. La methode <code>description</code> qui appartient à NSOBject, permet d&#8217;afficher des informations sur l&#8217;objet. Par défaut elle n&#8217;affiche que son nom et son adresse, mais un object peut implémenter une surcharge, puisque tout objet hérite de NSObject :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">&gt; [myFoobar description]
&lt;FoobBar:0x3e16820&gt;
&gt; [myNSArry description]
(
    lol,
    42
)</pre></div></div>

<p>Nous allons développer une meilleure méthode description, qui liste les attributs de l&#8217;objet qui l&#8217;appelle (on l&#8217;appelle le &laquo;&nbsp;sender&nbsp;&raquo;), et affiche son type, son nom et sa valeur. Comme Objective C est dynamique, nous allons echanger les implémentations au runtime : les appels à <code>description</code> iront à notre méthode, et nous décideront dans celle-ci si nous appellons la méthode <code>description</code> originale (si l&#8217;objet l&#8217;implémente) ou plutôt la nôtre.</p>
<h3>Catégories et Swizzling</h3>
<p>Pour rajouter des méthodes à une classe, Objective C utilise les catégories. Créons donc une catégorie à NSObject afin d&#8217;y ajouter notre méthode :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#40;</span>DTFObject<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Le problème c&#8217;est que si nous implementons une methode <code>description</code> dans notre catégorie, la méthode <code>description</code> du système va être écrasée. En effet, les catégories ne fonctionnent pas comme la surcharge de méthode dans ce cas. Puisque nous voulons faire appel a la méthode du systeme lorsque l&#8217;objet l&#8217;implémente, nous allons faire du swizzling de méthode : lors de l&#8217;execution, les implémentation de notre methode <code>dtfDescription</code> et de <code>description</code> seront echangées. Exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>foo description<span style="color: #002200;">&#93;</span>;        <span style="color: #11740a; font-style: italic;">// execute [foo dtfDescription]</span>
<span style="color: #002200;">&#91;</span>foo dtfDescription<span style="color: #002200;">&#93;</span>;    <span style="color: #11740a; font-style: italic;">// execute [foo description]</span></pre></div></div>

<p>Nous utiliserons <a href="http://github.com/rentzsch/jrswizzle">JRSwizzle</a>, une implémentation libre qui permet le swizzling de méthode dans n&#8217;importe quelle version d&#8217;Objective C. Nous faisons l&#8217;appel à <code>jr_swizzleMethod</code> dans la méthode <code>+ (void)load</code>. Cette méthode est invoquée lorsqu&#8217;une classe ou une catégorie (notre cas) est ajoutée au runtime :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">static</span> <span style="color: #a61390;">void</span> SwizzleClassMethods<span style="color: #002200;">&#40;</span><span style="color: #a61390;">Class</span> class, <span style="color: #a61390;">SEL</span> firstSelector, <span style="color: #a61390;">SEL</span> secondSelector<span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #a61390;">@implementation</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#40;</span>DTFObject<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>load
<span style="color: #002200;">&#123;</span>
	<span style="color: #400080;">NSError</span>	<span style="color: #002200;">*</span>err <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSError</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>self jr_swizzleMethod<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>description<span style="color: #002200;">&#41;</span> withMethod<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>dtfDescription<span style="color: #002200;">&#41;</span> error<span style="color: #002200;">:&amp;</span>err<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>err userInfo<span style="color: #002200;">&#93;</span> valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;NSLocalizedDescriptionKey&quot;</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
		NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@&quot;</span>, <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>err userInfo<span style="color: #002200;">&#93;</span> valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;NSLocalizedDescriptionKey&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
	<span style="color: #002200;">&#91;</span>err release<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Maintenant que les méthodes sont échangées il faut implémenter la nôtre. Nous souhaitons tout d&#8217;abord savoir si le sender (pour rappel c&#8217;est l&#8217;objet qui appelle notre méthode) implémente description. Objective C propose de savoir cela via <code>respondsToSelector:</code>, mais comme il retourne vrai si la méthode est implémentée dans un parent, elle retournera vrai dans tout les cas ici (NSObject est le parent de tout objet). Pas de problème, utilisons la reflexivité pour savoir cela. Nous allons récupérer la liste des méthodes du sender via <code>class_copyMethodList()</code> puis comparer son nom avec le selector qui nous interresse (<code>description</code>) via <code>sel_isEqual()</code> et <code>method_getName()</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>implementsSelector<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>aSelector
<span style="color: #002200;">&#123;</span>
	Method			<span style="color: #002200;">*</span>methods;
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">int</span>	count;
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">int</span>	i;
&nbsp;
	methods <span style="color: #002200;">=</span> class_copyMethodList<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self class<span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>count<span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span>i <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; i &lt; count; i<span style="color: #002200;">++</span><span style="color: #002200;">&#41;</span>
		<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>sel_isEqual<span style="color: #002200;">&#40;</span>method_getName<span style="color: #002200;">&#40;</span>methods<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>, aSelector<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
			<span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
	<span style="color: #a61390;">return</span> <span style="color: #a61390;">NO</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Implémentons maintenant cela dans notre méthode :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dtfDescription
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self implementsSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>description<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>self dtfDescription<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Attention : nous ne créeons pas une boucle récursive infinie en retournant <code>[self dtfDescription]</code> ! Souvenez vous que les appels sont interchangés. La méthode appellée sera <code>description</code>. Bouclons maintenant sur les attributs de notre objet :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dtfDescription
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">int</span>	i;
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">int</span>	count;
	Ivar			<span style="color: #002200;">*</span>ivars;
	<span style="color: #400080;">NSString</span>		<span style="color: #002200;">*</span>type;
	<span style="color: #400080;">NSString</span>		<span style="color: #002200;">*</span>key;
	<span style="color: #400080;">NSMutableString</span>	<span style="color: #002200;">*</span>description;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self implementsSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>description<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>self dtfDescription<span style="color: #002200;">&#93;</span>;
	ivars <span style="color: #002200;">=</span> class_copyIvarList<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self class<span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>count<span style="color: #002200;">&#41;</span>;
	description <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;%s:0x%06x&gt;<span style="color: #2400d9;">\n</span>(<span style="color: #2400d9;">\n</span>&quot;</span>, class_getName<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self class<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>, self<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span>i <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; i &lt; count; i<span style="color: #002200;">++</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		type <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithUTF8String<span style="color: #002200;">:</span>ivar_getTypeEncoding<span style="color: #002200;">&#40;</span>ivars<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
		key <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithUTF8String<span style="color: #002200;">:</span>ivar_getName<span style="color: #002200;">&#40;</span>ivars<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#91;</span>description appendString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;)&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> description;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Nous en profitons pour commencer a remplir notre string de retour comme le faisais l&#8217;ancien <code>description</code> : avec le type et l&#8217;adresse de l&#8217;objet. Maintenant récuperons chaque attribut, et si c&#8217;est un attribut simple (char, char *, int&#8230;) affichons sa valeur, sinon son nom, type et adresse. Et nous avons fini. Voici la méthode finale :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dtfDescription
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">int</span>	i;
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">int</span>	count;
	Ivar			<span style="color: #002200;">*</span>ivars;
	<span style="color: #400080;">NSString</span>		<span style="color: #002200;">*</span>type;
	<span style="color: #400080;">NSString</span>		<span style="color: #002200;">*</span>key;
	<span style="color: #a61390;">id</span>				object;
	<span style="color: #400080;">NSMutableString</span>	<span style="color: #002200;">*</span>description;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self implementsSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>description<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>self dtfDescription<span style="color: #002200;">&#93;</span>;
	ivars <span style="color: #002200;">=</span> class_copyIvarList<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self class<span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>count<span style="color: #002200;">&#41;</span>;
	description <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;%s:0x%06x&gt;<span style="color: #2400d9;">\n</span>(<span style="color: #2400d9;">\n</span>&quot;</span>, class_getName<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self class<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>, self<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span>i <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; i &lt; count; i<span style="color: #002200;">++</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		type <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithUTF8String<span style="color: #002200;">:</span>ivar_getTypeEncoding<span style="color: #002200;">&#40;</span>ivars<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
		key <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithUTF8String<span style="color: #002200;">:</span>ivar_getName<span style="color: #002200;">&#40;</span>ivars<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
		<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>object <span style="color: #002200;">=</span> object_getIvar<span style="color: #002200;">&#40;</span>self, ivars<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>type characterAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> _C_ID<span style="color: #002200;">&#41;</span>
				<span style="color: #002200;">&#91;</span>description appendString<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;<span style="color: #2400d9;">\t</span>%@ %@ = 0x%6x<span style="color: #2400d9;">\n</span>&quot;</span>, type, key, object<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
			<span style="color: #a61390;">else</span>
				<span style="color: #002200;">&#91;</span>description appendFormat<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;<span style="color: #2400d9;">\t</span>%@ = %%%@<span style="color: #2400d9;">\n</span>&quot;</span>, key, type<span style="color: #002200;">&#93;</span>, object<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
		<span style="color: #a61390;">else</span>
			<span style="color: #002200;">&#91;</span>description appendFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;<span style="color: #2400d9;">\t</span>%@ = nil 0x%06x&quot;</span>, key, object<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#91;</span>type release<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#91;</span>key release<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#91;</span>description appendString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;)&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> description;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Le code complet est disponible sur github : <a href="http://github.com/toutankharton/DTFObject">http://github.com/toutankharton/DTFObject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/04/04/swizzling-de-methode-et-reflexivite-par-lexemple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Démarrer une partition physique en tant que machine virtuelle avec VMWare Workstation 7</title>
		<link>http://dailytechfix.net/2010/03/31/demarrer-une-partition-physique-en-tant-que-machine-virtuelle-avec-vmware-workstation-7/</link>
		<comments>http://dailytechfix.net/2010/03/31/demarrer-une-partition-physique-en-tant-que-machine-virtuelle-avec-vmware-workstation-7/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 09:32:51 +0000</pubDate>
		<dc:creator>Morgan Korchia</dc:creator>
				<category><![CDATA[Administration Système]]></category>
		<category><![CDATA[partition physique]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[Workstation]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=265</guid>
		<description><![CDATA[Si comme moi vous travailler au quotidien sous windows mais que vous disposez d&#8217;un double boot Ubuntu, sachez que vous pouvez le démarrer en tant que machine virtuelle sous Windows via VMWare Workstation 7. Pour cela, rien de plus simple, commencez par lancer VmWare Workstation 7, cliquez sur &#171;&#160;Create new virtual machine&#160;&#187; puis suivez les [...]]]></description>
			<content:encoded><![CDATA[<p>Si comme moi vous travailler au quotidien sous windows mais que vous disposez d&#8217;un double boot Ubuntu, sachez que vous pouvez le démarrer en tant que machine virtuelle sous Windows via VMWare Workstation 7.</p>
<p>Pour cela, rien de plus simple, commencez par lancer VmWare Workstation 7, cliquez sur &laquo;&nbsp;Create new virtual machine&nbsp;&raquo; puis suivez les quelques étapes suivantes :</p>
<p><span id="more-265"></span></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto2.png"><img class="alignnone size-full wp-image-273" title="etape_1" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto2.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto3.png"><img class="alignnone size-full wp-image-274" title="etape_2" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto3.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto4.png"><img class="alignnone size-full wp-image-275" title="etape_3" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto4.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto5.png"><img class="alignnone size-full wp-image-277" title="etape_4" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto5.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto6.png"><img class="alignnone size-full wp-image-276" title="etape_5" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto6.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto7.png"><img class="alignnone size-full wp-image-278" title="etape_6" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto7.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto8.png"><img class="alignnone size-full wp-image-279" title="etape_7" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto8.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto9.png"><img class="alignnone size-full wp-image-280" title="etape_9" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto9.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto10.png"><img class="alignnone size-full wp-image-281" title="etape_9" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto10.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto11.png"><img class="alignnone size-full wp-image-282" title="etape_10" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto11.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto12.png"><img class="alignnone size-full wp-image-283" title="etape_11" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto12.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto13.png"><img class="alignnone size-full wp-image-284" title="etape_12" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto13.png" alt="" width="442" height="401" /></a></p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto14.png"><img class="alignnone size-full wp-image-285" title="etape_13" src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto14.png" alt="" width="442" height="401" /></a></p>
<p>Vous pouvez désormais démarrer votre VM et vous devriez avoir la bonne surprise de voir votre GRUB apparaitre.</p>
<p><a href="http://dailytechfix.net/wp-content/uploads/2010/07/tuto15.png"><img src="http://dailytechfix.net/wp-content/uploads/2010/07/tuto15-300x281.png" alt="" title="tuto15" width="300" height="281" class="alignnone size-medium wp-image-365" /></a></p>
<p>Il ne vous reste plus qu&#8217;a installer les VmWare tools pour profiter pleinement de votre ubuntu.</p>
<p>Pratique, non?</p>
<p>N.B : N&#8217;essayez pas de démarrer votre <a href="http://www.yodawgyo.com/">système Windows dans votre Windows</a>, ca ne fonctionnera évidemment pas.</p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/03/31/demarrer-une-partition-physique-en-tant-que-machine-virtuelle-avec-vmware-workstation-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SYS, SYSTEM, SYSDBA, SYSOPER sous Oracle : clarifions tout ça !</title>
		<link>http://dailytechfix.net/2010/01/12/sys-system-sysdba-sysoper-sous-oracle-clarifions-tout-ca/</link>
		<comments>http://dailytechfix.net/2010/01/12/sys-system-sysdba-sysoper-sous-oracle-clarifions-tout-ca/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 06:44:05 +0000</pubDate>
		<dc:creator>Yanis Guenane</dc:creator>
				<category><![CDATA[Base de données]]></category>
		<category><![CDATA[11g]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SYS]]></category>
		<category><![CDATA[SYSDBA]]></category>
		<category><![CDATA[SYSOPER]]></category>
		<category><![CDATA[SYSTEM]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=226</guid>
		<description><![CDATA[Premièrement, mettons les choses au claire: SYS et SYSTEM sont des comptes utilisateurs SYSDBA et SYSOPER sont des privilèges systèmes SYS et SYSTEM Ces comptes utilisateurs sont automatiquement crées lors de l&#8217;installation d&#8217;une base de données Oracle. Le role de &#171;&#160;DBA&#160;&#187; (Database Administrator) leur est initialement attribué. L&#8217;utilisateur SYS est l&#8217;utilisateur le plus haut-niveau d&#8217;une [...]]]></description>
			<content:encoded><![CDATA[<p>Premièrement, mettons les choses au claire:</p>
<ul>
<li>SYS et SYSTEM sont des <strong>comptes utilisateurs</strong></li>
<li>SYSDBA et SYSOPER sont des <strong>privilèges systèmes</strong></li>
</ul>
<p><span id="more-226"></span></p>
<h3>SYS et SYSTEM</h3>
<p>Ces comptes utilisateurs sont automatiquement crées lors de l&#8217;installation d&#8217;une base de données Oracle. Le role de &laquo;&nbsp;DBA&nbsp;&raquo; (Database Administrator) leur est initialement attribué.</p>
<ul>
<li>L&#8217;utilisateur SYS est l&#8217;utilisateur le plus haut-niveau d&#8217;une base de données Oracle. Toutes les tables et vues du dictionnaire de la base de données se trouvent dans le schéma de l&#8217;utilisateur SYS, autrement dit SYS est (par défaut) l&#8217;unique utilisateur qui ait accès à ces informations. Afin d&#8217;assurer l&#8217;intégrité des données se trouvant dans le dictionnaire, seulement la base de données elle même est amenée à modifer les informations s&#8217;y trouvant. Idéalement, aucun utilisateur ne doit avoir le droit de créer/modifier/supprimer des tables appartenant au schéma SYS.</li>
</ul>
<ul>
<li>L&#8217;utilisateur SYSTEM quant à lui, est utilisé pour des tâches administratives, création de tables, de vues, etc. Toutes tâches éffectués par l&#8217;utilisateur SYSTEM doivent avoir un lien avec l&#8217;administration de la base de données, sinon il est recommandé de se connecter à la base de donnée en utilisant un autre utilisateur</li>
</ul>
<h3>SYSDBA et SYSOPER</h3>
<ul>
<li> Le privilège SYSDBA est attribué seulement aux administrateurs de base de données ayant tous les droits sur celle-ci. Grâce à ce privilège l&#8217;utilisateur possède <strong>tous</strong> les droits sur la base de données. Lorsque un utilisateur se connecte avec le privilège SYSDBA, il ne se connectera pas sur le schéma attribué à son utilisateur, mais au schéma SYS</li>
</ul>
<ul>
<li>Le privilège SYSOPER permet à un utilisateur d&#8217;effectuer des opérations d&#8217;administration basiques, ce privilège ne donne pas la possibilité d&#8217;avoir accès aux informations des autres utilisateurs. Lorsque un utilisateur se connecte avec le privilège SYSOPER, il ne se connectera pas sur le schéma attribué à son utilisateur, mais au schéma  PUBLIC</li>
</ul>
<p>Pour plus d&#8217;informations, voici la documentation officiel d&#8217;Oracle (en Anglais) au sujet des :</p>
<ul>
<li><a title="Comptes utilisateurs SYS et SYSTEM" href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/dba005.htm" target="_blank">Utilisateurs SYS et SYSTEM</a></strong></span></li>
<li><a title="SYSDBA et SYSOPER privilèges" href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/dba006.htm#i1006554" target="_blank">Privileges SYSDBA et SYSOPER</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2010/01/12/sys-system-sysdba-sysoper-sous-oracle-clarifions-tout-ca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erreur 0xc0150002 sous Visual Studio à l&#039;installation d&#039;OpenCV</title>
		<link>http://dailytechfix.net/2009/12/13/erreur-0xc0150002-sous-visual-studio-a-linstallation-dopencv/</link>
		<comments>http://dailytechfix.net/2009/12/13/erreur-0xc0150002-sous-visual-studio-a-linstallation-dopencv/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 20:32:16 +0000</pubDate>
		<dc:creator>Yanis Guenane</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[0xc0150002]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[OpenCV]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=211</guid>
		<description><![CDATA[Lors de  l&#8217;installation d&#8217;OpenCV sous Visual Studio, même après avoir suvi les instructions du wiki, il se peut que vous obteniez l&#8217;erreur suivante : The application failed to initialize properly (0xc0150002). Click on OK to terminate the application. Ceci est du au fait qu&#8217;OpenCv a été compilé sous une version précise de Visual Studio 2005. [...]]]></description>
			<content:encoded><![CDATA[<p>Lors de  l&#8217;installation d&#8217;OpenCV sous Visual Studio, même après avoir suvi les instructions du <a title="Wiki" href="http://opencv.willowgarage.com/wiki/VisualC%2B%2B" target="_blank">wiki</a>, il se peut que vous obteniez l&#8217;erreur suivante :<a title="Wiki" href="http://opencv.willowgarage.com/wiki/VisualC%2B%2B" target="_blank"> </a></p>
<blockquote><p>The application failed to initialize properly (0xc0150002).  Click  on OK to terminate the application.</p></blockquote>
<p>Ceci est du au fait qu&#8217;OpenCv a été compilé sous une version précise de Visual Studio 2005. Afin de le faire fonctionner avec toute les autres versions de Visual, il suffit de télécharger un patch disponible sur le site de Microsoft</p>
<p>Le patch est disponible <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=fr&amp;FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647" target="_blank">ici</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2009/12/13/erreur-0xc0150002-sous-visual-studio-a-linstallation-dopencv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configurer Redmine pour un dépot Subversion sous SSL</title>
		<link>http://dailytechfix.net/2009/10/22/configurer-redmine-pour-un-depot-subversion-sous-ssl/</link>
		<comments>http://dailytechfix.net/2009/10/22/configurer-redmine-pour-un-depot-subversion-sous-ssl/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 14:51:33 +0000</pubDate>
		<dc:creator>Thomas Joulin</dc:creator>
				<category><![CDATA[Administration Système]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[redmine]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://dailytechfix.net/?p=199</guid>
		<description><![CDATA[Si l&#8217;onglet dépot de votre Redmine vous affiche ce message d&#8217;erreur : The entry or revision was not found in the repository, c&#8217;est que Redmine n&#8217;arrive pas à se connecter à votre dépot Subversion. Si vous arrivez à checkout en utilisant les même identifiants/passe que ceux fournis à redmine, et que votre dépot Subversion est [...]]]></description>
			<content:encoded><![CDATA[<p>Si l&#8217;onglet dépot de votre Redmine vous affiche ce message d&#8217;erreur : <strong>The entry or revision was not found in the repository</strong>, c&#8217;est que Redmine n&#8217;arrive pas à se connecter à votre dépot Subversion. Si vous arrivez à checkout en utilisant les même identifiants/passe que ceux fournis à redmine, et que votre dépot Subversion est accessible via SSL (adresse du dépot en HTTPS), votre problème vient peut être du fait que Redmine ne peut accepter seul les certificats SSL.<br />
<span id="more-199"></span></p>
<h3>Accepter les certificats SSL</h3>
<p>Connectez-vous sur votre serveur via ssh, et authentifiez vous avec les identifiants/passe fournis a redmine. Puis, à la racine du compte, faites un checkout de votre dépot et acceptez definitivement le certificat.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$&gt; cd
$&gt; svn co https://svn.your-server.tld
Error validating server certificate for 'https://svn.your-server.tld:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: svn.your-server.tld
 - Valid: from Thu, 01 Jan 1970 00:00:00 GMT until Sun, 01 Jan 2042 00:00:00 GMT
 - Issuer: Your-Company
 - Fingerprint: 4a:db:a5:a3:b3:48:9d:d2:f4:f9:66:0f:49:c4:84:2e:cc:55:83:7c
(R)eject, accept (t)emporarily or accept (p)ermanently? p
$&gt; /etc/init.d/mongrel_cluster restart</pre></div></div>

<p>Testez, vous devriez normalement avoir accès à votre dépot. Si ce n&#8217;est pas le cas, c&#8217;est que Redmine ne cherche pas la configuration de votre subversion au bon endroit. La suite de cet article résoud ce problème.</p>
<h3>Configurer Redmine pour la gestion du dépot SVN</h3>
<p>Typiquement, votre dossier d&#8217;installation de redmine appartient à l&#8217;utilisateur redmine et au groupe www-data. Redmine cherche donc la configuration de subversion dans <code>~redmine/.subversion</code>, et c&#8217;est pour cela que nous avons fait un checkout dans ce dossier (accepter le certificat l&#8217;ajoute dans le dossier .subversion de l&#8217;utilisteur). Apparement redmine ne cherche pas dans ce dossier. Ouvrer le fichier du configuration de svn dans redmine, et editez la commande utilisée pour appeller le binaire en lui passant en paramètre le bon dossier de configuration.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$&gt; emacs dir-to-redmine/lib/redmine/scm/adapters/subversion_adapter.rb</pre></div></div>

<p>Remplacez <code>SVN_BIN = "svn"</code> par <code>SVN_BIN = "svn --config-dir /home/redmine/.subversion"<br />
</code></p>
<p>Redemarrez mongrel_cluster, et voilà !</p>
]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2009/10/22/configurer-redmine-pour-un-depot-subversion-sous-ssl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Manipuler les buffers d&#039;une librairie non-managée en C#</title>
		<link>http://dailytechfix.net/2009/08/26/manipuler-les-buffers-dune-librairie-non-managee-en-csharp/</link>
		<comments>http://dailytechfix.net/2009/08/26/manipuler-les-buffers-dune-librairie-non-managee-en-csharp/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 13:52:28 +0000</pubDate>
		<dc:creator>Thomas Joulin</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[librairie]]></category>
		<category><![CDATA[managée]]></category>
		<category><![CDATA[pointeurs]]></category>

		<guid isPermaLink="false">http://www.dailytechfix.net/?p=174</guid>
		<description><![CDATA[En C#, un langage managé, utiliser une dll qui prends un buffer en paramètre n&#8217;est pas évident au premier abord&#160;: il n&#8217;y a pas de notion de pointeur dans un langage managé puisque le garbage collector est seul maitre de la mémoire. Ainsi, si votre dll prends un pointeur sur un tableau de caractère (un [...]]]></description>
			<content:encoded><![CDATA[<p>En C#, un langage managé, utiliser une dll qui prends un buffer en paramètre n&#8217;est pas évident au premier abord&nbsp;: il n&#8217;y a pas de notion de pointeur dans un langage managé puisque le garbage collector est seul maitre de la mémoire. Ainsi, si votre dll prends un pointeur sur un tableau de caractère (un buffer alloué qu&#8217;il va remplir et que vous souhaitez par la suite manipuler), vous devez trouver une solution pour faire passer votre tableau C# pour un pointeur sur un tableau de char. Plusieurs solutions existent, celle-ci a le mérite de ne pas à utiliser la clause <code>unsafe</code>.</p>
<p>Il s&#8217;agit de <a href="http://fr.wikipedia.org/wiki/Marshalling">marshalling</a> ou sérialisation binaire. On prends un tableau de <code>byte</code> csharp, et on le transmet comme un pointeur sur un tableau non managé. Le code est plutôt simple d&#8217;accès, quelques explication en dessous :</p>
<p><span id="more-174"></span></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Runtime.InteropServices</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> Test
<span style="color: #008000;">&#123;</span>
    <span style="color: #6666cc; font-weight: bold;">class</span> Program
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 BUFF_SIZE <span style="color: #008000;">=</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;library.dll&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> Int32 foo<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">LPArray</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> buffer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Int32   len<span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>  buffer <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span>BUFF_SIZE<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span>     i<span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span>  str<span style="color: #008000;">;</span>
&nbsp;
            len <span style="color: #008000;">=</span> foo<span style="color: #008000;">&#40;</span>buffer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> len<span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                str <span style="color: #008000;">+=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToChar</span><span style="color: #008000;">&#40;</span>buffer<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Concrètement, la ligne qui nous interresse est :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> Int32 foo<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">LPArray</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> buffer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Elle signifit que vous allez sérialiser votre tableau de <code>byte</code> en pointeur sur un tableau non-managé. Le prototype de votre methode <code>foo()</code> dans la dll serait ici :</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">        <span style="color: #993333;">long</span> foo<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dailytechfix.net/2009/08/26/manipuler-les-buffers-dune-librairie-non-managee-en-csharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 2.150 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-07 03:56:07 -->
<!-- Compression = gzip -->
