Coder Thoughts Piotr Mionskowski's thoughts on software, technology, architecture, design patterns and programming in general.

Piotr Mionskowski

  • How to clear database in Spring Boot tests?

    13 October 2017 tests, spring, boot, database, and kotlin

    Nowadays using a production like database in unit1 tests is a common practice. Calling a real database can increase our confidence that a tested code actually works. Having said that a database, by its very nature, brings external state into a test that will affect its behavior, hence we need to pay special attention to prepare the test execution. There are couple of ways to handle the database state in tests and I’m going to describe an approach I like most.

  • Simple Config Sections 1.2 released

    25 December 2015 .net and .net

    About a week ago I’ve released another version of SimpleConfigSections. It’s marked 1.2.0 and you can install it through Install-Package SimpleConfigSections.

  • Android Data Binding Part 2: Observer pattern to the bone

    27 July 2015 android and android

    In the previous part I’ve described typical problems we have to face when developing applications on Android. I’ve also highlighted that some of them may be mitigated when data binding API is utilized properly. It’s time to dive into more details of how this promising API works.

  • Android Data Binding Part 1: Why it is important

    20 July 2015 android and android

    Android application code often suffers from being more verbose than it could be. As libraries such as Android Annotations and ButterKnife have shown that’s only partially due to tediousness of Java. The recently announced Android Data Binding library can remove at least part of the boilerplate code we need to write. Since I’ve always liked Presentation Model pattern (MVVM) this is very dear to my heart. However just getting rid of a tedious code is not the main reason I’m so happy to see the new API. Let’s recap on common issues developer faces on Android and then I’ll show how using mentioned patterns with new offering from Google can mitigate them.

  • Handling different user types in android application

    12 July 2015 android

    In the previous post you can read how to use Session object to maintain current user information through the application lifecycle. Now we’ll explore different options of implementing varying behavior depending on user type.

  • Maintaining current user information in Android

    30 June 2015 android

    Every but trivial android application needs to maintain information about current user - regardless if he has authenticated or not. While this may sound easy there are still at least handful of ways one can do it - in this article I’m going to explore couple of them.

  • Anchor child element click

    25 January 2015 html and javascript

    I had to solve a seemingly trivial bug in an angularjs based application that turned out to be more interesting than usual.

  • Lazy Apk - a simple TeamCity artifact downloader

    06 January 2015 android and TeamCity

    At Bright Inventions we use TeamCity as a continuous integration server. Apart from building, running tests and uploading artifacts we sometimes use it to quickly distribute an android application to clients and test team. However we found using TeamCity UI on a mobile device isn’t as pleasing as it could be. That’s why we usually recommend downloading updates through a dedicated application such as TeamCity Downloader.

  • Google Play Services is no longer a giant monolith

    09 December 2014 android

    Nowadays it’s getting harder and harder to build a meaningful app and not rely on Google Play Services to aid us in some commonly required features such as maps, better location provider, geo fencing and so much more. Unfortunately up until now the library shipped as a giant monolith ripping us from one third of dex method limit. For curious reader here’s are method counts in couple of versions:

  • Integrate slf4j with Crashlytics

    20 November 2014 android

    As I mentioned in my previous post having meaningful log entries comes handy during development. When an app reaches beta testers as well as goes live it’s equally or even more important to be able to figure out why the app you’ve carefully coded isn’t behaving as it should. Testing the app on all android flavours is literally impossible that’s why getting an insight into what caused a crash is vital.

  • Introducing slf4android - a simple slf4j implementation for android

    01 November 2014 android

    Every now and then you have a bug that is hard to reproduce or only happens on certain phones or android versions. The thing that really comes handy in such case is a detailed application log. That’s why it’s so important to take time to add useful log entries in every non trivial part of the codebase. At the very minimum you’ll want to log any errors.

  • Guide to javascript generators

    15 June 2014 javascript, nodejs, ES6, and generators

    For a while now I’ve been hearing and reading about a new exciting features of ES6 like arrow functions, array comprehensions, classes, modules, generators and many more. While many of them are easy to understand generators can take a while to grok. So I thought it would be a good idea to write some samples to master this particular feature.

  • Setting up fluentd elasticsearch and Kibana on azure

    08 June 2014 fluentd, kibana, and elasticsearch

    A decent way too go through log files can come handy in various ways. From debugging bugs, investigating problems on production environment to figuring out where performance bottle necks are. For simple cases when there is only one log file involved you can go very far with using grep/awk/sed magic or any decent editor capable of handling regex in large files.

  • ng-click and double post

    21 May 2014 angularjs

    Recently I was fixing a bug in an application written in angularjs which turned out to be pretty interesting for me. At first I couldn’t reproduce the error and just when I got frustrated it happened exactly as stated in the issue tracker. As it turned out the problem was caused by fast clicking on the same button. Click handler triggered an http POST to server which creates a row in table - no wonder it looked strange when 2 rows where created after someone accidentally clicked twice.

  • Nonintrusive http proxy in nodejs

    23 March 2014 nodejs, http, and proxy

    In my previous posts I wrote about problems that might occur when using http proxy written in nodejs to debug http issues. Today I’m going to describe how to use nodejs builtin parser to overcome these problems. ##Nodejs streams Node.js has decent support for handling streams. Especially the pipe function takes a lot of burden away - whereas previously it had to be carefully handled by programmer. As a first step let’s use a simple socket server and tunnel http requests through it: