<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">

  <title>Jerome Etienne.js Blog</title>
  
  <link href="http://blog.jetienne.com/" />
  <updated>2011-09-12T21:26:09+02:00</updated>
  <id>http://blog.jetienne.com/</id>
  <author>
    <name>Jerome Etienne</name>
    
  </author>

  
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogjetiennecom" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="blogjetiennecom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
    <title>console4Worker - console API for worker</title>
    <link href="http://blog.jetienne.com/blog/2011/09/12/console4worker/" />
    <updated>2011-09-12T09:17:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/09/12/console4worker</id>
    <content type="html">&lt;p&gt;&lt;a href="https://github.com/jeromeetienne/console4Worker"&gt;console4Worker&lt;/a&gt; is console API for WebWorkers.
WebWorkers are hard to debug. On top of that, &lt;a href="http://getfirebug.com/wiki/index.php/Console_API"&gt;console API&lt;/a&gt;
is unavailable
in WebWorkers. It doesn't help.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/jeromeetienne/console4Worker"&gt;console4Worker&lt;/a&gt;
is a simple library which tries to fill this gap.
It provides the &lt;a href="http://getfirebug.com/wiki/index.php/Console_API"&gt;console API&lt;/a&gt;
, the same api you are used to.
It implemented in most browser, node.js, even part of
&lt;a href="http://wiki.commonjs.org/wiki/Console"&gt;commonjs&lt;/a&gt;.
See the &lt;a href="https://github.com/jeromeetienne/console4Worker/blob/master/examples/index.html"&gt;demo&lt;/a&gt;
in the examples/ directory.&lt;/p&gt;

&lt;h2&gt;On the Worker Side&lt;/h2&gt;

&lt;p&gt;First you include the script with this line.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;importScripts('console4Worker-worker.js');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;And you are &lt;strong&gt;done&lt;/strong&gt;! Now you can console API as you would normally do, even if you are in a
&lt;a href="http://www.whatwg.org/specs/web-apps/current-work/complete/workers.html"&gt;webworker&lt;/a&gt;.
Lets say something like&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;console.log("console call made from inside a webworker");
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;!-- more --&gt;


&lt;h2&gt;On the Page Side&lt;/h2&gt;

&lt;p&gt;On the page side, you need to add 3 lines.
&lt;em&gt;First&lt;/em&gt; to include the script, simply do&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script src="console4Worker-page.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Then&lt;/em&gt; you bind console4Worker to your worker with another line.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// init the worker
var worker  = new Worker("worker.js");
// bind the console4Worker to get console API from worker
console4Worker.bind(worker);  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If&lt;/em&gt; you got your own message event listener, add &lt;code&gt;console4Worker.filterEvent()&lt;/code&gt; in it.
This line will filter out messages coming from console4Worker.
So you should have something like&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;worker.addEventListener('message', function(event){
    // filter this event if it is from console4Worker
    if( console4Worker.filterEvent(event) ) return;

    // ... here handle your own events
}, false);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h2&gt;Motivation&lt;/h2&gt;

&lt;p&gt;Another project of mine is &lt;a href="http://pacmaze.com"&gt;pacmaze&lt;/a&gt;.
It uses webworkers to provide smoother animations.
This is important for high fps game.
The worst which can happen is to have 50fps most of the time
but with short period at 30fps.
People want the animation to be smooth.&lt;/p&gt;

&lt;p&gt;Webworker allows to spread the load on 2 cpu core.
Thus the pick of grabage collection is distributed, and you got twice more
cpu power. So all in all, i found myself spending quite some time debugging webworker, so i
wrote console4Worker to spend less time next time :)&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;How does it work ? a console object is declared in the worker. It intercepts
all console calls and pass them to the page thread. a direct approach.
I plan to add stacktrace and thus provide more accurate informations about the
location of the call.&lt;/p&gt;

&lt;p&gt;The code is available on &lt;a href="https://github.com/jeromeetienne/console4Worker"&gt;github&lt;/a&gt;
under MIT license.
If you hit bugs, fill issues on github. Feel free to fork, modify and have fun with it :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Pacmaze Update</title>
    <link href="http://blog.jetienne.com/blog/2011/09/10/pacmaze-update/" />
    <updated>2011-09-10T12:12:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/09/10/pacmaze-update</id>
    <content type="html">&lt;p&gt;Pacmaze just got an &lt;a href="http://pacmaze.com"&gt;update&lt;/a&gt;.
it was long overdue, i admit, other matters distracted me from it.
It is good to be back on it tho.
It is version 5 now. It is a major performance update, &lt;strong&gt;5 time faster&lt;/strong&gt; in some cases.
The game is now embeddable in external pages.
Additionnaly, Packy has been renamed Pucky as a reference to the original name of pacman,
&lt;a href="http://www.google.com/search?tbm=isch&amp;amp;hl=en&amp;amp;source=hp&amp;amp;biw=1280&amp;amp;bih=644&amp;amp;q=puckman&amp;amp;gbv=2&amp;amp;oq=puckman&amp;amp;aq=f&amp;amp;aqi=&amp;amp;aql=&amp;amp;gs_sm=s&amp;amp;gs_upl=0l0l0l4562l0l0l0l0l0l0l0l0ll0l0"&gt;'Puck-Man'&lt;/a&gt;.
You can read all about the history of pacman in the &lt;a href="http://home.comcast.net/~jpittman2/pacman/pacmandossier.html"&gt;pacman dossier&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Embedded game&lt;/h2&gt;

&lt;p&gt;See an embedded version below.
Use AWSD
keys to play or play the &lt;a href="http://pacmaze.com"&gt;full page version&lt;/a&gt;.&lt;/p&gt;

&lt;center&gt;&lt;iframe src='http://pacmaze.com' width='480px' height='360px'&gt;&lt;/iframe&gt;&lt;/center&gt;




&lt;!-- more --&gt;


&lt;p&gt;The game is now embeddable in external page.
To embed the game in your own page, just do the following and tune the css to own taste.&lt;/p&gt;

