Nikola Trubitsyn

developer's blog

Printing Images Side by Side

Jul 30, 2018 Linux

Some time ago I had to print a lot of images and not to waste too many sheets of paper. “Place two images on the same sheet”, – I thought. But how?

  1. Create a PDF of those images.
  2. Convert it so it has 2 (or as many as you want) images per sheet.

Iterables Unpacking in Python

Apr 8, 2018 Python

Suppose we have the following function:

def rgb(red, green, blue):
    print(f'R: {red} G: {green} B: {blue}')

Note: this code uses Python 3.6’s formatted string literals.

and a tuple of values:

colors = (0, 128, 255)

Then we should be able to pass the tuple to our function as follows (REPL output is shown):

>>> rgb(*colors)
R: 0 G: 128 B: 255

By using ** (two stars instead of one) you can pass a dict instead of named arguments: its key will be the parameter’s name and its value will be the parameter’s value.

Hacktoberfest 2017

Oct 24, 2017 Open Source

So I’ve finally completed the Hacktoberfest challenge! Here’s what has been done:

  • fossasia/susi_android
    • Optimize performance by not concatenating strings in loop (#1027)
  • Simple-Calendar
    • Russian translation update (#251)
  • Simple-Calculator
    • Update Android Gradle Plugin (#35)
  • Simple-Camera
    • Russian translation update (#81)
  • Simple-Draw
    • Russian translation update (#67)
  • Simple-File-Manager
    • Russian translation update (#108)
  • SimpleMobileTools/Simple-Notes
    • Update Build Tools (#123)
    • Add applicationId suffix (#126)

Keeping Multiple Build Types on Same Device

Oct 14, 2017 Android

It’s not uncommon to run both debug and release builds on your device. It’s impossible by default because package names are the same. This can be fixed by setting a custom application ID suffix in app/build.gradle for a build type or a flavor.

Making Robolectric Work on Windows

May 9, 2017 Android

The following applies to Robolectric 3.3.2 To get Robolectric tests run in your environment you need to set your Working directory to $MODULE_DIR$ in Android Studio’s Run Configurations dialog.

Reflections on TDD

Aug 1, 2016 Testing

I’ve been doing test driven development for a while on a GitLab CI. I have to say I even liked that! I think, every developer should try to write tests before code, and here’s why.

My Impressions on Kotlin

Mar 4, 2016 JVM

I ran into an article about Kotlin programming language recently (on habrahabr?) and immediately fell in love with it. The documentation is really short — I was able to write fluently after a day of reading it. It’s time to share my impressions.