Archive for April, 2010

April 23rd 2010

Java/C++ polyglot

Today I discovered Java’s “inline C++” keyword, //\u000a/*, which makes a Java/C++ polyglot pretty easy:


//\u000a/*
#include <iostream>

#define private
#define public
#define static
#define void int
struct {
  std::ostream &println(const char *c) {
    return std::cout << c < < std::endl;
  }
} out;

//*/
/*\u002a/
import static java.lang.System.out;

public class Polyglot {
//*/
  public static void main(/*\u002a/String[] args//*/
      ) {
    out.println("Hello from whatever language this is!");
  }

/*\u002a/
}
// */

Eclipse deals.. okay. The red-underlining in the commented sections is for the spelling. <3

1 Comment »

April 18th 2010

InstallShield unpacker

I couldn’t find anything that would unpack the (entirely unnecessary) Nokia map loader set-up application, which is some InstallShield 7 nastiness.

deshield can. Given the number of magic numbers in it, I fully expect it not to work with other installers.

Why do they bother? The data isn’t even compressed; it’s just bit-twiddled a little with the file-name, and this magic number: [ 0x13, 0x35, 0x86, 0x07 ].

2 Comments »

April 8th 2010

Tro^WMicrobenchmarks!

This blog is far too low in trolling. As a start, everyone knows that git is fast and svn is slow, but I wasn’t aware quite how shocking the difference was.

The test: committing a file that slowly increases in size, and a new file, 200 times.

git: 2 seconds.
darcs: 10 seconds.
bzr: 70 seconds.
svn: 200 seconds.

No comment.

Reproduction steps follow.
Continue Reading »

3 Comments »