Python3,float and math, what the hell?

So it was late at night and I was hacking away at my touch-controls for my UnicornHat. I was trying to set the brightness in nine steps between 0.1 and 0.9. When all of a sudden, this happened: >>> foo=0.1 >>> foo+=0.1 >>> print(foo) 0.2 >>> foo+=0.1 >>> print(foo) 0.30000000000000004 So according to my internal senses this looked not very precise. But according to the almighty Stackoverflow and one of my beloved coworkers who can indeed speak ASM fluently, this is in fact very precise (for a float)....

2016-03-14 · 1 min · 183 words · Jan

When you're generating queries from resultsets of other queries ...

I just hit a point in an app I am currently developing, where I found myself generating queries from the resultset of another query. Because, what can possibly go wrong, right? $selectors = array(); $query_phase2 = "SHOW KEYS FROM `".$row['table']."` WHERE Key_name = 'PRIMARY'"; $query_phase3 = "select `".$row['field']."` from `".$row['table']."` where "; if($result = $GLOBALS['dbconn']->query($query_phase2)) { while ($row = $result->fetch_assoc()) { if(array_key_exists($row['Column_name'], $data)) { $qextender = "`".$row['Column_name']."` = '".$data[$row['Column_name']]."'"; array_push($selectors,$qextender); } } $query_phase3 ....

2015-07-16 · 1 min · 121 words · Jan

DDoS and Online Gaming

I just stumbled across an enormous outcry about another attack by the “LizardSquad” against DBG’s (former SOE) Games that were allegedly the outcome of a few angry posts on Twitter by DBG’s CEO John Smedley. (Storylink) Along with the usual “fixit fixit fixit” there was also a lot of guesses thrown out about the size of the genitals of a 14-year old fin. What startled me though is the sheer lack of knowledge when it comes to the gamers themselves....

2015-07-10 · 4 min · 822 words · Jan

The day perl became a bit disgusting or why PHP got the better CGI enviroment

I just viewed a very nice #31c3 talk about a well known issue with certain functions within two very widely used perl-modules (DBI & CGI). When I heard the arguments brought to the presenter from the audience within the Q&A, I thought to myself, well, they’re right. All of these attack vectors are in theory something that could have been prevented by just flatten arguments (as you always should). Then again, this makes for a really, really messy programming style that does not come easy if you were programming any other programming language prior to perl....

2014-12-30 · 3 min · 464 words · Jan

Installing JAVA JDK/JRE on Debian/Ubuntu with ease

I recently commenced the third installation of JAVA on one of my Debian-Boxes and couldn’t remember any of the exact commands, had to google again, ended up with 8 open tabs all saying something different and so wrote this small bash script to set up all necessary alternatives with “update-alternatives” automatically. Please note that there has to be either icedtea or openjdk installed to make all parts of this script work....

2013-08-13 · 2 min · 260 words · Jan