Batchfile: simple slideshow with custom image order

Last week a friend of mine wanted to have a image slideshow for a presentation TV screen for an exhibition. Besides of a large number of images that should be displayed in order he wanted to display his company logo image every second image, like:

  1. image 1
  2. company image
  3. image 2
  4. company image
  5. image 3
  6. company image

I wanted to do this without writing a program or installing Perl (his laptop is a Windows box) so I did this with a tiny Windows batch file:

setLocal EnableDelayedExpansion

SET count=1

FOR %%a IN (*.*) DO ( call :do "%%a" )

SET UQ1=%1
ren %UQ1% "%count%_!UQ1:"=!"
set /a count+=1
copy %FILLIMAGE% "%count%.jpg"
set /a count+=1
GOTO :eof

Given the batchfile slideshow.bat, the directory with a copy of all the source images in C:images and the company logo image in C:companyimage.jpg the call simply is:

slideshow.bat "C:images" "C:companyimage.jpg"

This will rename all the pictures found in C:images with a number in front of the original file name – with one number left out; like 1,3,5,7,etc. The company image is copied in between all these images as 2.jpg, 4.jpg, 6.jpg, etc. Now simply viewing the first image with Windows Picture Viewer and hitting the slideshow button will display the files by name which is exactly the desired display order.

Regarding the batchfile: it would be possible to execute multiple statements within the DO ( … ) but that way the counter variable did not work. I had to do a call to a method which then changes the counter. Another issue was the unquoting of the file name. The “%%a” supplies the image file name with double quotes to the %1 inside the :do function. As the final name should be counter + image-name without unquoting it would look like 1_”my image.jpg” which will do an error. The magick is the !VAR:”=! which unquotes the string in VAR.


Bookmarklet for QR Codes from Android market links

Since the beginning of this month Google has been allowing access to its android app market for non-Android devices via Unfortunately when accessing the app pages with a non-android device there’re no QR codes for the apps, so getting the app to the device is pretty cumbersome. I wrote a little bookmarklet to convert the http://market URL into a market:// one and generate a QR code image for that link.

javascript:(function(){var exp = /details?id=([w.]*)/; exp.exec(location.href);'' + encodeURIComponent('market://details?id='+RegExp.$1), '_blank');})()

Just Drag&Drop this linked image:


to your bookmarks bar and click on it when you’re on a android app page:


Favorite Android Apps

For half a year my job has been getting me in “touch” 🙂 with Apple devices: an iPad 3G+WLAN and a new iPod touch. Most of the time we use these devices for testing our mobile websites and to find out how the rest of the mobile world does it. As I’m not that in favour of spending so much money for an Apple phone I ordered a startup Android 2.1 phone some time ago. The actual Huawei-manufactured Vodafone 845 comes with a pretty small resistive 320×240 pixel display – but: hey, it came only 100€!

After trying many many apps the following list is an overview of my favorite ones. I might add a list pretty useful iOS apps in another article together with Benjamin in the next days.


123 Maze Lite

Maze game which get’s quite tricky in the later levels.

Scumm VM (alpha)

The scumm VM is a virtual machine for the best adventure games ever – created some years ago by Lucas Arts. Till now I could only find a very early ported version for android but following the instructions in the website at: I got the manually installed apk running. You’ll need some files from the scumm VM project (datafiles) – just stick to their FAQ and it should work.

You can get some of the old games from abandonware games website on the web or just copy the data from your 3.5″ floopy disks :-). I successfully played Monkey Island 1 + 2, Zak McKraken, Sam & Max and Day Of the Tentacle (though the sound is sometimes cracking).

X Construction Lite

Like the bridge builder and Pontifex games in X Construction you have to compose stable bridges for a train using metal segments.

Traffic Jam Free

Rushhour is a puzzle game where you have to move cars out of the way so a yellow can drive to the exit. Thousands of levels and you can set the difficulty in various steps.

Labyrinth Lite

The kids just love it, though the lite version does not come with many levels.


Yet another Sudoku game with many variations and thousands of levels.

Android Invasion

Space invaders clone.

Chess for Android

You can set the CPU strength which gives even my bad chess skills a chance to win.

Droid Balance Lite

Fun with the position sensor of the phone. By turning the phone left and right you have to get rid of red shapes while preventing the blue ones from falling down.

Gensoid Lite

Gensoid is an emulator for good old SEGA games, such as Sonic the Hedgehog or Street Figther.

Math Attack & Math Workout

Two “brain-train” math games.

National Flags Quiz

Either you have to chose the correct country name according to a shown flag or the other way around. I knew suprisingly few of them …

