[o_o]
This website is in english, but due to a lot of french readers, some readers comments are in french. The official language of this site and of the comments is english, still.
  [ «« ]    [ « ]  Page 560/1151   [ » ]    [ »» ]
  [ «« ]    [ « ]  Navigation in the category Geek's World   [ » ]    [ »» ]
 [ da page ]
In order to be more occuratly indexed, the texts of the strip are written in this hidden div.

That bitch? How dare she!!!
Well, you beat her quite hard.

Like, you broke her arm and ruined her face forever.
What??

That's, in fact, a crime.
Not even legitimate defense. She didn't... even threaten you.
Okay... *Okay!!*



Cette pute! Comment ose-t-elle !
Ben, tu lui as gravement cassé la gueule.

Genre, tu lui as cassé le bras et détruit son visage pour toujours.
Quoi ??

En fait... c'est même un crime.
Même pas en légitime défense. Elle ne t'avait... même pas menacée.
OK... *OK !!*

New in the storyline? Get to the beginning of "All meet in the desert"
  [ «« ]    [ « ]  Page 560/1151   [ » ]    [ »» ]
2008-01-13 12:36:51

* Salagir

My geeky life



I changed a code I made at the opening of geeksworld and never changed since. It's the update code.

While looking at the code, I see that indeed I changed it once. It's the line with SOMESECRETDIR.
Note that use of SOMESECRETDIR and file moving is all you fault, because some people commented, on previous pages, strips in advance.


This is what I used.
In the code of the website, there is :
$Comic['PageEnd'] = include('num.inc');


In crontab :
1  0  *  *  1,3,5 /home/salagir/tmp/majgeek.pl


In majgeek.pl :
#!/usr/bin/perl -W

use strict qw(subs vars refs);

my ($num, @lignes);
my $fichier = "DAPATH/geeksworld.org/num.inc";

@lignes =  `cat $fichier`;
foreach(@lignes) {
    if ($_ =~ /<\?php return ([0-9]+); \?>/) {
        $_ = $1;
        $_ ++;
        $num = $_;
    }
}

system "cd SOMESECRETDIR; mv $num* DAPATH/geeksworld.org/pages/";

open(FILE, ">$fichier");
print FILE "<?php return $num?>";
close(FILE);


The main reason of the change is the random image of the top left of the design. It was recalculated each time the page is generated. And reading a complete directory each time isn't really optimal.
This was the code :
    <?php
    
// choix avatar
    
$A glob('avatars/PNG32/*png');
    
mt_srand(date('z')); // z va de 0 à 365
    
$A $Amt_rand(0,count($A)-1) ];
    
?>
    <a href="/"><img src="<?=$A?>" id="avatar" alt="" /></a>



So, now I use this. Instead of:
$Comic['PageEnd'] = include('num.inc');

and the previous quote, the page contains:
require_once('./daily.inc.php');
and
    <a href="/"><img src="<?=$LeftAvatar?>" id="avatar" alt="" /></a>


The cron becomes :
1  0  *  *  * php DAPATH/geeksworld.org/maj.cron.php


maj.cron.php contains :
<?php
if (php_sapi_name()!='cli') return;

$fichier 'daily.inc.php';

require(
$fichier);

////////////////////////////// Tous les jours : choix avatar

$A glob('avatars/PNG32/*png');
mt_srand(date('z')); // z va de 0 à 365
$A $Amt_rand(0,count($A)-1) ];

////////////////////////////// 3 fois par semaine : update strip

$weekday date('w'); // 0 (for Sunday) through 6 (for Saturday)
if ($weekday==|| $weekday==|| $weekday==5) {
    
$Comic['PageEnd']++;

    
system ("cd SOMESECRETDIR; mv $num* DAPATH/geeksworld.org/pages/");
}

////////////////////////////// ecriture fichier

