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.

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
}
Continue reading “Feature toggles in NodeJS”

Design Patterns – Books, tutorials & 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.

Continue reading “Design Patterns – Books, tutorials & notes”

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.

Continue reading “Simple role management for SailsJS”

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!

Continue reading “Exporting Card.IO as a fragment”