&lt;p&gt;```html&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;iframe src='http://pacmaze.com' width='480px' height='360px'&amp;gt;&amp;lt;/iframe&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h2&gt;Performance boost&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Pacmaze v5&lt;/em&gt; is a major performance update, especially for macbook.
I got recently got a &lt;a href="http://www.apple.com/macbookpro/specs-13inch.html"&gt;macbook&lt;/a&gt;.
I quickly noticed &lt;a href="http://pacmaze"&gt;pacmaze&lt;/a&gt; wasn't too good on it, to say the least.
So i optimized the WebGL on this plateform.  The performance are now much better.
For Chrome, the performance went from 10fps to more than 50fps.
On Firefox, the old version got bugs and 7fps... ouch. Now known bugs are removed
and the average fps is close to 45fps.&lt;/p&gt;

&lt;p&gt;So &lt;a href="http://en.wikipedia.org/wiki/Frame_rate"&gt;fps&lt;/a&gt; on macbook is now
5 time faster! Quite a boost! Next update i plan to focus on visual effets.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>MicroCache.js - Cache Micro Library</title>
    <link href="http://blog.jetienne.com/blog/2011/09/05/microcache.js/" />
    <updated>2011-09-05T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/09/05/microcache.js</id>
    <content type="html">&lt;p&gt;&lt;strong&gt;microcache.js&lt;/strong&gt; is a micro library to handle in-memory cache. It is less than
20 lines and works in node and browser.
It is available on github &lt;a href='https://github.com/jeromeetienne/microcache.js'&gt;here&lt;/a&gt;
under &lt;a href='https://github.com/jeromeetienne/microcache.js/blob/master/MIT-LICENSE.txt'&gt;MIT license&lt;/a&gt;.
If you hit bugs, fill issues on github. Feel free to fork, modify and have fun with it :)&lt;/p&gt;

&lt;h2&gt;Install it&lt;/h2&gt;

&lt;p&gt;To install it on node&lt;/p&gt;

&lt;p&gt;```bash&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install microcache
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;To install the browser version, download it and include it like that&lt;/p&gt;

