Context in Android Databinding XML files

It is so easy guys, just don’t forget that DataBinding creates a field called context which you can access by default in your XML file. So you can write something like this: <data> <variable name="name" type="String"/> </data> <layout> <TextView app:text="@{StringUtils.format(context, name)}" /> </layout> And it will be just fine. You have the context from the parent view. Check it HERE.

May 4, 2020 · 1 min · gmirchev90

Gaps between layout components in Android

There is a very simple solution in Android if you want to have space between components. You can always set margins but you can also use the Space class. You can use it like this: <Space android:layout_width="1dp" android:layout_height="30dp"/>

May 4, 2020 · 1 min · gmirchev90

Retrofit – Authorization &amp; Expiring Tokens

Situation is like this: You got an AccessToken and RefreshToken (AT and RT for now on) Every API call needs to contain the AT When the AT expires you need to refresh it using your RT

May 4, 2020 · 2 min · gmirchev90

Feature toggles in NodeJS

I had to implement a feature toggle recently. What is a feature toggle? I will keep it short. You have to add a new feature to your product, but you want that feature to be available only for certain type of users. What you do? Well, you just make an if check to see the user can see this feature and then you toggle it for him. Here is a sample check: if(ToggleRouter.isEnabled("comments")) { // Display the feature to the user }

May 4, 2020 · 2 min · gmirchev90

Design Patterns – Books, tutorials &amp; notes

Why design patterns? Well, this question is very simple. Because they will broaden your knowledge and make you enjoy programming again. They will remind it you that programming is a skillful art which requires constant research for a purpose. All of the patterns are extremely practical and easily applied to real world examples.

May 4, 2020 · 12 min · gmirchev90

A word on Javascript charts libraries available on the web

I had to make a project which contained a lot of charts and very different ones. I needed charts like: Pie chart Column chart Multiple column chart with 2 different y axis Column & line chart combined together Column & line chart combined with 2 different y axis

May 4, 2020 · 1 min · gmirchev90

Simple role management for SailsJS

You have probably heard this form me. I am working on a Sails js project and I wanted to implement a simple role management. That means that I have several routes like: “/admin”, “/login”, “/users” and I want the admin route to be accessed only from admins, login to be accessed from admin and users and the users route to be accessed from only the users.

May 4, 2020 · 2 min · gmirchev90

How to add Joi params, query, body validation to Sails JS?

Let’s keep the things short. I am working on a SailsJS app and I am missing a lot the HapiJS Joi validation features. It keeps the validation logic separate and isolated from the controllers and other stuff. So I was wondering how to integrate Joi with Sails.

May 4, 2020 · 2 min · gmirchev90

How to download older version of Google Play Services?

In the new version of the Google Play Services library there is a lot of new code for the material design which really made my app huge and it crossed the border of 65 536 methods.

May 4, 2020 · 2 min · gmirchev90

Exporting Card.IO as a fragment

You probably know the famous card detection library called card.io. It is developed by PayPal and used worldwide. There is a lot of OpenCV usage behind it, but I will leave this for another article. The problem The problem is that the library can only be used as a separate module. You can call the card.io Activity and it will return you the results from the detection. But what if you want to embed the detection view inside your app? Well, sadly, there is no fragment for that. But the library is open-source so you can change everything to fit your needs. So let’s start then!

May 4, 2020 · 5 min · gmirchev90