$F fopen($fichier'w');
fputs($F"<?php
    \$Comic['PageEnd'] = 
$Comic[PageEnd];
    \$LeftAvatar = '
$A';
?>\n"
);
fclose($F);

?>


And, yes, each time I'm late for the strip, I receive a mail with the error that files could not be moved.
It's okay, I receive a lot of cron reports every day.

As you can see, I also updated [ code ].
 

Readers comments:

2008-01-14 00:04:09

vlad

non preums
2008-01-14 00:05:31

Sam

donc si j'ai bien compris, en mettant un commentaire avec le strip, on fout le bordel ? ...
enjoy ! (sourire sadique)
pis on l'a déjà vu celui-là ! plein de fois !

(sauve un blog, bouffe un preum'seur !)
2008-01-14 00:19:23

13Kill

Josh n'est pas mort ! POURQUOI, POUR-QUOI ! :'(
2008-01-14 00:47:30

nepser

La pénurie de rasoir se fait vraiment sentir! Mike n'a même plus de bouche :(
2008-01-14 02:37:55

Edzilla

legitimate defense=> Self-defence
2008-01-14 07:50:29

Eternity

Je plussoie nepser: SALAGIR, envoie des rasoirs par mail!
2008-01-14 09:57:56

MollyGrue

Eh ben, elle ne rigole pas, la Moumoune*... euh pardon, la Lina... ^^,

*Reflets d'acide, évidemment
2008-01-14 10:53:25

Asterion

On va revoir Lina super sayen?
2008-01-14 13:52:43

nyamsprod

Je veux vraiment pas faire le chieur mais bon

> $A = glob('avatars/PNG32/*png');
> mt_srand(date('z')); // z va de 0 à 365
> $A = $A[ mt_rand(0,count($A)-1) ];

c'est plus rapide et safe de faire
$A = glob('avatars/PNG32/*png');
$A[array_rand($A)];
et de plus http://be.php.net/mt_srand : la deuxième ligne n'est plus nécessaire

Sinon à part ça je note que tu passe de perl à php, je me demande bien pourquoi :D

Salagir's answer:

En fait, j'ai écris l'article en même temps que je faisait le script, et ca.. n'est pas la dernière version (je ne mens pas) ! J'avais effectivement déjà changé la dernière ligne par ce que tu dis.
Pour le mt_srand() , j'avais oublié qu'effectivement, maintenant que le cron n'était lancé qu'une fois par jour, il ne m'étais plus nécessaire que le random donne la même réponse quelque soit le moment d'appel dans la même journée.

Enfin, j'avais fais le script initial en perl, surtout parce que j'apprenais perl. Je faisais déjà la plupart de mes scripts en php.
2008-01-14 18:58:06

Powermip

haha terrible ! Lina c'est un peu fait clasher !
2008-01-14 21:05:28

paloma

je suis fan

Salagir's answer:

Merci pour tous tes commentaires Palo :)
2008-01-15 12:22:54

Val

Et nous ? Non ?

Salagir's answer:

Non >:D
2008-01-15 17:42:57

Eather

Bouahaha trop classe! Pauvre Lina elle récolte que ce qu'elle a semé...
(mais je maintiens que bien que même si elle est bien roulée, la fille de Windows est pas belle =P)

Add your own comment:     Email for Gravatar:     Anti-spam, write the girl's name:

Text processing:


Add *, / or _ around some text, and it'll format it *bold*, /italic/ or _underlined_.
Usual BBcode works too: [b][/b], [i][/i] and [u][/u].
If you type a url or e-mail directly, it'll be made as a link. If you want to make a link around text different than the url, use [url=thelink]the text[/url], like in phpBB.
To show an image, use [img]url_of_image[/img]. This image must be uploaded on another site already.
If you begin your line with >, the color will be different, use it to quote other messages.
You will be able to edit your messages for a limited time.
  [ «« ]    [ « ]  Page 560/1151   [ » ]    [ »» ]
 
 
[FR] [EN]
   

Share the strip