Weekly Game Music: I’ve Got Some Balls – Feeling Irresistible

Sat, 05 Dec 2009 03:50:10 +0000

When remembering the past time when I got my first computer, some things I necessarily think of are – of course – Geos 2.0, Quick Basic, Nibbles, Scorched Earth and Cyberdogs – the software I probably used most. Later, I got my second computer, with Windows 98. Besides trying to run all of my old Software instead of using the new one, and trying the N64 Emulators at that time (which could run Super Mario 64 – which is amazing), one of the software I used mostly at that time was probably the game „I’ve Got Some Balls“.

It is a simple arcade game where you control a ball through mazes, trying to collect some crystals in a time as short as possible. Some of the levels are very tricky.

Anyway, during the gameplay, there is always the same melody. As far as I know it is called „Feeling Irresistible“, I have no idea where it comes from, probably from the Author „Sebastian Aaltonen“ himself. Anyway, here it is:


Abschaffung der Schaumweinsteuer

Fri, 04 Dec 2009 19:35:13 +0000

Das Deutsche Demokratische 4chan schießt mal wieder den Vogel ab mit einer Petition zur Abschaffung der Schaumweinsteuer.

Die Begründung ist erstmal interessant: Die Steuer wurde von Kaiser Wilhelm II eingeführt um dessen Kriegsflotte zu finanzieren. Und da diese Steuer zweckgebunden war, und der Zweck heute entfalle, wären diese Steuern rechtswidrig. Immerhin scheint sich der Petent mit dem Thema auseinandergesetzt zu haben.

Aber der Forenthread dazu ist Göttlich! Zitat: „Die Begründung ist nicht korrekt. Hitler hat 1933 die Steuer abgeschafft und 1939 zum Ausbau der U-Boot Waffe wieder eingeführt. (…) Ein Finanzierungsbedarf für die  U-Boote (…) ist gegeben.„. Darauf dann Antworten wie „Ich bin gegen die Petition, ich habe ein Herz für U-Boote!“ und die treffende Bemerkung, dass dem ordinären Schaumweinkonsumenten wohl selbige Steuer eigentlich relativ egal sein sollte.

Naja, ich frage mich, ob diese Petition überhaupt ernst gemeint war. Ein nettes Trolling ist sie auf jeden Fall. Weiter so, Epetitionen!


Werbeplakate in der U-Bahn

Thu, 03 Dec 2009 20:53:22 +0000

Heute in der U-Bahn habe ich etwas gesehen, was mich sehr froh gemacht hat:

Diese Art von Werbeplakaten regt mich gleich viel weniger auf als die sonstigen Werbeplakate. Wenn es mehr Werbeplakate dieser Art unter den Werbeplakaten gäbe, wäre die Welt wohl ein bisschen schöner. Leider ist das wohl nur ein Wunschtraum.


Mehr Spaß mit Mac OS X

Tue, 01 Dec 2009 23:29:18 +0000

Eigentlich sollte ich seit vier Stunden daran sitzen, etwas relativ wichtiges zu schreiben. Etwas, das sehr viel Mathematik enthalten wird, weswegen ich mich entschloss, LaTeX dazu zu verwenden. Normalerweise mag ich LaTeX nicht so besonders, und bevorzuge TeXmacs, aber für größere sachen ist es wohl besser, das System zu benutzen, das quasi jeder benutzt.

Natürlich bevorzuge ich dennoch etwas, das ein wenig WYSIWYGig ist – mir also eine möglichst gute näherung dessen angibt, was ich am ende bekommen werde. Insbesondere bei den Formeln kann das recht sinnvoll sein, wenn sie sehr komplex sind.

