Tag Archives: programming

♥ Memory card game in just 1024 bytes of JavaScript

I was always watching all kinds of 1k and 4k demos in all kinds of languages. Actually I always loved getting the best out of the code having straight constraints. This was true while we learned assembly for i8086 or when I made an embedded game for Ericsson R600. This year for the 1st time I made my own demo in JavaScript. You can see it here: http://neswork.com/javascript/js1k/2012/

Drawable.createFromPath

I was trying to load an image from the sdcard. From the same directory I managed to open sound files and play them, but for some reason it didn’t work for the image. After trying everything it turned out that

MediaPlayer.create(this, Uri.parse("file:///sdcard/app/a.mp3"));

works, but

Drawable.createFromPath("file:///sdcard/app/a.jpg");

doesn’t work. Instead of this path, one should use:

Drawable.createFromPath("/sdcard/app/a.jpg");

This finally works! BTW it also works for the MediaPlayer.

PHP Quines

Quines are self-reproducing programmes. Here are two in PHP I just wrote:

CLI version:

<?php $a='<?php $a=%c%s%c;printf($a,39,$a,39);?>’;printf($a,39,$a,39);?>

WEB version:

<?php $a=’&lt;?php $a=%c%s%c;printf($a,39,htmlspecialchars($a),39);?&gt;’;printf($a,39,htmlspecialchars($a),39);?>