Sunday, 11 January 2015

Fluency of Java 8 Date-Time API

Here are a few quick examples of how API calls can be chained to answer advanced queries, such as "Which day is the last Friday of the next month". Or imagine you need match a weekly or monthly schedule. These and similar queries can be resolved without much of an effort.

Saturday, 10 January 2015

String Interpolation in Java

Languages like Scala, Ruby or even PHP allow to build dynamic textual content in an elegant and concise way. Is string interpolation available in Java?

Tuesday, 6 January 2015

API Mock Server Powered by Node.js

There we go again. I couldn't help but to (re)write my own. Unlike my previous attempt, I managed to keep implementation neat and tidy with a solid test coverage. Since all the details are on the project page, I will only focus on a few quick highlights.

Sunday, 28 December 2014

Preloading of an Android WebView

Coding for Android can be tough at times. Especially when things one would take for granted aren't supported at all. Such as an option for a fully justified text in a TextView. After having tried a number of different solutions I eventually gave up on using a TextView and resorted to a WebView instead. Of course, the first problem I hit was bad performance. While the text started to show in a way it was meant to, it took about a second to load despite the fact there was no network traffic involved at all. Having to show a spinner for a tiny piece of text loaded from local resources felt like a snap in the face. I started to dig into the issue with the TextView once again. I even ended up implementing full justification on my own, but when trying to apply it to Android I quickly discovered there was much more to worry about. Scrap that, back to the sluggish WebView, trying to preload it this time. That finally worked. So here is my take on how to preload a simple dialog containing a WebView.

Monday, 22 December 2014

Google Cloud Endpoints - Design Considerations

While designing of the Endpoints API is fairly straightforward, there are gotchas one might stumble upon. Especially when task at hand is slightly more involved than the proverbial "hello world" example. It took several iterations in my tiny little project to adjust the API according to my needs.

Google Cloud Endpoints - GET vs POST

Conscious about REST? Then you want to have control over HTTP methods associated with your API calls. Should you choose not to use @ApiMethod, Endpoints falls back to an educated guess approach based on the API method name, as stated in the docs. I couldn't find much details about how the resolution works, but common sense worked for me. This post presents my findings when experimenting with automatic HTTP method resolution.

Sunday, 21 December 2014

Google Cloud Endpoints - Overloaded Methods not Supported

The title says it all, one cannot make use of method overloading when working with Endpoints. Not a big deal one might think. Well, as usual, it depends. To me, method overloading is a feature I appreciate, since it allows for a great naming consistency and promotes polymorphism, one of the major deals with OOP. I have yet to find out what the underlying limitation is. In Spring MVC for instance, as long as the associated URL mapping is unique, method overloading isn't much of a trouble. Nevertheless, this post adds a quick example proving the feature remains unsupported.