Un byte n'est pas un octet !

Dire qu'un byte est un octet est un abus de language. Un byte est la plus petite unité adressable. Cette unité d'adressage est souvent 8 bits, d'où la confusion. Cependant, en télécommunication ou autre domaine, il est possible de trouver des bytes de 9, 4, voire 1 bit. Le terme byte a été inventé pour l'informatique, il n'a pas de traduction exacte en Français. D'ailleurs, les mots byte et octet sont tous deux corrects en Français et en anglais.

Cette précision permettra d'être moins choqué devant des définitions de macros comme celle-ci (c.f. include/linux/bitops.h) :

#define BITS_PER_BYTE        8


Voir l'article Byte de Wikipedia pour plus de précision.

Faire le tour du poteau à Montréal

P2090422

Si vous attendez votre PVT ou votre permis de travail pour un stage ou autre au Canada et que vous l'avez pas encore reçu, vous pouvez tout de même rentrer au Canada comme touriste.
Quand vous recevrez le mail comme quoi votre permis est prêt, il vous faudra sortir du Canada et rerentrer pour le faire valider . C'est ce qu'on appelle "faire le tour du poteau".

Le plus simple est de passer la frontière des états-unis et revenir au Canada.
Pour cela, 2 options :

  • louer une voiture ;
  • prendre le bus pour une ville des États-Unis proche de la frontière.

J'ai choisi le bus.
Je suis allé à la gare d'autocars (Greyhound) de la station de métro Berri-UQÀM à et pris un billet de bus aller-retour pour Plattsburg (É-U) pour 9h du matin. J'en ai eut pour 40$CAN. En une heure environ on se retrouve à la frontière, on descend du bus et on précise qu'on doit retourner au Canada pour faire valider son working Visa. Là ils vous feront un "refus administratif" d'entrer aux É-U, vous traverserez l'autoroute à pied ou en voiture (si vous en avez loué une) et vous passerez le péage Canadien comme tout le monde. Une fois là vous donnerez les papiers nécessaires pour faire valider votre permis et le tour est joué.

Pour le retour, le problème du bus est qu'il faut attendre le prochain venant des É-U. J'avais validé mon permis vers 10h45 et j'aurais dû attendre le prochain bus vers 16h. Coup de chance, un français (Rachid, que je remercie !) venait faire lui aussi le tour du poteau en voiture et s'est proposé de me ramener.

D'ailleurs, une autre option qu'il m'a indiquée, est de parcourir le site des PVTistes (http://pvtistes.com) sur lequel il avait fait l'annonce de son voyage. C'est donc possible par ce moyen de trouver de quoi faire la route gratuitement ou moyennant une faible participation ;)

Bon séjour au Canada !
Vivien.

Tiny Ruby AlloURL API

Here is a small function I wrote in order to get rid of the boring AlloURL service (especially used on websites such as allowshowtv.com):

Example:

AlloURL.retrieve("http://209.212.147.251/?w=0Cg1J28hx64c9fksA7rgUjwGP6dezxq_xKw9mLk2S1_x0NIdJhERenx7jqEgbx1otbizgS9IVLAUB9r6e1_xZdIbw_o_o")
 # => "http://www.videobb.com/video/K7EJfnlZtmhL"

It will wait the 6 seconds and give the URL back to you for you.

Fell free to use it and/or contribute to it.

I also thank Doud for a Javascript trick used by AlloURL.

Veronica Mars Streaming VF

On m'avait demandé les Veronica Mars saison 1, 2 et 3 en Français, mais c'est pas évident de les trouver, car seuls quelques liens sont bons.
Alors voici la liste des épisodes des 3 saisons valides en Streaming version Française :

