samedi 24 août 2013

Installer virtual box sur la debian 7.1 Wheezy

Je rédige ce petit billet car j'ai eu quelques difficultés à installer virtualbox sur ma debian wheezy.

En passant par le gestionnaire de paquets j'ai récupéré ces messages d'erreurs au moment où j'ai voulu démarrer une VM XP

Virtualbox, Kernel driver not installed (rc=-1908) 

Après quelques lectures il s'avère necessaire d'installer virtualbox-ose-guest-dkms qui necessite lui-même les headers de linux.

Un lien pour mieux comprendre le rôle des DKMS.

On commence donc par installer les headers

 apt-get install linux-headers-$(uname -r)

Puis ensuite installer virtualbox en ajoutant le package virtualbox-ose-guest-dkms


apt-get install virtualbox virtualbox-dkms virtualbox-ose-guest-dkms virtualbox-guest-utils virtualbox-guest-additions virtualbox-qt

Ensuite plus de soucis virtual box fonctionne bien avec XP.

jeudi 22 août 2013

Learn multiplication tables with Space invader !


Type the alien value and press enter to kill it. Level more options below
Sorry, your browser is not supported. Update your browser : IE 9 or greater, Any versions of Chrome, Firefox 2 or greater, Opera 9 or greater. Updtating your browser improve also the security
2 3 4 5 6 7 8 9 10

lundi 19 août 2013

What's the role of save and restore in canvas context

When I started to work with canvas I was wondering the role of save and restore in canvas.

 Save store the drawing state of the context, do interesting things with a new drawing state and restore it when you have finished.

 Let's take an example to understand it. Imagine you want to build an ellipse and a circle. For the circle no problem :


But there's no function for the ellipse except if you decide to change the scale of the drawing context.


 The drawing state of the canvas has been changed with ctx.scale(1,0.6) which flat the coordinate system on the y axis, creating an ellipse.

So why not creating a circle and an ellipse this way :


As you can see I made an ellipse and a circle but they don't have the same center because when I scale vertically the drawing state it reduced the coordinate of the y center. Beside I kind of restore the drawing state with this code ctx.scale(1, 1/0.6); which is error prone because you may forget a change you didn't undo.

Here is a solution with translate and save/restore


 Now we have an ellipse and a circle with the same center.