Sep 25, 2012

Angry user...

Sorry, I could not resist the pun :)

Well, some time ago (to be more precise 1 1/2 years ago) I've bought a (Chinese) Android Tablet so I could experiment, play games and may be try to develop some program (of course I've failed miserable to write any application for it :(. You can see a picture of the device bellow (it ended up to be much more resistant than what I expected! You can see its cracked 
screen due to 2 ~ 3 not so smooth landings - thanks to my young daughter):

Anyway, I use it regularly for reading ebooks, email reading and playing basic games. Talking about games I used to play "Angry Birds" (all free editions) on this device with no problems at all; but at some point in time something has changed and since then I am not able to play it anymore. The symptoms are always the same: I launch the game, its "splash screen" shows up followed by some screens and finally the "loading" screen shows up but then the application just dies without any trace! 

I had just accepted the fact that I'd not be able to play this game again on this device but last weekend I was recovering from a small surgery and I decided to investigate it a little bit more.

First thing I did was to install a log viewer (I'm using aLogCat) to check if I could find anything on Android logs. Indeed it was pretty easy to find the information I was looking for:

E/HttpRequestHelper( 4956): Exception from HttpClient.execute.
E/HttpRequestHelper( 4956):
E/HttpRequestHelper( 4956): at
E/HttpRequestHelper( 4956): at
E/HttpRequestHelper( 4956): at
E/HttpRequestHelper( 4956): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(
E/HttpRequestHelper( 4956): at
E/HttpRequestHelper( 4956): at

Huum... ok, so the application tried to resolve the host "" and it failed bringing the whole app down! WTF? (I tried to access this host from my desktop and the result is the same (
Interesting enough, as well does exist) so I assume the problem is directly related to the subdomain "rovio" on

Searching on net for this error did not bring any useful answer. Also I've tried to clear Angry Birds application data, 
re-install it and even a device factory reset (due to other issues) to no avail :(. 

Have you seem this error? Any ideas how to fix it? I doubt I am the first one to stumble on it!

Sep 15, 2012

Shopping abroad

If you by stuff while travelling abroad (more specifically to European and some Asiatic countries) you may be paying more than you need to! This is because in such countries there are some taxes that tourists do not need to pay but they are included in the product price anyway.

Bellow I show the basic steps to make sure you'll get a tax refund:

  1. Find a participant store
  2. Buy and pay (of course) your stuff
  3. Tell the clerk that you want to get a tax-refund (at this point he/she will fill a form with information regarding your purchases / you)
  4. At the airport do the procedure to get your refund.
I'll not explain all these steps in details here; instead I'll focus on how to proceed at the airport (step 4) because that was the most confusing part for me. For more information, including the complete list of countries you can check here.

Also, keep in mind that the following description is based on my own experience (mostly travelling to Germany) and it may be different in other countries (although I believe that they are either pretty similar if not the same in all countries).

So, when you get ready to return:

  1. At the check-in post inform the clerk that you have a tax-refund to claim. She/he should follow the usual procedure but instead of dispatching your bags immediately it will be handed back to you (with the baggage identification stickers on it).
  2. Now you need to go tho the customs where a custom official will check your purchases, receipts and stamp the form filled at the store. At this moment your bags will be dispatched.
  3. With your form stamped go to the "tax-free" post (usually within the board area, i.e, after the security checks) and present the just stamped form and your passport.
  4. Get some of your hard earned money  back.

Regarding refund methods I have used two different ones: i) cash, ii) credit in a credit card; sometimes the tax-refund clerk asks you which method do you want, sometimes he/she will pick one for you :)

One mistake I've made at least twice was to forget that in some flight connections you don't take your bags back at the intermediate airport. For instance in one of my travels I was returning from Germany to Brasil but my flight had a connection in France, i.e, I'd fly from Germany -> France -> Brasil. Since the instructions are to follow this procedure when you are leaving EU I planed to  do this in France, but wait, I did not got my bags back in France, so no refund for me this time. In this case I should have done the process in Germany.

BTW: Last time I got back 13 euros which represents more or less 10% of my expenses (this value may vary for each country of course).

Hope this help others....

Sep 4, 2012

C#/.Net Generic constraints


Despite having no doubt about the usefulness of type constraints in C# generics (this is a key feature to help avoiding bugs when writing generic code in C#) I always had  the impression that it should be able to express more constraints than what the C# language / compiler exposes.

Well, some
 time ago this blog entry called my attention on my RSS reader and motivated me to go and scan the .Net specification (more specifically § II.10.1.7 in the CLI Metadata Definition and Semantics document which can be downloaded from here) and to my surprise I found out that in addition to the valid C# generic constraints CLI also support constraining a generic argument to delegates, arrays and even enums! That is nice.

Next question is: does the C# compiler abides by these rules when consuming assemblies?

To answer this question I wrote a small class library (
in C#) that exposes some generic types and manually (ildasm/ilasm) added each of these constraints. After that I created one application (C#) that uses this library and confirmed that C# compiler does respect these constraints (at least in VS 2010 which uses CSC 4.0.30319.1). Bellow you can see the result of trying to use these generic types with incompatible types:
Generic parameter 'E' was constrained to enums
Generic parameter 'E' was constrained to enums

Generic parameter 'A' was constrained to arrays. 
You can download the sample application from here.

The bottom line:  Generic constrains in .Net  are more useful than what you may be lead to believe ;)

As always, don't be shy! Let me know what you think.

Hope you find this useful.