Ich war mir natürlich sicher, dass ich unter Mac OS keine Probleme damit haben würde – unter jenem System, das ja als so benutzerfreundlich gilt. Nun, was es erstmal mit der MacTeX-Distribution gab, war nichts, was in meinen Augen den Namen „LaTeX-Editor“ verdient – sondern eher etwas, das für mich jeder gute Texteditor mit Plugin-Technologie können sollte – Syntax Highlightening, automatische Shell-Commands, etc. – nicht unbedingt schlecht, aber kein Vorteil zu Emacs – und da ich Emacs gewohnt bin, bevorzuge ich es natürlich im Zweifelsfall.

Aber genau soetwas wollte ich natürlich nicht, und so kam ich schnell zu der offensichtlichen Alternative: LyX. LyX gibt es auch für Mac OS X. Nur leider gibt es hier Probleme mit der Keymap. Ich benutze inzwischen die Keymap US-International, weil man mit ihr im Allgemeinen weniger Probleme bekommt. Umlaute waren auch kein Problem, aber ein „ß“ einzufügen war ein Ding der Unmöglichkeit, denn in diesem Layout hat das „ß“ die Tastenkombination Alt-s. Und da Mac OS keine AltGr-Tasten kennt, und Alt-S mit einer anderen Funktion versehen war, resultierte ein großer Fail. Ich versuchte natürlich, das Feature auszunutzen, Tastenkürzel zu definieren, fand aber in LyX keine Funktion, die ein scharfes s einsetzen hätte können.

Ja mei. Dann eben doch TeXmacs. Doch auch TeXmacs machte Probleme, diesmal mit den Umlauten. TeXmacs ist auch relativ seltsam Programmiert was Tastatureingaben angeht. Trotzdem ändert das in dem Fall nichts an der Tatsache.

Ja mei. Was es noch gäbe wäre AUCTeX wie man mir sagte. Ein Emacs-Mod. Na wunderbar – dachte ich mir – Emacs wirds schon richten. Nun, weder fink noch pkg noch macports haben es hingebracht das zu installieren – aus Gründen für die mir meine Zeit zu schade ist sie jetzt hier niederzuschreiben. Ein beherztes configure-make-makeinstall hat zwar irgendwas installiert, aber … nunja … ich müsste wohl Aquamacs noch entsprechend konfigurieren, inzwischen habe ich aber weder Lust dazu, noch groß Lust dann auch noch was damit zu schreiben – mit ein Grund für diesen Rant.

Also: VMWare Fusion angeschmissen, Cygwin (!!!) angemacht und erstmal dort LyX installiert. Geht out-of-the-box. Wie schön. Wenigstens morgen kann ich damit also schreiben.

Ein paar andere Freuden die mir das illustre Apple-Produkt heute bereitet haben, waren zum Einen, dass eine USB-Tastatur, die unter Windows und unter Linux problemfrei out-of-the-box ging, nicht erkannt wurde. Zum Anderen, herauszufinden, wie man Mac OS X so betreibt, dass nur der externe Bildschirm verwendet wird. Hier mal eine Anleitung:

  1. Netzteil einstecken – sonst geht es nicht
  2. USB-Tastatur anschließen und warten bis sie erkannt wurde – wenn sie nicht erkannt wird, pech
  3. Computer manuell in den Ruhezustand versetzen – einfach den Schirm zuklappen reicht nicht
  4. Warten bis der Computer wirklich im Ruhezustand ist, dann den Schirm zuklappen
  5. DVI-Adapter mit Bildschirm anschließen
  6. Eine beliebige Taste auf der externen Tastatur drücken, und hoffen, dass der externe Bildschirm angesprochen wird
  7. Nachdem das geklappt hat, einloggen
  8. Schirm am Macbook wieder aufklappen – der bleibt jetzt zwar schwarz, aber es besteht sonst die Gefahr, dass es sich überhitzt

Ja, so genial ist es, das Mac OS X. Es wäre ja auch viel zu kompliziert, das in den Konfigurationsdialog einzubauen, wie unter Windows.


Yeah, just read there is a Scheme-Interpreter in Clojure …

