http://yannesposito.com/ Yogsototh's last blogs entries 2012-02-08T13:17:53Z Yann Esposito http://yannesposito.com tag:yannesposito.com,2012-02-08:/Scratch/en/blog/Haskell-the-Hard-Way/ Learn Haskell Fast and Hard 2012-02-08T13:17:53Z 2012-02-08T13:17:53Z Yann Esposito yannesposito.com <p><img alt="Magritte pleasure principle" src="/Scratch/img/blog/Haskell-the-Hard-Way/magritte_pleasure_principle.jpg" /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> A very short and dense tutorial for learning Haskell.</p> <blockquote> <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /><span class="sc"><b>Table of Content</b></span><hr style="width:30%;float:right;border-color:#CCCCD0;margin-top:1em" /></center> <div class="toc"> <ul> <li><a href="#introduction">Introduction</a> <ul> <li><a href="#install">Install</a></li> <li><a href="#don-t-be-afraid">Don&rsquo;t be afraid</a></li> <li><a href="#very-basic-haskell">Very basic Haskell</a> <ul> ...</ul></li></ul></li></ul></div></hr></center></blockquote></div></p> tag:yannesposito.com,2012-02-02:/Scratch/en/blog/Typography-and-the-Web/ Typography and the Web 2012-02-02T09:53:00Z 2012-02-02T09:53:00Z Yann Esposito yannesposito.com <p><img alt="Screenshot of first in small caps with and without ligatures." src="/Scratch/img/blog/Typography-and-the-Web/first_sc_screenshot.png" />;</p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> Web typography sucks and we&rsquo;ll have to wait forever before it will be fixed.</p> </div> <p>I stumbled upon <a href="http://opentypography.org/">open typography</a>. Their main message is:</p> <blockquote> <p>«There is no reason to wait for browser development to catch up. We can all create better web typography ourselves, today.»</p> </blockquote> <p>As somebody who tried to make my website using some nice typography features and in particular <em>ligatures</em>, I believe this is wrong.</p> <p>I already made an autom...</p></p> tag:yannesposito.com,2012-01-15:/Scratch/en/blog/Yesod-tutorial-for-newbies/ Haskell web programming 2012-01-15T17:14:40Z 2012-01-15T17:14:40Z Yann Esposito yannesposito.com <p><img alt="Neo Flying at warp speed" src="/Scratch/img/blog/Yesod-tutorial-for-newbies/flying_neo.jpg" /></p> <div class="intro"> <p><em>update</em>: updated for yesod 0.10</p> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> A simple yesod tutorial. Yesod is a Haskell web framework. You shouldn&rsquo;t need to know Haskell. </p> <blockquote> <center><span class="sc"><b>Table of content</b></span></center> <ul id="markdown-toc"> <li><a href="#before-the-real-start">Before the real start</a> <ul> <li><a href="#install">Install</a></li> <li><a href="#initialize">Initialize</a></li> <li><a href="#configure-git">Configure git</a></li> <li><a href="#some-last-minute-words">Some last minute words</a></li> </ul> </li> ...</ul></blockquote></div></p> tag:yannesposito.com,2011-10-20:/Scratch/en/blog/SVG-and-m4-fractals/ Increase the power of deficient languages. 2011-10-20T09:39:36Z 2011-10-20T09:39:36Z Yann Esposito yannesposito.com <p><img alt="Yesod logo made in SVG and m4" src="/Scratch/img/blog/SVG-and-m4-fractals/main.png" /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> How to use m4 to increase the power of deficient languages. Two examples: improve <span class="sc">xslt</span> syntax and make fractal with <span class="sc">svg</span>.</p> </div> <p><span class="sc">xml</span> was a very nice idea about structuring data. Some people where so enthusiastic about <span class="sc">xml</span> they saw it everywhere. The idea was: the future is <span class="sc">xml</span>. Then some believed it would be a good idea to invent many <span class="sc">xml</span> compatible format and even programming languages with <span class="sc">xml</span> syntax.</p> </p> tag:yannesposito.com,2011-10-04:/Scratch/en/blog/Yesod-excellent-ideas/ Yesod excellent ideas 2011-10-04T08:18:59Z 2011-10-04T08:18:59Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/Yesod-excellent-ideas/main.png" /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span></p> <p><a href="http://www.yesodweb.com">Yesod</a> is a web framework which recently reached the maturity for which you should consider to use it. Before telling you why you should learn Haskell and use yesod, I will talk about ideas yesod introduced and I didn&rsquo;t saw in other frameworks before.</p> </div> <h2 id="type-safety">Type safety</h2> <p>Let&rsquo;s start by an obligatory link from <a href="http://xkcd.com">xkcd</a>:</p> <p><img src="http://imgs.xkcd.com/comics/exploits_of_a_mom.png" alt="SQL injection by a mom" /></p> <p>When you create a web application, a lot of time is spent...</p></p></p> tag:yannesposito.com,2011-09-28:/Scratch/en/blog/Higher-order-function-in-zsh/ Higher order function in zsh 2011-09-28T13:15:23Z 2011-09-28T13:15:23Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/Higher-order-function-in-zsh/main.jpg" /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> some simple implementation of higher order function for zsh.</p> </div> <p>Why is it important to have these functions? Simply because, the more I programmed with zsh the more I tended to work using functional programming style.</p> <p>The minimal to have better code are the functions <code>map</code>, <code>filter</code> and <code>fold</code>.</p> <p>Let&rsquo;s compare. First a program which convert all gif to png in many different directories of different projects.</p> <p>Before ⇒</p> <pre><code class="zsh"># for each directory in projects dir for toProject in /path/to/projects/*(...</code></pre></p> tag:yannesposito.com,2011-09-28:/Scratch/en/blog/programming-language-experience/ Programming Language Experience 2011-09-28T10:21:41Z 2011-09-28T10:21:41Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/programming-language-experience/dragon.jpg" /></p> <div class="intro"> <span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> My short and higly subjective feelings about programming languages I used. </div> <h3 id="basic"><code>BASIC</code></h3> <p><img alt="Title image" src="/Scratch/img/blog/programming-language-experience/basic.gif" class=" left" /></p> <p>The language of my firsts programs! I was about 10, with an <code>MO5</code> and <code>Amstrad CPC 6128</code> and even with my <code>Atari STe</code>. This is the language of <code>GOTO</code>s. Ô nostalgia. Unfortunately this might be the only interesting part of this language.</p> <p>Today this language is obsolescent. It is not even good to learn pr...</p></p></p> tag:yannesposito.com,2011-08-25:/Scratch/en/blog/Learn-Vim-Progressively/ Learn Vim Progressively 2011-08-25T17:28:20Z 2011-08-25T17:28:20Z Yann Esposito yannesposito.com <p><img alt="Über leet use vim!" src="/Scratch/img/blog/Learn-Vim-Progressively/uber_leet_use_vim.jpg" /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> You want to teach yourself vim (the best text editor known to human kind) in the fastest way possible. This my way of doing it. You start by learning the minimal to survive, then you integrate all the tricks slowly.</p> </div> <p><a href="http://www.vim.org">Vim</a> the Six Billion Dollar editor</p> <blockquote> <p>Better, Stronger, Faster.</p> </blockquote> <p>Learn <a href="http://www.vim.org">vim</a> and it will be your last text editor. There isn&rsquo;t any better text editor that I know of. It is hard to learn, but incredible to use.</p> <p>I suggest you teach yo...</p></p> tag:yannesposito.com,2011-08-17:/Scratch/en/blog/A-more-convenient-diff/ A more convenient diff 2011-08-17T09:33:30Z 2011-08-17T09:33:30Z Yann Esposito yannesposito.com <p>Diff is a very useful tool. But it is not so easy to read for us, simple mortal.</p> <p>This is why, when you use <code>git</code> it will use a better formatting and colorize it.</p> <p>Here is the script I use when I want to use human readable <code>diff</code> à la git. </p> <div class="codefile"><a href="/Scratch/en/blog/A-more-convenient-diff/code/ydiff">&#x27A5; ydiff</a></div> <pre><code class="zsh">#!/usr/bin/env zsh # Load colors helpers autoload -U colors &amp;&amp; colors function colorize_diff { while read line; do case ${line[0]} in +) print -n $fg[green];; -) print -n $fg[red];; @) # Display in cyan the @@ positions @@ if [[ ${line[1]} = '@' ]]; then line=$(print $line | perl -pe 's#(\@\@[^\@]*\@\@)(.*)$#'$fg[cyan]'$1'$reset...</code></pre> tag:yannesposito.com,2011-07-10:/Scratch/en/blog/Haskell-Mandelbrot/ ASCII Haskell Mandelbrot 2011-07-10T10:41:26Z 2011-07-10T10:41:26Z Yann Esposito yannesposito.com <p>Here is the obfuscated code:</p> <div class="codefile"><a href="/Scratch/en/blog/Haskell-Mandelbrot/code/animandel.hs">&#x27A5; animandel.hs</a></div> <pre><code class="haskell">a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003) newtype C = C (Double,Double) deriving (Show,Eq) instance Num C where C(x,y)*C(z,t)=C(z*x-y*t,y*z+x*t);C(x,y)+C(z,t)=C(x+z,y+t);abs(C(x,y))=C(sqrt(x*x+y*y),0.0) r(C(x,y))=x;i(C(x,y))=y f c z 0=0;f c z n=if(r(abs(z))&gt;2)then n else f c ((z*z)+c) (n-1) h j k = map (\z-&gt;(f (C z) (C(0,0)) 32,(fst z&gt;l - q/2))) [(x,y)|y&lt;-[p,(p+((o-p)/a))..o],x&lt;-[m,(m + q)..l]] where o=i k;p=i j;m=r j;l=r k;q=(l-m)/b u j k = concat $ map v $ h j k where v (i,p)=(" .,`'°\":;-+oO0123456789=!%*§&amp;$@#"!!i):rst p;rst True="\n";rst False="" main = putStrLn $ im ...</code></pre> tag:yannesposito.com,2011-05-18:/Scratch/en/blog/Password-Management/ 40 character's passwords 2011-05-18T11:14:28Z 2011-05-18T11:14:28Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/Password-Management/main.png" /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> How I manage safely my password with success for some years now.<br /> <strong><code>sha1( password + domain_name )</code></strong><br /> I memorize only one password. I use a different password on all website.</p> </div> <p>Disclamer, this is an unashamed attempt to make you download my iPhone app&nbsp;;-). You&rsquo;re always here? Even if you won&rsquo;t download my app, you should read more. My method doesn&rsquo;t necessitate my app. It is both safe and easy to use everyday.</p> <p>If you just want to <em>use</em> the tools without searching to understand why it is safe, just jump at the </p></p></div></p> tag:yannesposito.com,2011-04-20:/Scratch/en/blog/2011-04-20-Now-hosted-on-github/ Now hosted on github 2011-04-20T15:22:15Z 2011-04-20T15:22:15Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/2011-04-20-Now-hosted-on-github/main.png" /></p> <p>I am now hosted on github.</p> </p> tag:yannesposito.com,2011-01-03:/Scratch/en/blog/2011-01-03-Why-I-sadly-won-t-use-coffeescript/ Why I won't use CoffeeScript (sadly) 2011-01-03T08:37:26Z 2011-01-03T08:37:26Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/2011-01-03-Why-I-sadly-won-t-use-coffeescript/main.png" /></p> <div class="encadre"> <p><em>Update</em>: I might change my mind now. Why? I just discovered a <a href="https://github.com/rstacruz/js2coffee">js2coffee converter</a>. Furthermore Denis Knauf told me about a <code>CoffeeScript.eval</code> function. And as Denis said: &ldquo;it is time to use Coffeescript as a javascript with Ruby-like syntax not a Ruby-like programming language&rdquo;.</p> </div> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> I would have loved to program client side using a Ruby-like syntax. But in the end, CoffeScript raised more disavantages than advantages.</p> </div> <p>Recently I read </p></p> tag:yannesposito.com,2011-01-01:/Scratch/en/blog/2011-01-03-Happy-New-Year/ Happy New Year 2011-01-01T06:55:54Z 2011-01-01T06:55:54Z Yann Esposito yannesposito.com <p>Happy New Year!</p> <p>I was busy during the last months. But I will revive a bit this blog.</p> <p>I made a project to write book in markdown syntax and generating HTML and high quality PDF. I am not finished with this.</p> <p>I had written an efficient <em class="pala">&amp;</em> simplistic MVC javascript framework.</p> <p>Best wishes for <em>2011</em>!</p> tag:yannesposito.com,2010-10-26:/Scratch/en/blog/2010-10-26-LaTeX-like-macro-and-markdown/ LaTeX like macro for markdown 2010-10-26T12:30:58Z 2010-10-26T12:30:58Z Yann Esposito yannesposito.com <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> I made a simple macro system for my blog. Now I juste have to write %<span></span>latex and it show as <span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T<sub style="vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em; font-size: 1em">e</sub>X</span>.</p> </div> <p>I added a macro system for my blog system. When we are used to <span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T</span></p> tag:yannesposito.com,2010-10-14:/Scratch/en/blog/2010-10-14-Fun-with-wav/ Fun with wav 2010-10-14T09:04:58Z 2010-10-14T09:04:58Z Yann Esposito yannesposito.com <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> Played to process a <code>wav</code> file. <code>C</code> was easier and cleaner than Ruby.</p> <p>edit: I wanted this program to work only on one specific machine (a x86 on a 32 bit Ubuntu). Therefore I didn&rsquo;t had any portability consideration. This is only a <em>hack</em>.</p> </div> <p>I had to compute the sum of the absolute values of data of a <code>.wav</code> file. For efficiency (and fun) reasons, I had chosen <code>C</code> language.</p> <p>I didn&rsquo;t programmed in <code>C</code> for a long time. From my memory it was a pain to read and write to files. But in the end I was really impressed by the code I get. It was really clean. This is even more impressive know...</p> tag:yannesposito.com,2010-10-10:/Scratch/en/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/ Secure eMail on Mac in few steps 2010-10-10T16:39:00Z 2010-10-10T16:39:00Z Yann Esposito yannesposito.com <p><img alt="Title image" src="/Scratch/img/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/main.png" class="clean " /></p> <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> <em>on Mac</em></p> <ul> <li>Get a certificate signed by a CA: <a href="http://www.instantssl.com/ssl-certificate-products/free-email-certificate.html">click here for a free one</a>,</li> <li>open the file,</li> <li>delete securely the file,</li> <li>use Mail instead of online gmail.</li> <li>???</li> <li>Profit</li> </ul> </div> <p>I&rsquo;ve (re)discovered how to become S/MIME compliant. I am now suprised how easy it was. Some years ago it was far more difficult. Now I&rsquo;m able to sign and encrypt my emails.</p> </p> tag:yannesposito.com,2010-10-06:/Scratch/en/blog/2010-10-06-New-Blog-Design-Constraints/ New Blog Design Constraints 2010-10-06T09:33:03Z 2010-10-06T09:33:03Z Yann Esposito yannesposito.com <p>I changed the design of my blog. Now it should be far cleaner. I believe I use no CSS3 feature and far less javascript. Of course before my website was perfectly browsable without javascript. Unfortunately some CSS3 feature are not mature enough on some browser. For more details you can read my older <a href="/Scratch/en/blog/2010-07-07-CSS-rendering-problems-by-navigator">blog entry</a>. But the major problem came from, <code>font-shadow</code> and gradients. Then my new design obey to the following rules:</p> <ul> <li>no CSS element begining by &lsquo;-moz&rsquo; or &lsquo;-webkit&rsquo;, etc&hellip;,</li> <li>no text shadow,</li> <li>clean (I mean delete) most javascript.</li> </ul> <p>I hope the new design please you.</p> tag:yannesposito.com,2010-09-02:/Scratch/en/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/ Use git to calculate trusted mtimes 2010-09-02T13:54:10Z 2010-09-02T13:54:10Z Yann Esposito yannesposito.com <p>You can remark at the bottom of each page I provide a last modification date. This label was first calculated using the <code>mtime</code> of the file on the file system. But many times I modify this date just to force some recompilation. Therefore the date wasn&rsquo;t a date of <em>real</em> modification.</p> <p>I use <a href="http://git-scm.org">git</a> to version my website. And fortunately I can know the last date of <em>real</em> change of a file. This is how I do this with <a href="http://nanoc.stoneship.org">nanoc</a>:</p> <div class="codefile"><a href="/Scratch/en/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/code/gitmtime.rb">&#x27A5; gitmtime.rb</a></div> <pre><code class="ruby">def gitmtime filepath=@item.path.sub('/Scratch/','content/html/').sub(/\/$/,'') ...</code></pre> tag:yannesposito.com,2010-09-02:/Scratch/en/blog/2010-09-02-base64-and-sha1-on-iPhone/ base64 and sha1 on iPhone 2010-09-01T22:02:17Z 2010-09-01T22:02:17Z Yann Esposito yannesposito.com <p>Lets be straight: here are two functions to add to your code to have <code>base64</code> and <code>hexadecimal</code> version of the <code>sha1</code> hash of an NSString.</p> <p>To use it, simply copy the code in your class and use as this:</p> <pre><code class="objective-c">#import &lt;CommonCrypto/CommonDigest.h&gt; ... NSString *b64_hash = [self b64_sha1:@"some NSString to be sha1'ed"]; ... NSString *hex_hash = [self hex_sha1:@"some NSString to be sha1'ed"]; </code></pre> <p>The <code>base64</code> algorithm must be programmed by hand on iPhone!</p> <div class="codefile"><a href="/Scratch/en/blog/2010-09-02-base64-and-sha1-on-iPhone/code/iphone_base64_sha1.c">&#x27A5; iphone_base64_sha1.c</a></div> <pre><code class="c"> - (unsigned char *)sha1:(NSString *)baseString result:(...</code></pre> tag:yannesposito.com,2010-08-31:/Scratch/en/blog/2010-08-31-send-mail-from-command-line-with-attached-file/ send mail from command line with attached file 2010-08-31T08:16:04Z 2010-08-31T08:16:04Z Yann Esposito yannesposito.com <p>I had to send a mail using only command line. I was surprised it isn&rsquo;t straightforward at all. I didn&rsquo;t had <code>pine</code> nor <code>mutt</code> or anything like that. Just <code>mail</code> and <code>mailx</code>.</p> <p>What Internet say (via google) is</p> <pre><code class="zsh">uuencode fic.jpg fic.jpg | mail -s 'Subject' </code></pre> <p>I tried it. And it works almost each times. But for my file, it didn&rsquo;t worked. I compressed it to <code>.gz</code>, <code>.bz2</code> and <code>.zip</code>. Using <code>.bz2</code> format it worked nicely, but not with other formats. Instead of having an attached file I saw this in my email.</p> <pre> begin 664 fic.jpg M(R$O=7-R+V)I;B]E;G8@&gt;G-H"GAL&lt;STD,0H*9F]R(&QI;F4@:6X@)"@\("1X M;',@*0H@("`@9&amp;-R/20H96-H;R`D;...</pre> tag:yannesposito.com,2010-08-23:/Scratch/en/blog/2010-08-23-Now-heberged-on-heroku/ Now hosted by heroku 2010-08-23T13:05:13Z 2010-08-23T13:05:13Z Yann Esposito yannesposito.com <h1 class="first" id="now-on-herokuhttpherokucom">Now on <a href="http://heroku.com">Heroku</a></h1> <p>I now changed my hosting to <a href="http://heroku.com">Heroku</a>. I believe it will be far more reliable.</p> <p>But as you should know my website is completely static. I use <a href="http://nanoc.stoneship.org/">nanoc</a> to generate it. But here is the conf to make it work on heroku.</p> <p>The root of my files is <code>/output</code>. You only need to create a <code>config.ru</code><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> file:</p> <div class="codefile"><a href="/Scratch/en/blog/2010-08-23-Now-heberged-on-heroku/code/config.ru">&#x27A5; config.ru</a></div> <pre><code class="ruby">require 'rubygems' require 'rack' require 'rack/contrib' require 'rack-rewr...</code></pre> tag:yannesposito.com,2010-08-11:/Scratch/en/blog/2010-07-09-Indecidabilities/ Undecidabilities (part 1) 2010-08-11T08:04:31Z 2010-08-11T08:04:31Z Yann Esposito yannesposito.com <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> I pretend to create a world to give examples of different meanings behind the word <em>undecidability</em>:</p> <ul> <li>Undecidability due to measure errors, </li> <li>Big errors resulting from small initial measure error,</li> <li>Fractal undecidability&nbsp;;</li> <li>Logic Undecidability.</li> </ul> </div> </div> <div class="corps"> <h1 class="first" id="the-undecidabilities">The Undecidabilities</h1> <div class="intro"> <p>If a demiurge made our world, he certainly had a great sense of humor. After this read, you should be convinced. I&rsquo;ll pretend to be him. I&rsquo;ll create a simplified world. A world that obey to simple mathematical rules. And I&rsquo;ll tell you about one of ...</p> tag:yannesposito.com,2010-07-31:/Scratch/en/blog/2010-07-31-New-style-after-holidays/ New style after holidays 2010-07-31T21:59:10Z 2010-07-31T21:59:10Z Yann Esposito yannesposito.com <p>Before my holidays many visitors tell me my website was too long to scroll. This is why I completely changed my website design. Now all should scroll smoothly on all platforms. I was inspired by Readability and iBooks<small>&copy;</small> (the iPhone<small>&copy;</small> application).</p> <p>Tell me what you think of this new design.</p> tag:yannesposito.com,2010-07-07:/Scratch/en/blog/2010-07-07-CSS-rendering-problems-by-navigator/ Do not use CSS gradient with Chrome 2010-07-07T13:43:43Z 2010-07-07T13:43:43Z Yann Esposito yannesposito.com <p>Some <a href="http://reddit.com">Reddit</a> users reported my website was really long to load and to scroll. They thinks it was because of the &lsquo;1px shadow&rsquo; I apply on all the text. I was a bit surprised, because I make some test into a really <em>slow</em> virtual machine. And all have always worked fine. In fact, what slow down so much are by order of importance:</p> <ol> <li>Radial gradient on Chrome (not in Safari on Mac)</li> <li>Box shadows on Firefox and Chrome</li> </ol> <h2 id="gradient">Gradient</h2> <p>On Safari on Mac there is absolutely no rendering time problem. But when I use Chrome under Linux it is almost unusable.</p> <p>Safari and Chrome use webkit, when you access my website with javascript enabled, an additionnal browser specific CSS is loaded....</p> tag:yannesposito.com,2010-07-05:/Scratch/en/blog/2010-07-05-Cappuccino-and-Web-applications/ Cappuccino vs jQuery 2010-07-05T11:49:04Z 2010-07-05T11:49:04Z Yann Esposito yannesposito.com <div class="intro"> <p><abbr class="sc" title="Too long; didn't read">tl;dr</abbr>:</p> <ul> <li>Tried to make <a href="http://yannesposito.com/Softwares/YPassword.html">YPassword</a> in jQuery and with Cappuccino.</li> <li>Cappuccino nice in desktop browser but 1.4MB, not compatible with iPhone.</li> <li>jQuery not as nice as the Cappuccino version but 106KB. iPhone compatible.</li> <li>I&rsquo;ll give a try to Dashcode 3.</li> </ul> </div> <hr /> <div class="intro"> <p>Before start, I must say I know Cappuccino and jQuery are no more comparable than Cocoa and the C++ standard library. One is oriented for user interface while the other is and helper for low level programming. Nonetheless I used these two to make the same web application. This is why I compare the exp...</p></div></hr> tag:yannesposito.com,2010-06-19:/Scratch/en/blog/2010-06-19-jQuery-popup-the-easy-way/ jQuery popup the easy way 2010-06-18T22:44:50Z 2010-06-18T22:44:50Z Yann Esposito yannesposito.com <p>Here is a fast and easy way to create jQuery popup.</p> <div class="codefile"><a href="/Scratch/en/blog/2010-06-19-jQuery-popup-the-easy-way/code/essai.js">&#x27A5; essai.js</a></div> <pre><code class="javascript">// --- code popup --- function openPopup() { $(this).clone(false).appendTo($("#_code")); $("#_code").show(); } function closePopup() { $("#_code").html(""); $("#_code").hide(); } function initCode() { $(".code").click(openPopup); $(".code").css({cursor: "pointer"}); $('body').append('&lt;div id="_code"&gt;&lt;/div&gt;'); $('#_code').css( { 'text-align': "justify", position: "fixed", left:0, top:0, width: "100%", height: "100%", "background-color": "rgba(0, 0, 0, 0.8)", 'z-index':2000, 'pad...</code></pre> tag:yannesposito.com,2010-06-17:/Scratch/en/blog/2010-06-17-hide-yourself-to-analytics/ Hide Yourself to your Analytics 2010-06-17T14:37:22Z 2010-06-17T14:37:22Z Yann Esposito yannesposito.com <p>This is a way not to count your own visits to your blog. First you should look on how <a href="/Scratch/en/blog/2010-06-17-track-events-with-google-analytics">I handle analytics</a>. All analytics are handled in one javascript file, this make things really convenient.</p> <p>Then you need to know my method use the <code>jquery-cookie</code>.</p> <p>I check if the key <code>admin</code> is not set in the cookie before adding the visit.</p> <pre><code class="javascript"> var admin = $.cookie('admin'); if (! admin) { // put your analytics code here } else { console.log("[WARNING] you're HIDDEN to analytics"); } </code></pre> <p>then create two <span class="sc">html</span> files. One to hide:</p> <div class="codefile"></div> tag:yannesposito.com,2010-06-17:/Scratch/en/blog/2010-06-17-track-events-with-google-analytics/ Track Events with Google Analytics 2010-06-17T12:41:36Z 2010-06-17T12:41:36Z Yann Esposito yannesposito.com <p>Here is how to track all clicks on your website using google analytics asynchronously.</p> <p>First in your <span class="sc">html</span> you need to use <a href="http://jquery.com">jQuery</a> and a javscript file I named <code>yga.js</code>:</p> <pre><code class="html"> &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="yga.js"&gt;&lt;/script&gt; </code></pre> <p>And here is the <code>yga.js</code> file:</p> <div class="codefile"><a href="/Scratch/en/blog/2010-06-17-track-events-with-google-analytics/code/yga.js">&#x27A5; yga.js</a></div> <pre><code class="javascript">$(document).ready( function() { // add an event to all link for google analytics $('a').click(function () { // tell analytics to save ...</code></pre> tag:yannesposito.com,2010-06-15:/Scratch/en/blog/2010-06-15-Get-my-blog-engine/ Get my blog engine 2010-06-15T08:56:32Z 2010-06-15T08:56:32Z Yann Esposito yannesposito.com <p>I published a <em>light</em> version of my blog engine based on <a href="http://nanoc.stoneship.org">nanoc</a> yesterday night. By <em>light</em>, I mean a lighter, more portable CSS (without round border). You can get it on <a href="http://github.com/yogsototh/nanoc3_blog">github.com</a>.</p> <p>What this system provide?</p> <ul> <li>All <a href="http://nanoc.stoneship.org">nanoc</a> advantages,</li> <li>Easy multi-language handling,</li> <li>Syntax Coloration for most languages,</li> <li><a href="http://intensedebate.org">intenseDebate</a> comments integration (asynchronous)&nbsp;;</li> <li>Portable with and without javascript, XHTML Strict 1.0 / CSS3,</li> <li>Write in markdown format (no HTML editing needed),</li> <li>Typographic ameliorations (no &lsquo;:&rsquo; ...</li></ul> tag:yannesposito.com,2010-06-14:/Scratch/en/blog/2010-06-14-multi-language-choices/ multi language choices 2010-06-14T14:14:57Z 2010-06-14T14:14:57Z Yann Esposito yannesposito.com <p>I translate most of my blog entries in French and English. Most people advice me to have one file per language. Generally it ends with:</p> <pre class="twilight"> Bonjour, voici un exemple de texte en français. [image](url) </pre> <pre class="twilight"> Hello, here is an example of english text. [image](url) </pre> <p>This way of handling translations force you to write completely an article in one language, copy it, and translate it.</p> <p>However, most of time, there are common parts like images, source code, etc&hellip; When I want to correct some mistake on these parts, I have to make twice the work. With sometimes adding another mistake in only one language.</p> <p>This is why I preferred to handle it differently. I use <em>tags</em> on a single file. Finally my files...</p> tag:yannesposito.com,2010-05-24:/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/ Trees; Pragmatism and Formalism 2010-05-24T18:05:14Z 2010-05-24T18:05:14Z Yann Esposito yannesposito.com <div class="intro"> <p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span>: </p> <ul> <li>I tried to program a simple filter</li> <li>Was blocked 2 days</li> <li>Then stopped working like an engineer monkey</li> <li>Used a pen and a sheet of paper</li> <li>Made some math.</li> <li>Crushed the problem in 10 minutes</li> <li>Conclusion: The pragmatism shouldn&rsquo;t mean &ldquo;never use theory&rdquo;.</li> </ul> </div> <h2 id="abstract-longer-than-span-classscabbr-titletoo-long-didnt-readtldrabbr-span">Abstract (longer than <span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span>)</h2> <p>For my job, I needed to resolve a problem. It first seems not too hard. Then I started working directly on my program. I entered in the...</p> tag:yannesposito.com,2010-05-19:/Scratch/en/blog/2010-05-19-How-to-cut-HTML-and-repair-it/ How to repair a cutted XML? 2010-05-19T20:20:34Z 2010-05-19T20:20:34Z Yann Esposito yannesposito.com <p>For my main page, you can see, a list of my latest blog entry. And you have the first part of each article. To accomplish that, I needed to include the begining of the entry and to cut it somewhere. But now, I had to repair this cutted HTML.</p> <p>Here is an example:</p> <pre><code class="html">&lt;div class="corps"&gt; &lt;div class="intro"&gt; &lt;p&gt;Introduction&lt;/p&gt; &lt;/div&gt; &lt;p&gt;The first paragraph&lt;/p&gt; &lt;img src="/img/img.png" alt="an image"/&gt; &lt;p&gt;Another long paragraph&lt;/p&gt; &lt;/div&gt; </code></pre> <p>After the cut, I obtain:</p> <pre><code class="html">&lt;div class="corps"&gt; &lt;div class="intro"&gt; &lt;p&gt;Introduction&lt;/p&gt; &lt;/div&gt; &lt;p&gt;The first paragraph&lt;/p&gt; ...</code></pre> tag:yannesposito.com,2010-05-17:/Scratch/en/blog/2010-05-17-at-least-this-blog-revive/ I live again! 2010-05-17T11:25:51Z 2010-05-17T11:25:51Z Yann Esposito yannesposito.com <p>Hi all!</p> <blockquote cite="http://www.madore.org/~david/weblog/2010-05.html#d.2010-05-12.1752"> <p>The more you wait to do something, the more difficult it is to start doing it.</p> </blockquote> <p>I had to write another post for this blog. I had added many article idea in my todolist. But, I made many other things, and I&rsquo;ve always said (until now), I&rsquo;ll do this later. What changed my mind is the haunt of this simple remark about how to be productive in programming. &gt; Stop write <code>TODO</code> in your code and make it now!<br /> &gt; You&rsquo;ll be surprised by the results.</p> <p>In short: &gt; <strong>Just do it!</strong> ou <strong>Juste fait le</strong> comme auraient dit les nuls.</p> <p>Finally I&rsquo;ll certainly write blog post more often for a ...</p></p> tag:yannesposito.com,2010-03-23:/Scratch/en/blog/2010-03-23-Encapsulate-git/ Encapsulate git 2010-03-23T20:37:36Z 2010-03-23T20:37:36Z Yann Esposito yannesposito.com <div class="intro"> Here is a solution to maintain divergent branches in git. Because it is easy to merge by mistake. I give a script that encapsulate git in order to forbid some merge and warn you some merge should be dangerous. </div> <h2 id="how-to-protect-against-your-own-dumb">how to protect against your own dumb</h2> <p>I work on a project in which some of my git branches should remain divergent. And divergences should grow.</p> <p>I also use some branch to contain what is common between projects.</p> <p>Say I have some branches:</p> <p>master: common to all branches dev: branch devoted to unstable development client: branch with features for all client but not general enough for master clientA: project adapted for client A clientB: project adapted for client B</p> <p>Her...</p> tag:yannesposito.com,2010-03-22:/Scratch/en/blog/2010-03-22-Git-Tips/ Git Tips 2010-03-22T08:42:27Z 2010-03-22T08:42:27Z Yann Esposito yannesposito.com <h2 class="first" id="clone-from-github-behind-an-evil-firewall">clone from github behind an evil firewall</h2> <p>Standard:</p> <div> <pre><code class="zsh">git clone git@github.com:yogsototh/project.git </code></pre> </div> <p>Using HTTPS port:</p> <div> <pre><code class="zsh">git clone git+ssh://git@github.com:443/yogsototh/project.git </code></pre> </div> <h2 id="clone-all-branches">clone all branches</h2> <p><code>git clone</code> can only fetch the master branch.</p> <p>If you don&rsquo;t have much branches, you can simply use clone your project and then use the following command:</p> <div> <pre><code class="zsh">git branch --track local_branch remote_branch </code></pre> </div> <p>for example:</p> <div> <pre><code class="zsh">$ git clone git@github:yogsototh/examp...</code></pre></div> tag:yannesposito.com,2010-02-23:/Scratch/en/blog/2010-02-23-When-regexp-is-not-the-best-solution/ When regexp is not the best solution 2010-02-23T08:09:52Z 2010-02-23T08:09:52Z Yann Esposito yannesposito.com <p>Regular expression are really useful. Unfortunately, they are not always the best way of doing things. Particularly when transformations you want to make are easy.</p> <p>I wanted to know how to get file extension from filename the fastest way possible. There is 3 natural way of doing this:</p> <div> <pre><code class="ruby"># regexp str.match(/[^.]*$/); ext=$&amp; # split ext=str.split('.')[-1] # File module ext=File.extname(str) </code></pre> </div> <p>At first sight I believed that the regexp should be faster than the split because it could be many <code>.</code> in a filename. But in reality, most of time there is only one dot and I realized the split will be faster. But not the fastest way. There is a function dedicated to this work in the <code>File</code> module.</p> tag:yannesposito.com,2010-02-18:/Scratch/en/blog/2010-02-18-split-a-file-by-keyword/ split a file by keyword 2010-02-18T13:29:14Z 2010-02-18T13:29:14Z Yann Esposito yannesposito.com <p>Strangely enough, I didn&rsquo;t find any built-in tool to split a file by keyword. I made one myself in <code>awk</code>. I put it here mostly for myself. But it could also helps someone else. The following code split a file for each line containing the word <code>UTC</code>.</p> <div> <pre><code class="perl">#!/usr/bin/env awk BEGIN{i=0;} /UTC/ { i+=1; FIC=sprintf("fic.%03d",i); } {print $0&gt;&gt;FIC} </code></pre> </div> <p>In my real world example, I wanted one file per day, each line containing UTC being in the following format:</p> <pre class="twilight"> Mon Dec 7 10:32:30 UTC 2009 </pre> <p>I then finished with the following code:</p> <div> <pre><code class="perl">#!/usr/bin/env awk BEGIN{i=0;} /UTC/ { date=$1$2$3; if ( date != olddate ) { ...</code></pre></div> tag:yannesposito.com,2010-02-16:/Scratch/en/blog/2010-02-16-All-but-something-regexp--2-/ Pragmatic Regular Expression Exclude (2) 2010-02-16T08:33:21Z 2010-02-16T08:33:21Z Yann Esposito yannesposito.com <p>In my <a href="previouspost">previous post</a> I had given some trick to match all except something. On the same idea, the trick to match the smallest possible string. Say you want to match the string between &lsquo;a&rsquo; and &lsquo;b&rsquo;, for example, you want to match:</p> <pre class="twilight"> a.....<span class="Constant"><strong>a......b</strong></span>..b..a....<span class="Constant"><strong>a....b</strong></span>... </pre> <p>Here are two common errors and a solution:</p> <pre class="twilight"> /a.*b/ <span class="Constant"><strong>a.....a......b..b..a....a....b</strong></span>... </pre> <p>The first error is to use the <em>evil</em> <code>.*</code>. Because you will match from the first to the last.</p> <pre class="twilight"> /a.*?b/ <span class="Constant"><strong>...</strong></span></pre> tag:yannesposito.com,2010-02-15:/Scratch/en/blog/2010-02-15-All-but-something-regexp/ Pragmatic Regular Expression Exclude 2010-02-15T09:16:12Z 2010-02-15T09:16:12Z Yann Esposito yannesposito.com <p>Sometimes you cannot simply write:</p> <div> <pre><code class="ruby">if str.match(regexp) and not str.match(other_regexp) do_something </code></pre> </div> <p>and you have to make this behaviour with only one regular expression. But, there exists a major problem: the complementary of a regular language might not be regular. Then, for some expression it is absolutely impossible to negate a regular expression.</p> <p>But sometimes with some simple regular expression it should be possible<sup><a href="#note1">&dagger;</a></sup>. Say you want to match everything containing the some word say <code>bull</code> but don&rsquo;t want to match <code>bullshit</code>. Here is a nice way to do that:</p> <div> <pre><code class="ruby"># match all string containing 'bull' (bullsh...</code></pre></div>