<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>iTx Technologies » Blogue</title>
	
	<link>http://itx-technologies.com</link>
	<description>Programmation et intégration Web à Montréal</description>
	<lastBuildDate>Mon, 14 May 2012 20:31:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BlogueItxMontreal" /><feedburner:info uri="blogueitxmontreal" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>45.523236</geo:lat><geo:long>-73.556063</geo:long><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><image><link>http://itx-technologies.com/blog/</link><url>http://itx-technologies.com/site/</url><title>iTx Technologies</title></image><item>
		<title>Sugar CRM : faire un appel SOAP</title>
		<link>http://feedproxy.google.com/~r/BlogueItxMontreal/~3/1cIzxnn0MR0/3360-sugar-crm-faire-un-appel-soap-php-avance</link>
		<comments>http://itx-technologies.com/blog/3360-sugar-crm-faire-un-appel-soap-php-avance#comments</comments>
		<pubDate>Tue, 24 Apr 2012 20:02:58 +0000</pubDate>
		<dc:creator>Jean-Vivien</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[SugarCRM]]></category>
		<category><![CDATA[php orienté objet]]></category>
		<category><![CDATA[soap]]></category>

		<guid isPermaLink="false">http://itx-technologies.com/?p=3360</guid>
		<description><![CDATA[Lors de vos échanges entre applications il est utile de charger l&#8217;environnement de Sugar CRM pour utiliser son API et gagner du temps de développement. Voici quelques étapes pour créer une instance de Sugar CRM depuis n&#8217;importe quel script php et vérifier l&#8217;existence d&#8217;un contact dans la base de données par exemple. Pré-requis : Avoir [...]]]></description>
			<content:encoded><![CDATA[<p>Lors de vos échanges entre applications il est utile de charger l&#8217;environnement de Sugar CRM pour utiliser son API et gagner du temps de développement.<br />
Voici quelques étapes pour créer une instance de Sugar CRM depuis n&#8217;importe quel script php et vérifier l&#8217;existence d&#8217;un contact dans la base de données par exemple.</p>
<h3>Pré-requis :</h3>
<ul>
<li>Avoir une application Sugar CRM déployée et paramétrée sur le serveur</li>
<li>Connaître les notions de base de la programmation PHP orientée objet</li>
</ul>
<h3>Etape 1 : Créer une instance PHP de Sugar CRM</h3>
<p>La première étape est de rendre disponible les fonctionnalités de Sugar. Nous allons stocker les objets Sugar de base (Client, Proxy, Session) dans des variables php.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./Sugar/include/nusoap/nusoap.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//librairie SOAP de sugar crm</span>
<span style="color: #000088;">$soapclient</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> nusoapclient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.monserveur.com/Sugar/soap.php?wsdl'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//création d'une instance Sugar</span>
<span style="color: #000088;">$soapproxy</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soapclient</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProxy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$soapsession</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soapclient</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">call</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_auth'</span><span style="color: #339933;">=&gt;</span>array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_name'</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'monidentifiant'</span><span style="color: #339933;">,</span>
   <span style="color: #0000ff;">'password'</span><span style="color: #339933;">=&gt;</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'monmotdepasse'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'version'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'.01'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'application_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'SoapSugar'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$soapsessionid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soapsession</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Dans ce script j&#8217;attire surtout votre attention sur deux points :</p>
<ul>
<li>l&#8217;instance &#8216;soapclient&#8217; utilise l&#8217;url du site plutôt que le chemin d&#8217;accès au script sur le serveur</li>
<li>le mot de passe indiqué pour créer la session Sugar CRM doit être converti en <strong>MD5</strong></li>
</ul>
<h3>Etape 2 : Vérifier l&#8217;existence d&#8217;un contact Sugar CRM à partir de son adresse email</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'sos@itx-technologies.com'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Contacts.id in (SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON
   (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 and ea.email_address = &quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$email</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;)'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$orderby</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Contacts.id DESC'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soapproxy</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_entry_list</span><span style="color: #009900;">&#40;</span>
<span style="color: #000088;">$soapsessionid</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Contacts'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orderby</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//offset</span>
   <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//champs retournés dans la réponse</span>
   <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//nombre maximum de résultat retournés</span>
   <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #666666; font-style: italic;">//deleted</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$account_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'entry_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Dans cette deuxième étape, nous utilisons directement une des fonctions de l&#8217;API Sugar, <strong>get_entry_list</strong>. Vous remarquerez que nous lui passons en paramètre l&#8217;identifiant de la session en cours pour confirmer que nous sommes autorisés à utiliser l&#8217;application Sugar ainsi qu&#8217;une partie de la requête SQL qui permet de faire la jointure entre le module Contacts et les adresses mail stockées dans la table &laquo;&nbsp;<em>email_adresses</em>&laquo;&nbsp;.</p>
<p>Finalement, la variable <strong>$account_id</strong> a une valeur à NULL ou bien une clé id si au moins un contact a été trouvé.</p>
<p>Ce premier exemple de SOAP vous permettra de confirmer que tout fonctionne correctement et que votre environnement Sugar CRM est bien rappatrié dans l&#8217;objet. Vous pourrez alors construire une classe dédiée au SOAP avec une initialisation des objets Client, Proxy et Session dans le constructeur et des fonctions dédiées de manipulation des données de Sugar. Faites nous part de vos essais !</p>
]]></content:encoded>
			<wfw:commentRss>http://itx-technologies.com/blog/3360-sugar-crm-faire-un-appel-soap-php-avance/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://itx-technologies.com/blog/3360-sugar-crm-faire-un-appel-soap-php-avance</feedburner:origLink></item>
		<item>
		<title>Créer une pagination sous WordPress</title>
		<link>http://feedproxy.google.com/~r/BlogueItxMontreal/~3/nchghblXWG0/3345-creer-une-pagination-sous-wordpress</link>
		<comments>http://itx-technologies.com/blog/3345-creer-une-pagination-sous-wordpress#comments</comments>
		<pubDate>Fri, 17 Feb 2012 13:51:41 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[thème]]></category>
		<category><![CDATA[trucs et astuces]]></category>

		<guid isPermaLink="false">http://itx-technologies.com/?p=3345</guid>
		<description><![CDATA[Rien de plus simple que ça ! Toutefois, il existe encore plusieurs plugins qui font la même chose même si WordPress possède une fonction juste pour ça : &#60;?php // Tiré de codex.wordpress.org global $wp_query; &#160; $big = 999999999; // need an unlikely integer &#160; echo paginate_links&#40; array&#40; 'base' =&#62; str_replace&#40; $big, '%#%', get_pagenum_link&#40; $big [...]]]></description>
			<content:encoded><![CDATA[<p>Rien de plus simple que ça ! Toutefois, il existe encore plusieurs plugins qui font la même chose même si WordPress possède une fonction juste pour ça :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Tiré de codex.wordpress.org</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$big</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">999999999</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// need an unlikely integer</span>
&nbsp;
<span style="color: #b1b100;">echo</span> paginate_links<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'base'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$big</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%#%'</span><span style="color: #339933;">,</span> get_pagenum_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$big</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'format'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'?paged=%#%'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'current'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'total'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">max_num_pages</span>
<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Copiez ce code dans le fichier index.php, archives.php, search.php ou peu importe là où vous voulez avoir une pagination !</p>
]]></content:encoded>
			<wfw:commentRss>http://itx-technologies.com/blog/3345-creer-une-pagination-sous-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://itx-technologies.com/blog/3345-creer-une-pagination-sous-wordpress</feedburner:origLink></item>
		<item>
		<title>Désactiver les rétroliens vers son propre site WordPress</title>
		<link>http://feedproxy.google.com/~r/BlogueItxMontreal/~3/kT090CS-E-0/3282-desactiver-les-retroliens-vers-son-propre-site-wordpress</link>
		<comments>http://itx-technologies.com/blog/3282-desactiver-les-retroliens-vers-son-propre-site-wordpress#comments</comments>
		<pubDate>Fri, 10 Feb 2012 19:38:12 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[didacticiel]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[rétroliens]]></category>

		<guid isPermaLink="false">http://itx-technologies.com/?p=3282</guid>
		<description><![CDATA[Un rétrolien, c&#8217;est une façon d&#8217;envoyer un ping à un autre blogue pour lui faire signe que vous parlez du même sujet ou que vous l&#8217;avez cité dans votre article. Le ping se fait automatiquement sous WordPress : vous n&#8217;avez qu&#8217;à faire un lien vers un autre site, et celui-ci recevra un ping sous forme [...]]]></description>
			<content:encoded><![CDATA[<p>Un rétrolien, c&#8217;est une façon d&#8217;envoyer un <em>ping</em> à un autre blogue pour lui faire signe que vous parlez du même sujet ou que vous l&#8217;avez cité dans votre article.  Le ping se fait automatiquement sous WordPress : vous n&#8217;avez qu&#8217;à faire un lien vers un autre site, et celui-ci recevra un <em>ping</em> sous forme de commentaire automatisé.</p>
<p>Mais à quoi bon s&#8217;<em>auto-pinger</em> ?  Lorsque vous faites un lien vers un article de votre propre blogue, WordPress ne fait pas la distinction entre votre site ou un autre, alors il créera un commentaire sous l&#8217;article vers lequel vous avez fait un lien, comme si c&#8217;était un autre site qui venait de vous envoyer un rétrolien.</p>
<h3>Comment désactiver les <em>auto-rétroliens</em></h3>
<p>Il suffit d&#8217;écrire une fonction dans votre fichier functions.php et de <em>hooker</em> cette fonction à l&#8217;action <em>pre_ping</em> qui est exécutée juste avant que WordPress ne génère les pings.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Désactiver les rétroliens vers son propre site</span>
<span style="color: #000000; font-weight: bold;">function</span> mes_retroliens<span style="color: #009900;">&#40;</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$liens</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$home</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'home'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$liens</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$l</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$lien</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">===</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$lien</span><span style="color: #339933;">,</span> <span style="color: #000088;">$home</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$liens</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'pre_ping'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mes_retroliens'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>La fonction, <a href="http://wordpress.org/support/topic/feature-removal-request-self-pingbacks">écrite par un membre des forums de WordPress</a>, va <em>parser</em> le ou les liens de votre articles, et si elle découvre qu&#8217;un de ces liens possède l&#8217;URL de votre site, elle ne la comptera pas dans les rétroliens à faire.</p>
]]></content:encoded>
			<wfw:commentRss>http://itx-technologies.com/blog/3282-desactiver-les-retroliens-vers-son-propre-site-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://itx-technologies.com/blog/3282-desactiver-les-retroliens-vers-son-propre-site-wordpress</feedburner:origLink></item>
		<item>
		<title>Afficher seulement les noms des fichiers avec la commande grep</title>
		<link>http://feedproxy.google.com/~r/BlogueItxMontreal/~3/WOwQky8vCGI/3276-afficher-seulement-les-noms-des-fichiers-avec-la-commande-grep</link>
		<comments>http://itx-technologies.com/blog/3276-afficher-seulement-les-noms-des-fichiers-avec-la-commande-grep#comments</comments>
		<pubDate>Thu, 09 Feb 2012 19:15:53 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[commande]]></category>
		<category><![CDATA[grep]]></category>

		<guid isPermaLink="false">http://itx-technologies.com/?p=3276</guid>
		<description><![CDATA[Je vous ai souvent parlé de la commande grep, cette commande qui m&#8217;a sauvé la vie Ô combien de fois ! Pour les non-initiés, la commande grep, exécutée dans un terminal Linux, sert à rechercher une expression donnée à l&#8217;intérieur d&#8217;un ou de plusieurs fichiers. Exemple Cela dit, lorsque vous exécutez une commande, par exemple [...]]]></description>
			<content:encoded><![CDATA[<p>Je vous ai <a href="http://itx-technologies.com/blog/1521-5-exemples-avec-la-commande-grep-sur-linux" title="5 exemples avec la commande grep sur Linux">souvent parlé</a> de la <a href="http://itx-technologies.com/man-linux/grep-egrep-fgrep-afficher-les-lignes-correspondant-a-un-motif-donne" title="grep, egrep, fgrep – Afficher les lignes correspondant à un motif donné">commande grep</a>, cette  commande qui m&#8217;a sauvé la vie Ô combien de fois !</p>
<p>Pour les non-initiés, la commande grep, exécutée dans un terminal Linux, sert à rechercher une expression donnée à l&#8217;intérieur d&#8217;un ou de plusieurs fichiers.</p>
<h3>Exemple</h3>
<p>Cela dit, lorsque vous exécutez une commande, par exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-R</span> include wp-content<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

<p>le résultat de la commande, qui cherche l&#8217;expression &laquo;&nbsp;include&nbsp;&raquo; dans tous les fichiers du dossier, et sous-dossiers, de <em>wp-content</em>, donnera quelque chose du genre :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-R</span> include wp-content<span style="color: #000000; font-weight: bold;">/*</span>
plugins<span style="color: #000000; font-weight: bold;">/</span>akismet:    <span style="color: #007800;">odeValue</span>=trimAndGetNodeText<span style="color: #7a0874; font-weight: bold;">&#40;</span>table.config,node<span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">if</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>table.config.debug<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>log<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Checking if value was empty on row:'</span>+rowIndex<span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">keepLooking</span>=<span style="color: #c20cb9; font-weight: bold;">false</span>;<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">for</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>var <span style="color: #007800;">i</span>=<span style="color: #000000;">1</span>;i<span style="color: #000000; font-weight: bold;">&lt;</span>l;i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">if</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>parsers<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>.is<span style="color: #7a0874; font-weight: bold;">&#40;</span>nodeValue,table,node<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">return</span> parsers<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">return</span> include<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">function</span> getNodeFromRowAndCellIndex<span style="color: #7a0874; font-weight: bold;">&#40;</span>rows,rowIndex,cellIndex<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">return</span> rows<span style="color: #7a0874; font-weight: bold;">&#91;</span>rowIndex<span style="color: #7a0874; font-weight: bold;">&#93;</span>.cells<span style="color: #7a0874; font-weight: bold;">&#91;</span>cellIndex<span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">function</span> trimAndGetNodeText<span style="color: #7a0874; font-weight: bold;">&#40;</span>config,node<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">return</span> $.trim<span style="color: #7a0874; font-weight: bold;">&#40;</span>getElementText<span style="color: #7a0874; font-weight: bold;">&#40;</span>config,node<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">function</span> getParserById<span style="color: #7a0874; font-weight: bold;">&#40;</span>name<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>var <span style="color: #007800;">l</span>=parsers.length;<span style="color: #000000; font-weight: bold;">for</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>var <span style="color: #007800;">i</span>=<span style="color: #000000;">0</span>;i<span style="color: #000000; font-weight: bold;">&lt;</span>l;i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">if</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>parsers<span style="color: #7a0874; font-weight: bold;">&#91;</span>i<span style="color: #7a0874; font-weight: bold;">&#93;</span>.id.toLowerCase<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>==name.toLowe
themes<span style="color: #000000; font-weight: bold;">/</span>twentyten:   :<span style="color: #000000; font-weight: bold;">function</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>var <span style="color: #007800;">parsers</span>=<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>,<span style="color: #007800;">widgets</span>=<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;this.include=<span style="color: #7a0874; font-weight: bold;">&#123;</span>cssHeader:<span style="color: #ff0000;">&quot;header&quot;</span>,cssAsc:<span style="color: #ff0000;">&quot;headerSortUp&quot;</span>,cssDesc:<span style="color: #ff0000;">&quot;headerSortDown&quot;</span>,cssChildRow:<span style="color: #ff0000;">&quot;expand-child&quot;</span>,sortInitialOrder:<span style="color: #ff0000;">&quot;asc&quot;</span>,sortMultiSortKey:<span style="color: #ff0000;">&quot;shiftKey&quot;</span>,sortForce:null,sortAppend:null,sortLocaleCompare:<span style="color: #c20cb9; font-weight: bold;">true</span>,textExtraction:<span style="color: #ff0000;">&quot;simple&quot;</span>,parse</pre></div></div>

<p>En fait, c&#8217;est que la commande renvoit la ligne de code, dans le fichier, où l&#8217;expression (en l&#8217;occurrence <em>include</em>) a été trouvée.  Le gros désavantage c&#8217;est que votre terminal est rempli de lignes de code et cela devient très difficile à lire lorsque vous avez des centaines de résultats à votre requête.</p>
<h3>La commande qui vous faut</h3>
<p>C&#8217;est simple : il vous suffit simplement d&#8217;ajouter l&#8217;option -l (grep -l) pour que seulement le nom du fichier sera affiché.  Dans notre exemple, cela deviendrait :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-lR</span> include wp-content<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

<p>Ah, que c&#8217;est beau Linux !</p>
]]></content:encoded>
			<wfw:commentRss>http://itx-technologies.com/blog/3276-afficher-seulement-les-noms-des-fichiers-avec-la-commande-grep/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://itx-technologies.com/blog/3276-afficher-seulement-les-noms-des-fichiers-avec-la-commande-grep</feedburner:origLink></item>
		<item>
		<title>Faire un JOIN deux fois sur la même table avec MySQL</title>
		<link>http://feedproxy.google.com/~r/BlogueItxMontreal/~3/y8ueqdnxwcM/3269-faire-un-join-deux-fois-sur-la-meme-table-avec-mysql</link>
		<comments>http://itx-technologies.com/blog/3269-faire-un-join-deux-fois-sur-la-meme-table-avec-mysql#comments</comments>
		<pubDate>Wed, 08 Feb 2012 20:24:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[commande]]></category>
		<category><![CDATA[JOIN]]></category>

		<guid isPermaLink="false">http://itx-technologies.com/?p=3269</guid>
		<description><![CDATA[Bon, je sais, ça peut sembler très pointu comme tuto mais c&#8217;est que nous nous faisons un devoir de publier sur des sujets qui nous ont fait galérer alors voici pourquoi. Pour ceux qui tomberont sur ce petit didactiel très simple savent très bien ce dont je parle : nous pouvons faire un JOIN avec une table [...]]]></description>
			<content:encoded><![CDATA[<p>Bon, je sais, ça peut sembler très pointu comme tuto mais c&#8217;est que nous nous faisons un devoir de publier sur des sujets qui nous ont fait galérer alors voici pourquoi.</p>
<p>Pour ceux qui tomberont sur ce petit didactiel très simple savent très bien ce dont je parle : nous pouvons faire un JOIN avec une table mais nous ne pouvons pas le faire 2 fois avec la même table !</p>
<p>Pour ce faire, il faut utiliser des synonymes :</p>
<h3>Exemple</h3>
<p>Prenons la table &laquo;&nbsp;articles&nbsp;&raquo; avec les champs id, titre, cree_par_id, modifie_par_id.  Nous voulons créer une requête en la joignant avec la table &laquo;&nbsp;utilisateurs&nbsp;&raquo; qui possède les champs id, nom. Nous voulons avoir :</p>
<p>titre de l&#8217;article, créer par (nom), modifié par (nom)</p>
<p>Les champs cree_par_id et modifier_par_id comprennent les ID des utilisateurs mais nous voulons leur nom alors il faudra faire 2 fois le JOIN :</p>
<p>JOIN #1 : articles.cree_par_id et utilisateurs.id<br />
JOIN #2 : articles.modifie_par_id et utilisateurs.id</p>
<h3>La requête</h3>
<p>Alors, ce qu&#8217;il faut faire, c&#8217;est donner un synonyme à la table &laquo;&nbsp;articles&nbsp;&raquo; car autrement, l&#8217;engin MySQL ne nous laissera pas faire 2 JOIN.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> a1<span style="color: #66cc66;">.</span>titre<span style="color: #66cc66;">,</span> a1<span style="color: #66cc66;">.</span>cree_par_id<span style="color: #66cc66;">,</span> a2<span style="color: #66cc66;">.</span>modifie_par_id
&nbsp;
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> articles a1 
    <span style="color: #993333; font-weight: bold;">ON</span> utilisateur<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">=</span> a1<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`cree_par_id`</span>
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> articles a2 
    <span style="color: #993333; font-weight: bold;">ON</span> utilisateur<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">=</span> a2<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`modifie_par_id`</span></pre></div></div>

<p>Voilà, comme on peut voir, nous créons deux JOIN : la première fois avec la table a1 (premier synonyme de &laquo;&nbsp;articles&nbsp;&raquo;) et ensuite avec a2 (deuxième synonyme de &laquo;&nbsp;articles&nbsp;&raquo;).</p>
]]></content:encoded>
			<wfw:commentRss>http://itx-technologies.com/blog/3269-faire-un-join-deux-fois-sur-la-meme-table-avec-mysql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://itx-technologies.com/blog/3269-faire-un-join-deux-fois-sur-la-meme-table-avec-mysql</feedburner:origLink></item>
	</channel>
</rss>