&lt;p&gt;```html&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script src="microcache.js"&amp;gt;&amp;lt;/script&amp;gt;   
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;!-- more --&gt;


&lt;h2&gt;API&lt;/h2&gt;

&lt;p&gt;To instanciate a cache, do the following. You can have as many instances you want.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var microcache = new MicroCache();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h3&gt;.get(key)&lt;/h3&gt;

&lt;p&gt;To get a cached asset which is in the cache. Each cached element has a unique
key to identify it.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;microcache.get('foo');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h3&gt;.set(key, value)&lt;/h3&gt;

&lt;p&gt;To set a element value in the cache.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;microcache.set('foo', 'bar');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h3&gt;.contains(key)&lt;/h3&gt;

&lt;p&gt;To know if a given asset is currently in the cache.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;microcache.contains('foo');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h3&gt;.values()&lt;/h3&gt;

&lt;p&gt;To return all the elements currently in the cache&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;microcache.values();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h3&gt;.getSet(key, value)&lt;/h3&gt;

&lt;p&gt;To get an element from the cache, if it isnt already present, store it then return it&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;microcache.getSet(key, value);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h2&gt;FAQ&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Q.&lt;/strong&gt; what about plain &lt;code&gt;var microcache = {}&lt;/code&gt; ? isnt this wrapper overengineering ?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A.&lt;/strong&gt;  i was thinking so too at first. but the syntax of a .getSet() without wrapper was too ugly for my taste :)
&lt;code&gt;var a = cache[key] = (cache[key] || value)&lt;/code&gt; from @floriancargoet&lt;/li&gt;
&lt;/ul&gt;

</content>
  </entry>
  
  <entry>
    <title>GoWithTheFlow.js - async flow control with a zen touch</title>
    <link href="http://blog.jetienne.com/blog/2011/07/17/gowiththeflow.js-async-flow-control-with-a-zen-touch/" />
    <updated>2011-07-17T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/07/17/gowiththeflow.js-async-flow-control-with-a-zen-touch</id>
    <content type="html">&lt;p&gt;GoWithTheFlow.js is a javascript asynchronous flow-control micro library which works &lt;strong&gt;in
node.js and in browser&lt;/strong&gt;. It allow to control how your
asynchronous code is executed, sequentially or in parallel.
Flow() is only 30lines.&lt;/p&gt;

&lt;h1&gt;How to use it&lt;/h1&gt;

&lt;p&gt;Let start with a basic example. 2 jobs run in sequence. The first job is a timeout
so the result is delivered asynchronously, and a second job is run only &lt;em&gt;after&lt;/em&gt; the
completion of the first.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Flow().seq(function(next){
    console.log("step 1: started, it will last 1sec");
    setTimeout(function(){
        console.log("step 1: 1sec expired. Step 1 completed");
        next();
    }, 1000);
}).seq(function(next){
    console.log("step 2: run after step1 has been completed");
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;It will display the following&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;step 1: started, it will last 1sec
step 1: 1sec expired. Step 1 completed
step 2: run after step1 has been completed
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- more --&gt;


&lt;h1&gt;Methods&lt;/h1&gt;

&lt;p&gt;In order to keep it as simple as possible, Flow has only 2 methods.&lt;/p&gt;

&lt;h2&gt;.seq(callback) to execute job sequentially&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.seq()&lt;/code&gt; is used to execute functions sequentially. The &lt;em&gt;callback&lt;/em&gt; parameter
will be executed only after all previous jobs are completed.
The callback signature is &lt;code&gt;callback(next, error, result)&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;next(error, result)&lt;/code&gt; is the function to call when the job is completed. &lt;em&gt;error&lt;/em&gt; is to notify an error
to the next job. &lt;em&gt;result&lt;/em&gt; to notify a result. &lt;em&gt;error&lt;/em&gt; and &lt;em&gt;result&lt;/em&gt; may be omitted, if so they are considered
equal to &lt;code&gt;undefined&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;error&lt;/code&gt; is the error send by previous jobs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;result&lt;/code&gt; is the result send by previous jobs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;for example&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Flow().seq(function(next){
    console.log("first job");
    next(null, "result1");
}).seq(function(next, error, result){    
    console.log("second job. run *after* first job");
    next();
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h2&gt;.par(callback) to execute job in parallel&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.par()&lt;/code&gt; is used to execute functions in parallel. The &lt;em&gt;callback&lt;/em&gt; parameter is the same as for &lt;code&gt;.seq()&lt;/code&gt;.
If multiple .par() are declared one after another, they are run in parallel. The first &lt;code&gt;.seq()&lt;/code&gt; after them
will receive all the &lt;em&gt;error&lt;/em&gt; and &lt;em&gt;result&lt;/em&gt; in Array. One array item per previous &lt;code&gt;.par()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for example&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Flow().par(function(next){
    console.log("job foo");
    next(null, "foo");
}).par(function(next){
    console.log("job bar");
    next(null, "bar");
}).seq(function(next, errors, results){
    console.log("job run *after* the completion of foo and bar");
    console.assert(errors.length == 2 &amp;amp;&amp;amp; errors[0] === null &amp;amp;&amp;amp; errors[1] == null)
    console.assert(results.length == 2 &amp;amp;&amp;amp; results[0] === 'foo' &amp;amp;&amp;amp; results[1] == 'bar')
    next();
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;That's it&lt;/p&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;GoWithTheFlow.js is available on github &lt;a href='https://github.com/jeromeetienne/gowiththeflow.js'&gt;here&lt;/a&gt;
under &lt;a href='https://github.com/jeromeetienne/gowiththeflow.js/blob/master/MIT-LICENSE.txt'&gt;MIT license&lt;/a&gt;.
If you hit bugs, fill issues on github.
Feel free to fork, modify and have fun with it :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Javascript Class Inheritance ala vapor.js in 3 lines</title>
    <link href="http://blog.jetienne.com/blog/2011/07/10/javascript-class-inheritance-ala-vaporjs-in-3-lines/" />
    <updated>2011-07-10T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/07/10/javascript-class-inheritance-ala-vaporjs-in-3-lines</id>
    <content type="html">&lt;p&gt;This post describes a standalone way to add class inheritance in your javascript code.
We will do that ala &lt;a href="https://github.com/madrobby/vapor.js"&gt;vapor.js&lt;/a&gt;, so no
dependancy or external framework. A vaporjs inheritance is only 3 lines!&lt;/p&gt;

&lt;p&gt;Lets get started, say you got a class &lt;em&gt;animal&lt;/em&gt;. It gonna have a constructor and a
method &lt;em&gt;talk&lt;/em&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var Animal = function(opts){}
Animal.prototype.talk   = function(){ return 'mumble';  }
Animal.prototype.sleep  = function(){ return 'zzzzz';   }
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- more --&gt;


&lt;h1&gt;How to write the inheritance&lt;/h1&gt;

&lt;p&gt;Now let write a &lt;em&gt;Cat&lt;/em&gt; class which inherits from &lt;em&gt;Animal&lt;/em&gt;. It will override the animal
method &lt;em&gt;talk&lt;/em&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var Cat = function(opts){
    // call the parent class constructor (one line)
    Animal.call(this, opts)
}

// inherit from Animal methods (two lines)
Cat.prototype = new Animal();
Cat.prototype.constructor = Animal;

// override talk method
Cat.prototype.talk = function(){
    return "maow"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So a vaporjs inheritance is only 3 lines!&lt;/p&gt;

&lt;h1&gt;Lets test methods override&lt;/h1&gt;

&lt;p&gt;Now lets test the result of all this&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var cat = new Cat()
console.log("cat sleep as ", cat.sleep());
console.log("cat talk as ", cat.talk());
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will display&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat sleep as zzzzz
cat talk as maow
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So &lt;code&gt;.talk()&lt;/code&gt; is actually overridden, and .sleep() is properly passed to the parent class &lt;em&gt;Animal&lt;/em&gt;.&lt;/p&gt;

&lt;h1&gt;Lets test instanceOf semantic&lt;/h1&gt;

&lt;p&gt;Last but not least, the &lt;a href="https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/instanceof"&gt;instanceOf&lt;/a&gt;
operator which is so important for javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;console.log("Cat instanceof Cat", cat instanceof Cat);
console.log("Cat instanceof Animal", cat instanceof Animal);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;will display&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Cat instanceof Cat true
Cat instanceof Animal true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So &lt;code&gt;cat&lt;/code&gt; object is an instance of the class &lt;em&gt;Cat&lt;/em&gt; and of the class &lt;em&gt;Animal&lt;/em&gt; which is the good
semantic for &lt;em&gt;instanceOf&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That's all folks. have fun.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Parisjs 7 slides</title>
    <link href="http://blog.jetienne.com/blog/2011/05/26/Parisjs-7-slides/" />
    <updated>2011-05-26T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/05/26/Parisjs-7-slides</id>
    <content type="html">&lt;p&gt;&lt;a href="http://parisjs.org"&gt;parisjs #7&lt;/a&gt; was fun as always. I did a flash talk
on &lt;a href="https://github.com/jeromeetienne/shorttag.js"&gt;shorttag.js&lt;/a&gt; and presented what
i did on &lt;a href="http://pacmaze.com"&gt;pacmaze&lt;/a&gt; &lt;a href="http://buddymaze.com"&gt;experiment&lt;/a&gt; this month. Here
are the slides i used.&lt;/p&gt;

&lt;center&gt;
    &lt;iframe src="https://docs.google.com/present/embed?id=dhng4bgf_66dbnvxjch" frameborder="0" width="410" height="342"&gt;&lt;/iframe&gt;
&lt;/center&gt;


&lt;p&gt;Btw ryah is coming to paris on june 8th, &lt;a href="http://parisnodemeetup.eventbrite.com/"&gt;register&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Webgl London Meeting</title>
    <link href="http://blog.jetienne.com/blog/2011/05/25/Webgl-london-meeting/" />
    <updated>2011-05-25T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/05/25/Webgl-london-meeting</id>
    <content type="html">&lt;p&gt;Yesterday, the first london webgl meeting happened!
people interested in webgl all in a same place and time, it was nice.
see reports &lt;a href="http://learningwebgl.com/blog/?p=3770"&gt;here&lt;/a&gt;
and &lt;a href="http://mozillalabs.com/blog/2011/05/london-webgl-meetup-yesterday/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I talked about &lt;a href="http://pacmaze.com"&gt;pacmaze&lt;/a&gt; &lt;a href="http://buddymaze.com"&gt;experiment&lt;/a&gt;, here
are the slides i used.&lt;/p&gt;

&lt;center&gt;
    &lt;iframe src="https://docs.google.com/present/embed?id=dhng4bgf_65dcvz5hfd" frameborder="0" width="410" height="342"&gt;&lt;/iframe&gt;
&lt;/center&gt;


&lt;p&gt;A nice picture from &lt;a href="http://twitter.com/#!/tbx"&gt;@tbx&lt;/a&gt;. I love the packy checking on me while im presenting him to
audience :) reccursive gamification ftw!&lt;/p&gt;

&lt;center&gt;
    &lt;a href="http://www.flickr.com/photos/tobimcfly/5758181812/" title="Jerome Etienne showing pacmaze.com by tobimcfly, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3229/5758181812_76c5ecee80.jpg" width="500" height="375" alt="Jerome Etienne showing pacmaze.com"&gt;&lt;/a&gt;
&lt;/center&gt;

</content>
  </entry>
  
  <entry>
    <title>cancelRequestAnimationFrame() For Paul Irish requestAnimationFrame()</title>
    <link href="http://blog.jetienne.com/blog/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame/" />
    <updated>2011-05-18T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame</id>
    <content type="html">&lt;p&gt;&lt;a href="http://paulirish.com/"&gt;Paul Irish&lt;/a&gt; recently
wrote &lt;a href="http://paulirish.com/2011/requestanimationframe-for-smart-animating/"&gt;requestAnimationFrame for smart animating&lt;/a&gt;.
It is a polyfill so people can start use requestAnimationFrame() today and still be future proof.&lt;/p&gt;

&lt;p&gt;This post is about its counterpart,
&lt;a href="http://webstuff.nfshost.com/anim-timing/Overview.html#cancelRequestAnimationFrame"&gt;cancelRequestAnimFrame()&lt;/a&gt;.
It cancels a &lt;a href="http://webstuff.nfshost.com/anim-timing/Overview.html#requestAnimationFrame"&gt;requestAnimationFrame()&lt;/a&gt;,
like &lt;a href="https://developer.mozilla.org/en/DOM/window.clearTimeout"&gt;clearTimeout&lt;/a&gt;
cancels a &lt;a href="https://developer.mozilla.org/en/DOM/window.setTimeout"&gt;setTimeout&lt;/a&gt;.&lt;/p&gt;

&lt;!-- more --&gt;


&lt;h2&gt;Step 1: how to get the code&lt;/h2&gt;

&lt;p&gt;First include the &lt;code&gt;cancelRequestAnimFrame()&lt;/code&gt; code in your page.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;window.cancelRequestAnimFrame = ( function() {
    return window.cancelAnimationFrame          ||
        window.webkitCancelRequestAnimationFrame    ||
        window.mozCancelRequestAnimationFrame       ||
        window.oCancelRequestAnimationFrame     ||
        window.msCancelRequestAnimationFrame        ||
        clearTimeout
} )();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;Add &lt;code&gt;requestAnimFrame()&lt;/code&gt; too. It is a slightly modified version of
&lt;a href="http://paulirish.com/2011/requestanimationframe-for-smart-animating/"&gt;paul's&lt;/a&gt;
to return setTimeout() handle.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;window.requestAnimFrame = (function(){
    return  window.requestAnimationFrame       || 
        window.webkitRequestAnimationFrame || 
        window.mozRequestAnimationFrame    || 
        window.oRequestAnimationFrame      || 
        window.msRequestAnimationFrame     || 
        function(/* function */ callback, /* DOMElement */ element){
            return window.setTimeout(callback, 1000 / 60);
        };
})();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h2&gt;Step 2: how to use it&lt;/h2&gt;

&lt;p&gt;Here is a possible way to use it.
&lt;strong&gt;&lt;em&gt;Show, dont tell&lt;/em&gt;&lt;/strong&gt;, here is a &lt;a href="http://jsfiddle.net/ghjKC/3/"&gt;live demo&lt;/a&gt; on jsfiddle&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// to store the request
var request;

// start and run the animloop
(function animloop(){
  render();
  request = requestAnimFrame(animloop, element);
})();

// cancelRequestAnimFrame to stop the loop in 1 second
setTimeout(function(){
    cancelRequestAnimFrame(request);                
}, 1*1000)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;h2&gt;About requestAnimationFrame&lt;/h2&gt;

&lt;p&gt;In the past months, much has been done for web graphics. Among them,
&lt;a href="http://webstuff.nfshost.com/anim-timing/Overview.html"&gt;requestAnimationFrame()&lt;/a&gt;
is used to make smoother animation while not wasting useless
rescources when not visible.
The &lt;a href="http://webstuff.nfshost.com/anim-timing/Overview.html"&gt;spec&lt;/a&gt; is making good
progress, and &lt;a href="http://dev.chromium.org/developers/design-documents/requestanimationframe-implementation"&gt;several&lt;/a&gt;
&lt;a href="https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame"&gt;implementations&lt;/a&gt; are already deployed.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>a trip to html5 and game - talk at parisjs</title>
    <link href="http://blog.jetienne.com/blog/2011/04/28/trip-to-html5-and-game-talk-at-parisjs-6/" />
    <updated>2011-04-28T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/28/trip-to-html5-and-game-talk-at-parisjs-6</id>
    <content type="html">&lt;p&gt;Yesterday i was at &lt;a href="http://parisjs.org"&gt;parisjs&lt;/a&gt; talking about html5 and game.
I presented games from the &lt;a href="http://blog.jetienne.com/2011/04/20/pacmaze-v2-even-more-WebGL-in-pacman.html"&gt;Pacmaze&lt;/a&gt;
&lt;a href="http://blog.jetienne.com/2011/04/13/pacmaze-v1-release.html"&gt;Experiment&lt;/a&gt; and talked about html5 technology in it.
Here are the slides i used.&lt;/p&gt;

&lt;center&gt;
&lt;iframe src="https://docs.google.com/present/embed?id=dhng4bgf_63gks3skcf" frameborder="0" width="410" height="342"&gt;&lt;/iframe&gt;
&lt;/center&gt;

</content>
  </entry>
  
  <entry>
    <title>Buddymaze - First Personn Shooter in WebGL</title>
    <link href="http://blog.jetienne.com/blog/2011/04/28/buddymaze-fps-in-webgl/" />
    <updated>2011-04-28T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/28/buddymaze-fps-in-webgl</id>
    <content type="html">&lt;p&gt;&lt;a href="http://buddymaze.com"&gt;Buddymaze&lt;/a&gt; is a clone of
&lt;a href="http://en.wikipedia.org/wiki/MIDI_Maze"&gt;midimaze&lt;/a&gt;, an old game
where people shoot at each other.
You can find it as &lt;a href="http://buddymaze.com"&gt;standalone webapp&lt;/a&gt; or in
&lt;a href="https://chrome.google.com/webstore/detail/hpplggoofiffhijgnmnbgcppfafcmljp"&gt;chrome web store&lt;/a&gt;.
This is the second game in the &lt;a href="http://blog.jetienne.com/2011/04/13/pacmaze-v1-release.html"&gt;pacmaze experiment announced here&lt;/a&gt;&lt;/a&gt;,
the first one being &lt;a href="http://pacmaze.com"&gt;pacmaze&lt;/a&gt;.
This version is rather rought, i will keep you updated. Considere it as a early beta.&lt;/p&gt;

&lt;center&gt;
&lt;iframe width="425" height="349" src="http://www.youtube.com/embed/OvmuNhkV5aQ" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;/center&gt;



</content>
  </entry>
  
  <entry>
    <title>Pacmaze v2 - Event More WebGL in Pacman</title>
    <link href="http://blog.jetienne.com/blog/2011/04/20/pacmaze-v2-even-more-WebGL-in-pacman/" />
    <updated>2011-04-20T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/20/pacmaze-v2-even-more-WebGL-in-pacman</id>
    <content type="html">&lt;p&gt;&lt;a href='http://pacmaze.com' target='_blank'&gt;Pacmaze&lt;/a&gt; v2 is the second version of pacmaze
in the &lt;a href='http://blog.jetienne.com/2011/04/13/pacmaze-v1-release.html'&gt;pacmaze experiment announced here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Compared to &lt;a href='http://pacmaze1.jetienne.com' target='_blank'&gt;pacmaze v1&lt;/a&gt;, it provides &lt;strong&gt;much nicer 3D effects&lt;/strong&gt; with
lot of camera moves. Use &lt;em&gt;pageUp/pageDown&lt;/em&gt; or &lt;em&gt;C/V&lt;/em&gt; keys to change the camera positions. It is a little easier
on the user too. In case you dont have WebGL, you may watch a screencast... better than the original
with a alert(), couch :) Show, dont tell, here is the screencast&lt;/p&gt;

&lt;center&gt;
&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/9_ZtsK4rU4g" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;/center&gt;


&lt;p&gt;Other improvements were done this week, but they were either not yet ready or not visible on the screen...
According to &lt;em&gt;pacmaze experiment&lt;/em&gt; &lt;a href='http://blog.jetienne.com/2011/04/13/pacmaze-v1-release.html'&gt;schedule&lt;/a&gt;, i should
release a new game every 2 weeks, so another game is due next wednesday.
&lt;a href='http://pacmaze.com' target='_blank'&gt;Pacmaze&lt;/a&gt; v2 is just an improvement of last week
release.&lt;/p&gt;

&lt;h2&gt;tl;dr;&lt;/h2&gt;

&lt;p&gt;Pacmaze is a pacman in WebGL. You are a pacman trapped in a maze.
You need to eat all the pills to get out, and avoid the ghosts in the
process. Well... you known pacman.
You can find it as &lt;a href="http://pacmaze.com"&gt;standalone webapp&lt;/a&gt; or in
&lt;a href="https://chrome.google.com/webstore/detail/ggeliggglgbhachnoljoieibaneidchi"&gt;chrome web store&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>wget thinks github.com is a threat</title>
    <link href="http://blog.jetienne.com/blog/2011/04/15/wget-thinks-github.com-is-a-threat/" />
    <updated>2011-04-15T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/15/wget-thinks-github.com-is-a-threat</id>
    <content type="html">&lt;p&gt;This is just a little post on a oddity. As a coder, i use &lt;a href="http://github.com"&gt;github&lt;/a&gt;
and &lt;a href="http://www.gnu.org/software/wget/"&gt;wget&lt;/a&gt; everyday or close. When i do, i
see this message.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ wget https://github.com/jeromeetienne/nmod/raw/master/nmod
...
ERROR: certificate common name `*.github.com' doesn't match requested
host name `github.com'.
To connect to github.com insecurely, use `--no-check-certificate'.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This message puzzles me quite a bit...
&lt;a href="http://www.gnu.org/software/wget/"&gt;wget&lt;/a&gt;
thinks
&lt;strong&gt;&lt;em&gt;&lt;a href="http://github.com"&gt;github&lt;/a&gt;
is a threat&lt;/em&gt;&lt;/strong&gt; ... and requires an explicit action
from you (adding &lt;code&gt;--no-check-certificate&lt;/code&gt;) to be sure you are willing to take this &lt;strong&gt;&lt;em&gt;risk&lt;/em&gt;&lt;/strong&gt; .
The risk of downloading files from github... ok lets admit it, &lt;strong&gt;&lt;em&gt;this is ridiculous&lt;/em&gt;&lt;/strong&gt;.
&lt;a href="http://www.gnu.org/software/wget/"&gt;wget&lt;/a&gt; distrusting &lt;a href="http://github.com"&gt;github&lt;/a&gt; is
like ... &lt;a href="http://en.wikipedia.org/wiki/Ls"&gt;ls&lt;/a&gt; distrusting &lt;a href="http://en.wikipedia.org/wiki/Cd_(command)"&gt;cd&lt;/a&gt; :)&lt;/p&gt;