Tue, 01 Dec 2009 22:28:15 +0000

Just read on Reddit that there is a Scheme-Interpreter for Clojure. What a nice thingy.

I mean one could just use JScheme but hey, who cares. Its Clojure. Its fresh. Its new. Its Web 2.0.


Randomly Found Software: Zeta

Mon, 30 Nov 2009 23:13:56 +0000

Actually, when I read this freshmeat announcement, I wondered whether to admire the person writing that project, or consider him crazy: „it was created for the sole purpose of having a new target to which the Linux kernel, GNU bintutils, and GNU gcc can be ported„. And visiting the website, I read that they have already ported a huge amount of the GNU binutils and the Linux Kernel and the GCC onto it – which I assume was a lot of work.

So I wondered what all that is actually good for – and as far as I read, it is good for „people interested in learning linux kernel internals„. So there seems no practical use aimed. That is, somebody used his spare time to create a virtual architecture and create a linux-port for it, just for fun. Thats definitely cool.

But ok, they could have ported linux to run under the JVM or under SPIM, too, then they wouldnt have to build their own architecture.

On the other hand, the architecture seems to be comparably easy – as far as I see. As well easy to use as easy to reimplement. Thus, as soon as linux is being ported there completely, one has a platform to reimplement and do experiments. Therefore – very interesting.


WindowWrangler – Endlich ein einigermaßen gescheiter freier Window Manager für Mac OS

Sun, 29 Nov 2009 03:21:35 +0000

Zufällig hier gefunden – warum auch immer ich es bisher noch nicht gefunden hatte. WindowWrangler. Das Programm hat keine imba Keyboard Shortcuts um sich irgendwelche Fensterpositionen zu merken. Aber dafür hat es genau die Funktionalität die ich will: Fenster per Keyboard resizen und verschieben. Und es ist Donationware – die Bezahlung ist freiwillig. Da sitzen bei mir die Euros gleich viel Lockerer, wenn man mich nicht zwingt zu bezahlen – vielleicht werde ich, wenn ich mir VMWare Fusion kaufe, den preis aufrunden, und den Rest für diesen Fenstermover bezahlen. So als Trinkgeld quasi.

Am Liebsten würde ich natürlich mal eine API-Dokumentation durchlesen um zu sehen wie ich mir selber ein entsprechendes Programm schreiben kann – aber wenn das nur halb so schwer ist wie einen X11-Window-Manager zu schreiben kann ich glaub ich gleich sagen, dass ich keine Zeit dafür habe.

VMWare Fusion werd ich mir auch nur deshalb kaufen weil ich wahrscheinlich die nächsten Monate immer wieder eine Windows-Umgebung brauche, und keine Zeit habe, zu schaun, wie ich das Ganze mit VirtualBox hinbekomme – ich meine man kann sicher einige features mit VirtualBox auch hinbekommen, auch das Booten einer BootCamp-Partition dürfte principiell kein Ding der Unmöglichkeit sein. Aber es ist … Arbeit.


VMWare Fusion – die wahrscheinlich erste Mac-Software die ich mir kaufen werde…

Sat, 28 Nov 2009 03:14:49 +0000

… Denn wie ich schon schrub benutze ich atm hauptsächlich Windows. Und ich bin mir relativ sicher, dass das noch häufiger der Fall sein wird, bzw. dass häufiger die Notwendigkeit bestehen wird, mehrere Betriebssysteme zu nutzen. Denn es gibt immer, für so ziemlich jede Aufgabe, irgendeine Sache die mich an irgendeinem der drei Betriebssysteme wirklich nervt.

Nun kann man aber VMWare so wunderschön nutzen um BootCamp-Partitionen virtuell zu Booten, die man aber auch gleichzeitig nativ booten kann. Ein klarer Vorteil zu VirtualBox – wo man das zwar auch hinbekommt, aber nicht ohne erheblich größere Anstrengungen (aber vielleicht schreibt ja irgendwann mal jemand sowas).

