Http responses – php

Il peut s’avérer intéressant de récupérer le code renvoyé dans la réponse HTTP dans un script.

Quelques codes comme exemples :

  • 200: OK
  • 302: Déplacé mais trouvé
  • 403: Accès interdit
  • 404: Page Introuvable
  • 500: Erreur serveur

Voici comment faire (je vous fourni un bout de code commenté, des explications plus complètes se trouvent en dessous de ce dernier) :

function ch_url($urlParam){
	// On récupère l'ancien level d'error reporting
	$levelBefore = error_reporting();
	//Le fopen d'une url sur un serveur qui n'existerait plus par exemple fait un très moche message d'erreur, on les déactive donc
	//Ouverture de la connexion
	if (!$fp = fopen($urlParam, 'r')) {
	    return "404";
	//On récupère les données du stream
	$meta = stream_get_meta_data($fp);
	//On prend la donnée qui nous intéressé dans l'objet et on la transforme comme on veut (voir si dessous pour l'explication)
	$return = explode(' ',$meta['wrapper_data'][0]);
	//On ferme proprement la connexion
	//On replace le niveau d'erreur
	//Et on renvoie le résultat
	return $return[1];
/*On fait s'afficher la réponse de notre fonction pour une url étant passé par GET
 (script.php?url= par exemple)
echo ch_url($_GET['url']);

Read More…

Posted in Web at February 14th, 2010. Comments Off on Http responses – php.

Include handling rar archive on Nautilus

I observed that people are looking for install rar on nautilus.

In fact, it’s very simple, first, we open rarlab page.

We have to choose between the ‘normal’ (x32) and ’64 bits’ (x64) version.

What is your architecture ?  You can know that by typing these command.

uname -i

Here, is a 64 bits architecture and I will download the right file (x64) (32 bits version is here).

Open a CLI, and go to file. After that, you must extract and install.

$tar zxvf rarlinux-x64-3.9.2b1.tar.gz #extract

$cd rar/ #go into directorycreated

$su #switch in root mode

#make install #simply install

It finished, enjoy it.

Posted in Linux at January 31st, 2010. Comments Off on Include handling rar archive on Nautilus.

Merge & convert AC3 5.1 in Mp3 Stereo lame

I consider that we have 3 AC3 files :

  1. Sample1.ac3
  2. Sample2.ac3
  3. Sample3.ac3

Merge files

We want to merge these 3 files. Simply use the cat command :

cat *.ac3 > All.ac3
#normally *.ac3 tell
“Sample1.ac3 Sample2.ac3 Sample3.ac3” properly sorted. If you have a doubt, you will be allowed to use the full sentence.
cat Sample1.ac3 Sample2.ac3 Sample3.ac3 > All.ac3

The 3 files merged in one All.ac3.

Decode AC3 file

Lame doesn’t be able to read AC3 files, so we must convert them. a52dec is a decoder of ac3 file to a lot of format (oss, ossdolby, oss4, oss6, wav, wavdolby, aif, aifdolby, peak, peakdolby, null, null4, null6, float).
Here, we use “wav” type output. The program decodes specified file to stdout and we must use operator ‘>’ like that :

a52dec -o wav All.ac3 > All.wav

This command downmix the 5.1 stream into full stereo stream (with channel level adjustment (-3, 0, + 3dB for instance) based on output mode). You can disable this with add a ‘-a’, use man for the rest.

Read More…

Posted in Vidéo & Audio at January 16th, 2010. 5 Comments.


When you have in options to a nautilus for instance :

Create the initial window with the given geometry.

Read More…

Posted in Linux at January 10th, 2010. Comments Off on GEOMETRY.

nVidia Kmod install for fedora 11, 12

Don’t do like me. And install your KMod-Nvidia correctly :

Like that

Posted in Fedora 12 at January 8th, 2010. Comments Off on nVidia Kmod install for fedora 11, 12.

PacMan Ring

A very beautyfull (or not) but so funny gift for your girlfriend if she is a geek :

The fun ring for geek (click on for see the source of article)

For complement :

An other ring

Earrings wich are also fun

Earrings wich are also fun

Posted in A voir at January 8th, 2010. Comments Off on PacMan Ring.

Dad, Mum and Nounourse

Evil mum hit my dad because he sticked out his tong to my mother and she found that not very polite .

Me, Super Nounourse, who don’t like that, hit evil mum and told her Dont hit my daaaaad”.

My mother told me “If I can’t hit your dad, I will hit you then !” and me, after that, says “No, no don’t hit me, hit dad instead”

Dad who was dying, beat up, sent off Nounourse for punishment to the pillow in the corner.

Ceci est de la fiction et/ou du pur délire et n’a pour but que d’améliorer mon anglais.
This is fiction and/or pure madness and has just for goal to improve my english.

Posted in Improve my english at January 8th, 2010. Comments Off on Dad, Mum and Nounourse.