Saison 1  
1 http://www.videobb.com/video/ut81SJa70C97
2 http://www.videobb.com/video/upGmSwfPQbLQ
3 http://www.videobb.com/video/ZHSNNXAE7ulU
4 http://www.videobb.com/video/ApDTgqYQLBhu
5 http://www.videobb.com/video/RPJGYwdeuu6K
6 http://www.videobb.com/video/8Fli4GM57bXd
7 http://www.videobb.com/video/LpaRmBILbOik
8 http://www.videobb.com/video/Y0AoMPM0VbhV
9 http://www.videobb.com/video/t4sx594fZruv
10 http://www.videobb.com/video/CHQSrhVFyWyX
11 http://www.videobb.com/video/0T9LlJnBr7yb
12 http://www.videobb.com/video/eWmCCeLT4k5Z
13 http://www.videobb.com/video/aALrNAfYx4Uj
14 http://www.videobb.com/video/BEJkmKQ78ULF
15 http://www.videobb.com/video/nW3wRbOZMs7J
16 http://www.videobb.com/video/OPhOIhiYWeAL
17 http://www.videobb.com/video/jYxV2ZVfSSGp
18 http://www.videobb.com/video/nKnflo6u0Mr5
19 http://www.videobb.com/video/boiWAODVR8gu
20 http://www.videobb.com/video/oVoiyxapcBNo
21 http://www.videobb.com/video/rXpd3SMTeOVv
22 http://www.videobb.com/video/Tv49eWLA2UoY
Saison 2  
1 http://www.videobb.com/video/vMLUWz9mbP3U
2 http://www.videobb.com/video/fjQiTRRhVo9k
3 http://www.videobb.com/video/4Dq8vmB9WK0A
4 http://www.videobb.com/video/oZiZzYf00oZc
5 http://www.videobb.com/video/W7Pu1Lp9IP3T
6 http://www.videobb.com/video/AwdDYfDr7SHH
7 http://www.videobb.com/video/DMtOmxWzgk3U
8 http://www.videobb.com/video/vEre5NGlRKU6
9 http://www.videobb.com/video/6cuD4LfiAHNf
10 http://www.videobb.com/video/rA3Lf8cABoIO
11 http://www.videobb.com/video/ujqJSsFu7TI5
12 http://www.videobb.com/video/epCjghw4dLjg
13 http://www.videobb.com/video/44d11kXChFyp
14 http://www.videobb.com/video/tbBFtR8wSg0T
15 http://www.videobb.com/video/1Cg4D77aGzg6
16 http://www.videobb.com/video/uXUlDlvBBqja
17 http://www.videobb.com/video/hYys3v4roVM8
18 http://www.videobb.com/video/9CdfUJvKOegf
19 http://www.videobb.com/video/ZB0AAluQyenT
20 http://www.videobb.com/video/0U8JTefwy2VQ
21 http://www.videobb.com/video/zXunYprfNBfV
22 http://www.videobb.com/video/ezEfPVD4NFIm
Saison 3  
1 http://www.videobb.com/video/K7EJfnlZtmhL
2 http://www.videobb.com/video/HgjwjRnpgVQt
3 http://www.videobb.com/video/ogBGR1XYLE5o
4 http://www.videobb.com/video/HvcA8kycNuI7
5 http://www.videobb.com/video/vZ1uEWeqTcnX
6 http://www.videobb.com/video/xXwLAzFG8ikd
7 http://www.videobb.com/video/2VF36Q0N84y8
8 http://www.videobb.com/video/DnMbUr7fbX7R
9 http://www.videobb.com/video/k605wDeYnFDg
10 http://www.videobb.com/video/Ss7n9iFdXBIu
11 http://www.videobb.com/video/2NFHo9c99TLj
12 http://www.videobb.com/video/BVV5rMVsDxMW
13 http://www.videobb.com/video/C17FAaGT8OSC
14 http://www.videobb.com/video/9FkAIn9HDZsP
15 http://www.videobb.com/video/o1qKuqLY30CW
16 http://www.videobb.com/video/G4nV7DKRPVh8
17 http://www.videobb.com/video/WuZxHk8Tdgs6
18 http://www.videobb.com/video/H0ASnTvSAgs6
19 http://www.videobb.com/video/NYGCyM4GzREh
20 http://www.videobb.com/video/03b8CWy9GRxd

Stratégie vs Tactique

La stratégie est un art

La stratégie concerne ce qu’on ne connaît pas ou peu, ce sont les choix dont on ne peut pas être certain qu’ils soient meilleurs que d’autres avant de les avoirs effectués et souvent en cas de réussite on est incapable de savoir si un autre choix aurait pu être meilleur.

Le stratège doit avoir une vision générale et à long-terme.

Le métier de référence : Le PDG

La tactique est une science

Une tactique concerne ce qu’on connaît plutôt bien, l’objectif est lisible, les expériences précédentes permettent d’obtenir une bonne vision de ce qu’il peut se passer. Par ailleurs, l’atteinte de l’objectif est finie dans le temps.

Le tacticien doit analyser le maximum de possibilités pour atteindre un objectif précis.

Le métier de référence : L’organisateur des attaques commandos / GIGN

dog better than cat

Since Ubuntu Hardy, the dog utility tool (a cat improved) has been removed because it is not yet maintained.
But you can easily install dog 1.7-12 on Ubuntu Maverick amd64 thanks to epii:

sudo add-apt-repository ppa:epii/ppa
 sudo aptitude update
sudo aptitude install dog

If you're using another plateform you can check out others 1.7-10 dog deb packages on Debian.org's FTP, or download and install dog 1.7-10:

wget http://ftp.de.debian.org/debian/pool/main/d/dog/dog_1.7-10.dsc
 wget http://ftp.de.debian.org/debian/pool/main/d/dog/dog_1.7.orig.tar.gz