Momentan renne ich die Testversion. Mal schaun wo ich günstig eine Lizenz kaufen kann.

Sobald ich Zeit habe richte ich mir dann vielleicht unter Windows noch einen VMWare Player ein, sodass ich eine Linux-VM unter beiden Systemen verwenden kann. Auf ein natives Linux muss ich dann leider verzichten, aber ich denke, das kann ich auch ganz gut, denn Linux ist so modular eingerichtet, dass es die Vorteile der Virtualisierungslösungen auch wirklich ausnutzen kann. Außerdem ist es ohnehin nicht ganz trivial Linux auf dem Mac nativ laufen zu lassen – es geht, und ich fand es auch ganz gut, aber es kann, wie man mir sagte, der Hardware schaden, da Apple der Software ziemlich viel Einfluss überlässt – was ich persönlich übrigens sehr unschön finde, denn Softwarefehler passieren nunmal immer wieder.

Dabei fällt mir zufällig wieder eine Idee ein, die ich als enthusiastischer Informatik-Erstie (oder Zweitie) mal hatte: Einen POSIX-Layer für die Java-VM. Im Moment wird ziemlich viel für die Java-VM entwickelt, und sie ist recht gut optimiert, es gibt sogar C-Compiler dafür. Und mir geht es häufig so, dass ich lieber ein ineffizientes Programm habe, als gar keines. Nun, ein POSIX-Layer für Java, auf dem man viele Programme compilieren kann, das würde einem die Möglichkeit geben, sehr viele Software quasi plattformunabhängig zu compilieren. Ich meine damit soetwas wie „Cygjava“ – die Speicherung von Java Bytecode in ELF-Dateien, eine Syscall-Infrastruktur, und was eben sonst noch so dazu gehört. Kann das mal bitte jemand Programmieren?


Weekly Game Music: Wario Land 3 – Rudy The Clown

Sat, 28 Nov 2009 02:42:48 +0000

I have actually never played Wario Land 3,  but according to the things I have seen it is quite similar to Wario Land 2 which I have played and enjoyed. It was comparably easy but had a lot of secrets to find. You cannot die in that game (as far as I know you cannot die in Wario Land 3 either), but enemies cost you coins and may change you into some other form (like making you fat or turning you into a zombie) – as you can see when watching the cover in the video below, where a few forms of Wario seem to be drawn. Anyway, the music which I will link here sounds typical for Wario Games. Enjoy!

(direct link)


Things C could have – in my opinion

Fri, 27 Nov 2009 15:04:49 +0000

For portable imperative low-level programming, my favourite programming language ist still C. Basically because there is no real alternative to it so far – there may be projects aiming it, but a big advantage of C is simply the huge codebase and portability, mostly without having to do anything at all. For example, you can even rely on most POSIX-Functions even under windows, if you dont mind using the Cywgin-DLLs, etc. On the other hand – of course – C is not good for hacking. When writing software in C, one should have a clear perception of what he wants to code and how he wants to structure his code.

But I dont want to discuss this by now. C has its advantages and disadvantages, there is no doubt about that. What I want to point out right now is, that C has a few disadvantages, of which I actually do not understand why they are still existing (or whether they are still existing at all). I would like to point out a few of them and explain why I dont understand that they are existing.

Probably I will be wrong with some assumptions, since I have never actually viewed a code of a complex C compiler. So, if I am wrong, feel free to comment this post.

Turing-Complete Macro System

The first thing that C lacks of is a turing-complete macro-system. The template-system from C++ is – as far as I heard – turing complete meanwhile, but its comparably hard to actually code with it. I tried to understand it, but to me this system seems really ugly for actually programming something with it.

