Programmers Are Whining Pussies June 6th, 2010
Foreword: I write this article especially with two projects in mind: “Eventscripts” and “Truecrypt”. Come and get me.
The species called “Programmer” seems to be a bit thin-skinned when it comes to issues only “related” to their work.
The first thing is documentation:
Eventscripts is the best example for a lack of documentation. Eventscripts is a scripting engine which enables one to write gaming server related scripts for CS:S for instance. Eventscripts uses python for the underlying scripting engine, but adds a vast amount of increments to it regarding the game events and so on.
There is a wiki containing documentation, but it is by no means complete. many commands are missing, others are incomplete, others are simply wrong. IT IS A PAIN IN THE ASS to write a script with this bad documentation.
I started a conversation regarding this issue with the Eventscripts creators, and it degenerated fast into a conflict, arguing about whose job it is to do documentation.
Since the wiki is writable for everyone, the creators have the opinion that the users have to write this documentation.
But how i ask, how can a user write this documentation without knowing what a command can do? or even not knowing that some commands exist?
IMHO it is always the job of the programmers to document their work! I also write code i publish (mostly unter GPL), but i would never even think of publishing it without a complete documentation!
The second thing is behaviour that is not caused by the program but by the operating system:
I assume you all know Truecrypt: When one creates a large container file in Truecrypt, he will most probably leave the creation process running over night, since it takes many hours to create.
The problem is: after creating and formatting the container, the operating system needs to do a task which requires system privileges. The system asks the user to give it to this process, but since no one is on the keyboard, it runs into a timeout and tells Truecrypt that the format was unsuccessful. Truecrypt then tells the user that it could not format the container AND DELETES the nevertheless successful created container.
The argument in the forum why this bug isn’t fixed is that it is a issue with the operating system, therefore it’s not the Truecrypt programmers fault. They easily could fix it by requesting the admin privileges for the process on the beginning of the formatting.
So, what is it with programmers to accept their own babies to be incomplete or faulty by simply stating that’s not their fault? I could never do that! It would break the rule of delivering a complete and usable product!
So to all the programmers out there: Stop whining and start writing cool, complete and usable software!!!
Posted in Programming, Various | No Comments »
HTML 5 – The future starts now May 17th, 2010
This is very much the first project i have done out of curiosity instead of boredom:

An HTML 5 video player with a nice tile repeation effect.
It is mostly a performance test for HTML5’s new Video and Canvas tags allowing you to manipulate pictures and other picture related sources like videos in real time with nothing more than HTML and Javascript!
YES, NO FLASH IS INVOLVED!!!
Please don’t get me wrong: I really like Flash and it will never die, that’s because it can do much more application like things than HTML5 (for instance: A real time Sequencer and Synthesizer or a complete Picture Editing Suite).
But seeing done such monitor filling animations in HTML5 is really nice.
So check it out and enjoy a whole new video experience on Viiideeeooo.de!
Posted in Design, Programming | No Comments »
Adobe Flash AS 2 snowflakes snowing effect script December 20th, 2009
Well, i was bored again, and here is the outcome: A snow effect for Flash AS 2, which uses very less CPU power.
It is extremely simple to use:
1. Create a new empty movieclip on the top layer of your (root) movie.
2. Move the new movieclip at the x and y position 0 Pixel.
3. Copy the following code to the first frame in your new movieclip: Flash Snow Script
Don’t forget to set your movie’s framerate to 30 FPS!
That’s it, compile and be happy.
There are some parameters you can change on top of the Script, mainly to tweak the number of snowflakes and the CPU usage.
Have fun and Happy Christmas!
Posted in Programming, Tools | No Comments »
Portal End Credits – The Flash version November 26th, 2009
Are you looking for “Portal The Flash Game – Console Commands List”?
Once there was a bored little Webdesigner.
One day he thought: “Wouldn’t it be nice to make a Flash version of the Portal end credits?”
No sooner said than done, he extracted the commands and the music from the game files itself, and wrote an interpreter for them in Flash.
My luck the Portal end credits are text based commandos and not a video, so i could take the commandos to reproduce the credits 100% identical in flash. You can even copy and paste the text.
Have Fun:

