6 mois sans bave, en voilà.

publié par kAworu
il y a onze mois

Attention, il est tard. Voilà un gros bout de bave car, en plus d'être écrit dans un langage peu recommandable que je nommerais pas (PHP), il provient d'une codebase d'un projet qui vise le développement d'un langage peu recommandable que je ne nommerais pas non plus (encore PHP).

/* ... */
// a nice binary search :)
do {
    $mid = intval(($left + $right)/2);
    $val = $lines_offset[$mid];

    if ($val < $offset) {
        if (++$mid > $count || $lines_offset[$mid] > $offset) {
            $line = $mid;
            return;
        } else {
            $left = $mid;
        }   
    } else if ($val > $offset) {
        if ($lines_offset[--$mid] < $offset) {
            $line = $mid+1;
            return;
        } else {
            $right = $mid;
        }   
    } else {
        $line = $mid+1;
        return;
    }   
} while (true);
/* ... */

s/nice/buggy/
More on this later, stay tuned, je promet plus de bave dans moins de 6 mois!

Much love.
kA.

secure.js

publié par kAworu
il y a plus d'un an
<!-- ... -->
</head>
<div id="primo" style="position:absolute; width:100%; height:100%; z-index:1; left: 0px; top: 0px; background-color: #F0F0F0; layer-background-color: #FFFFFF; border: 1px none #000000; overflow: auto; visibility: visible; clip: rect(auto auto auto 1);"><TABLE ALIGN="CENTER"><TR><TD VALIGN="MIDDLE"><FONT face="Arial, Helvetica, sans-serif" size="4"  color="#336699"><H3><B>This page is password secured. You can view this page after entering the password</B></H3></FONT></TD></TR></TABLE></div>
<script src="md5_1.js"></script>
<script>function attivaPrimo()
 {
   var pwd= prompt("Enter password for the Page","");
 if((pwd!="")&&(pwd!=null))
{  pwd=hex_md5(pwd); } 
document.getElementById("primo").style.left = 0 + "px";
document.getElementById("primo").style.top =0+ "px";
 if(pwd=="370757d2df51ae456bf63c165fc71817") 
 { document.getElementById("primo").style.visibility = "hidden"; 

 if( document.getElementById("bodyid_01") )
     document.getElementById("bodyid_01").style.visibility="visible"; }
 else if((pwd=="")||(pwd!=null)) 
 {  document.getElementById("primo").style.visibility = "visible";
 alert("Please enter your correct password  "); attivaPrimo(); }
 if(pwd==null){
document.write('<BODY bgcolor="#FFFFFF" text="#336699">');
document.write('<TABLE ALIGN="CENTER" WIDTH="100%" HEIGHT="100%" VALIGN="CENTER">');
document.write('<TR>');
document.write('<TD ALIGN="CENTER">');
document.write('<FONT face="Arial, Helvetica, sans-serif" size="4">');
document.write('<H3>');document.write('<B>Sorry! You are not authorized to view this page.</B>');
<!-- ... -->
}</script>
<BODY id="bodyid_01" onload="attivaPrimo();"  bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 background="img/base/bg_body.gif">
<!-- ... -->
<script>document.getElementById("bodyid_01").style.visibility="hidden";</script>

Faudrait lui dire, que md5, c'est plus très secure.

look at the star

publié par kAworu
il y a plus d'un an

Y a pas à discuter, les pointeurs en C, t'en bave grave. C'était violent, surtout avec mon background Java (pwerk). Java c'est abjec^Wobjet, et donc très orienté sur les types. Un truc qui m'a vraiment pas rendu la tâche facile c'était de lire des déclaration de pointeurs:

int *p;

Mais pourquoi diantre les gens n'écrivaient pas plutôt

int* p;

Après tout, la variable c'est p et son type c'est int*. et quand on initialise en même temps que la déclaration, ça donne l'impression de déférencer, et c'est confusant™.

kirk was right

publié par kAworu
il y a plus d'un an

Ces temps je lis un bouquin d'amour qui explique comment c'est codaz dans le kernel de de la boule de geisha (qu'au passage, je recommande vivement). Présentement je suis au chapitre 12 (Network Communication) qui commence par une brève description des couches (transport - network - link). Quand il commence à parler de Data Flow et d'encryption (chiffrage en français, mais y a de la relâche c'est vendredi) un paragraphe m'a sauté aux yeux dont voici un extrait.

At the time of the original design and implementation of the networking subsystem, the possibility of securing data by encrypting packets was still far in the future. Since that initial design, many different uses have been made of the code. [...]
While the ideas are complex, the code is even more so.

C'est interessant parce que pour ceux qui suivent pas l'actualité (comme moi), IPARAITQUE y a une éventuelle probabilité que des backdoor aient (peut-être) été introduites dans le la couche IPSec du poisson qui pique (mais on est pas sûr, y a des gens qui cherchent toussa).

c'est pas la taille qui compte

publié par kAworu
il y a plus d'un an

En C pour travailler avec les path y a une macro sympa: MAXPATHLEN. En faite, y a aussi PATH_MAX et comme j'ai jamais trouvé la profonde différence entre les deux, j'ai demandé à google. Dans mes recherches, je voulais aussi savoir si la valeur de MAXPATHLEN (ou PATH_MAX) représente la taille réelle du chemin le plus long, ou la taille du buffer contenant le chemin le plus long (la différence entre les deux est que le buffer a besoin d'un slot supplémentaire pour le '\0').

J'ai finalement dérivé (sur le web, on dérive. en tout cas moi souvent.) sur un combat mené par GNU contre ces macros, qui reflète une guerre plus globale de GNU contre les limites arbitraires.

is Not an Addon

publié par kAworu
il y a plus d'un an

QUOTE

Chrome Addon: AdBlock for Google Chrome

Well, this isn’t exactly an addon. But by following the below given steps, you’ll be able to block ads in Google Chrome.

  1. Download and install Privoxy.
  2. Click on the Wrench icon in Chrome in the upper right corner.
  3. Choose options>Under The Hood>Change proxy settings.
  4. In the Internet Properties dialog’s Connections tab, click on the LAN settings button.
  5. Check off “Proxy settings” and in the address setting add 127.0.0.1 and in the port 8118.
  6. If you have the option, you can also check off “Bypass proxy for local settings”.
  7. Click “OK,” close Chrome and restart it.

/ QUOTE

Next time, try « exactly not an addon », srsly.

http://www.mychromeaddons.com/chrome-addon-adblock-for-google-chrome/