&lt;p&gt;According to github, &lt;a href="http://support.github.com/discussions/site/2507-error-certificate-common-name-githubcom-doesnt-match-requested-host-name-githubcom"&gt;this is actually a wget bug which has been reported and fixed but not release&lt;/a&gt;
, and point to a &lt;a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=409938"&gt;bug from 2007&lt;/a&gt;!!!!
Dunno if this is true, or who is at the best place to fix the issue... and the purpose of this post
is not to do finger pointing.&lt;/p&gt;

&lt;p&gt;Lets note that everybody is from open source world here.
wget is from gnu, not only under gpl, but
&lt;a href="http://en.wikipedia.org/wiki/Wget#Authors_and_copyright"&gt;even got his copyright assigned to fsf&lt;/a&gt;.
What to say about github and opensource ? well they got &lt;a href="https://github.com/blog/685-one-million-repositories"&gt;millions of
repositories&lt;/a&gt;
and most of them are open source software.&lt;/p&gt;

&lt;p&gt;This post is not meant to be a rant. More to put the light on an oddity. something that i see
as a &lt;code&gt;symptom of communication issue&lt;/code&gt; in the opensource community.&lt;/p&gt;

&lt;p&gt;Let do better! :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>jquery.acewidget - a jQuery plugin to easily embed ace</title>
    <link href="http://blog.jetienne.com/blog/2011/04/15/jquery.acewidget-a-jquery-plugin-to-easily-embed-ace/" />
    <updated>2011-04-15T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/15/jquery.acewidget-a-jquery-plugin-to-easily-embed-ace</id>
    <content type="html">&lt;h1&gt;AceWidget jQuery Plugin&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/jeromeetienne/acewidget/tree/master/contrib/jquery.acewidget"&gt;jquery.acewidget.js&lt;/a&gt; is a