Portal End Credits in Flash
Twitter made easy – How to tweet with PHP with 19 lines of code October 7th, 2009
You know the dilemma, you want to write a simple tweeting PHP script and have to mess around with the Twitter API.
With the following small script you can tweet with a simple function call. It IS that simple (And SSL secured!!!).
Here’s the function:
function tweet($user, $pass, $text) {
unset($GLOBALS['tweetError']);
if(strlen($text) > 140) { $GLOBALS['tweetError'] = 'TEXT TOO LONG: '.$text; return false; }
$tweet = curl_init();
curl_setopt($tweet, CURLOPT_URL, 'https://www.twitter.com/statuses/update.xml');
curl_setopt($tweet, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($tweet, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($tweet, CURLOPT_HTTPHEADER, array('Authorization: Basic '.base64_encode($user.':'.$pass)));
curl_setopt($tweet, CURLOPT_POST, 1);
curl_setopt($tweet, CURLOPT_POSTFIELDS, 'status='.utf8_encode($text));
if(!$return = curl_exec($tweet)) $GLOBALS['tweetError'] = 'CURL ERROR: '.curl_error($tweet);
else if($returnData = simplexml_load_string($return)) {
if(!isSet($returnData->error)) $GLOBALS['tweetSuccess'] = 'Created at: '.$returnData->created_at.'Text: '.utf8_decode($returnData->text);
else $GLOBALS['tweetError'] = 'TWITTER ERROR: '.$returnData->error;
} else $GLOBALS['tweetError'] = 'RETURN IS NOT XML: '.$return;
curl_close($tweet);
return (isSet($GLOBALS['tweetError']))?false:true;
}
To make a tweet just call the function:
tweet("username", "password", "My cool tweet!");
The function returns “true” if successful or “false” if not.
To echo out the error or success messages, just use this code:
if(tweet("username", "password", "My cool tweet!")) {
echo 'Tweet Successful!'.$GLOBALS['tweetSuccess'];
} else {
echo 'Tweet Error!'.$GLOBALS['tweetError'];
}
If there was an error, the error description is saved in $GLOBALS['tweetError'], and if the tweet was successful, the time and the text itself is saved in $GLOBALS['tweetSuccess'].
Have fun and happy (automatic?) tweeting.
Posted in Programming | No Comments »
The smallest AJAX framework ever July 21st, 2009
The most AJAX frameworks are bloated with many functions you’ll never use or need. Who wants 60 KB of JavaScript if your only need is to send and load data? I Don’t.
I have found somewhere a short howto for AJAX, and derived (rewritten) the smallest AJAX framework ever out of it:
var ajax = false;
if(window.XMLHttpRequest) ajax = new XMLHttpRequest();
else if(window.ActiveXObject) {
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) {
try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) {}
}
}
function ajaxGetContent(type, url, parameter, output_function) {
if(!ajax) eval(output_function + '(false);');
ajax.onreadystatechange = function() {
if(output_function != 'void' && ajax.readyState == 4) {
if(ajax.status == 200) eval(output_function + '(ajax.responseText);');
else eval(output_function + '(false);');
}
}
if(type == "post") {
ajax.open('POST', url, true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.send(parameter);
} else {
ajax.open('GET', url + ((parameter.length > 0)?"?":"") + parameter, true);
ajax.send(null);
}
}
That’s short, isn’t it?
To get the data you want you have to simply call the function and define a function which will be called after the data arrives:
ajaxGetContent('post', '/myURL/index.php', 'a=b', 'myDataCallBack');
function myDataCallBack(myContent) {
if(myContent == false) {
// something went wrong
} else {
// have fun with your data
}
}
And if you want to send data only and don’t care of the answer, use this syntax:
ajaxGetContent('post', '/myURL/index.php', 'a=b', 'void');
Some explanation:
- type = How to send the data (Parameters). “post” or “get”.
- url = Where to send it to.
- parameter = URL-style parameters. Never use a question mark!
- output_function = The function which will be called after the data is received.
This Tool is tested in Opera 9+10, Firefox 2+3 and MSIE 7+8.
Have fun!
Posted in Programming, Tools | No Comments »
MySQL Birthday Column – Age of a Person July 8th, 2009
If you search for a solution to get the age of a person (in years) in MySQL, google gives you many obsolete (and complicated) answers, from MySQL 4.1.1 it is very easy to get this number:
TIMESTAMPDIFF(YEAR, myDateColumn, NOW())
Have fun.
DIV layer with 100% height, the Javascript way July 1st, 2009
When you create a div layer with 100% width and height, the height is always only the height of the browser window, not of the page content (which can be much higher).
To solve this, give the layer div an id and use the following JS code inside the layer div:
<script type="text/javascript">document.getElementById("yourlayerid").style.height = document.getElementsByTagName("body")[0].offsetHeight + "px";</script>
The code is very simple, it gets the height of the content (the body element) and gives it the layer div.
Tested in Opera, Firefox and *barf* MSIE (8).
Posted in Programming | No Comments »
How to force file downloading with htaccess July 1st, 2009
Nearly every browser will show image oder video files you want to provide for download in the browser itself instead of opening a download dialog.
Most of the websites suggest to use this code in your .htaccess:
<FilesMatch "\.(jpg|zip|avi)$" >
ForceType application/octet-stream
</FilesMatch>
But this is not enough! Even when the MIME-Type is set to “octet-stream”, some browsers will still open the files their selfs because they have detected the .jpg or .avi file extension.
The solution to this is to add the following header:
<FilesMatch "\.(jpg|zip|avi)$" >
ForceType application/octet-stream
Header add Content-Disposition "attachment"
</FilesMatch>
With this header every browser i tested opened a download dialog, regardless of which file extension is present.
On-the-fly Picture Swapping, how to get it work in MSIE June 5th, 2009
To swap or reload a picture on the fly is easy with Javascript. Just give the img tag a unique id and execute the following command in javascript:
document.getElementById("picture").src = "/img/cool-picture.jpg";
Now comes the glitch in (guess where) Internet Explorer: If you want to reload a picture that has changed on the server (let’s say you have overwritten the picture with a php gd-lib script in the background), the Internet Explorer (i call him msie, spoken “emsy”) always keeps the cached picture instead of reloading the picture from the server like opera and firefox do.
You can fix this behaviour with a simple cache-avoiding technique: Add a random number as a parameter, as shown in the following code, that’s it.
document.getElementById("picture").src = "/img/cool-picture.jpg?r=" + Math.floor(Math.random() * 1000);
Posted in Programming | No Comments »