wget http://ftp.de.debian.org/debian/pool/main/d/dog/dog_1.7-10.diff.gz
 dpkg-source -x dog_1.7-10.dsc
 cd dog-1.7/
dpkg-buildpackage
sudo make install

Non Debian-based plateforms users can download and compile dog 1.7:

wget http://ftp.de.debian.org/debian/pool/main/d/dog/dog_1.7.orig.tar.gz
 tar xzf dog_1.7.orig.tar.gz
cd dog-1.7.orig/
make
 

Removing older commits than yours with Git

Imagine a Git project repository with some commits like this:
A-B-C

And you want to start a new project based on it.
So, you clone this repository and start committing your changes. It looks like:
A-B-C-D-E-F-G

Now, because your project drives a totally different way than the original one, you'd like to remove every older commits than yours (something like the network view in Github can be annoying if you've forked your project from another repository).

So you'll get something like:
D'-E-F-G
with D' a kind of single commit of A-B-C-D.

Here is what you need to do (you can see commits ID with git log).
Pull a fresh clone, just to be safe so you don't mess yup your main repo:

git clone git@example.com:project.git
cd project/
Create a branch at the point you want the new history to start, check it out:
git checkout -b new-start-point D
Soft-reset the branch back to the very first commit in the repo:
git reset --soft A
Do an amend-commit to make a new detached branch with a single commit at the new start point:
git commit --amend --reset-author -m "Starts a new Y project based on X"
Rebase the commits you want to keep onto the new branch:
git rebase --onto new-start-point C master

It's done.

Note: You can start the new branch from C if you'd like not to merge your first commit with older ones (if you do so, do not use --reset-author in order to keep the original author).

From a discussion with Tekkub of Github support staff.

Grep annotations in source files

Notes

Hi everybody,

I've just released a new gem which provides an executable to grep annotations (such as TODO, FIXME, OPTIMIZE or custom annotations) recursively in source code

The purpose is to have a kind of `rake notes' (only for Rails applications), but for every source files, in every languages.

Just typing `notes' will look for default annotations (TODO, FIXME and OPTIMIZE) recursively in the current directory.

The complete synopsis is `notes [options] [file...]'.
Try `notes --help' for the full usage.

Annotations will be pretty displayed on screen with color and everything.
For example, searching default annotations and a custom annotation FOO in a sample.c file, will result in the given screenshot.

This is useful to quickly have a look to what need to be done in a file/project. Another useful trick is the ability to write a TODO file with found annotations. That can be nice if you want to maintain a To Do list for a project.

For example, `notes -o TODO.txt sample.c' will generated a TODO.txt file with the following content:

 * [TODO    ] test/data/sample.c (16): first thing to do
 * [FIXME   ] test/data/sample.c (26): first fixme thing
 * [TODO    ] test/data/sample.c (32): second todo thing!
 * [OPTIMIZE] test/data/sample.c (42): make it better
 * [TODO    ] test/data/sample.c (47): hello world

You can simply install this gem using:

gem install notes

This gem also provides a Ruby lib to grep annotations. So it will be easy to use this in a script or whatever.

The source code and more details can be found on GitHub and Rubygems.

Try it and tell me if it is useful for you or if you have any suggestions!

v0n.

Utiliser un dépôt SVN avec Git

Si vous voulez plus toucher à Subversion, mais que vous y êtes bien obligés pour un projet quelconque, il est tout à fait possible d'utiliser Git pour gérer un dépôt SVN.

Installer git-svn :

 sudo aptitude install git-svn

La commande git-svn ne se trouvera pas dans le $PATH après l'installation, alors rajoutez-la à la main :

sudo ln -s /usr/lib/git-core/git-svn /usr/bin/git-svn
 

Pour clôner un dépôt Subversion (équivalent de svn checkout), utiliser :

git svn clone --username <user> <url_du_depot>

À présent, vous pouvez utiliser votre copie locale comme un dépôt Git classique, c'est-à-dire faire des git add, git commit, etc.

Pour mettre à jour votre dépôt local (équivalent de svn update) :

 git svn rebase
 

Pour pusher sur le dépôt SVN (équivalent de svn commit), il est préférable de d'updater le dépôt puis appliquer les commit :

 git svn rebase
 git svn dcommit
 

Pour que l'utilisation de git-svn soit plus pratique et intuitive, je vous conseille de rajouter deux alias dans votre fichier ~/.bash_aliases :

# Git aliases
alias git-svn-pull='git svn rebase'
alias git-svn-push='git svn rebase && git svn dcommit'
 

De cette façon, puller avec :

git-svn-pull

et pusher avec :

git-svn-push