jQuery plugin for &lt;a href="https://github.com/jeromeetienne/acewidget"&gt;acewidget&lt;/a&gt;.
AceWidget is a widget which make &lt;a href="http://mozillalabs.com/skywriter/2011/01/18/mozilla-skywriter-has-been-merged-into-ace/"&gt;ace&lt;/a&gt;
/&lt;a href="https://mozillalabs.com/blog/2009/02/introducing-bespin/"&gt;bespin&lt;/a&gt; trivial to embed in your pages. The Vision is to be
super simple to embed and have no server to setup. It provides the whole official embeded api. The
code is available on github under MIT license. That's it. No fuss no muss.&lt;/p&gt;

&lt;p&gt;Show dont tell, a &lt;a href="http://jeromeetienne.github.com/acewidget/demo.html"&gt;demo of acewidget&lt;/a&gt; and a
&lt;a href="http://jeromeetienne.github.com/acewidget/contrib/jquery.acewidget/test.html"&gt;example of jquery.acewidget&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How to use it&lt;/h2&gt;

&lt;p&gt;First you include the plugin itself in a usual script&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script type="text/javascript" src='jquery.acewidget.js'&amp;gt;&amp;lt;/script&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then create a DOM element which gonna contains ace widget, say a div&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="editor"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then you create the ace widget in this container by&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var acewidget = jQuery('#editor').acewidget();
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- more --&gt;