C has the #define statement, and most C-Compilers support inline functions. I myself try to use inline functions whenever possible, because they are easier to debug and seem to be a more modern approach. On the other hand, in some cases, they are simply not sufficient. Luckily, #define statements can even have arguments. But there is no recursion, they are not turing-complete, and there is no possibility (I know of) to modify the contents of the arguments before putting them in the code.

Ok, so you could just put some kind of recursive calls for #define statements, and maybe some basic string-operations in your C-Compiler. Then one could for example implement a simple JSON-Parser, etc., to handle that code and have something that is comparably mighty. Would be one solution which should not be too hard to implement, improves usability of the compiler, and doesnt make the actual code which is generated slower, since anything that happens happens at compile-time. This possibility would be better than what we have right now, but I wouldnt really consider it being a good alternative to the macro-systems I know from Lisp.

A better possibility would be to actually use code-generating functions written directly in C. You could then pass them the arguments either as strings or in some kind of syntax-tree – syntax-tree would be better since in most cases you would use some parser anyway, so why not using the one the compiler has. One would have to find a good format of these syntax trees, there are a few possibilities for that, but that part shouldnt be too hard. This function then returns either a string or a syntax tree which is then placed into the code, where the macro was called.

This is the possibility I would actually prefer. But of course, it is harder to implement. One main difference between C and most functional languages is that in C, compilation time and runtime are strictly separated, so you cannot just call functions you have already compiled while still compiling (which you actually can do in most lisp dialects). Of course, one could consider this a misfeature of C compilers, and in fact, it should be possible to have the same thing in C, too, but on the other hand, many things are harder to optimize then, and since C is very low level, this could produce a lot of problems when it comes to memory management like managing syntax trees, buffer overflows, etc.

Maybe an alternative would be some statement – lets call it #macroinclude – where you can include a file which explicitly must be runnable (i.e. in most cases compiled) before the actual file can be compiled, because it relies on the macros defined in that file. Then, the compiler could take that file, compile it (maybe with lesser optimizations, etc.), and use it for compiling the actual file. To prevent the compiler from flaws, it could fork and let only one subprocess actually call these functions, while the other subprocess asks it for macroexpansion whenever needed.

Multi-Line Strings

I dont see any reason why it is not possible to declare a string that has newline-symbols with proper newline-symbols inside the code, i.e. declaring a string in multiple lines inside the code, as it can be done in Scheme and Common Lisp for example. It shouldnt be too much harder to parse (in fact, it should be easier I think).

Compile-Time Type-Dispatching, Operator Overloading

Actually, C++ already does have these features in some cases. But C apparently doesnt. And actually, of course, I see simple reasons for that – functions in shared libraries must have a pre-defined unique name. On the other hand, one could easily define a simple naming-scheme for such functions. The reason why one may want this is that it is simply extremely useful and can enhance code-readability. Lets say for example you want to define an additional numeric type, say Countable Ordinal (I explicitly dont use Complex Numbers here, because there are C-Compilers supporting them, as far as I heard), and you want to define an addition for them. You would have to add a new function name like „addOrdinals“. But it also makes sense to add integers to ordinals, since they are a special case of ordinals. So you would also have to add a function „addOrdinalToInteger“. With Compile-Time Type-Dispatching, you would be able to just define a function „add“ twice, with different types. Now, with operator overloading, you could also add an additional definition for +, which can also enhance readability. Important: All of this can (and should) be done at compile-time.

User-Defined Infix Operators

Even though I like Lisp, in languages like C which are not optimized for coding with prefix-ops, additional infixes can be a nice thing to have. Many languages (haskell, sml, afaik also perl 6) have them, so it shouldnt be too hard to add them to C.

Structure Introspection

C has no type information on runtime. And thats a good thing, I suppose. Its a design decision whether or not to have type information on runtime, and since C is low-level and you want to be able to do such „bad“ things like casting integers into strings to send them through sockets, etc. – with a turing-complete macro-system you could of course add something like type-information to some structures, if you want it, but C is a low-level-language, and it should stay that. If I really need a complex object system, I would maybe switch to GLib if I have to use C, or use Common Lisp.

