Saturday, March 26, 2011

If Chuck Norris were ... oh wait he is ...

  • Chuck Norris can sort in O(1).
  • Chuck Norris can call pure virtual functions.
  • All turing machines will terminate for Chuck Norris.
  • Chuck Norris can throw exceptions from destructors, in all cases.
  • Chuck Norris can instantiate interfaces.
  • Chuck Norris can return values from constructors.
  • Chuck Norris' destructors can take arguments.
  • Chuck Norris knows a clean way to use the visitor pattern with checked exceptions.
  • Chuck Norris can use closures in Brainfuck.
  • Chuck Norris finished the hurd kernel years ago, he just doesn't feel like releasing the code.
  • You may think Linus Torvalds is much cooler than Chuck Norris, well they are the same person.
  • Dereferencing null pointers fails because the memory with this adress is owned by Chuck Norris.
  • Object inherits from Chuck Norris.
  • Chuck Norris doesn’t use web standards as the web will conform to him.
  • Chuck Norris can overflow your stack just by looking at it.
  • Chuck Norris doesn’t need a debugger, he just stares down the bug until the code confesses.
  • Project managers never ask Chuck Norris for estimations ... ever.
  • The programs that Chuck Norris writes don’t have version numbers because he only writes them once. If a user reports a bug or has a feature request they don’t live to see the sun set.
  • Chuck Norris' Internet connection is faster upstream than downstream because even data has more incentive to run from him than to him.
  • Chuck Norris can binary search unsorted data.
  • Chuck Norris doesn't get compiler warnings. In fact, hardware is so scared of him, it will interpret his programs directly.
  • The one true bracing style is the one Chuck Norris uses.
  • Chuck Norris never changed a running system, but he sure could.
  • Every time you use Visual Basic Chuck Norris kills a kitten.
  • Chuck Norris has never seen a kitten video on youtube.
  • Chuck Norris can pack his backpack perfectly in O(1).
  • Chuck Norris doesn't need the observer pattern, he observes everything.-
  • Chuck Norris can use a One Time Pad twice without losing perfect security.
  • Chuck Norris knows all data ever piped to /dev/null.

Fun C Code

What does this do?

Google App Engine Banking Server

Now that my wallet is up and running I need some sort of server to upload my transactions to and download my banking statements from.

My home banking software (KMyMoney) supports two bank statement sync formats. There is a java library for both of them
OFX: http://ofx4j.sourceforge.net/
HBCI: http://hbci4java.kapott.org/

HBCI ships with more documentation, and since my real Bank uses this standard, I already know that it can work with KMyMoney. Compiling this library is a pain. After getting errors of the kind "Using enum as an identifier is illegal" and miss matching library version, I decide to check the date of the last commit. Great, Christmas 2002.

OFX is badly documented, but it builds easily and it is open source, so who needs documentation anyway? Yes, there is an unmarshaller class.



I only need an example OFX file and I can figure it all out. But no, it can't be that easy. They OFX main website http://www.ofx.net/ just has to be down. Maybe the mailing list can help me.

Days later ... no respose, but the website is up again. And they ship with examples:
http://www.ofx.net/OFXExamplesPage/OFXExamples.aspx

Some unmarshalling magic later:

Parsing a request


Generating a response


The next day, my mailinglist post is answered.

Friday, March 25, 2011

My first Android app

I just got my Nexus S the other day (the first time I really wanted to own a cellphone). The it is so much fun that, even though I swore myself not to get hooked on another project again right now, I just couldn't resist to check out the Platform. So I installed the SDK:
http://developer.android.com/sdk/index.html

It is smart to run the app directly on your phone. Starting the emulator takes forever.
Setting up the connection is pretty straight forward with the Nexus S:
http://developer.android.com/guide/developing/device.html#setting-up

Debugging is nothing new to someone having used eclipse before. One can either write logs using the Log.e() function or syso.

Everything else is pretty straight forward.