<?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>Sébastien Barbieri's blog</title>
	<atom:link href="http://blog.sbw.be/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sbw.be</link>
	<description>My life, my work, my projects</description>
	<lastBuildDate>Tue, 08 May 2012 10:06:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>XPdev hot seat at work experience learned</title>
		<link>http://blog.sbw.be/2012/05/08/xpdev-hot-seat-at-work-experience-learned/</link>
		<comments>http://blog.sbw.be/2012/05/08/xpdev-hot-seat-at-work-experience-learned/#comments</comments>
		<pubDate>Tue, 08 May 2012 10:06:30 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[freelance]]></category>
		<category><![CDATA[je bosse là]]></category>
		<category><![CDATA[OpenDojo]]></category>
		<category><![CDATA[dos and donts]]></category>
		<category><![CDATA[hot seat]]></category>
		<category><![CDATA[Tori]]></category>
		<category><![CDATA[Uke]]></category>
		<category><![CDATA[xp]]></category>
		<category><![CDATA[XPdev]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=568</guid>
		<description><![CDATA[I proposed new objectives to myself: Programming in XP (hot seat: 2 dev one computer) 1/2 day per week with another developer each week. Here is a summary of DOs and DONTs to keep in mind. Let&#8217;s say there are 2 guys: Tori: the executor (the guy who have the keyboard and explain what he [...]]]></description>
			<content:encoded><![CDATA[<p>I proposed new objectives to myself:<br />
Programming in XP (hot seat: 2 dev one computer) 1/2 day per week with another developer each week.<br />
Here is a summary of DOs and DONTs to keep in mind.</p>
<p>Let&#8217;s say there are 2 guys:</p>
<ul>
<li><strong>Tori</strong>: the executor (the guy who have the keyboard and explain what he does)</li>
<li><strong>Uke</strong>: the learner (the guy who look at the guy who have the keyboard and learn from what he does)</li>
</ul>
<table>
<tr>
<th width="50%">DO</th>
<th width="50%">DON&#8217;T</th>
</tr>
<tr>
<td>Explain the whole concept of XP hot seat, <strong>Tori</strong> &#038; <strong>Uke</strong> roles and plan it</td>
<td>Start without briefing, scheduled appointment</td>
</tr>
<tr>
<td>Predefine the scope 1 day before</td>
<td>start without plan</td>
</tr>
<tr>
<td>Master the concept of the scope</td>
<td>do a spike in XP as it request a lot of documentation reading</td>
</tr>
<tr>
<td>Read the documentation the day before</td>
<td>Drive blind</td>
</tr>
<tr>
<td>Use shortcuts, quick links, snippets, auto completion, syntax highlighting</td>
<td>Use notepad or similar way of development</td>
</tr>
<tr>
<td>Refine and reduce objective and scope while working</td>
<td>Enlarge the scope and work on more and more stuff</td>
</tr>
<tr>
<td>Let <strong>Tori</strong> explain what he is doing</td>
<td>Let <strong>Uke</strong> take the lead</td>
</tr>
<tr>
<td>Respect the time window of 15 minutes</td>
<td>Let <strong>Tori</strong> continue over 15 minutes</td>
</tr>
<tr>
<td>Stop and re-schedule, redefine scope when it fails (both get stuck by a lack of knowledge for instance)</td>
<td>Continue if it doesn&#8217;t work</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2012/05/08/xpdev-hot-seat-at-work-experience-learned/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading from ubuntu 11.10 to 12.04LTS</title>
		<link>http://blog.sbw.be/2012/04/28/upgrading-from-ubuntu-11-10-to-12-04lts/</link>
		<comments>http://blog.sbw.be/2012/04/28/upgrading-from-ubuntu-11-10-to-12-04lts/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 06:23:20 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[D'alpha du centaure]]></category>
		<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[12.04LTS]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=564</guid>
		<description><![CDATA[Same issue. In system settings: clicking on Network raise a popup with: The system network services are not compatible with this version&#8230; No network at all auto lo iface lo inet loopback Gasp. update 1 hour later Problem solved. Obviously the upgrade process crashed somewhere, I clicked the &#8220;Updates Available&#8230;&#8221; menu item from the top [...]]]></description>
			<content:encoded><![CDATA[<p>Same issue. In system settings: clicking on Network raise a popup with: The system network services are not compatible with this version&#8230;</p>
<p>No network at all</p>
<pre class="brush: bash; title: ; notranslate">
cat /etc/interfaces
</pre>
<pre>
auto lo
iface lo inet loopback
</pre>
<p>Gasp.</p>
<p>update 1 hour later</p>
<p>Problem solved.<br />
Obviously the upgrade process crashed somewhere, I clicked the &#8220;Updates Available&#8230;&#8221; menu item from the top right computer menu and ran a partial upgrade which finished successfully the 12.04 install and restarted the network.<br />
I guess the X server failed during the night waiting for me to click a dialog box. This morning the screen was dark and the pc was running, but with no answer from the keyboard I thought he hanged at the restart stage&#8230; but it was at the config stage somewhere.</p>
<p>Everything back to normal. Resuming normal activities.</p>
<p>end of transmission</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2012/04/28/upgrading-from-ubuntu-11-10-to-12-04lts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql 5.5.20 utf8 collation bug with implicit datetime casting</title>
		<link>http://blog.sbw.be/2012/04/27/mysql-5-5-20-utf8-collation-bug-with-implicit-datetime-casting/</link>
		<comments>http://blog.sbw.be/2012/04/27/mysql-5-5-20-utf8-collation-bug-with-implicit-datetime-casting/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 10:22:39 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[je bosse là]]></category>
		<category><![CDATA[OpenDojo]]></category>
		<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[casting]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=554</guid>
		<description><![CDATA[A very strange behavior detected in Mysql 5.5.20 maybe linked to some implicit cast/convert: The datetime is implicitly converted to the next day&#8230; it&#8217;s a morning bug, solved every afternoon and detectable thus only in the morning, probably an AM/PM error while working in 24h&#8230; That&#8217;s a really stupid bug that makes me waste half [...]]]></description>
			<content:encoded><![CDATA[<p>A very strange behavior detected in Mysql 5.5.20 maybe linked to some implicit cast/convert: The datetime is implicitly converted to the next day&#8230;</p>
<p>it&#8217;s a morning bug, solved every afternoon and detectable thus only in the morning, probably an AM/PM error while working in 24h&#8230; </p>
<p>That&#8217;s a really stupid bug that makes me waste half a day so I post it here, just in case someone has the same issue.</p>
<p>It did not exist in 5.1 and does not exist in MariaDB, so it&#8217;s probably something added by Oracle somewhere in between&#8230;</p>
<p>Here is the query with a between date, with the standard connection settings:</p>
<pre class="brush: sql; title: ; notranslate">
show variables like 'character%';
</pre>
<pre>
+--------------------------+---------------------------------------+
| Variable_name            | Value                                 |
+--------------------------+---------------------------------------+
| character_set_client     | latin1                                |
| character_set_connection | latin1                                |
| character_set_database   | utf8                                  |
| character_set_filesystem | binary                                |
| character_set_results    | latin1                                |
| character_set_server     | utf8                                  |
| character_set_system     | utf8                                  |
| character_sets_dir       | /opt/mysql/server-5.5/share/charsets/ |
+--------------------------+---------------------------------------+
</pre>
<pre class="brush: sql; title: ; notranslate">
SELECT *
FROM tableA A
WHERE (A.`end_date` &gt;= '2012-04-27T07:04:25+02:00')
AND (A.`start_date` &lt;= '2012-04-28T06:30:00+02:00' );
</pre>
<pre>
| id    | start_date          | end_date            |
| 42966 | 2012-04-27 19:50:00 | 2012-04-27 22:55:00 |
| 36883 | 2012-04-27 23:00:00 | 2012-04-27 23:50:00 |
</pre>
<p>Trying with the settings switched to utf8 still works.</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8;
SELECT *
FROM tableA A
WHERE (A.`end_date` &gt;= '2012-04-27T07:04:25+02:00')
AND (A.`start_date` &lt;= '2012-04-28T06:30:00+02:00' );
</pre>
<pre>
| id    | start_date          | end_date            |
| 42966 | 2012-04-27 19:50:00 | 2012-04-27 22:55:00 |
| 36883 | 2012-04-27 23:00:00 | 2012-04-27 23:50:00 |
</pre>
<p>And then, TADAAA the bug, with implicit casting while using the collate utf8_unicode_ci.</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8 COLLATE utf8_unicode_ci;
SELECT *
FROM tableA A
WHERE (A.`end_date` &gt;= '2012-04-27T07:04:25+02:00')
AND (A.`start_date` &lt;= '2012-04-28T06:30:00+02:00' );
</pre>
<pre>
| id    | start_date          | end_date            |
| 37093 | 2012-04-28 17:50:00 | 2012-04-28 20:00:00 |
| 31003 | 2012-04-28 19:55:00 | 2012-04-28 22:00:00 |
| 43181 | 2012-04-28 20:00:00 | 2012-04-28 22:59:00 |
| 43112 | 2012-04-28 22:45:00 | 2012-04-28 23:59:00 |
</pre>
<p>So let&#8217;s try with an explicit conversion&#8230; and it works.</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8 COLLATE utf8_unicode_ci;
SELECT *
FROM tableA A
WHERE (A.`end_date` &gt;= TIMESTAMP('2012-04-27T07:04:25+02:00'))
AND (A.`start_date` &lt;= TIMESTAMP('2012-04-28T06:30:00+02:00') );
</pre>
<pre>
| id    | start_date          | end_date            |
| 42966 | 2012-04-27 19:50:00 | 2012-04-27 22:55:00 |
| 36883 | 2012-04-27 23:00:00 | 2012-04-27 23:50:00 |
</pre>
<p>If anyone can spot the real bug and explain it to me&#8230; I&#8217;m listening.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2012/04/27/mysql-5-5-20-utf8-collation-bug-with-implicit-datetime-casting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTP xml POST in php with curl or with Zend</title>
		<link>http://blog.sbw.be/2012/04/23/http-xml-post-in-php-with-curl-or-with-zend/</link>
		<comments>http://blog.sbw.be/2012/04/23/http-xml-post-in-php-with-curl-or-with-zend/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 21:25:38 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=547</guid>
		<description><![CDATA[To test the code just launch a nc: and run your script from a browser or with php in command line. Here is the same code using Zend Framework.]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
&lt;?php

/**
 * Send xml via HTTP
 */

// Create XML

$xml = &lt;&lt;&lt;EOF
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;xmlsample&gt;
	&lt;title&gt;Test&lt;/title&gt;
	&lt;url&gt;http://www.example.org/&lt;/url&gt;
	&lt;!--
		This is a comment
	--&gt;
&lt;/xmlsample&gt;

EOF;

print(&quot;We will send this xml: \n$xml&quot;);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost:8080/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_USERAGENT, &quot;MyUserAgent/1.1&quot;);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if($result===false){
	print(&quot;Error: &quot;.curl_error($ch));
}else{
	print(&quot;Success&quot;);
}
curl_close($ch);
</pre>
<p>To test the code just launch a nc:</p>
<pre class="brush: bash; title: ; notranslate">
nc -l localhost 8080
</pre>
<p>and run your script from a browser or with php in command line.</p>
<p>Here is the same code using Zend Framework.</p>
<pre class="brush: php; title: ; notranslate">
require_once(&quot;Zend/Http/Client.php&quot;);
$client = new Zend_Http_Client('http://localhost:8080/upload.php');
$client -&gt; setAdapter(&quot;Zend_Http_Client_Adapter_Curl&quot;);
$client -&gt; setHeaders('User-Agent',&quot;MyUserAgent/1.1&quot;);
try{
	$client-&gt;setRawData($xml, 'text/xml')-&gt;request('POST');
}catch(Exception $e){
	print(&quot;Error: &quot;.var_export($e,true));
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2012/04/23/http-xml-post-in-php-with-curl-or-with-zend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql 5.5 problem with date using php PDO and &#8216;slashes&#8217; instead of &#8216;dashes&#8217;</title>
		<link>http://blog.sbw.be/2012/02/22/mysql-5-5-problem-with-date-php-pdo/</link>
		<comments>http://blog.sbw.be/2012/02/22/mysql-5-5-problem-with-date-php-pdo/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 13:14:02 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[pdo]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=534</guid>
		<description><![CDATA[While upgrading from mysql 5.1 to mysql 5.5 we found a strange issue. Consider the DB testdb and the TABLE test We have an issue with date and collate settings: For instance: This will return nothing but this will work We are still checking why&#8230; but at least we have a quick fix. A better [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mysql.com/"><img alt="" src="http://www.mysql.com/common/logos/logo-mysql-110x57.png" title="Mysql 5.5" class="alignright" width="110" height="57" /></a><br />
While upgrading from mysql 5.1 to mysql 5.5 we found a strange issue.</p>
<p>Consider the DB testdb and the TABLE test</p>
<pre class="brush: sql; title: ; notranslate">
CREATE TABLE IF NOT EXISTS `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_insert` datetime NOT NULL,
  KEY `index_date` (`date_insert`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
</pre>
<p>We have an issue with date and collate settings:</p>
<p>For instance: This will return nothing</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8 COLLATE utf8_unicode_ci;
SELECT COUNT(*) FROM testdb.test WHERE date_insert&amp;gt;'2012/02/01';
</pre>
<p>but this will work</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8 COLLATE utf8_general_ci;
SELECT COUNT(*) FROM testdb.test WHERE date_insert&amp;gt;'2012/02/01';
</pre>
<p>We are still checking why&#8230; but at least we have a quick fix.</p>
<p>A better fix is to use an ISO 8601 date:<br />
2012-02-22T00:00:00+01:00</p>
<p>This will work regardless of the COLLATE option</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8 COLLATE utf8_unicode_ci;
SELECT COUNT(*) FROM testdb.test WHERE date_insert&amp;gt;'2012-02-22T00:00:00+01:00';
</pre>
<p>A similar solution is to use &#8216;-&#8217; (dash) instead of &#8216;/&#8217; (slash) in all date:</p>
<pre class="brush: sql; title: ; notranslate">
SET NAMES utf8 COLLATE utf8_unicode_ci;
SELECT COUNT(*) FROM testdb.test WHERE date_insert&amp;gt;'2012-02-22';
</pre>
<p>That&#8217;s probably a better practice anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2012/02/22/mysql-5-5-problem-with-date-php-pdo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bière Ommegang</title>
		<link>http://blog.sbw.be/2011/12/24/biere-ommegang/</link>
		<comments>http://blog.sbw.be/2011/12/24/biere-ommegang/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 00:12:13 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[cuisine]]></category>
		<category><![CDATA[biere]]></category>
		<category><![CDATA[ommegang]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=518</guid>
		<description><![CDATA[Au début je n&#8217;y ai cru qu&#8217;a moitié. Puis j&#8217;ai oublié&#8230; Il y a quelques jours j&#8217;ai reçu un mail pour me dire que le brassin était pret et que dès que l&#8217;embouteillage aurait lieu, la bouteille serait envoyée. Là je me suis dit: &#8220;ça doit être une erreur, ils ont envoyé un mail à [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://lh3.googleusercontent.com/-7nJ9gGceZkM/TvUWi7KqUDI/AAAAAAAAKv0/LrGpwObFGzI/s800/IMG_1514.JPG"><img class="alignright" title="Ommegang biere" src="https://lh3.googleusercontent.com/-7nJ9gGceZkM/TvUWi7KqUDI/AAAAAAAAKv0/LrGpwObFGzI/s800/IMG_1514.JPG" alt="" width="192" height="374" /></a><br />
Au début je n&#8217;y ai cru qu&#8217;a moitié. Puis j&#8217;ai oublié&#8230;<br />
Il y a quelques jours j&#8217;ai reçu un mail pour me dire que le brassin était pret et que dès que l&#8217;embouteillage aurait lieu, la bouteille serait envoyée.<br />
Là je me suis dit: &#8220;ça doit être une erreur, ils ont envoyé un mail à tout le monde alors qu&#8217;ils ne ciblait que les acheteurs&#8221;.<br />
Mais, je dois me rendre à l&#8217;évidence, car c&#8217;est bien arrivé. Aujourd&#8217;hui j&#8217;ai été chercher au point poste ma bouteille d&#8217;Ommegang édition limitée.<br />
Waw&#8230; ça c&#8217;est du marketing!<br />
Pas de spam, un message pour dire que ça va arriver et puis le cadeau. Propre, simple efficace.<br />
Bon, il ne reste plus qu&#8217;à gouter.<br />
<a href="http://blog.sbw.be/wp-content/uploads/2011/12/IMG_1516.jpg"><img class="alignleft size-medium wp-image-520" title="ommegang close up" src="http://blog.sbw.be/wp-content/uploads/2011/12/IMG_1516-300x200.jpg" alt="" width="300" height="200" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2011/12/24/biere-ommegang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling XmlRpc of WordPress with Zend Framework (Zend_XmlRpc_Client) and adding the default thumbnail to a post</title>
		<link>http://blog.sbw.be/2011/07/19/calling-xmlrpc-of-wordpress-with-zend-framework-zend_xmlrpc_client-and-adding-the-default-thumbnail-to-a-post/</link>
		<comments>http://blog.sbw.be/2011/07/19/calling-xmlrpc-of-wordpress-with-zend-framework-zend_xmlrpc_client-and-adding-the-default-thumbnail-to-a-post/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 19:13:44 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[D'alpha du centaure]]></category>
		<category><![CDATA[OpenDojo]]></category>
		<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[metaWeblog.newMediaObjec]]></category>
		<category><![CDATA[metaWeblog.newPost]]></category>
		<category><![CDATA[Zend_XmlRpc_Client]]></category>
		<category><![CDATA[Zend_XmlRpc_Value_Base64]]></category>
		<category><![CDATA[Zend_XmlRpc_Value_Struct]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=504</guid>
		<description><![CDATA[This code is in 2 parts First part, we download an image somewhere using Zend_Http_Client Second part, we use xmlrpc to upload the image into wordpress as a media and to create a post using this media as featured image or default image of main thumbnail, whatever the name is Let&#8217;s have a look at [...]]]></description>
			<content:encoded><![CDATA[<p>This code is in 2 parts</p>
<p>First part, we download an image somewhere using Zend_Http_Client</p>
<p>Second part, we use xmlrpc to upload the image into wordpress as a media and to create a post using this media as featured image or default image of main thumbnail, whatever the name is</p>
<p>Let&#8217;s have a look at the first part:<br />
<strong>Downloading an image with Zend_Http_Client</strong><br />
this is quite simple</p>
<pre class="brush: php; title: ; notranslate">
				require_once 'Zend/Http/Client.php';
				$config=array(
					'adapter'=&gt;'Zend_Http_Client_Adapter_Curl'
				);
				$Zend_Http_Client = new Zend_Http_Client($imageUrl,$config);
				try{
					$result = $Zend_Http_Client-&gt;request('GET');
				}catch(Exception $e){
					print_r($e);
				}
				$data = $result-&gt;getBody();
				//file_put_contents('/tmp/test.jpg',$data); // this is just to test the image if you are unsure
</pre>
<p>second part, storing the image in wordpress and creating a post with custom field: <strong>_thumbnail_id</strong> set to this image</p>
<p>To store a media object we will use the <strong>metaWeblog.newMediaObject</strong> XmlRpc method</p>
<pre class="brush: php; title: ; notranslate">
				require_once 'Zend/XmlRpc/Client.php';
				require_once 'Zend/XmlRpc/Value/Base64.php';
				require_once 'Zend/XmlRpc/Value/Struct.php';
				require_once 'Zend/XmlRpc/Value/Array.php';
				$xmlRpcClient = new Zend_XmlRpc_Client('http://www.example.com/myblog/xmlrpc.php');
				try{
					$thumbnail = $xmlRpcClient-&gt;call(
						'metaWeblog.newMediaObject',
						array(0,
							'login',
							'pass',
							array(
								'name'=&gt;'test.jpg',
								'type'=&gt;'image/jpeg',
								'bits'=&gt;new Zend_XmlRpc_Value_Base64($data),
							)
						)
					);
// ...
</pre>
<p>in the thumbnail object we don&#8217;t get the id&#8230; because it&#8217;s not possible to get the id unless you hack wordpress</p>
<blockquote><p>
<strong>WP file</strong>: wp-include/class-wp-xml-rpc.php</p>
<p><strong>method</strong>: function mw_newMediaObject($args) {</p>
<p>modification: add the id in the return:</p>
<pre class="brush: php; title: ; notranslate">
return apply_filters(
	'wp_handle_upload',
	array( 'file' =&gt; $name, 'url' =&gt; $upload[ 'url' ], 'type' =&gt; $type )
	, 'upload'
	);
</pre>
<p>by:</p>
<pre class="brush: php; title: ; notranslate">
return apply_filters(
	'wp_handle_upload',
	array( 'file' =&gt; $name, 'url' =&gt; $upload[ 'url' ], 'type' =&gt; $type, 'id'=&gt;$id )
	, 'upload'
	);
</pre>
</blockquote>
<pre class="brush: php; title: ; notranslate">
// ...
		$struct = new Zend_XmlRpc_Value_Struct(
					array('key'=&gt;'_thumbnail_id', 'value'=&gt;$thumbnail['id'])
				);
		$result = $xmlRpcClient-&gt;call(
			'metaWeblog.newPost',
			array(0,
			'login',
			'pass',
			array(
				'post_type'=&gt;'post',
				'title'=&gt;'New article with thumb',
				'description'=&gt;'Article text',
				'custom_fields'=&gt;array($struct),
			),
			false)
		);
	}catch(Exception $e){
		print_r($e);
	}
</pre>
<p>Of course, this won&#8217;t work&#8230; because no one is allowed to access private custom_fields such as _thumbnail_id &#8230;</p>
<p>A second WP hack is necessary here:</p>
<p><strong>file</strong>: wp-includes/meta.php<br />
<strong>function</strong>: is_protected_meta</p>
<p>add an exception for _thumbnail_id</p>
<pre class="brush: php; title: ; notranslate">
function is_protected_meta( $meta_key, $meta_type = null ) {
        if($meta_key == '_thumbnail_id'){
                $protected=false;
        }else{
                $protected = (  '_' == $meta_key[0] );
        }
        return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
}
</pre>
<p>Without a nice documentation that was the best I could do in few time.</p>
<p>Another approach could be to create a new XmlRpc method, which do both in once avoiding the weakness of reusing an internal id in a second call, but still XmlRpc use add_meta which is a really ugly way to add meta in a post as everything has to be put in $_POST &#8230; </p>
<p>If anyone has a better approach (using xmlrpc) feel free to submit the suggestion.</p>
<p>A third approach could be to write a plugin&#8230; that&#8217;s next step</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2011/07/19/calling-xmlrpc-of-wordpress-with-zend-framework-zend_xmlrpc_client-and-adding-the-default-thumbnail-to-a-post/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>All the assumption I want to remember in PHP</title>
		<link>http://blog.sbw.be/2011/05/26/all-the-assumption-i-want-to-remember-about-php/</link>
		<comments>http://blog.sbw.be/2011/05/26/all-the-assumption-i-want-to-remember-about-php/#comments</comments>
		<pubDate>Thu, 26 May 2011 09:33:00 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[empty]]></category>
		<category><![CDATA[false]]></category>
		<category><![CDATA[NULL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=491</guid>
		<description><![CDATA[Probably linked to some alcohol I drank to young, I always forget some key assumption in PHP. NULL is NULL NULL is EMPTY NULL is FALSE NULL has a sizeof 0 BUT FALSE is not NULL FALSE is EMPTY FALSE is FALSE FALSE has a sizeof 1 AND empty ARRAY is not NULL empty ARRAY [...]]]></description>
			<content:encoded><![CDATA[<p>Probably linked to some alcohol I drank to young, I always forget some key assumption in PHP.</p>
<p>NULL is NULL<br />
NULL is EMPTY<br />
NULL is FALSE<br />
NULL has a sizeof 0</p>
<p><strong>BUT</strong></p>
<p>FALSE is not NULL<br />
FALSE is EMPTY<br />
FALSE is FALSE<br />
FALSE has a sizeof 1</p>
<p><strong>AND</strong></p>
<p>empty ARRAY is not NULL<br />
empty ARRAY is EMPTY<br />
empty ARRAY is FALSE<br />
empty ARRAY has a sizeof 0</p>
<pre class="brush: php; title: ; notranslate">
$test=NULL;
if(is_null($test)){print(&quot;NULL is NULL&quot;);}else{print(&quot;NULL is not NULL&quot;);}
// NULL is NULL
if(empty($test)){print(&quot;NULL is EMPTY&quot;);}else{print(&quot;NULL is not EMPTY&quot;);}
// NULL is empty
if($test){print(&quot;NULL is TRUE&quot;);}else{print(&quot;NULL is FALSE&quot;);}
// NULL is FALSE
print(count($test));
// 0
$test=false;
if(is_null($test)){print(&quot;FALSE is NULL&quot;);}else{print(&quot;FALSE is not NULL&quot;);}
// FALSE is not NULL
if(empty($test)){print(&quot;FALSE is EMPTY&quot;);}else{print(&quot;FALSE is not EMPTY&quot;);}
// FALSE is EMPTY
if($test){print(&quot;FALSE is TRUE&quot;);}else{print(&quot;FALSE is FALSE&quot;);}
// FALSE is FALSE
print(count($test));
// 1
$test=array();
if(is_null($test)){print(&quot;empty ARRAY is NULL&quot;);}else{print(&quot;empty ARRAY is not NULL&quot;);}
// empty ARRAY is not NULL
if(empty($test)){print(&quot;empty ARRAY is EMPTY&quot;);}else{print(&quot;empty ARRAY is not EMPTY&quot;);}
// empty ARRAY is EMPTY
if($test){print(&quot;empty ARRAY is TRUE&quot;);}else{print(&quot;empty ARRAY is FALSE&quot;);}
// empty ARRAY is FALSE
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2011/05/26/all-the-assumption-i-want-to-remember-about-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run 20km and give them water</title>
		<link>http://blog.sbw.be/2011/05/03/run-20km-and-give-them-water/</link>
		<comments>http://blog.sbw.be/2011/05/03/run-20km-and-give-them-water/#comments</comments>
		<pubDate>Tue, 03 May 2011 20:00:08 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Questions existentielles]]></category>
		<category><![CDATA[20km]]></category>
		<category><![CDATA[bruxelles]]></category>
		<category><![CDATA[croix-rouge]]></category>
		<category><![CDATA[dons]]></category>
		<category><![CDATA[rwanda]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=485</guid>
		<description><![CDATA[Avec 425 autres coureurs nous allons nous lancer dans la course afin de récolter 30 000 € pour le croix-rouge. Run and Give them water est un projet d&#8217;approvisionnement en eau potable au Rwanda Pour faire un don: suivez le lien: http://www.croix-rouge.be/20km/parrainage_don.htm et rajouter SEBASTIEN BARBIERI à la fin de la zone d&#8217;édition. 20 KM [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Run and Give them water" src="http://www.croix-rouge.be/20km/img/20km_logo_crb.png" title="Croix rouge run and give them water 20 km bruxelles" class="alignleft" width="350" height="199" />Avec 425 autres coureurs nous allons nous lancer dans la course afin de récolter 30 000 € pour le croix-rouge.</p>
<p><a href="http://www.croix-rouge.be/20km/">Run and Give them water</a> est un projet d&#8217;approvisionnement en eau potable au Rwanda</p>
<p>Pour faire un don: suivez le lien: <a href="http://www.croix-rouge.be/20km/parrainage_don.htm">http://www.croix-rouge.be/20km/parrainage_don.htm</a> et rajouter SEBASTIEN BARBIERI à la fin de la zone d&#8217;édition.</p>
<blockquote><p>20 KM PARRAINAGE &#8211; SEBASTIEN BARBIERI</p></blockquote>
<p>Ou faites un versemment au compte: 000-0000016-16 avec la mention &#8220;20 KM PARRAINAGE + SEBASTIEN BARBIERI&#8221;</p>
<p>Pour me parrainer vous pouvez décider par exemple de donner 50 cents/km, et pour chaque kilomètres que je parcours, vous versez 50 cents soit 10€ pour les 20km.</p>
<p>Je m&#8217;engage pour ma part à courir pour 5€/Km => 100€.</p>
<p>Soutenez-moi, par vos encouragement ou par un don.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2011/05/03/run-20km-and-give-them-water/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>baladodiffusion</title>
		<link>http://blog.sbw.be/2011/04/20/baladodiffusion/</link>
		<comments>http://blog.sbw.be/2011/04/20/baladodiffusion/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 12:08:26 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[8th chakra]]></category>
		<category><![CDATA[je bosse là]]></category>
		<category><![CDATA[Mon blog]]></category>
		<category><![CDATA[baladodiffusion]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=479</guid>
		<description><![CDATA[Adieu podcasts, bienvenue Baladodiffusion! Quel est le principe? La radio propose sur un site des liens vers des fichiers audio permettant de réécouter une émission radio de manière diférrée. Avantages Pouvoir écouter quand on veut et où l&#8217;on veut une émission. Bon mais c&#8217;est la même chose que le podcast jusque là. Alors quel est [...]]]></description>
			<content:encoded><![CDATA[<p>Adieu podcasts, bienvenue Baladodiffusion!</p>
<p><strong>Quel est le principe?</strong></p>
<p>La radio propose sur un site des liens vers des fichiers audio permettant de réécouter une émission radio de manière diférrée.</p>
<p><strong>Avantages</strong></p>
<p>Pouvoir écouter quand on veut et où l&#8217;on veut une émission.</p>
<p><strong>Bon mais c&#8217;est la même chose que le podcast jusque là. Alors quel est la différence ?</strong></p>
<p>La différence est déjà dans le mot BALADO-DIFFUSION, la diffusion en balade.<br />
<a href="http://fr.wiktionary.org/wiki/balade">Balade</a>: Selon le wiktionnaire: </p>
<blockquote><p><strong>Etymologie:</strong> Du verbe balader, lui-même venant de ballade (« poème chanté ») en raison des saltimbanques qui se déplaçaient sans destination particulière et qui chantaient des ballades pour demander l’aumône.</p></blockquote>
<p>C&#8217;est ici toute l&#8217;idée: Balade, poème chanté, déplacement, mobilité. A notre époque il s&#8217;agit de pouvoir se promener avec de la musique. Totalement différent de Podcast, qui n&#8217;est qu&#8217;un mot commercial contraction de iPod(R) et de broadcast ==> diffusion sur iPod&#8230;</p>
<p><strong>WTF?</strong></p>
<p>Oui, je sais&#8230;</p>
<p>Faites comme moi, adieu podcast, bienvenue baladodiffusion et m&#8230;. à l&#8217;envahisseur (Pomme (R) )</p>
<p>TAG: #baladodiffusion #jeBosseSurMusiq3 #vivelamusiqueclassique</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2011/04/20/baladodiffusion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

