<?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>piouPiouM&#039;s dev&#187; Archives de la catégorie Snippets &#8211; piouPiouM&#039;s dev</title>
	<atom:link href="http://pioupioum.fr/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://pioupioum.fr</link>
	<description>Bloc-note d&#039;un développeur web</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:47:44 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TextMate&#160;: commande &#8220;Export words&#8221;</title>
		<link>http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html</link>
		<comments>http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html#comments</comments>
		<pubDate>Sun, 16 May 2010 14:30:47 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[licence MIT]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=380</guid>
		<description><![CDATA[À l&#8217;intérieur du code source d&#8217;une classe PHP, je souhaite stocker dans un tableau la liste des mots de la version populaire de l&#8217;incontournable texte Lorem ipsum. Jusque là rien de bien sorcier. Mais pour des raisons de lisibilité et de conventions de codage je veux obtenir des lignes formées par un maximum de 72 [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>À l&#8217;intérieur du code source d&#8217;une classe PHP, je souhaite stocker dans un tableau la liste des mots de la version populaire de l&#8217;incontournable texte <em><a href="http://fr.wikipedia.org/wiki/Faux-texte#Lorem_ipsum_.28version_populaire.29" title="Faux-texte - Wikipédia">Lorem ipsum</a></em>. Jusque là rien de bien sorcier. Mais pour des raisons de lisibilité et de conventions de codage je veux obtenir des lignes formées par un maximum de 72 caractères.</p>

<p>Certes je peux <em>m&#8217;amuser</em> à le faire à la main, mais pourquoi me fatiguer quand un langage de script tel que <strong>PHP</strong> me tend la main pour automatiser la procédure&#160;? Et, cerise sur le gâteau, si en plus je peux l&#8217;intégrer à mon éditeur préféré, <a href="http://pioupioum.fr/tag/textmate/" title="Archives pour le tag TextMate – piouPiouM&#039;s dev">TextMate</a>.</p>

<p><div id="attachment_386" class="wp-caption aligncenter" style="width: 458px"><a href="http://assets1.pioupioum.fr/uploads/2010/05/export-words.png"><img src="http://assets1.pioupioum.fr/uploads/2010/05/export-words-448x350.png" alt="Exemple d&#039;action de la commande TextMate Export words" title="TextMate Export words" width="448" height="350" class="size-medium wp-image-386" /></a><p class="wp-caption-text">Exemple d&#8217;action de la commande TextMate Export words</p></div><span id="more-380"></span></p>

<h2>Intégration dans Textmate</h2>

<ol>
<li>Allez dans le menu <span lang="en">Bundles</span> > <span lang="en">Bundle Editor</span> > <span lang="en">Show Bundle Editor</span> puis créez une nouvelle commande à l&#8217;aide de l&#8217;action <span lang="en">New Command</span>.</li>
<li>Donnez à la commande le nom <span lang="en">Export words</span>.</li>
<li>Veillez à ce que <span lang="en">Save</span> soit défini à <span lang="en">Nothing</span>.</li>
<li>Sélectionnez pour <span lang="en">Input</span> les options <span lang="en">Selected Text or Nothing</span>.</li>
<li>Placez <span lang="en">Output</span> à <span lang="en">Replace Selected Text</span>.</li>
<li>Choisissez une <span lang="en">Activation</span> de type <span lang="en">Key Equivalent</span> et définnez un raccourci. J&#8217;ai opté pour la séquence <kbd>⌥⇧W</kbd>.</li>
<li>Laissez vide le champ <span lang="en">Scope Selector</span> afin de pouvoir jouir de la commande depuis n&#8217;importe quel type de fichier et scope.</li>
<li>Enfin, copiez-collez le code ci-dessous dans le champ <span lang="en">Command(s)</span>.</li>
</ol>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">#!/usr/bin/env php -n
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * Export a wrapped representation of the words of a text.
 *
 * Optional parameters in a line that follows the text:
 *      l&lt;size&gt;. The column width. Default: 72.
 *      s&lt;characters&gt;. Characters to remove. Default: punctuation.
 *      o&lt;asc|desc&gt;. Sort order. Default: none.
 */</span>
<span style="color: #666666; font-style: italic;">/*
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2010 Mehdi Kabab &lt;http://pioupioum.fr/&gt;
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the &quot;Software&quot;), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# ***** END LICENSE BLOCK ***** */</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">version_compare</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">PHP_VERSION</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'5.0.0'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'You must have PHP &gt;= 5.0.0!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$lenght</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">72</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// the default column width.</span>
<span style="color: #000088;">$strip</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'\p{P}'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// removes the ponctuation</span>
<span style="color: #000088;">$sort</span>   <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// no sorting</span>
&nbsp;
<span style="color: #000088;">$raw</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php://filter/read=string.tolower/resource=php://stdin'</span><span style="color: #339933;">,</span>
            FILE_IGNORE_NEW_LINES <span style="color: #339933;">|</span> FILE_SKIP_EMPTY_LINES<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$raw</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_pop</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#^(?:\s{0,}(?:l(?&lt;lenght&gt;\d+)|s(?&lt;strip&gt;.*)|o(?&lt;sort&gt;asc|desc))\s{0,})+$#u'</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lenght'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lenght'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$lenght</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lenght'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strip'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strip'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$strip</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'|'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strip'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sort'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sort'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$sort</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sort'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$raw</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$raw</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Removes punctuation and user characters</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$strip</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$strip</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$strip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$raw</span>   <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$strip</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">')#u'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Estimating indent</span>
<span style="color: #000088;">$start_index</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_INPUT_START_LINE_INDEX'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$start_index</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_INPUT_START_LINE_INDEX'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YES'</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_SOFT_TABS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tab</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tab</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$tab_count</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$start_index</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$extra_spaces</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$start_index</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tabs</span>         <span style="color: #339933;">=</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tab</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tab_count</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extra_spaces</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tabs_len</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$tab_count</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_TAB_SIZE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$extra_spaces</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Extracting words now!</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#\s+#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$raw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trim'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_filter</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_unique</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// removes empty fields</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$sort</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">natsort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$sort</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_reverse</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%s\'%s\''</span><span style="color: #339933;">,</span>
                 <span style="color: #000088;">$tabs</span><span style="color: #339933;">,</span>
                 <span style="color: #990000;">wordwrap</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;', '&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lenght</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$tabs_len</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #006699; font-weight: bold;">$tabs</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #000088;">$start_index</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$words</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;''&quot;</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$words</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$words</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<h2>Utilisation de la commande TextMate <strong>Export words</strong></h2>

<p>Sélectionnez le texte à transformer. La transformation du texte se contrôle en ajoutant à la suite une ligne d&#8217;arguments <strong>optionnels</strong>&#160;:</p>

<ul>
<li><strong><code>l&lt;size&gt;</code></strong>. Ajuster la longueur de ligne. Exemple&#160;: <code>l80</code> pour effectuer une coupure à la colonne 80. Défaut&#160;: 72.</li>
<li><strong><code>s&lt;characters&gt;</code></strong>. Exemple&#160;: <code>slorem|ipsum</code> pour exclure les mots <em>lorem</em> et <em>ipsum</em>. Défaut&#160;: toute ponctuation.</li>
<li><strong><code>o&lt;asc|desc&gt;</code></strong>. Trier la sortie selon les ordres <code>asc</code>endant et <code>desc</code>endant. Défaut&#160;: aucun tri n&#8217;est réalisé.</li>
</ul>

<p>Notez que si votre sélection est précédée par une indentation, alors le script va appliquer cette dernière à chacune des lignes générées en se conformant aux options courantes de TextMate&#160;: il générera des espaces si le mode <span lang="en">Soft Tabs</span> est activé. Sinon des tabulations complétées d&#8217;éventuels espaces.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html' title='Bundle License Helper pour TextMate'>Bundle License Helper pour TextMate</a></li><li><a href='http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html' title='TextMate : convertir une couleur hexadécimale en notation RGBA'>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li><li><a href='http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html' title='PHP : fonction uncamel() pour inverser une notation en CamelCase'>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</a></li><li><a href='http://pioupioum.fr/developpement/javascript-array-intersection.html' title='JavaScript : optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles'>JavaScript&#160;: optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles</a></li></ul>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP&#160;: installer APC sous Mac OS X Leopard</title>
		<link>http://pioupioum.fr/snippets/php-installer-apc-macosx.html</link>
		<comments>http://pioupioum.fr/snippets/php-installer-apc-macosx.html#comments</comments>
		<pubDate>Thu, 06 May 2010 18:47:30 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[APC]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=376</guid>
		<description><![CDATA[Sous Mac OS X Leopard, l&#8217;installation du système de cache APC via PECL est en carton. Pour faire simple, l&#8217;extension n&#8217;est disponible que pour la version CLI de PHP.

Il est cependant possible d&#8217;y remédier1 et ainsi disposer d&#8217;APC avec la configuration de base fourni par Apple.

Récupérer la dernière version d&#8217;APC

$ curl http://pecl.php.net/get/APC -o ~/Downloads/APC-latest.tgz
$ tar [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Sous Mac OS X Leopard, l&#8217;installation du système de cache <a href="http://php.net/manual/fr/book.apc.php" title="PHP: APC - Manual">APC</a> <em>via</em> <a href="http://pecl.php.net/" title="PECL :: The PHP Extension Community Library">PECL</a> est en carton. Pour faire simple, l&#8217;extension n&#8217;est disponible que pour la version CLI de PHP.</p>

<p>Il est cependant possible d&#8217;y remédier<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> et ainsi disposer d&#8217;<strong>APC</strong> avec la configuration de base fourni par Apple.</p>

<h2>Récupérer la dernière version d&#8217;APC</h2>

<pre>$ curl http://pecl.php.net/get/APC -o ~/Downloads/APC-latest.tgz
$ tar -zxf !$ -C ~/Downloads/
$ cd ~/Downloads/APC-3.1.3p1/</pre>

<p>La version utilisée ici est la 3.1.3p1.</p>

<h2>Préparer l&#8217;environnement de compilation</h2>

<pre>$ /usr/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519</pre>

<p><span id="more-376"></span></p>

<h2>Lancer la compilation</h2>

<p>Copier-coller dans la commande qui suit dans son intégralité. Attention à ne pas inclure de retours à la ligne.</p>

<pre>MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure</pre>

<p>Puis un coup de <code>make</code>&#160;:</p>

<pre>$ make
...
----------------------------------------------------------------------
Libraries have been installed in:
   /Users/mehdi/Downloads/APC-3.1.3p1/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.</pre>

<p>Et pour finir, on installe l&#8217;extension APC.</p>

<pre>$ sudo make install
Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20060613/</pre>

<h2>Activer l&#8217;extension APC pour PHP</h2>

<p>Éditer le fichier <code>php.ini</code> pour ajouter la configuration qui suit&#160;:</p>


<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">extension</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> apc.so</span>
apc.enabled <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span>
apc.enable_cli <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span>
apc.mmap_file_mask <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /tmp/apc.XXXXXX</span>
apc.num_files_hint <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1024</span>
apc.shm_segments <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span>
apc.shm_size <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 128</span>
apc.ttl <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 7200</span>
apc.user_ttl <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 7200</span></pre></div></div>


<p>Relancer Apache pour qu&#8217;il prenne en compte la nouvelle extension.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li><li><a href='http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html' title='PHP : fonction uncamel() pour inverser une notation en CamelCase'>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</a></li><li><a href='http://pioupioum.fr/snippets/apache-rotation-logs.html' title='Rotation des logs Apache'>Rotation des logs Apache</a></li><li><a href='http://pioupioum.fr/snippets/convertir-icone-icns-png.html' title='Convertir une icône ICNS en une image PNG'>Convertir une icône ICNS en une image PNG</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>Source&#160;: <a href="http://discussions.apple.com/thread.jspa?threadID=1578979" title="Apple - Support - Discussions - Entropy php5 with GD support and APC ...">Forum du support Apple</a>.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/php-installer-apc-macosx.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP&#160;: convertir un DATETIME en un timestamp UNIX</title>
		<link>http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html</link>
		<comments>http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html#comments</comments>
		<pubDate>Tue, 09 Mar 2010 23:28:01 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[convertir]]></category>
		<category><![CDATA[licence MIT]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=346</guid>
		<description><![CDATA[Mise à jour à 10:57
Plus simple, rapide, intégré, toussa&#160;: utiliser strtotime tout simplement.
Merci à Éric Daspet et à Oncle Tom pour le rappel.

Une fonction utilitaire1 pour convertir une chaîne de type DATETIME ou DATE en un timestamp UNIX.
Les formats pris en charges en entrée sont AAAA-MM-JJ HH:MM:SS et AA-MM-JJ HH:MM:SS. L&#8217;heure étant optionnelle dans le [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Mise à jour à 10:57</strong><br />
Plus simple, rapide, intégré, toussa&#160;: utiliser <a href="http://php.net/manual/fr/function.strtotime.php">strtotime</a> tout simplement.<br />
Merci à <a href="http://twitter.com/edasfr/status/10264669320" title="réaction sur twitter">Éric Daspet</a> et à <a href="http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html#comment-1187" title="réaction dans les commentaires">Oncle Tom</a> pour le rappel.</p>

<p>Une fonction utilitaire<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> pour convertir une chaîne de type <strong>DATETIME</strong> ou <strong>DATE</strong> en un <strong>timestamp UNIX</strong>.<br />
Les formats pris en charges en entrée sont <code>AAAA-MM-JJ HH:MM:SS</code> et <code>AA-MM-JJ HH:MM:SS</code>. L&#8217;heure étant optionnelle dans le cas de la conversion d&#8217;une date.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * Get UNIX timestamp for a date or date time.
 *
 * Example:
 * &lt;code&gt;
 * &lt;?php
 * unix_timestamp('2010-03-09 22:43:46'); # 1268171026
 * unix_timestamp('10-03-09 22:43:46');   # 1268171026
 * unix_timestamp('2010-03-09');          # 1268089200
 * ?&gt;
 * &lt;/code&gt;
 *
 * @author    Mehdi Kabab &lt;http://pioupioum.fr/&gt;
 * @copyright 2010 Mehdi Kabab
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 * @link      http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html
 *
 * @param string The date or datetime to convert.
 * @return int The UNIX timestamp corresponding to the datetime.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> unix_timestamp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$c</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$c</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">array_pad</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">array_walk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'intval'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html' title='PHP : fonction uncamel() pour inverser une notation en CamelCase'>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</a></li><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li><li><a href='http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html' title='TextMate : convertir une couleur hexadécimale en notation RGBA'>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</a></li><li><a href='http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html' title='Bundle License Helper pour TextMate'>Bundle License Helper pour TextMate</a></li><li><a href='http://pioupioum.fr/developpement/javascript-array-intersection.html' title='JavaScript : optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles'>JavaScript&#160;: optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>vous allez dire qu&#8217;il en existe pléthore, mais je les trouve toutes trop lourdes (conditions, strlen, multiples explode, etc) pour le peu à faire. Sans parler du fait qu&#8217;elles ne supportent uniquement que le format DATETIME.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Bash&#160;: convertir un string en entier</title>
		<link>http://pioupioum.fr/snippets/bash-convertir-string-to-integer.html</link>
		<comments>http://pioupioum.fr/snippets/bash-convertir-string-to-integer.html#comments</comments>
		<pubDate>Sat, 06 Mar 2010 19:06:25 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[convertir]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=340</guid>
		<description><![CDATA[Bash n&#8217;offre pas de fonction pour convertir une chaîne de caractères ou un nombre flottant en un entier.
Cela n&#8217;est toute fois pas impossible, il suffit de faire appel à printf1 et le tour est joué&#160;!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# string_to_int.sh - Shell script to convert a string or float number
# to an integer.
&#160;
function string_to_int &#40;&#41;
&#123;
    [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><a href="http://fr.wikipedia.org/wiki/Bourne-Again_shell" title="Bourne-Again shell - Wikipédia">Bash</a> n&#8217;offre pas de fonction pour convertir une chaîne de caractères ou un nombre flottant en un entier.<br />
Cela n&#8217;est toute fois pas impossible, il suffit de faire appel à <code>printf</code><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> et le tour est joué&#160;!</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/env bash</span>
<span style="color: #666666; font-style: italic;"># string_to_int.sh - Shell script to convert a string or float number</span>
<span style="color: #666666; font-style: italic;"># to an integer.</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> string_to_int <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>
    <span style="color: #007800;">LANG</span>=C
    <span style="color: #007800;">d</span>=<span style="color: #800000;">${1##*.}</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${#1}</span> <span style="color: #660033;">-eq</span> <span style="color: #800000;">${#d}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">d</span>=<span style="color: #000000;">0</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #007800;">e</span>=<span style="color: #800000;">${1%.*}</span>
    <span style="color: #007800;">e</span>=<span style="color: #800000;">${e//,/}</span>
    <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #000000; font-weight: bold;">%</span>.0f <span style="color: #ff0000;">&quot;<span style="color: #007800;">$e</span>.<span style="color: #007800;">$d</span>&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">not_int</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;12.652&quot;</span> <span style="color: #ff0000;">&quot;-12.652&quot;</span> <span style="color: #000000;">12.652</span> <span style="color: #000000;">14</span> <span style="color: #ff0000;">&quot;12,652&quot;</span> foo <span style="color: #ff0000;">&quot;1,254.8&quot;</span> <span style="color: #000000;">1</span>,<span style="color: #000000;">254.8</span> <span style="color: #ff0000;">&quot;125,160,254.8&quot;</span> <span style="color: #ff0000;">&quot;125,160,254&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> value <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${not_int[@]}</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Convert <span style="color: #007800;">$value</span> to int: <span style="color: #007800;">$(string_to_int $value)</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>


<p>Ce qui nous donne&#160;:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>string_to_int.sh 
Convert <span style="color: #000000;">12.652</span> to int: <span style="color: #000000;">13</span>
Convert -<span style="color: #000000;">12.652</span> to int: <span style="color: #660033;">-13</span>
Convert <span style="color: #000000;">12.652</span> to int: <span style="color: #000000;">13</span>
Convert <span style="color: #000000;">14</span> to int: <span style="color: #000000;">14</span>
Convert <span style="color: #000000;">12</span>,<span style="color: #000000;">652</span> to int: <span style="color: #000000;">12652</span>
Convert foo to int: <span style="color: #000000;">0</span>
Convert <span style="color: #000000;">1</span>,<span style="color: #000000;">254.8</span> to int: <span style="color: #000000;">1255</span>
Convert <span style="color: #000000;">1</span>,<span style="color: #000000;">254.8</span> to int: <span style="color: #000000;">1255</span>
Convert <span style="color: #000000;">125</span>,<span style="color: #000000;">160</span>,<span style="color: #000000;">254.8</span> to int: <span style="color: #000000;">125160255</span>
Convert <span style="color: #000000;">125</span>,<span style="color: #000000;">160</span>,<span style="color: #000000;">254</span> to int: <span style="color: #000000;">125160254</span></pre></div></div>


<p>Voir <a href="http://gist.github.com/324313">sur Github</a>.</p>

<p><strong>Mis à jour le 7 mars 2010</strong><br />
Prise en charge de la notation US. Merci à <a href="http://pioupioum.fr/snippets/bash-convertir-string-to-integer.html#comment-1159">patpro</a>.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html' title='TextMate : convertir une couleur hexadécimale en notation RGBA'>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li><li><a href='http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html' title='PHP : fonction uncamel() pour inverser une notation en CamelCase'>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</a></li><li><a href='http://pioupioum.fr/snippets/convertir-icone-icns-png.html' title='Convertir une icône ICNS en une image PNG'>Convertir une icône ICNS en une image PNG</a></li><li><a href='http://pioupioum.fr/snippets/leopard-rechercher-nom-reel-utilisateur.html' title='Rechercher le nom réel d&#8217;un utilisateur sous Leopard'>Rechercher le nom réel d&#8217;un utilisateur sous Leopard</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>une substitution du séparateur des décimals <code>.</code> en <code>,</code> est nécessaire avant de faire appel à <code>printf</code>.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/bash-convertir-string-to-integer.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</title>
		<link>http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html</link>
		<comments>http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html#comments</comments>
		<pubDate>Sun, 28 Feb 2010 18:17:12 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[convertir]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[licence MIT]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=336</guid>
		<description><![CDATA[Une fonction PHP utilitaire pour convertir une chaîne en notation CamelCase en mots réunis par un séparateur (par défaut, le caractère underscore _).

La fonction uncamel() supporte indifféremment, en entrée, les notations lowerCamelCase et UpperCamelCase.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
&#60;?php
/**
 * Reverse a CamelCase string.
 *
 * Examples:
 *     uncamel('lowerCamelCase') === 'lower_camel_case'
 *     [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Une fonction <strong><a href="http://fr.wikipedia.org/wiki/PHP" title="PHP: Hypertext Preprocessor - Wikipédia">PHP</a></strong> utilitaire pour convertir une chaîne en notation <strong><a href="http://fr.wikipedia.org/wiki/CamelCase" title="CamelCase - Wikipédia">CamelCase</a></strong> en mots réunis par un séparateur (par défaut, le caractère <em>underscore</em> <code>_</code>).</p>

<p>La fonction <strong><code>uncamel()</code></strong> supporte indifféremment, en entrée, les notations <strong>lowerCamelCase</strong> et <strong>UpperCamelCase</strong>.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * Reverse a CamelCase string.
 *
 * Examples:
 *     uncamel('lowerCamelCase') === 'lower_camel_case'
 *     uncamel('UpperCamelCase') === 'upper_camel_case'
 *     uncamel('ThisIsAString') === 'this_is_a_string'
 *     uncamel('notcamelcase') === 'notcamelcase'
 *     uncamel('lowerCamelCase', ' | ') === 'lower | camel | case'
 *
 * @author    Mehdi Kabab &lt;http://pioupioum.fr/&gt;
 * @copyright 2010 Mehdi Kabab
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 * @link      http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html
 *
 * @param  string $content The CamelCase string.
 * @param  string $separator The glue for the compound words. Defaults to '_'.
 * @return string
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> uncamel<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$separator</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'_'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#(?&lt;=[a-zA-Z])([A-Z])(?=[a-zA-Z])#e'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;'<span style="color: #006699; font-weight: bold;">$separator</span>' . strtolower('<span style="color: #006699; font-weight: bold;">$1</span>')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$content</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


<p>Le <a href="http://gist.github.com/317702" title="gist: 317702 -  GitHub">forker (gist)</a>.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li><li><a href='http://pioupioum.fr/outils-astuces/textmate-convertir-couleur-hexadecimale-html-rgba.html' title='TextMate : convertir une couleur hexadécimale en notation RGBA'>TextMate&#160;: convertir une couleur hexadécimale en notation RGBA</a></li><li><a href='http://pioupioum.fr/outils-astuces/license-helper-textmate-bundle.html' title='Bundle License Helper pour TextMate'>Bundle License Helper pour TextMate</a></li><li><a href='http://pioupioum.fr/developpement/javascript-array-intersection.html' title='JavaScript : optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles'>JavaScript&#160;: optimiser le calcul de l&#8217;intersection de tableaux de grandes tailles</a></li></ul>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>WordPress&#160;: autoriser l&#8217;upload de fichiers au format non-supporté</title>
		<link>http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html</link>
		<comments>http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 14:50:30 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=316</guid>
		<description><![CDATA[WordPress ne supporte en upload qu&#8217;une liste exhaustive de formats de fichiers. Si comme moi vous souhaitez uploader1 des fichiers issus de TextMate, comme les .tmCommand et autres .tmSnippet, ajoutez le code qui suit dans le fichier functions.php de votre thème2.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
&#60;?php
// Add the new filter
add_filter&#40;'upload_mimes', 'addUploadMimes'&#41;;
&#160;
/**
 * Adds new supported media types for upload.
 *
 [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>WordPress ne supporte en upload qu&#8217;une liste exhaustive de formats de fichiers. Si comme moi vous souhaitez uploader<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> des fichiers issus de <a href="http://macromates.com/" title="TextMate — The Missing Editor for Mac OS X">TextMate</a>, comme les <code>.tmCommand</code> et autres <code>.tmSnippet</code>, ajoutez le code qui suit dans le fichier <code>functions.php</code> de votre thème<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td 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;">// Add the new filter</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_mimes'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'addUploadMimes'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Adds new supported media types for upload.
 *
 * @see wp_check_filetype() or get_allowed_mime_types()
 * @param array $mimes Array of mime types keyed by the file extension regex corresponding to those types.
 * @return array
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> addUploadMimes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$mimes</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$mimes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mimes</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span>
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$mimes</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


<p>Indiquez en clé les nouvelles extensions de fichier (séparées par des <em>pipes</em>) et en valeur le type mime associé.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/outils-astuces/wordpress-recuperation-avancee-images-article.html' title='WordPress : récupération avancée des images d&#8217;un article'>WordPress&#160;: récupération avancée des images d&#8217;un article</a></li><li><a href='http://pioupioum.fr/outils-astuces/afficher-images-article-page-media.html' title='WordPress : lister les images d&#8217;un article sur une page media'>WordPress&#160;: lister les images d&#8217;un article sur une page media</a></li><li><a href='http://pioupioum.fr/developpement/optimiser-rapidite-chargement-adsense-jquery.html' title='Optimiser le chargement des AdSense'>Optimiser le chargement des AdSense</a></li><li><a href='http://pioupioum.fr/snippets/apache-rotation-logs.html' title='Rotation des logs Apache'>Rotation des logs Apache</a></li><li><a href='http://pioupioum.fr/plugins-wordpress/wordpress-jquery-ui-effects.html' title='WordPress jQuery UI Effects'>WordPress jQuery UI Effects</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>sous Mac OS X tout du moins, <a href="http://swfupload.org/" title="SWFUpload News | SWFUpload">SWFUpload</a> me désactive la sélection des fichiers de TextMate m&#8217;obligeant à passer par l&#8217;interface d&#8217;upload native du navigateur. Je suis preneur de toute solution.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>à choisir, l&#8217;ajouter dans un plugin serait plus judicieux puisque cette fonctionnalité ne dépend pas du thème.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git ignore pour un projet Flex Builder</title>
		<link>http://pioupioum.fr/snippets/git-ignore-projet-flex-builder.html</link>
		<comments>http://pioupioum.fr/snippets/git-ignore-projet-flex-builder.html#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:57:41 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=311</guid>
		<description><![CDATA[Contenu type d&#8217;un fichier .gitignore pour un projet Flex Builder&#160;:

bin-debug
html-template
.actionScriptProperties
.flexProperties
.project
.settings
.DS_Store


Continuez votre lecture sur des sujets similaires

Git&#160;: des alias pour aller plus viteGit&#160;: 10 commandes utiles
]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Contenu type d&#8217;un fichier <code>.gitignore</code> pour un projet <strong>Flex Builder</strong>&#160;:</p>

<pre><code>bin-debug
html-template
.actionScriptProperties
.flexProperties
.project
.settings
.DS_Store
</code></pre>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/developpement/git-alias-productivite.html' title='Git : des alias pour aller plus vite'>Git&#160;: des alias pour aller plus vite</a></li><li><a href='http://pioupioum.fr/developpement/git-10-commandes-utiles.html' title='Git : 10 commandes utiles'>Git&#160;: 10 commandes utiles</a></li></ul>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/git-ignore-projet-flex-builder.html/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rotation des logs Apache</title>
		<link>http://pioupioum.fr/snippets/apache-rotation-logs.html</link>
		<comments>http://pioupioum.fr/snippets/apache-rotation-logs.html#comments</comments>
		<pubDate>Wed, 20 Jan 2010 09:14:46 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=306</guid>
		<description><![CDATA[Effectuer une rotation de ses logs Apache chaque semaine à l&#8217;aide de rotatelogs&#160;:

CustomLog "&#124;/usr/sbin/rotatelogs /var/log/www/mondomaine.tld/mondomaine.tld-access_log 604800" "combined"


Notez le pipe au début d&#8217;argument qui permet la redirection du logfile vers rotatelogs.
Merci à patpro pour l&#8217;astuce.

Continuez votre lecture sur des sujets similaires

PHP&#160;: installer APC sous Mac OS X LeopardOptimiser le chargement des AdSenseWordPress&#160;: autoriser l&#8217;upload de fichiers [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Effectuer une <strong>rotation de ses logs Apache</strong> chaque semaine à l&#8217;aide de <strong><a href="http://httpd.apache.org/docs/2.0/programs/rotatelogs.html" title="rotatelogs - Piped logging program to rotate Apache logs - Apache HTTP Server">rotatelogs</a></strong>&#160;:</p>

<pre><code>CustomLog "|/usr/sbin/rotatelogs /var/log/www/mondomaine.tld/mondomaine.tld-access_log 604800" "combined"
</code></pre>

<p>Notez le <em>pipe</em> au début d&#8217;argument qui permet la redirection du logfile vers rotatelogs.<br />
Merci à <a href="http://www.patpro.net/" title="Je pensais qu'il était avec vous... | patpro.net">patpro</a> pour l&#8217;astuce.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/snippets/php-installer-apc-macosx.html' title='PHP : installer APC sous Mac OS X Leopard'>PHP&#160;: installer APC sous Mac OS X Leopard</a></li><li><a href='http://pioupioum.fr/developpement/optimiser-rapidite-chargement-adsense-jquery.html' title='Optimiser le chargement des AdSense'>Optimiser le chargement des AdSense</a></li><li><a href='http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html' title='WordPress : autoriser l&#8217;upload de fichiers au format non-supporté'>WordPress&#160;: autoriser l&#8217;upload de fichiers au format non-supporté</a></li><li><a href='http://pioupioum.fr/developpement/git-alias-productivite.html' title='Git : des alias pour aller plus vite'>Git&#160;: des alias pour aller plus vite</a></li><li><a href='http://pioupioum.fr/developpement/git-10-commandes-utiles.html' title='Git : 10 commandes utiles'>Git&#160;: 10 commandes utiles</a></li></ul>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/apache-rotation-logs.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convertir une icône ICNS en une image PNG</title>
		<link>http://pioupioum.fr/snippets/convertir-icone-icns-png.html</link>
		<comments>http://pioupioum.fr/snippets/convertir-icone-icns-png.html#comments</comments>
		<pubDate>Mon, 14 Dec 2009 21:01:57 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[icônes]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[outil]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=268</guid>
		<description><![CDATA[Il m&#8217;a récemment1 fallu convertir une icône mac au format ICNS2 en une image au format  PNG. C&#8217;est ainsi que l&#8217;outil méconnu sips disponible dès Mac OS X 10.3&#160;m&#8217;est venu en aide o/


sips -s format png -s formatOptions best -Z 64 /chemin/vers/icone.icns --out /chemin/vers/icone-64.png


Petites explications&#160;:


-s format png pour spécifier le format de sortie PNG.
-s [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Il m&#8217;a récemment<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> fallu convertir une icône <strong>mac</strong> au format <strong><a href="http://en.wikipedia.org/wiki/Apple_Icon_Image" title="Apple Icon Image - Wikipedia, the free encyclopedia">ICNS</a></strong><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> en une image au format  <strong><a href="http://fr.wikipedia.org/wiki/Portable_Network_Graphics" title="Portable Network Graphics - Wikipédia">PNG</a></strong>. C&#8217;est ainsi que l&#8217;outil méconnu <a href="http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html" title="Mac OS X Manual Page For sips(1)">sips</a> disponible dès Mac OS X 10.3&#160;m&#8217;est venu en aide o/</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sips <span style="color: #660033;">-s</span> format png <span style="color: #660033;">-s</span> formatOptions best <span style="color: #660033;">-Z</span> <span style="color: #000000;">64</span> <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>vers<span style="color: #000000; font-weight: bold;">/</span>icone.icns <span style="color: #660033;">--out</span> <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>vers<span style="color: #000000; font-weight: bold;">/</span>icone-64.png</pre></div></div>


<p>Petites explications&#160;:</p>

<ul>
<li><code>-s format png</code> pour spécifier le format de sortie PNG.</li>
<li><code>-s formatOptions best</code> permet d&#8217;obtenir la meilleure qualité d&#8217;image bitmap.</li>
<li><code>-Z 64</code> sert à préciser les dimensions maximales du fichier de destination. Ici, l&#8217;icône .icns sera convertie en un .png de 64px de côtés.</li>
</ul>

<p>Comme vous pourrez le lire dans le man de l&#8217;outil <code>sips</code>, ce dernier supporte en sortie les formats  jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sgi et tga.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/snippets/leopard-rechercher-nom-reel-utilisateur.html' title='Rechercher le nom réel d&#8217;un utilisateur sous Leopard'>Rechercher le nom réel d&#8217;un utilisateur sous Leopard</a></li><li><a href='http://pioupioum.fr/snippets/php-installer-apc-macosx.html' title='PHP : installer APC sous Mac OS X Leopard'>PHP&#160;: installer APC sous Mac OS X Leopard</a></li><li><a href='http://pioupioum.fr/snippets/bash-convertir-string-to-integer.html' title='Bash : convertir un string en entier'>Bash&#160;: convertir un string en entier</a></li><li><a href='http://pioupioum.fr/outils-astuces/wordpress-recuperation-avancee-images-article.html' title='WordPress : récupération avancée des images d&#8217;un article'>WordPress&#160;: récupération avancée des images d&#8217;un article</a></li><li><a href='http://pioupioum.fr/outils-astuces/textmate-css-selection-unicode.html' title='TextMate : bundle CSS, commande &quot;Convertir la sélection en Unicode&quot;'>TextMate&#160;: bundle CSS, commande &quot;Convertir la sélection en Unicode&quot;</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>enfin c&#8217;est vite dit, cela fait maintenant plusieurs mois mais l&#8217;idée de noter la commande ici n&#8217;est venu que récemment =]&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>si l&#8217;icône se trouve être celle d&#8217;une application, vous la trouverez généralement dans le répertoire <code>Application.app/Contents/Resources/</code>.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/convertir-icone-icns-png.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP&#160;: valider qu&#8217;une URL pointe sur un domaine donné</title>
		<link>http://pioupioum.fr/snippets/php-valider-url-domaine.html</link>
		<comments>http://pioupioum.fr/snippets/php-valider-url-domaine.html#comments</comments>
		<pubDate>Sat, 05 Sep 2009 23:35:41 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[URL]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=236</guid>
		<description><![CDATA[Voici une petite fonction PHP pour vérifier qu&#8217;une URL pointe bien sur un domaine donné.

On valide dans un premier temps, via filter_var1, le format de l&#8217;URL. Cette dernière doit notamment être accompagné d&#8217;un protocole. La récupération de l&#8217;hôte depuis l&#8217;URL se fait très simplement avec la fonction parse_url. Enfin, on s&#8217;assure que le domaine cible [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Voici une petite fonction PHP pour vérifier qu&#8217;une <abbr title="Uniform Resource Locator">URL</abbr> pointe bien sur un domaine donné.</p>

<p>On valide dans un premier temps, <em>via</em> <a href="http://www.php.net/manual/fr/function.filter-var.php" title="PHP: filter_var - Manual">filter_var</a><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>, le format de l&#8217;<abbr title="Uniform Resource Locator">URL</abbr>. Cette dernière doit notamment être accompagné d&#8217;un protocole. La récupération de l&#8217;hôte depuis l&#8217;<abbr title="Uniform Resource Locator">URL</abbr> se fait très simplement avec la fonction <a href="http://www.php.net/manual/fr/function.parse-url.php" title="PHP: parse_url - Manual">parse_url</a>. Enfin, on s&#8217;assure que le domaine cible est bien le domaine principal de l&#8217;hôte.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Checks a URL belongs to a given domain.
 *
 * @param string $url The URL to test.
 * @param string $domain The target domain.
 * @return boolean
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> isDomainOf<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">===</span> <span style="color: #990000;">filter_var</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> FILTER_VALIDATE_URL<span style="color: #339933;">,</span> FILTER_FLAG_HOST_REQUIRED<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #990000;">parse_url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> PHP_URL_HOST<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$host</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>boolean<span style="color: #009900;">&#41;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#^(?:[^\.]*\.){0,}'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$domain</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'$#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$host</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<p><span id="more-236"></span></p>

<h2>Suite de tests</h2>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$test</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Le domaine testé lui même.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://example.com'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un domaine différent.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://www.pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un sous-domaine.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://foo.bar.pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un double sous-domaine.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'bar.pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://foo.bar.pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Le dommaine cible contient un sous-domaine.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://assets1.pioupioum.fr/foo/bar.png'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un contenu hébergé sur un sous-domaine.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://www.example.com/foo/bar.png'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un contenu hébergé sur un domaine différent.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://fakepioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un domaine proche.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://www.fakepioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Un domaine proche avec un sous-domaine.'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'domain'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'pioupioum.fr'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'synopsis'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Aucun protocol n\'étant spécifié, la fonction filter_var invalide le test.'</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$test</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$ok</span> <span style="color: #339933;">=</span> isDomainOf<span style="color: #009900;">&#40;</span><span style="color: #000088;">$test</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$test</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'domain'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%s</span><span style="color: #000099; font-weight: bold;">\n</span>[<span style="color: #009933; font-weight: bold;">%s</span>] L'URL <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #009933; font-weight: bold;">%s</span><span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #009933; font-weight: bold;">%s</span> sur le domaine <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #009933; font-weight: bold;">%s</span><span style="color: #000099; font-weight: bold;">\&quot;</span>.<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #000088;">$test</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'synopsis'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ok</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'SUCCESS'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'FAIL'</span><span style="color: #339933;">,</span>
        <span style="color: #000088;">$test</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ok</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'pointe bien'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'ne pointe pas'</span><span style="color: #339933;">,</span>
        <span style="color: #000088;">$test</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'domain'</span><span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<p>Qui nous donne l&#8217;affichage suivant&#160;:</p>


<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">Le domaine testé lui même.
[SUCCESS] L'URL &quot;http://pioupioum.fr&quot; pointe bien sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Un domaine différent.
[FAIL] L'URL &quot;http://example.com&quot; ne pointe pas sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Un sous-domaine.
[SUCCESS] L'URL &quot;http://www.pioupioum.fr&quot; pointe bien sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Un double sous-domaine.
[SUCCESS] L'URL &quot;http://foo.bar.pioupioum.fr&quot; pointe bien sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Le dommaine cible contient un sous-domaine.
[SUCCESS] L'URL &quot;http://foo.bar.pioupioum.fr&quot; pointe bien sur le domaine &quot;bar.pioupioum.fr&quot;.
&nbsp;
Un contenu hébergé sur un sous-domaine.
[SUCCESS] L'URL &quot;http://assets1.pioupioum.fr/foo/bar.png&quot; pointe bien sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Un contenu hébergé sur un domaine différent.
[FAIL] L'URL &quot;http://www.example.com/foo/bar.png&quot; ne pointe pas sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Un domaine proche.
[FAIL] L'URL &quot;http://fakepioupioum.fr&quot; ne pointe pas sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Un domaine proche avec un sous-domaine.
[FAIL] L'URL &quot;http://www.fakepioupioum.fr&quot; ne pointe pas sur le domaine &quot;pioupioum.fr&quot;.
&nbsp;
Aucun protocol n'étant spécifié, la fonction filter_var invalide le test.
[FAIL] L'URL &quot;pioupioum.fr&quot; ne pointe pas sur le domaine &quot;pioupioum.fr&quot;.</pre></div></div>


<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/developpement/jslint-console-rhino.html' title='Une console JSLint pour aider vos validations JavaScript'>Une console JSLint pour aider vos validations JavaScript</a></li><li><a href='http://pioupioum.fr/snippets/textmate-commande-exporter-mots-word-wrap.html' title='TextMate : commande &laquo;&nbsp;Export words&nbsp;&raquo;'>TextMate&#160;: commande &laquo;&nbsp;Export words&nbsp;&raquo;</a></li><li><a href='http://pioupioum.fr/snippets/php-installer-apc-macosx.html' title='PHP : installer APC sous Mac OS X Leopard'>PHP&#160;: installer APC sous Mac OS X Leopard</a></li><li><a href='http://pioupioum.fr/snippets/php-convertir-datetime-unix-timestamp.html' title='PHP : convertir un DATETIME en un timestamp UNIX'>PHP&#160;: convertir un DATETIME en un timestamp UNIX</a></li><li><a href='http://pioupioum.fr/snippets/php-uncamel-fonction-convertir-camel-case.html' title='PHP : fonction uncamel() pour inverser une notation en CamelCase'>PHP&#160;: fonction uncamel() pour inverser une notation en CamelCase</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>la fonction requiers au minimum PHP 5.2.0.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/php-valider-url-domaine.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
