<?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>{curlybracket} &#187; Tools</title>
	<atom:link href="http://curlybracket.net/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://curlybracket.net</link>
	<description>Development &#38; Design for digital media</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:56:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>todo.sh &#8211; powerful command line interface</title>
		<link>http://curlybracket.net/2011/10/19/todo-powerful-command-line-interface/</link>
		<comments>http://curlybracket.net/2011/10/19/todo-powerful-command-line-interface/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 10:37:01 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[version control]]></category>
		<category><![CDATA[work]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1936</guid>
		<description><![CDATA[To work consistently, I have always had todo lists &#8211; on paper, in files, on walls. However, the best tool for me as a person working with a computer most of the time, has always been a simple text file. &#8230; <a href="http://curlybracket.net/2011/10/19/todo-powerful-command-line-interface/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To work consistently, I have always had todo lists &#8211; on paper, in files, on walls.</p>
<p>However, the best tool for me as a person working with a computer most of the time, has always been a simple text file.<br />
Some months ago I discovered the great <a href="http://todotxt.com/">todo.txt project</a> by Gina Trapani, a developer from Italy.<br />
I have integrated her tool into my version control repository and this is what I want to share here with you today.</p>
<ol>
<li>Download the latest version of todo.txt and unpack it to a version control repository</li>
<li>chmod +x todo.sh</li>
<li>adapt the todo.cfg file to your needs, adding the path to your current version control repository</li>
<li>add a symlink to todo.sh in /usr/local/bin</li>
<li>add an alias in ~/.bashrc :<br />
alias todo=&#8217;/usr/local/bin/todo -d /home/rike/projects/versioncontrol/todo/todo.cfg&#8217;</li>
</ol>
<p>There you go.</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/10/19/todo-powerful-command-line-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessible and nice inputs with jQuery</title>
		<link>http://curlybracket.net/2011/09/18/accessible-and-nice-inputs-with-jquery/</link>
		<comments>http://curlybracket.net/2011/09/18/accessible-and-nice-inputs-with-jquery/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 21:33:08 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[UX]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1926</guid>
		<description><![CDATA[I like to have accessible code while enhancing user experience with jQuery. Suppose the following markup: &#60;label for="password" class="label"&#62;Type your password&#60;/label&#62; &#60;input type="text" id="password" name="password" /&#62; I would like to gain space by writing &#171;&#160;Type your password&#160;&#187; into the text &#8230; <a href="http://curlybracket.net/2011/09/18/accessible-and-nice-inputs-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I like to have accessible code while enhancing user experience with jQuery.</p>
<p>Suppose the following markup:</p>
<pre>&lt;label for="password" class="label"&gt;Type your password&lt;/label&gt;
&lt;input type="text" id="password" name="password" /&gt;</pre>
<p>I would like to gain space by writing &laquo;&nbsp;Type your password&nbsp;&raquo; into the text input. However this would create hassle for the user without Javascript: they would need to manually delete my indication.</p>
<p>I could propose this to a user with Javascript, by adding <em>onclick=&nbsp;&raquo;this.value=&nbsp;&raquo;;&nbsp;&raquo;</em> to the input. However, this alters the markup. And also, everytime they click outside of the input, then click again in the input, it will delete the contents which may be annoying.</p>
<p>That is why I came up with this function:</p>
<pre>jQuery(document).ready(function() {
    $('.label').each(function(){
        var labelText = $(this).text();
        var correspondingInput = $(this).attr('for');
        $('#'+correspondingInput).attr('value', labelText);
        $('#'+correspondingInput).click(function(){
            if ($(this).attr('value') == labelText) {
                $(this).attr('value', '');
            }
        });
        $(this).hide();
    });
});</pre>
<p>Basically, every label of the class &laquo;&nbsp;label&nbsp;&raquo; will be hidden and its text will be shown in the corresponding text input.<br />
This method only supposes clean markup:</p>
<ul>
<li>attribute &laquo;&nbsp;for&nbsp;&raquo; on the label</li>
<li>attribute &laquo;&nbsp;id&nbsp;&raquo; on the input</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/09/18/accessible-and-nice-inputs-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vertically center align content with jQuery</title>
		<link>http://curlybracket.net/2011/07/31/vertically-center-align-content-with-jquery/</link>
		<comments>http://curlybracket.net/2011/07/31/vertically-center-align-content-with-jquery/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 19:49:59 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[jquery]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1905</guid>
		<description><![CDATA[Quick&#8217;n'dirty. Vertical center align the #content element using another -parent- element (body, in this example) as a reference with jQuery. &#60;script type="text/javascript"&#62; jQuery(document).ready(function() { centerElm('#content', 'body'); }) function centerElm(elm, elmParent) { var elmHeight = $(elmParent).height(); var elmHeightInner = $(elm).innerHeight(); var &#8230; <a href="http://curlybracket.net/2011/07/31/vertically-center-align-content-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Quick&#8217;n'dirty.</p>
<p>Vertical center align the #content element using another -parent- element (body, in this example) as a reference with jQuery.</p>
<pre>&lt;script type="text/javascript"&gt;
jQuery(document).ready(function() {
    centerElm('#content', 'body');
})
function centerElm(elm, elmParent) {
	var elmHeight = $(elmParent).height();
	var elmHeightInner = $(elm).innerHeight();
	var spacing = (elmHeight - elmHeightInner)/2;
	$(elm).css('padding-top', spacing);
}
&lt;/script&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/07/31/vertically-center-align-content-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E-mail spam protection with jQuery</title>
		<link>http://curlybracket.net/2011/07/08/e-mail-spam-protection-with-jquery/</link>
		<comments>http://curlybracket.net/2011/07/08/e-mail-spam-protection-with-jquery/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 15:38:25 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Javascript/jQuery]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1896</guid>
		<description><![CDATA[To protect e-mails from spam robots I recommend using this technique, which will only reveal the e-mail adress for users with Javascript enabled, which is typically not the case of robots searching for e-mail adresses. &#60;script type="text/javascript"&#62; jQuery(document).ready(function() { $('a.mail').each(function() &#8230; <a href="http://curlybracket.net/2011/07/08/e-mail-spam-protection-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To protect e-mails from spam robots I recommend using this technique, which will only reveal the e-mail adress for users with Javascript enabled, which is typically not the case of robots searching for e-mail adresses.</p>
<pre>&lt;script type="text/javascript"&gt;
jQuery(document).ready(function() {
$('a.mail').each(function() {
  e = this.rel.replace('#/#','@'); // replace #/# by @
  this.title = ''; // delete the title attribute
  this.href = 'mailto:' + e; // add mailto and href instead of rel
  $(this).html(e); // replace "Contact" by complete email address
  });
})
&lt;/script&gt;</pre>
<p>Of course. you have to include the jQuery library in your &lt;head&gt; section to make this work.</p>
<p>Then you can write emails like this and they will be automatically replaced by Javascript :</p>
<pre>&lt;a href="<a href="view-source:http://www.pretatacher.com/#">#</a>" class="mail" rel="example#/#example.com" title="Please enable Javascript to get the contact adress."&gt;Contact&lt;/a&gt;</pre>
<p>You may use any suite of caracters for &laquo;&nbsp;#/#&nbsp;&raquo;, except $ or +, just replace them in the script AND the markup.</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/07/08/e-mail-spam-protection-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alert users to update their browser via jQuery</title>
		<link>http://curlybracket.net/2011/07/08/alert-users-to-update-their-browser-via-jquery/</link>
		<comments>http://curlybracket.net/2011/07/08/alert-users-to-update-their-browser-via-jquery/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 15:27:24 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Javascript/jQuery]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1893</guid>
		<description><![CDATA[Sometimes I am too lazy, too busy, not well paid enough or just not willing to make a website work in old and deprecated browsers like IE6. However, I&#8217;d like the users to know that they could have a better &#8230; <a href="http://curlybracket.net/2011/07/08/alert-users-to-update-their-browser-via-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes I am too lazy, too busy, not well paid enough or just not willing to make a website work in old and deprecated browsers like IE6.</p>
<p>However, I&#8217;d like the users to know that they could have a better experience of my sites if they&#8217;d just upgrade their browser to a newer version or to another one, more up-to-date.</p>
<p>That is why I like to use jQuery to tell them :</p>
<pre>&lt;script type="text/javascript"&gt;
jQuery(document).ready(function() {
if ($.browser.msie) { // case Internet Explorer
 var version = parseInt($.browser.version, 10);
   if(version &lt; 7) { // all versions before IE7
     $('&lt;div id="oldbrowser" class="alert"&gt;Please upgrade your browser to get full user experience.&lt;/div&gt;').appendTo(document.body);
   }
 }
});
&lt;/script&gt;</pre>
<p>Of course you have to first include the latest jQuery library to the &lt;head&gt; section of your site.</p>
<p>The CSS to place the message at the beginning of the page:</p>
<pre>#oldbrowser {
   position: absolute;
   top: 1em;
   left: 1em;
}
.alert {
  color: red;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/07/08/alert-users-to-update-their-browser-via-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Vimeo videos to WordPress via extra fields</title>
		<link>http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/</link>
		<comments>http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 19:57:43 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[vimeo]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1856</guid>
		<description><![CDATA[I wanted an easy solution for people to add videos from Vimeo to their WordPress articles (without having to add them to the editor for several reasons) and I came up with the following: a function to be added to &#8230; <a href="http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wanted an easy solution for people to add videos from Vimeo to their WordPress articles (without having to add them to the editor for several reasons) and I came up with the following:</p>
<ul>
<li>a function to be added to the teme</li>
<li>a piece of code to add to one or more templates(s) of the theme</li>
<li>an extra field to fill in for each post or page by the editor of the website</li>
</ul>
<p><strong>The function</strong></p>
<p>Add this to functions.php in your theme. It is based on the vimeo shortcode plugin for WordPress.</p>
<pre>function insert_vimeo($clip_id) {
   $width = '640';
   $height = '360';
   if (empty($clip_id) || !is_numeric($clip_id)) return '&lt;!-- Vimeo: Invalid clip_id --&gt;';
   if ($height &amp;&amp; !$width) $width = intval($height * 16 / 9);
   if (!$height &amp;&amp; $width) $height = intval($width * 9 / 16);
   return "&lt;iframe src='http://player.vimeo.com/video/$clip_id?title=0&amp;amp;byline=0&amp;amp;portrait=0'
           width='$width' height='$height' frameborder='0'&gt;&lt;/iframe&gt;";
}</pre>
<p><strong>The piece of code for your template :</strong></p>
<p>Put this in single.php or page.php, within the loop.<strong><br />
</strong></p>
<pre>&lt;?php
if ( get_post_meta($post-&gt;ID, 'vimeo', true) ) :
    $vimeo = get_post_meta($post-&gt;ID, 'vimeo', true);
    echo (insert_vimeo($vimeo));
endif;
?&gt;</pre>
<p>Now you just have to add an extra field called &laquo;&nbsp;vimeo&nbsp;&raquo; to your posts or pages and add as a value the ID of the clip, that means the numbers in the URL. If, for example, you want to add the video at <a href="http://vimeo.com/20732587">http://vimeo.com/20732587</a> you would add <em>20732587</em> to the value of your field.</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically generate a RSS feed from static pages with PHP</title>
		<link>http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/</link>
		<comments>http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 17:51:23 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1555</guid>
		<description><![CDATA[This may sound a stupid thing to do, however, there are websites out there in plain and badly formatted HTML out there that need RSS feeds. See the script in action here : http://airdeparis.com/rss.php Here I am considering that we &#8230; <a href="http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This may sound a stupid thing to do, however, there are websites out there in plain and badly formatted HTML out there that need RSS feeds.</p>
<p>See the script in action here : <a href="http://airdeparis.com/rss.php">http://airdeparis.com/rss.php</a></p>
<p>Here I am considering that we update some files every now and then and we want those updates  to appear in a dynamic RSS feed. In order to do so save the following code as a file called &laquo;&nbsp;rss.php&nbsp;&raquo;, edit it to suit your needs and then upload it to  your site. You may access the file like this : http://example.com/rss.php.</p>
<h3>How does it work?</h3>
<p>We declare the files we want to have in our PHP file in an array. We will use the last modification time of each of these files, filter out the &lt;title&gt; and contents and then create the feed.</p>
<p>(By the way, if you want this to work on PHP4 you will have to replace the <em>html_entity_decode</em> function otherwise it will not function.<em>)<br />
</em></p>
<p><span id="more-1555"></span></p>
<h3>The code</h3>
<pre>&lt;?php
/*************************************************************************************
WTFPL, copyright 2010 curlybracket.net
html strip function from http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page
**************************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////
// adjust to your needs
$sitename = "My example site";
$siteurl = "http://example.com/";
$sitedescription = "On example.com we talk a lot about examples.";
$files = array("firstpage.htm", "second.html", "directory/lol.html");
$lang = "en";
//////////////////////////////////////////////////////////////////////////////////////
$now = date("D, d M Y H:i:s O");
$rss = readfiles($files);
//////////////////////////////////////////////////////////////////////////////////////
// RSS output
header("Content-Type: application/rss+xml");
echo '&lt;?xml version="1.0" encoding="UTF-8"?&gt;'."\n"; ?&gt;
&lt;rss version="2.0"&gt;
  &lt;channel&gt;
    &lt;title&gt;&lt;?php echo $sitename; ?&gt;&lt;/title&gt;
    &lt;link&gt;&lt;?php echo $siteurl; ?&gt;&lt;/link&gt;
    &lt;description&gt;&lt;?php echo $sitedescription; ?&gt;&lt;/description&gt;
    &lt;lastBuildDate&gt;&lt;?php echo $now ?&gt;&lt;/lastBuildDate&gt;
    &lt;language&gt;&lt;?php echo $lang; ?&gt;&lt;/language&gt;
    &lt;?php if($rss) {
          foreach($rss as $item) {
            echo '    &lt;item&gt;
            &lt;title&gt;'.$item['title'].'&lt;/title&gt;
            &lt;guid&gt;'.$siteurl.$item['file'].'&lt;/guid&gt;
            &lt;pubDate&gt;'.$item['lastmod'].'&lt;/pubDate&gt;
            &lt;description&gt;'.$item['description'].'&lt;/description&gt;
            &lt;link&gt;'.$siteurl.$item['file'].'&lt;/link&gt;
            &lt;/item&gt;\n';
          }
    } ?&gt;
  &lt;/channel&gt;
&lt;/rss&gt;
//////////////////////////////////////////////////////////////////////////////////////
function readfiles($files) {
    $i = 0;
    foreach($files as $file) {
        if(file_exists($file) &amp;&amp; is_readable($file)) {
             //which file, for link construction
             $rss[$i]['file'] = $file;
             // find the page last modification time
             $rss[$i]['lastmod'] = date("D, d M Y H:i O", filemtime($file));
             // find the page title from the &lt;title&gt; atrribute
             $file_contents = file_get_contents($file);
             $start = strpos($file_contents, '&lt;title&gt;');
             $end = strpos($file_contents, '&lt;/title&gt;');
             if ($start !== false) {
                 $start = $start + 7; //href=" = 6 chars
                 if ($end !== false) {
                     $end = $end - $start; //length of string
                 }
                 $rss[$i]['title'] = substr($file_contents, $start, $end);
            } else {
                 $rss[$i]['title'] = $sitename;
            }
            // get file description from file content
            // Get the file's character encoding from a &lt;meta&gt; tag
            preg_match('@&lt;meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $file_contents, $matches);
            $encoding = $matches[3];
            // Convert to UTF-8 before doing anything else
            $utf8_text = iconv($encoding, "utf-8", $file_contents);
            // Strip HTML tags and invisible text
            $utf8_text = strip_html_tags($utf8_text);
            // remove empty lines
            $utf8_text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", $utf8_text);
            // Decode HTML entities, this works in PHP5
            $utf8_text = trim(html_entity_decode($utf8_text, ENT_QUOTES, "UTF-8"));
            $rss[$i]['description'] = $utf8_text;
        } else {
            // the file does not exist or is not readable.
           return FALSE;
        }
        $i++;
    }
    return($rss);
}
//////////////////////////////////////////////////////////////////////////////////////
/**
 * Remove HTML tags, including invisible text such as style and
 * script code, and embedded objects. Add line breaks around
 * block-level tags to prevent word joining after tag removal.
 */
function strip_html_tags($text) {
    $text = preg_replace(
    array(
    // Remove invisible content
    '@&lt;head[^&gt;]*?&gt;.*?&lt;/head&gt;@siu',
    '@&lt;style[^&gt;]*?&gt;.*?&lt;/style&gt;@siu',
    '@&lt;script[^&gt;]*?.*?&lt;/script&gt;@siu',
    '@&lt;object[^&gt;]*?.*?&lt;/object&gt;@siu',
    '@&lt;embed[^&gt;]*?.*?&lt;/embed&gt;@siu',
    '@&lt;applet[^&gt;]*?.*?&lt;/applet&gt;@siu',
    '@&lt;noframes[^&gt;]*?.*?&lt;/noframes&gt;@siu',
    '@&lt;noscript[^&gt;]*?.*?&lt;/noscript&gt;@siu',
    '@&lt;noembed[^&gt;]*?.*?&lt;/noembed&gt;@siu',
    // Add line breaks before and after blocks
    '@&lt;/?((address)|(blockquote)|(center)|(del))@iu',
    '@&lt;/?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
    '@&lt;/?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
    '@&lt;/?((table)|(th)|(td)|(caption))@iu',
    '@&lt;/?((form)|(button)|(fieldset)|(legend)|(input))@iu',
    '@&lt;/?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
    '@&lt;/?((frameset)|(frame)|(iframe))@iu',
    ),
    array(
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0",
    "\n\$0", "\n\$0",
    ),
    $text );
    return strip_tags($text);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>@font-face – doing it right</title>
		<link>http://curlybracket.net/2010/09/19/font-face-doing-it-right/</link>
		<comments>http://curlybracket.net/2010/09/19/font-face-doing-it-right/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 19:20:01 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[font-face]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1460</guid>
		<description><![CDATA[Tous les graphistes avec lesquels j&#8217;ai travaillé sur des sites web durant ces dernières années ont insisté pour utiliser des polices de caractères spécifiques. Des polices autres que Arial, Helvetica, Verdana, Times New Roman etc. qui sont les polices installées &#8230; <a href="http://curlybracket.net/2010/09/19/font-face-doing-it-right/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tous les graphistes avec lesquels j&#8217;ai travaillé sur des sites web durant ces dernières années ont insisté pour utiliser des polices de caractères spécifiques. Des polices autres que Arial, Helvetica, Verdana, Times New Roman etc. qui sont les polices installées par défaut sur les ordinateurs des personnes qui accèdent à une page web (voir aussi : <em>safe list</em> du <a href="http://www.typetester.org/">typetester</a> et la page Wikipedia <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Core_fonts_for_the_Web">Core Fonts For The Web</a>).<br />
(Souvent d&#8217;ailleurs, c&#8217;est parce qu&#8217;on peut utiliser des polices de caractère spécifiques que certains graphistes préfèrent faire des sites avec  <span style="text-decoration: line-through;">Macromedia</span> Adobe Flash&#8230;)</p>
<h3>Utilisation de polices standard en CSS</h3>
<p>La spécification <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Web_typography#CSS1">CSS1 permettait déjà</a> de désigner une police de caractère à utiliser, sa taille, la graisse, le style. De plus, il est conseillé d&#8217;utiliser un <em><a href="https://secure.wikimedia.org/wikipedia/en/wiki/Web_typography#Fallback_fonts">fallback</a></em>. En CSS, cela ressemble à quelque chose comme ça :</p>
<pre>body {
    font-family: Arial, sans-serif;
    font-size: 1em;
}</pre>
<h3>A l&#8217;ancienne</h3>
<p>Jusqu&#8217;à il n&#8217;y a pas si longtemps, vouloir utiliser des polices de caractère spécifiques impliquait de désigner des zones importantes, comme des menus ou des titres (pour ne pas alourdir trop les pages), et d&#8217;y implémenter des images statiques que le ou la graphiste devait préparer auparavant à l&#8217;aide d&#8217;un logiciel de traitement d&#8217;image. (Ces images devaient avoir la bonne taille, de préférence un fond transparent (PNG24) &#8211; ce qui posait problème à son tour dans le navigateur alors le plus répandu : IE6..)<br />
Cette méthode devient assez vite pénible, par exemple, quand on a plus que 3 langues différentes &#8211; et donc autant d&#8217;images différentes &#8211; à gérer. Ou encore dès lors qu&#8217;on veut modifier un mot&#8230;<br />
<span id="more-1460"></span></p>
<h3>Cufón</h3>
<p>Ensuite on découvre <a href="http://cufon.shoqolate.com/generate/">cufón</a>, une méthode qui transforme, à la volée, le texte en images, au moyen de javascript. L&#8217;avantage : ça marche dans tous les navigateurs web. Les désavantages : cela fonctionne assez bien sur des polices de caractère de grande taille, mais le texte de petite taille «bave». Mais le plus lourd c&#8217;est qu&#8217;il devient impossible de copier-coller du texte (sans afficher le code source de la page).<br />
Puis, la méthode cufón pose une question importante : celui de la licence de la police de caractère. Pour générer le code qui remplacera par la suite les textes d&#8217;un site à la volée, il faut d&#8217;abord uploader un fichier (au format TTF, OTF ou PFB) sur le site de cufón. Or, la plupart des polices a une licence qui ne permet pas le <em>embedding</em> sur un site web, même si, avec cette méthode, on ne met pas directement à disposition le fichier de police lui-même. A ce sujet le générateur cufón met en garde :</p>
<blockquote><p>See <a href="http://www.fontembedding.com/fonts-and-the-law/">Fonts and the Law</a> at <a href="http://www.fontembedding.com/">fontembedding.com</a> for more information. 									Fonts produced by the following foundries/vendors/creators are <em>known to be safe</em>: 									<a href="http://www.adobe.com/type/embedding.html">Adobe Systems</a>. 									The following are <em>known to require separate or extended licenses</em> for Web Embedding: 									<a href="http://www.bertholdtypes.com/info/agreement.html">Berthold</a> (separate), 									<a href="http://www.fontfont.com/support/licensing.ep">FontFont</a> (separate), 									<a href="http://www.fontsmith.com/support/licencingandusage/end-user-licence-agreement-eula.cfm">Fontsmith</a> (separate), 									<a href="http://www.typography.com/">Hoefler &amp; Frere-Jones</a> (separate), 									<a href="http://www.itcfonts.com/About/Embedding.htm">ITC</a> (separate), 									<a href="http://www.linotype.com/2061-28225/licenseagreementforfontsoftware.html">Linotype</a> (extended).</p></blockquote>
<p>En gros, quand vous achetez une police de caractère (des vendeurs nommés ci-dessus par exemple), vous adhérez aux conditions de vente qui définissent par exemple le nombre d&#8217;ordinateurs sur lesquels vous avez le droit d&#8217;installer la police, et ce que vous avez le droit de faire avec (regarder, créer et imprimer des documents, par exemple). Et pour pouvoir utiliser leurs polices sur le web, il faut souvent acheter une licence supplémentaire. Et encore, il convient de bien lire les CGV. Dans tous les cas, vous n&#8217;avez pas le droit de redistribuer le fichier de police lui-même. Si on veut utiliser cufón, on doit alors s&#8217;assurer d&#8217;avoir la bonne licence en main, ou alors utiliser une police de caractère libre.</p>
<h3>@font-face</h3>
<p>Comme dit plus haut, cufón ne m&#8217;a pas convaincu &#8211; surtout pour des raisons pratiques et visuelles. Un jour, un de mes collaborateurs graphistes m&#8217;a averti de la méthode <a href="https://developer.mozilla.org/en/CSS/@font-face">@font-face</a> (probablement dans le but de voir se réaliser ses rêves les plus farfelus en matière de polices de caractères sur le web, hin hin).<br />
Cette méthode fonctionne dans la plupart des navigateurs récents qui ont implémenté la spécification CSS3 (@font-face avait été introduit en CSS2, puis retiré en CSS2.1). Elle consiste à mettre à disposition un fichier de police sur le serveur et de spécifier, dans la feuille de style, l&#8217;utilisation de ce fichier. Cela marche très bien, le rendu des caractères est propre, suivant la police utilisée.</p>
<p>En CSS cela ressemblerait, au plus simple, à quelque chose comme ça :</p>
<pre>@font-face {
    font-family: Molengo;
    src: url(fonts/Molengo.otf) format("opentype");
}
body {
    font-family: Molengo, sans-serif;
    font-size: 1em;
}</pre>
<p>Cependant, cette méthode pose deux problèmes.<br />
Le premier problème est celui du format : Mozilla Firefox 3.5+, Opera 10+, Safari 3.1+ et Google Chrome 4.0+supportent les formats <em>TrueType</em> (TTF) and <em>OpenType</em> (TTF/OTF). Internet Explorer requiert cependant le format <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Embedded_OpenType">EOT</a>, un format qui vise spécifiquement le web et qui utilise des techniques de <a href="https://secure.wikimedia.org/wikipedia/fr/wiki/Gestion_des_droits_num%C3%A9riques">DRM</a> pour en empêcher la copie illégale. Quand on a une police au format TTF, il faut donc d&#8217;abord la convertir au format EOT, pour qu&#8217;elle soit lisible aussi dans IE (<a href="https://code.google.com/p/ttf2eot/">possible avec cet outil</a>).<br />
(iPhone et iPad pour leur part utilisent des polices au format SVG, la conversion vers SVG est possible avec <a href="http://xmlgraphics.apache.org/batik/tools/font-converter.html">Batik</a>.)<br />
Il y a, depuis peu, un nouveau format de police, spécifiquement déstiné au web : le <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Web_Open_Font_Format">WOFF</a><em> (web open font format)</em>.  Ce format est supporté par Mozilla Firefox 3.6+, Opera, Google Chrome 5+ et le sera aussi par IE9.  Ce format est donc le seul à être supporté par tous les navigateurs  importants (à l&#8217;exception des navigateurs d&#8217;Apple &#8211; sans surprise). L&#8217;avantage du WOFF est que les fichiers sont beaucoup plus légers que les fichier TTF ou OTF. (Pour convertir un fichier TTF ou OTF vers WOFF on peut utiliser <a href="http://people.mozilla.com/~jkew/woff/">sfnt2woff</a> ou le <a href="http://www.fontsquirrel.com/fontface/generator">générateur de Fontsquirrel</a>.)</p>
<p>Le deuxième problème est celui de la licence : si on met à disposition un fichier sur un serveur, chaque visiteur peut y accéder et le télécharger (le navigateur se charge par ailleurs de télécharger le fichier de police dans le cache obligatoirement). On devient alors distributeur de ce fichier. Tout comme cufón, la méthode @font-face pose donc le problème de la licence. Et la plupart des polices commercialisées ne permettent pas la redistribution du fichier.<br />
Mais il y a des solutions à  ce problème :</p>
<ul>
<li>Utiliser des polices libres. En ce qui me concerne, je n&#8217;ai aucune envie de me prendre la tête avec des licences propriétaires et je résoud ce conflit en utilisant des polices libres, c&#8217;est-à dire des polices qui sont distribuées sous licence <a href="https://secure.wikimedia.org/wikipedia/en/wiki/GNU_General_Public_License">GPL</a>, <a href="https://secure.wikimedia.org/wikipedia/en/wiki/SIL_Open_Font_License">SIL-OFL</a>, <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Creative_commons">CC</a> ou similaires.</li>
<li>Encoder les polices en base64 afin de les inclure directement dans la CSS. On se débarasse ainsi des fichiers qui trainent sur le serveur (méthode pratiqué ainsi par <a href="http://typekit.com">Typekit</a> et possible aussi avec le <a href="http://www.fontsquirrel.com/fontface/generator">générateur de kit @font-face de Fontsquirrel</a>).</li>
<li>Le <a href="http://www.fontsquirrel.com/fontface/generator">générateur de kit @font-face de Fontsquirrel</a> propose aussi une restriction d&#8217;adresse IP et l&#8217;option <em>webOnly</em> qui rend les polices ininstallables sur un ordinateur.</li>
</ul>
<p>Assez parlé.</p>
<h3>Trouver des polices pour le web</h3>
<p>Il y a quelques services qui se sont spécialisés à la mise à disposition de polices de caractères pour le web (notamment) :</p>
<ul>
<li><a href="http://fontsquirrel.com">Fontsquirrel</a> (mon favori absolu) met à disposition des polices libres sous forme de kit qu&#8217;on peut facilement intégrer dans un site web. Le kit contient la police au format TFF, OTF ou WOFF ainsi qu&#8217;a format EOT et SVG, puis la feuille de style toute faite à simplement inclure. (Il ne faut pas oublier d&#8217;appliquer la/les font-family dans sa propre feuille de style aux éléments concernés.)</li>
<li><a href="https://code.google.com/webfonts">Google webfonts</a> Google aussi propose une sélection de polices libres. Le choix est très réstreint, mais c&#8217;est extrèmement simple à appliquer. Il suffit d&#8217;inclure une ligne qui appelle une feuille de style sur les serveurs de Google dans le &lt;head&gt; de votre page HTML, puis d&#8217;appliquer le nom de la font-family sur les éléments concernés dans se propre feuille de style.</li>
<li><a href="http://typekit.com">Typekit</a> est un système qui propose une solution toute faite contre un forfait annuel (tester est gratuit). En contrepartie, l&#8217;entreprise se charge de payer les licences des polices propriétaires proposées. Ici, il y a un très grand choix. Ils mettent à disposition une interface pour tester, puis génèrent du code CSS et JS. Ensuite, il suffit d&#8217;inclure un bout de code sur le site concerné. Une solution très facile d&#8217;accès.</li>
<li>Sur <a href="http://openfontlibrary.org/">Openfontlibrary</a> et <a href="http://dafont.com">Dafont</a> on peut trouver des polices de caractères libres. (Sur Dafont, utiliser les options de recherche avancés pour trier par licence.)</li>
</ul>
<h3>La CSS</h3>
<p>Pour finir, voici une feuille de style un peu plus détaillée :</p>
<pre>@font-face {
    font-family: Molengo;
    src: url('fonts/Molengo.eot');
    src: local("☺"),
    url('fonts/molengo.woff') format('woff'),
    url('fonts/molengo.otf') format('opentype'),
    url('fonts/molengo.svg#filename') format('svg');
}
body {
     font-family: Molengo, sans-serif;
     font-size: 1em;
}</pre>
<p>Explication du code ci-dessus :</p>
<ul>
<li>Le fichier eot est chargé en premier (<a href="http://nicewebtype.com/notes/2009/10/30/how-to-use-css-font-face/">pour diverses raisons</a>)</li>
<li>ensuite on propose le fichier le plus adapté et le plus léger : WOFF</li>
<li>si le navigateur n&#8217;accepte pas le WOFF, on passe sur OTF (ou TTF)</li>
<li>si on est sur un iPhone ou iPad on passe sur le fichier SVG. le <em>filename</em> est un ID spécifié à la conversion vers SVG et doit être remplacé</li>
<li>local &amp; smiley empêchent d&#8217;utiliser une police installée (<a href="http://paulirish.com/2010/font-face-gotchas/#smiley">voir explications</a>)</li>
</ul>
<h3>Plus d&#8217;infos ailleurs</h3>
<p>Des articles en anglais :</p>
<ul>
<li><a href="http://nicewebtype.com/notes/2009/10/30/how-to-use-css-font-face/">@font-face step by step guide</a></li>
<li><a href="https://secure.wikimedia.org/wikipedia/en/wiki/Web_typography">Wikipedia : web typography</a></li>
<li><a href="http://opentype.info/blog/2010/04/13/the-ipad-and-svg-fonts-in-mobile-safari/">SVG fonts on the iPad (mobile Safari)</a></li>
<li><a href="http://www.alistapart.com/articles/on-web-typography/">A list apart : On web typography</a></li>
<li><a href="http://www.ascendercorp.com/news/web-fonts-study/">Ascender study on web fonts</a></li>
<li>D&#8217;autres méthodes pour utiliser une police de caractère spécifique se trouvent en bas de <a href="http://openfontlibrary.org/wiki/Web_font_linking_with_@font-face">cette page</a>.</li>
</ul>
<p>Lire aussi : <a title="Bookmark Mais quel cauchemar : le rendu des polices sur Mac diffère de celui d’autres systèmes" rel="bookmark" href="../2010/09/01/cauchemar-le-rendu-des-polices/">Mais quel cauchemar : le rendu des polices sur Mac diffère de celui d’autres systèmes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2010/09/19/font-face-doing-it-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protéger une install WordPress par mot de passe tout en ayant une page de garde accessible</title>
		<link>http://curlybracket.net/2010/09/18/proteger-une-install-wordpress-par-mot-de-passe-tout-en-ayant-une-page-de-garde-accessible/</link>
		<comments>http://curlybracket.net/2010/09/18/proteger-une-install-wordpress-par-mot-de-passe-tout-en-ayant-une-page-de-garde-accessible/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 10:52:53 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1524</guid>
		<description><![CDATA[Avoir une page de garde accessible pour le monde entier pendant qu&#8217;on travaille encore sur un site WordPress installé au même endroit c&#8217;est possible : ajouter un fichier index.html à la racine du site (la page de garde) ajouter un &#8230; <a href="http://curlybracket.net/2010/09/18/proteger-une-install-wordpress-par-mot-de-passe-tout-en-ayant-une-page-de-garde-accessible/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Avoir une page de garde accessible pour le monde entier pendant qu&#8217;on travaille encore sur un site WordPress installé au même endroit c&#8217;est possible :</p>
<ol>
<li>ajouter un fichier index.html à la racine du site (la page de garde)</li>
<li>ajouter un fichier .htpasswd créé auparavant</li>
<li>ajouter un fichier .htaccess (ou compléter celui de WordPress) avec les lignes suivantes :</li>
</ol>
<pre><code>
&lt;FilesMatch "\.(php)$"&gt;
   AuthName "Demande de mot de passe"
   AuthUserFile /the/path/to/.htpasswd
   AuthType basic
   Require valid-user
&lt;/FilesMatch&gt;
&lt;FilesMatch "(index.html)$"&gt;
   Order allow,deny
   allow from all
&lt;/FilesMatch&gt;
</code></pre>
<p>Cela permet d&#8217;accéder au fichier index.html à tout le monde (<em>allow from all</em>), tandis que pour accéder à un fichier .php (et donc à WordPress) il faut entrer un nom et un mot de passe (spécifié dans le fichier .htpasswd).<br />
Le chemin vers le fichier .htpasswd doit être absolu. Pour le trouver , on peut utiliser <a href="http://fr.php.net/manual/fr/function.phpinfo.php">phpinfo()</a>.</p>
<p>Seul souci : on ne peut plus correctement voir la page d&#8217;accueil du site. Pour cela, il faut entrer à la main dans la barre d&#8217;adresse du navigateur : http://example.com/index.php?preview=true</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2010/09/18/proteger-une-install-wordpress-par-mot-de-passe-tout-en-ayant-une-page-de-garde-accessible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extensions utiles pour WordPress</title>
		<link>http://curlybracket.net/2010/09/07/plugins-utiles-pour-wordpress/</link>
		<comments>http://curlybracket.net/2010/09/07/plugins-utiles-pour-wordpress/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 14:37:29 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1446</guid>
		<description><![CDATA[Voici, pour mémoire, une liste non exhaustive d&#8217;extensions utiles pour WordPress. Performance WP minify compresse les feuilles de style et les scripts WP Super Cache sert des fichiers statiques au format html au lieu de recalculer toutes les pages à &#8230; <a href="http://curlybracket.net/2010/09/07/plugins-utiles-pour-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Voici, pour mémoire, une liste non exhaustive d&#8217;extensions utiles pour WordPress.</p>
<h3>Performance</h3>
<ul>
<li><a href="http://wordpress.org/extend/plugins/wp-minify/">WP minify</a> compresse les feuilles de style et les scripts</li>
<li><a href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Super Cache</a> sert des fichiers statiques au format html au lieu de recalculer toutes les pages à chaque requête</li>
<li><a href="http://wordpress.org/extend/plugins/wp-avoid-slow/">wp avoid slow</a> ajoute <a href="http://developer.yahoo.com/performance/rules.html#expires"><em>expires headers</em></a> et <a href="http://developer.yahoo.com/performance/rules.html#etags"><em>entity tags</em></a></li>
<li><a href="http://wordpress.org/extend/plugins/gzip-enable/">gzip enable</a> compression au niveau serveur, <a href="http://developer.yahoo.com/performance/rules.html#gzip">sert la page au format gzip</a>, utilise <em>mod_deflate</em></li>
<li><em></em><a href="http://wordpress.org/extend/plugins/wp-jquery-lightbox/">jquery lightbox</a> puisque sur la plupart des sites j&#8217;utilise déjà jQuery, il est plus léger d&#8217;utiliser une extension lightbox basé sur cette librairie plutôt que l&#8217;original qui est basé sur prototype.</li>
</ul>
<h3>Maintenance</h3>
<ul>
<li><a href="http://wordpress.org/extend/plugins/wp-db-backup/">WP DB backup</a> pour faire une sauvegarde de la base de données, manuellement ou automatiquement toutes les semaines (aussi par e-mail)</li>
</ul>
<h3>Securité</h3>
<ul>
<li><a href="http://wordpress.org/extend/plugins/chap-secure-login/">Chap Secure Login</a> s&#8217;authemtifier sur un site WordPress sans HTTPS peut engendrer que des tiers enregistrent ou lisent votre mot de passe. Cette extension sécurise un minimum la transmission du mot de passe, en le chiffrant (MD5). Seul inconvénient : dépend de l&#8217;activation de javascript.</li>
<li><a href="http://wordpress.org/extend/plugins/secure-wordpress/">Secure WordPress</a> enlève notamment l&#8217;information de la version de WP du &lt;head&gt;</li>
</ul>
<p><span id="more-1446"></span><strong></strong></p>
<h3><strong>Référencement</strong></h3>
<ul>
<li><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Google XML sitemaps</a> génère un plan du site pour faciliter la tâche aux moteurs de recherche</li>
<li><a href="http://wordpress.org/extend/plugins/basic-seo/">Basic SEO</a> optimise titres &amp; metadonnées (au cas où le thème ne fait pas déjà)</li>
</ul>
<h3>Statistiques des visites<strong><br />
</strong></h3>
<ul>
<li><a href="http://wordpress.org/extend/plugins/wassup/">WassUp</a> permet d&#8217;avoir des statistiques d&#8217;accès au site, en temps réel, avec graphes etc. Surtout utile quand on n&#8217;a pas accès aux logs d&#8217;Apache. Inconvénient : fait grandir la base de données, suivant le nombre de visites plus ou moins rapidement.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2010/09/07/plugins-utiles-pour-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