Save Newton Lite

Using arrows shot by a bow you have to save Newton from apples falling from the tree.

Sea Fight

Classic sea fight game. Just place your ships wise and try to nuke the CPU one’s.

Tools & spare time


All-you-need for geocaching. Just connected my account and turned on GPS and it worked like a charm. Comes with Google maps overlay, GPS compass, detailed cache information with riddles, coordinates and user hints. You can store geocache information for later use – e.g. if there’s no network in the woods.


Accesses movie information from the internet movie database. Very handy for quicky looking up a movie or what actor did which movie and such.

Google Sky Map

Ever looked to the night sky and wondered: what’s the name of that bright star? Google sky map can tell you, just point your phone into the direction of the target.Can also guide you to find a specific galaxy or star.


Displays comic strips which you can chose from a large list. I’m much in favour of XKCD, Dilbert and Peanuts.


Instant message client for Gtalk, msn, icq or yahoo. Can also do video calls. I’ve been using it for ICQ chatting sometimes.


Given a scanned barcode of a grocery item you can look up it’s caloric values or where to get it with best price.


Small app for tracking fuel consumption and gas station prices.

By the way: I used the QR Code generator by Jason Delport of Paxmodept to create the QR codes. You can get market links and package names of android apps using and – as of today, I believe – you can visit the market links using any browser as google opened the market for the web.

JavaScript Timer and Stack Trace Debugging

Today I had to work on a webpage with a large amount of JavaScript timers running and I had to find a bug which one of them caused. Unfortunatly the timeline in the Google Chrome developer tools only showed the order of the timer execution together with the timer ID. That IDs are created by each JavaScript setInterval() and setTimeout call. But just the ID doesn’t help much. So I rewrote the prototype of both the setTimeout and setInterval functions:

window._oldTimeOut = window.setTimeout;
window.setTimeout = function(execute, timeout) {
	var id = window._oldTimeOut(execute, timeout);
	console.debug("created timer with id:", id, arguments.callee.caller.toString());
	return id;

window._oldInterval = window.setInterval;
window.setInterval = function(execute, timeout) {
	var id = window._oldInterval(execute, timeout);
	console.debug("created interval with id:", id, arguments.callee.caller.toString());
	return id;

This gave me at least a hint where the sourcecode lines of the timer-executed code can be found. Also very helpful is a stack trace (aka call stack) at the current code position to find out which other function was calling the current one. I found a pretty old but still working code snippet on and added it to my timer debugging:

Function.prototype.trace = function() {
	var trace = [];
	var current = this;
	while(current) {
		current = current.caller;
	return trace;

Function.prototype.signature = function() {
	var signature = {
		name: this.getName(),
		params: [],
		toString: function() {
			var params = this.params.length > 0 ? "'" + this.params.join("', '") + "'" : "";
			return + "(" + params + ")";
	if(this.arguments) {
		for(var x=0; x<this.arguments.length; x++)
	return signature;

Function.prototype.getName = function() {
	var definition = this.toString().split("n")[0];
	var exp = /^function ([^s(]+).+/;
			return definition.split("n")[0].replace(exp, "$1") || "anonymous";
		return "anonymous";

	window._oldTimeOut = window.setTimeout;
	window.setTimeout = function(execute, timeout) {
		var id = window._oldTimeOut(execute, timeout);
		console.debug("created timer with id:", id);
		console.debug("stacktrace", arguments.callee.trace());
		return id;

	window._oldInterval = window.setInterval;
	window.setInterval = function(execute, timeout) {
		var id = window._oldInterval(execute, timeout);
		console.debug("created interval with id:", id);
		console.debug("stacktrace", arguments.callee.trace());
		return id;

Be sure to add that script tag at the very top of your JavaScript execution (as the first element of your <head> tag for example).

Find UTF-8 byte order marks

In a templating application I just ran into ugly “” characters a the beginning of the text. This is caused by the byte order mark with the hex characters 0xEFBBBF. As it was not the only one file that contained the BOM I ran a search:

find . -iname '*.css' -o -iname '*.html' -o -iname '*.js' -o -iname '*.pm' -o -iname '*.pl' -o -iname '*.xml' | xargs grep -rl $'xEFxBBxBF'

To remove the BOM I followed the suggested way by using sed:

find . -iname '*.css' -o -iname '*.html' -o -iname '*.js' -o -iname '*.pm' -o -iname '*.pl' -o -iname '*.xml' -exec sed 's/^xEFxBBxBF//' -i.bak {} ; -exec rm {}.bak ;

Tada, no more ugly BOMs!