Wednesday, March 31, 2010

A nice day in the Zoo

We spent a nice afternoon in the Zoo Gelsenkirchen - Zoom Erlebniswelt. Due to the fact that there are currently school holidays we were far of from being the only visitors. Luckily the Zoo area is big enough so that this was never really disturbing. The Zoo provides three different theme parks: Alaska, Africa and Asia. As the latter is new and justed opened, we started with this one.

As you can see in the picture above the Asia theme park consists of a outdoor area - which was not populated with animals except few great apes with were fixing the last things within the area - and a big indoor area. The latter provides a jungle hall and a big indoor playground for the kids.

After having a rest at the central snack point we explored the Alaska theme. As a picture can say more than thousands words:


The Zoo is a modern zoo which provides the animals with a recent amount of space. You do not find any small cages build from iron bars but rather big areas which are bounded by nature emphasized borders, like rocks and water. Works nice - not only for the animals but also for the visitors as this gives a much more natural impression than in the old fashioned zoos. Glass windows in the different enclosure give you the opportunity of a 5 meter-distance eye in eye contact with e.g. a pole bear. Drawback of this is that the visitor needs to be more patient to really spot all of the animals as some of them use the available space to hide from the visitor. So take your time and bring you Zoom lens with you...

For the kids the zoo provides great opportunities not only to experience all the animals but also to refresh their capacity for animal experiences on the various playground. Even within the theme parks they find - nicely integrated in the theme - a couple of slides which keep the kids happy.

As we got a free visit as part of the Ruhrtop-Card it was more than OK just to spent half a day in the Zoo. Anyway if you aim to see all parts of the Zoo you should definitely spent a whole day in the Zoo. More than enough attractions to see and nice opportunities for a break. I think a nice alternative to the central snack area - which provides a huge playground for the kids - would be to aim for one of the snack points within the theme parks. Those are much smaller and provide some park theme related atmosphere and food.

We are looking forward to our next visit - even quite willing to spent some money for this.

Wednesday, March 10, 2010

Simon says done / Benchmark

... really easy puzzle. Spent more time on writing - a still really easy - test server than actually writing the client. Anyway the purpose is to get thrift running (and proof the connection/submission process towards Facebook) and that has been well achieved.

Beside playing a little bit more with the puzzles, I will know dig a little bit deeper into the thrift piece. For the time being I found a interesting benchmark of different object (de-)serialization solutions including Thrift, protobuf and many more. Interesting ...

Saturday, March 6, 2010

Getting in touch with Thrift - Get the turial example running

So - Thrift has been compiled - hopefully it does work (see earlier post). Before I jump to the "Simon says" Puzzle, I wanted first to check if my thrift build is working. Therefore I gave the example of the thrift tutorial a go. The tutorial is still in an early stage:

This tutorial is known to be woefully incomplete, and is a work in progress. This skeleton is illustrative of what is being worked on and will soon be available. [thrift webpage]


Sounds not that promising and indeed there have been some minor obstacles in my way. Prerequisits for the tutorial is the availability of
  • Simple Logging Facade for Java - SLF4J and
  • Log4j if you decide to use log4j behind the facade
jars in the classpath of the system. Instead of building from the provided build file, I decided to create a eclipse project. After setting the scenes, I still got some compile errors in JavaServer.java. Seven occasions like:

[javac] /home/stefan/thriftest/tutorial/java/src/JavaServer.java:57: an enum switch case label must be the unqualified name of an enumeration constant
[javac] case Operation.ADD:


which simply can be solved by replacing case Operation.ADD by case ADD. And two more problems:

[javac] /home/stefan/thriftest/tutorial/java/src/JavaServer.java:69: incompatible types
[javac] found : tutorial.Operation
[javac] required: int
[javac] io.what = work.op;
[javac] ^
[javac] /home/stefan/thriftest/tutorial/java/src/JavaServer.java:77: incompatible types
[javac] found : tutorial.Operation
[javac] required: int
[javac] io.what = work.op;

I omitted those by commenting those lines as they anyway don't add to the functionality of the server.

After this manual changes the tutorial seems to be running fine. Ready for Simon says puzzle.

Friday, March 5, 2010

Getting in touch with Thrift - Simon says

Selected Simon Says from the Facebook Puzzle selection as this one seems to be the easiest example which involves the usage of Thrift. Thrift is right now a apache incubation project and is a framework for x-language service development. It has been initially developed by Facebook.

Let's see how to get Thrift working on my Ubuntu 9.10 system. First of all I downloaded the current snapshot from the Facebook Developer Pages ( in my case thrift-20090330.tar.gz). After unpacking a run of the ./configure script unveils a unsatisfied dependency on boost libraries. Synaptic comes with a couple of boost packages. I gave it a try with libboost-dev package (incl dependencies). With that the configure script was happy but the make command produces this nice error:

make[3]: Betrete Verzeichnis '/home/stefan/thrift-instant-r760184/compiler/cpp'
g++ -DHAVE_CONFIG_H -I. -I../.. -Wall -I./src -I/usr/include -g -O2 -MT thrift-thriftl.o -MD -MP -MF .deps/thrift-thriftl.Tpo -c -o thrift-thriftl.o `test -f 'thriftl.cc' || echo './'`thriftl.cc
In file included from ./src/parse/t_const.h:10,
from ./src/main.h:11,
from thriftl.ll:20:
./src/parse/t_type.h:88: error: ISO C++ forbids declaration of ‘uint8_t’ with no type
./src/parse/t_type.h:88: error: expected ‘;’ before ‘*’ token
./src/parse/t_type.h:92: error: expected ‘;’ before ‘std’
./src/parse/t_type.h:110: error: ‘uint8_t’ has not been declared
./src/parse/t_type.h:149: error: ‘uint8_t’ does not name a type
./src/parse/t_type.h: In member function ‘virtual void t_type::generate_fingerprint()’:
./src/parse/t_type.h:76: error: ‘fingerprint_’ was not declared in this scope
./src/parse/t_type.h: In member function ‘bool t_type::has_fingerprint() const’:
./src/parse/t_type.h:81: error: ‘fingerprint_’ was not declared in this scope
./src/parse/t_type.h: In member function ‘std::string t_type::get_ascii_fingerprint() const’:
./src/parse/t_type.h:94: error: expected initializer before ‘*’ token
./src/parse/t_type.h:96: error: ‘fp’ was not declared in this scope
./src/parse/t_type.h: In constructor ‘t_type::t_type()’:
./src/parse/t_type.h:123: error: ‘fingerprint_’ was not declared in this scope
./src/parse/t_type.h: In constructor ‘t_type::t_type(t_program*)’:
./src/parse/t_type.h:129: error: ‘fingerprint_’ was not declared in this scope
./src/parse/t_type.h: In constructor ‘t_type::t_type(t_program*, std::string)’:
./src/parse/t_type.h:136: error: ‘fingerprint_’ was not declared in this scope
./src/parse/t_type.h: In constructor ‘t_type::t_type(std::string)’:
./src/parse/t_type.h:143: error: ‘fingerprint_’ was not declared in this scope
thriftl.cc: In function ‘int yylex()’:
thriftl.cc:1449: warning: label ‘find_rule’ defined but not used
thriftl.cc: In function ‘int yy_get_next_buffer()’:
thriftl.cc:2389: warning: comparison between signed and unsigned integer expressions
thriftl.cc: At global scope:
thriftl.cc:2483: warning: ‘void yyunput(int, char*)’ defined but not used
thriftl.cc:3138: warning: ‘int yy_flex_strlen(const char*)’ defined but not used
make[3]: *** [thrift-thriftl.o] Fehler 1

I played a little bit with different versions of flex, bison and such a like, but I couldn't get this one running. While I was browsing for help, I found this nice blog entry from Robert J Berger which talks you through the installation of Thrift on a Ubuntu system. However mine still does not work.

As a x-check I downloaded the 0.2 Thrift release from the project homepage and tried to compile this. And this worked without any visible errors (note that you need to execute ./bootstrap.sh before running ./configure. Next step will be to test this installation and than keep fingers crossed that this one works for the Facebook Puzzles as well.

Thursday, March 4, 2010

Facebook puzzles

Tonight I joined the community of people who are spending their time to solve Facebook Puzzles.

Those puzzles are programming exercises. Facebook provides couple of those puzzles in different difficulty levels. Each of them consists of a problem description, sample input and expected output data. Solution are excepted in a range of different programming languages like Java, C, C++, Ruby, Erlang (.. really long list ...). You submit your solution as an email which is processed by a bot which compiles and runs the submission against an input which is not known by us. Result of this run is provided as an email which provides a binary success / failure indication.

As far as I looked at those problems they are restricted variants of hard problems. Only the tiny restrictions make them solvable in polynomial time. So quite some thoughts on finding a proper algorithm is needed for this one which makes this stuff pretty interesting. Another dimension is that your solution will be run on large/difficult test data. Therefore you really need to spent some time to optimize your solution in runtime and space. That makes it even more interesting. The more advanced puzzle involve the usage of the Thrift framework and elements of distributed computing. Nice :-)

Facebook provides quite some ground for a vivid developer community around the puzzles. There is a fan page, quite some discussion threads and even stuff outside Facebook (like this FAQ) which deal with that topic. There is a Facebook application which allows you to share the glory of solved puzzles on your Facebook profile and there are public pages which show High-Scores like thriftpuzzle server. Everything set for a good competition ;-).

Facebook places the puzzle as a recruiting tool - showing guys which solved puzzles and have been hired. Definitely this is a good tool for a company to get smart developers into your orbit.

Some of my colleagues started solving those puzzles some time ago and I was trying to keep myself out of this one as this definitely would impact my family life. High risk of addiction ;-). Now it happened, but I try to keep my involvement low. Personally it is a nice opportunity to
  • solve some nice algorithmic challenges
  • learn/compare programming languages on valuable problems
  • get in touch with the Thrift framework - on my list anyway.
Why don't you try this as well?!