Anyway, structure introspection is something that could really be easily provided, at least on compile-time, for example inside macros, but I actually dont see why not also on runtime. For any structure A, you could – for example – add a function void* readFieldA(A* object, char* fieldname) which returns a pointer to the beginning of the given field for the given object. This is a simple function that could be easily implemented. If you already have Compile-Time-Dispatching as mentioned above, you wouldnt even have to use an own function name for any type. Additionally, maybe one would like to have a function like size_t fieldLength (A* object, char* fieldname) to know the length of the field, and functions int fieldNum(A* object) and void getDeclaredFieldNames(A* object, char** names) to get all names of declared fields.

Well, this is one possibility I could think of. One of many. A problem with this possibility is when it comes to tings like unions or bitshifts. For this, maybe it would be a good thing to let readField return an appropriate function pointer which you can pass the given object to extract the desired data, instead of a pointer onto the data itself.

Templates

Templates are a nice thing to have. As far as I know, they are already planned to add to a new C standard. And well, why not?

Lambda-Forms, Closures

As well clang as gcc as some new C++-Drafts are trying to define a lambda-syntax and lambda-forms for C/C++. In fact, it shouldnt be too hard to get something like that, at the moment, I like clang’s block-syntax most, but its still very complicated to use imho. Whats the problem with a syntax like just lambda (arglist) { <code> ; return <...>; }. The type can be inferred by looking at the return-statements. Lambda-Forms are not to use for huge functions, that is, normally they should stay small enough such that not only the compiler but also the code writer should be able to determine its type. And what about the ugly function pointer syntax als clang’s block syntax has? Why cant there just be type-declarations like (int,int->int) or some similar syntax? In the end, its just syntax, for the parser it shouldnt be too much additional work, for the programmer, it should become easier to code.

With lambda-forms comes – of course – the problem with closures. Small objects like integers can be directly copied into the code of the lambda-form (or some additional data structure naming the initial stack frame). But sometimes, you have pointers to work with, pointers to stack objects which may be already deleted when calling this function. That is a problem of which I dont know a proper solution (except when changing the memory management – which is something you usually dont want when working with C). Well, you will – as with all structures you define inside C – have to take care that your pointers stay valid yourself. I guess thats a price you have to pay for low-level-programming. In many cases, the compiler should be able to detect if a pointer references onto the stack or onto something else, so it could warn the programmer.

Tail Recursion, Loop-Recur

GCC also supports tail call optimization, and in my oppinnion, this should be the default, since I see no reason why one wouldnt want to have it in most cases – and in the few cases when it would make sense, maybe one could add a keyword or compiler-flag to suppress it.

In addition, it would be nice to have some loop-recur-statement as scheme and clojure do have, like loop (arglist) { <code>; recur args; <code>; return ...;}. I think it would be convenient to have two possibilities, either recur (arguments) as a function call (for the cases you dont have tail recursion – which may sometimes occur), or recur arguments as a replacement for return recur(arguments), but thats a matter of taste. And of course, you could do the same thing (except for non-tail-calls) using a while-form – but thats not the point.

Namespaces

I never quite understood why there are no namespaces in C. Namespaces have – in my opinion – nothing to do with the fact that the language is low-level. Namespaces are useful for structuring code, and they are something that can be handled during compile-time. The main problem would be which naming-scheme to use in libraries, but since most systems have common naming-schemes for that, since as far as I know in most systems there exist C++-Compilers and mostly different C++-Compilers are trying to act similar to each other, I dont see any problem with that.

Another possibility would be to just define prefixes of names which can be omitted when declaring it. In the end, thats about what namespaces are. Thats not that beautiful, but who cares, its simple.

Conclusion

So these are a few simple language extension requests by me. I think most of them would not break the spirit of C but would be extremely useful. Discuss!