Good tips n tricks to learn coding ?
category: code [glöplog]
rudi: whether it's useful or not depends mostly on what you do with the image after converting - YUV isn't as easy to deal with as HSL. E.g. hue rotation involves vector rotation of UV with a couple of sins, instead of just an addition. More complex stuff is worse. But still, given how fast the rgb->YUV and back is, it's worth a look.
(And pure glsl here, targeting 720p at 30fps on a mobile GPU for extra challenge :D)
(And pure glsl here, targeting 720p at 30fps on a mobile GPU for extra challenge :D)
i do it on a per pixel basis. never coded any shader stuff before, but you probably could do that there as well (i dont know). anyway. i have so many projects lying around.. and i code something one day and something else another day. it sucks.
if only C could be as simple as PHP :p
no typed vars, tables, structs n all .. ahh..
well, i realize now that llearning PHP helps me a lot with the understanding of C, it's the same langage, more complicated to write lol
no typed vars, tables, structs n all .. ahh..
well, i realize now that llearning PHP helps me a lot with the understanding of C, it's the same langage, more complicated to write lol
i suppose that, to write my php "beginner-code" in C, it will be much harder, with pointers, types and all
Code:
function VerifyBaieloc($champ) {
if(!preg_match_all('/^[U-Uu-u][0-9][0-9][U-Uu-u][0-9][0-9]$/', $champ, $out)){
echo '<br><br><font face="verdana">Erreur: la valeur "Emplacement dans la baie" doit etre au format UXXUXX</font><br><br>';
echo '<a href="javascript:history.back()"><font face="verdana" color="#91aa37">Retourner en arriere<br></a>';
exit;
}
}
function VerifyBaielocExist($champ, $table, $baieid) {
$tableu = array();
for($i=0; $i<=42; $i++){
$tableu[] = $i;
}
$newtableu = array();
$get_fields = 'SELECT baie_loc FROM '.$table.' WHERE baie_id = "'.$baieid.'" ORDER BY baie_loc';
$exec_get = mysql_query($get_fields);
while ($data = mysql_fetch_assoc($exec_get)) {
$unumb = $data['baie_loc'];
$Ustart = substr($unumb, 1, 2);
$Uend = substr($unumb, 4, 5);
if (preg_match('/^0/', $Ustart)) {
$Ustart = str_replace("0","",$Ustart);
}
for ($u=$Ustart; $u<=$Uend; $u++) {
$tableu[$u] = "filled";
}
}
$newnumb = $champ;
$newUstart = substr($newnumb, 1, 2);
$newUend = substr($newnumb, 4, 5);
for ($i=$newUstart; $i<=$newUend; $i++) {
$newtableu[$i] = "filled";
if ($tableu[$i] == "filled") {
echo '<br><font face="verdana">le U '.$i.' est deja utilise, merci de choisir un autre emplacement dans le rack</font><br><br>';
echo '<a href="javascript:history.back()"><font face="verdana" color="#91aa37">Retourner en arriere<br></a>';
exit;
}
}
}
rudi: my shader version is all per-pixel too. The GPU can be much faster, but it doesn't like branching code so lots of if/else statements aren't good. And rgb->hsl and back is normally full of if/else statements :/
Speed: maybe avoid mysql in your first C experiments though ;)
Speed: maybe avoid mysql in your first C experiments though ;)
Avoid multiplying by zero. It will save you hours of debug work.
sell your PC, buy an amiga, change its caps, and then only you will be certain to learn to code on a machine that will always be there in 20 years, thus your knowledge will be less obsolete.
Quote:
Avoid multiplying by zero. It will save you hours of debug work.
Real coders patch the "Divison by Zero" exception vector and happily divide by zero. \o/
Just don't cross the streams..
BALLS TOUCHING