&lt;p&gt;You wait until it is loaded in your DOM&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;acewidget.bind('load', function(){
    /* you start using it here */
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After that you use it with the normal ace API&lt;/p&gt;

&lt;h2&gt;API&lt;/h2&gt;

&lt;h3&gt;to set a new text&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;acewidget.setValue("foobar", function(){
alert("setValue "+result.status)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The callback is optional' and notified when the action is completed.
It is &lt;a href="http://labs.omniti.com/labs/jsend/wiki"&gt;jsend compatible&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;to get the current text&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;acewidget.getValue(function(result){
    alert("getValue "+result.status+" text:"+result.data.data)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;to set the tab size&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;acewidget.setTabSize(8, function(result){
    alert("setTabSize "+result.status)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;to be notified when the acewidget is loaded&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;acewidget.bind('load', function(){
    alert('acewidget is loaded')
})
&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  
  <entry>
    <title>Pacmaze V1 - a Pacman in WebGL</title>
    <link href="http://blog.jetienne.com/blog/2011/04/13/pacmaze-v1-release/" />
    <updated>2011-04-13T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/13/pacmaze-v1-release</id>
    <content type="html">&lt;h2&gt;tl;dr;&lt;/h2&gt;

&lt;p&gt;Pacmaze v1 is a pacman in WebGL. You are a pacman trapped in a maze.
You need to eat all the pills to get out, and avoid the ghosts in the
process. Well... you known pacman.
You can find it as &lt;a href="http://pacmaze.com"&gt;standalone webapp&lt;/a&gt; or in
&lt;a href="https://chrome.google.com/webstore/detail/ggeliggglgbhachnoljoieibaneidchi"&gt;chrome web store&lt;/a&gt;.
Pacmaze v1 is the first game of &lt;em&gt;the pacmaze experiment&lt;/em&gt;. Show, dont tell, here is a screencast&lt;/p&gt;

&lt;center&gt;
&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/9_ZtsK4rU4g" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;/center&gt;


&lt;h2&gt;Pacmaze Experiment&lt;/h2&gt;

&lt;p&gt;What is it ?
&lt;strong&gt;The pacmaze experiment&lt;/strong&gt; is the fancy name for &lt;em&gt;my trip discovering gamedev field&lt;/em&gt;.
It is an experiment i wish to try. The rule is simple.
During 4 months, i am commited to work in a &lt;em&gt;publish early, publish often&lt;/em&gt; mode.
Twice a month, i will publish a new game, or a significant improvement of a
previous one, on the second and the fourth wednesday of each month.
Pacmaze V1 being the first of the serie.&lt;/p&gt;

&lt;p&gt;This is the current plan... I know the schedule is tight, but this
is part of the challenge. We will see how it goes along the road.&lt;/p&gt;

&lt;!-- more --&gt;


&lt;h2&gt;Pacmaze Experiment Origin&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://pacmaze0.jetienne.com"&gt;Pacmaze v0&lt;/a&gt; was the first
&lt;a href="http://en.wikipedia.org/wiki/First-person_shooter#Multiplayer"&gt;multi-player first person shooter&lt;/a&gt;
using html5 power with &lt;a href="http://en.wikipedia.org/wiki/WebGL"&gt;WebGL&lt;/a&gt;
and &lt;a href="http://en.wikipedia.org/wiki/WebSockets"&gt;WebSockets&lt;/a&gt;.
It started on 14 march 2011 with a &lt;a href="http://blog.jetienne.com/Pacmaze%20Experiment/2011/03/21/pacmaze-v0-origin.html"&gt;36h code rush&lt;/a&gt;.
It was a &lt;a href="http://en.wikipedia.org/wiki/Proof_of_concept"&gt;proof-of-concept&lt;/a&gt;.
Its purpose was to know if the needed technology was available on today browsers.
&lt;em&gt;Good news! it is&lt;/em&gt; :)&lt;/p&gt;

&lt;p&gt;Obviously to code a &lt;a href="http://en.wikipedia.org/wiki/First-person_shooter"&gt;multiplayer fps&lt;/a&gt; in 36h,
you have to cut a lot of corners.
&lt;a href="http://pacmaze0.jetienne.com"&gt;Pacmaze v0&lt;/a&gt; is ugly and got a crappy gameplay.
Additionnaly, a code rush was nice and fancy but it doesnt produce a stable code base.
I ended with a program which has been hacked rapidely. On top i was a beginner in
the &lt;a href="http://en.wikipedia.org/wiki/Video_game_development"&gt;gamedev&lt;/a&gt; field.
So i spent some time to refactor the code from 36h hack to something more stable.&lt;/p&gt;

&lt;p&gt;I did many visual enhancements, improved the gameplay quite a bit... and then
you got &lt;a href="http://pacmaze.com"&gt;Pacmaze v1&lt;/a&gt;. have fun :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>jquery.qrcode - jquery plugin for pure browser qrcode generation</title>
    <link href="http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode/" />
    <updated>2011-04-07T00:00:00+02:00</updated>
    <id>http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode</id>
    <content type="html">&lt;p&gt;&lt;a href='http://jeromeetienne.github.com/jquery-qrcode'&gt;jquery.qrcode.js&lt;/a&gt;
is &lt;em&gt;jquery plugin for a pure browser qrcode generation&lt;/em&gt;.
It allow you to easily add qrcode to your webpages.
It is standalone, less than 4k after minify+gzip, no image download.
It doesnt rely on external services which go on and off, or add latency while loading.
It is based on a &lt;a href='http://www.d-project.com/qrcode/index.html'&gt;library&lt;/a&gt;
which build qrcode in various language. &lt;a href='http://jeromeetienne.github.com/jquery-qrcode'&gt;jquery.qrcode.js&lt;/a&gt; wraps
it to make it easy to include in your own code.&lt;/p&gt;

&lt;p&gt;Show, dont tell, here is a &lt;a href='http://jeromeetienne.github.com/jquery-qrcode/examples/basic.html'&gt;example&lt;/a&gt;&lt;/p&gt;

&lt;!-- more --&gt;


&lt;h2&gt;How to Use It&lt;/h2&gt;

&lt;p&gt;Let me walk you thru it. First include it in your webpage with the usual script tag&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script type="text/javascript" src="jquery.qrcode.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then create a DOM element which gonna contains the generated qrcode image. Lets say
a div&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="qrcode"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then you add the &lt;em&gt;qrcode&lt;/em&gt; in this container by&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;jquery('#qrcode').qrcode("this plugin is great");
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is it. see it &lt;a href='http://jeromeetienne.github.com/jquery-qrcode/examples/basic.html'&gt;live&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;&lt;a href='http://jeromeetienne.github.com/jquery-qrcode'&gt;jquery.qrcode.js&lt;/a&gt; is available on github
&lt;a href='https://github.com/jeromeetienne/jquery-qrcode'&gt;here&lt;/a&gt;
under &lt;a href='https://github.com/jeromeetienne/jquery-qrcode/blob/master/MIT-LICENSE.txt'&gt;MIT license&lt;/a&gt;.
If you hit bugs, fill issues on github.
Feel free to fork, modify and have fun with it :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>MicroEvent.js - micro event emitter in 20 lines</title>
    <link href="http://blog.jetienne.com/blog/2011/03/22/microeventjs/" />
    <updated>2011-03-22T00:00:00+01:00</updated>
    <id>http://blog.jetienne.com/blog/2011/03/22/microeventjs</id>
    <content type="html">&lt;p&gt;&lt;em&gt;MicroEvent.js&lt;/em&gt; is a event emitter library which provides the
&lt;a href="http://en.wikipedia.org/wiki/Observer_pattern"&gt;observer pattern&lt;/a&gt; to javascript objects.
It works on node.js and browser. It is a single .js file containing
a &lt;a href="https://github.com/jeromeetienne/microevent.js/blob/master/microevent.js#L12-31"&gt;20 lines class&lt;/a&gt;
for a total of 321-bytes after minification+gzip.&lt;/p&gt;

&lt;h2&gt;How to Use It&lt;/h2&gt;

&lt;p&gt;You need a single file &lt;a href="https://github.com/jeromeetienne/microevent.js/raw/master/microevent.js"&gt;microevent.js&lt;/a&gt;.
Include it in a webpage via the usual script tag.&lt;/p&gt;

&lt;p&gt;```html&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script src="microevent.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;To include it in a nodejs code isnt much harder&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var MicroEvent = require('./microevent.js')
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;Now suppose you got a class &lt;code&gt;Foobar&lt;/code&gt;, and you wish it to support the observer partern. do&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MicroEvent.mixin(Foobar)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;!-- more --&gt;


&lt;p&gt;That's it. The repository contains an &lt;a href="https://github.com/jeromeetienne/microevent.js/blob/master/examples/example.html"&gt;example in browser&lt;/a&gt;
and an &lt;a href="https://github.com/jeromeetienne/microevent.js/blob/master/examples/example.js"&gt;example in nodejs&lt;/a&gt;.
Both use the same code in different contexts. Let me walk you thru it.&lt;/p&gt;

&lt;h2&gt;Example&lt;/h2&gt;

&lt;p&gt;First we define the class which going to use MicroEvent.js. This is a ticker, it is
triggering 'tick' events every second, and add the current date as parameter&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var Ticker = function(){
    var self = this;
    setInterval(function(){
        self.trigger('tick', new Date());
    }, 1000);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;We mixin &lt;em&gt;MicroEvent&lt;/em&gt; into &lt;em&gt;Ticker&lt;/em&gt; and we are all set.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MicroEvent.mixin(Ticker);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;Now lets actually use the &lt;em&gt;Ticker&lt;/em&gt; Class. First, create the object.&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ticker = new Ticker();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;and bind our &lt;em&gt;tick&lt;/em&gt; event with its data parameter&lt;/p&gt;

&lt;p&gt;```javascript&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ticker.bind('tick', function(date) {
    console.log('notified date', date);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;And you will see this output:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;notified date Tue, 22 Mar 2011 14:43:41 GMT
notified date Tue, 22 Mar 2011 14:43:42 GMT
...
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Motivation&lt;/h2&gt;

&lt;p&gt;I needed a event emitter in js... something generic which works on browser and server, cross browser. The solutions i
found were too complex for my taste.&lt;/p&gt;

&lt;p&gt;When i have seen John Resig &lt;a href="http://ejohn.org/blog/javascript-micro-templating/"&gt;micro templating&lt;/a&gt;
or &lt;a href='http://ejohn.org/blog/simple-javascript-inheritance/'&gt;simple inheritance&lt;/a&gt;, i loved it. It is
simple, short, self contained, easy to understand... so &lt;strong&gt;elegant&lt;/strong&gt;. i thought "this is no more a dependancy
because i could maintain it if needed". Now i try to apply those principles to my own work.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;MicroEvent.js is available on github &lt;a href='https://github.com/jeromeetienne/microevent.js'&gt;here&lt;/a&gt;
under &lt;a href='https://github.com/jeromeetienne/microevent.js/blob/master/MIT-LICENSE.txt'&gt;MIT license&lt;/a&gt;.
If you hit bugs, fill issues on github.
Feel free to fork, modify and have fun with it :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Pacmaze V0 - First multi-player first person shooter on html5</title>
    <link href="http://blog.jetienne.com/blog/2011/03/21/pacmaze-v0-origin/" />
    <updated>2011-03-21T00:00:00+01:00</updated>
    <id>http://blog.jetienne.com/blog/2011/03/21/pacmaze-v0-origin</id>
    <content type="html">&lt;p&gt;Last week, i started to do gamedev.
During a code rush, i did pacmaze v0 in &lt;em&gt;36h!!!&lt;/em&gt; Then i slept a lot and published it as
&lt;a href="https://chrome.google.com/webstore/detail/ggeliggglgbhachnoljoieibaneidchi"&gt;chrome application&lt;/a&gt;
(This way, i didnt have to care about cross-browser compatbility out of time and lazyness i admit :)&lt;/p&gt;

&lt;p&gt;Pacmaze v0 is a &lt;a href="http://en.wikipedia.org/wiki/First-person_shooter"&gt;multi-player first person shooter&lt;/a&gt;.
Everybody joins in the same maze, and they shoot at each other. Lets the best win... except
that nobody dies because i forgot to code death :)&lt;/p&gt;

&lt;p&gt;To my knowledge, Pacmaze v0 is the first
&lt;a href="http://en.wikipedia.org/wiki/First-person_shooter#Multiplayer"&gt;multi-player first person shooter&lt;/a&gt;
using html5 power with &lt;a href="http://en.wikipedia.org/wiki/WebGL"&gt;WebGL&lt;/a&gt;
and &lt;a href="http://en.wikipedia.org/wiki/WebSockets"&gt;WebSockets&lt;/a&gt;.
You can find the game as standalone &lt;a href="http://pacmaze0.jetienne.com"&gt;here&lt;/a&gt;. have fun. I certainly
had fun writing it :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Initial Post</title>
    <link href="http://blog.jetienne.com/blog/2011/03/10/initial-post/" />
    <updated>2011-03-10T00:00:00+01:00</updated>
    <id>http://blog.jetienne.com/blog/2011/03/10/initial-post</id>
    <content type="html">&lt;p&gt;Trying to blog again. Here is my first post.&lt;/p&gt;

&lt;p&gt;Up to now i didnt considere my blogging seriously. My blog posts were kinda PostIts to me, some random texts
that i have written not to forget. So the targeted reader was me, and if it helps people outthere, all for
the best, but not the primary purpose.&lt;/p&gt;

&lt;p&gt;This blog is using &lt;a href="http://jekyllrb.com/"&gt;jekyll&lt;/a&gt; and will be hosted at &lt;a href="http://notes.jetienne.com"&gt;notes.jetienne.com&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
</feed>

