Author : beriba | 09/16/2016

Installing agilo error:

protagonist@1.5.0 install: `node-gyp rebuild`

Installing protagonist error:

gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp


sudo apt-get install nodejs-legacy

Do it even if you have nodejs installed!

Just install:

sudo apt-get install kio-extras

It works on Kubuntu 16.04 so it’ll probably also work on Ubuntu 16.04. I also found out that it may work on Ubuntu 15.04.

Author : beriba | 08/08/2016
sudo apt-get install exfat-fuse exfat-utils

Then just mount exFAT device.

There is a simple trick to specify a tab as a separator. You simply have to write it as:


For example:

cat in.txt | sort -t $'\t' -k 2

It should work in all commands where you can specify separator.

Author : beriba | 06/08/2015

This is plain and simple. Just go to the line you want to select and hit

Author : beriba | 02/09/2014

Have you ever wondered is there any way to get private or protected properties from other object? Of course you have. If you’re developing something from scratch this is totally unneeded. You can just made a property either public or make get/set methods. Of course the second option is way much better.
But sometimes you are using a third-party module, you just can’t edit it and you need a private/protected property. In PHP it’s not the end of the world. Below you can find two methods, which sets and gets (respectively) non-public values.

 * Sets value of protected or private property in given object
 * @param mixed  $object   Object in which we want to change property value
 * @param string $property Property name
 * @param mixed  $value    New property value
protected function setNonPublicValue($object, $property, $value)
    $reflectionObject = new ReflectionObject($object);
    $reflectionProperty = $reflectionObject->getProperty($property);
    $reflectionProperty->setValue($object, $value);

 * Gets value of protected or private property from given object
 * @param mixed  $object   Object in which we want to change property value
 * @param string $property Property name
 * @return mixed
protected function getNonPublicValue($object, $property)
    $reflectionObject = new ReflectionObject($object);
    $reflectionProperty = $reflectionObject->getProperty($property);

    return $reflectionProperty->getValue($object);

This is very dirty solution and should be used only when you’re aware what you’re doing and only when no other ways are possible.

Author : beriba | 02/01/2014

Using virtual machines is a very common practice. I’ll not tell you here the pros and cons of using them because it’s not the point of this post. One of the most popular VM tools is VirtualBox. While using linux VM you sometimes need to share some data between host and VM. Of course VirtualBox has a functionality to do that. From host (assuming that it is Windows) this folder is instantly accessible. But from VM this folder is only accessible by root. Adding sudo to every cp or any other command using shared folder isn’t what we really want. There is a solution. You just need to add your user to vboxsf group. You can do that by executing

sudo usermod -a -G vboxsf myusername

But that’s not everything. Now you just have to re-login (or reboot). But sometimes there are reasons to not reboot the VM. There’s also solution for that. You just have to do an explicit login.

su - myusername

There’s only one thing you have to remember. Until doing a re-login, you have to do an explicit login in every terminal session you open.

In the previous post I wrote about Windows Azure Queue. But back then, when I was playing with it I had a significant problem with creating it. The main difficulty was connecting to real Azure Queue (not emulated one). I couldn’t find anywhere how connection string should look like. After some ‚shotgun debugging’ I came up with something that works.

$queueRestProxy = ServicesBuilder::getInstance()->createQueueService('DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey=4Gu6Jvm9c5zlaaGEmuA9GZqYr3RzqRfC0W20Yrjnu0sayRnhXeHMCQYWy0IfXnlwTWwPHW2fU+bJ8bqlJRBPgg==');

My AccountName in this string was lower case and you may want to write it that way if something doesn’t work with upper case letters.

I don’t know if it is still valid because it was 6 months ago or more but maybe it will be useful for someone.

Author : beriba | 11/07/2013

This post should have landed here long time ago. It haven’t because I didn’t have enough time to prepare it.

Some time ago I was testing Windows Azure combined with PHP. There were some tools and tutorials around the web. Tutorials were not really up to date. They were saying that development could be done both on windows or linux. And it’s almost true… almost. If you’ll combine it with continuous deployment from git repository, making your „hello world” is just a pleasure. But if you want to do something more, let’s say, add some database to your application, it’s getting tricky. You can develop it only on windows because sqlsrv drivers are out of date and they’re not working on linux. And there are more tricky moments.

One of them shows up when you want to get messages from the queue. Everything is normal when you want to peek 2, 10 or 20 messages. But when you want to peek more than 31 messages there is an unexpected fail. Below code is an example which triggers this error.

$message_options = new PeekMessagesOptions();

An error is saying what happened but that’s all.

400: Fail: Code: 400 Value: One of the query parameters specified in the 
request URI is outside the permissible range. details (if any): 
ďťżOutOfRangeQueryParameterValueOne of the query parameters specified in 
the request URI is outside the permissible range. 

I’m a developer for a long time and I don’t expect any error to tell me every detail. And I’m aware that every technology has it’s limitations but let’s face it – possibility to peek just 31 messages? In cloud? Not good. Instead of saying the same thing twice, there could be some explanation in error message.
I still don’t know why this limit is so low but I don’t want to know. I hope this will be changed.

But there is one thing that I loved about Windows Azure. It’s the best admin panel (or whatever it is called) I’ve ever used. Everything is plain, simple and beautifully animated.

Author : beriba | 09/02/2013

Have you ever had too many GIT branches? Have you ever looked for a way to remove half of them or even all? If „Yes” is an answer for any of those two questions, this tip is for you. Probably you’ll have about 3 questions about removing git branches:
1. Is that possible? Yes
2. Is it built-in? No
3. How to do that? Look below

git branch -D `git for-each-ref --format="%(refname:short)" refs/heads/bugs_\*`

A little bit of explaination. Above command will remove permanently (without asking!) any branch that starts with „bugs_” (without quotes of course). You have to put backslash before * (asterisk), ? (question mark) and probably before few more characters. If you don’t know what is „git for-each-ref” feel free to ask me in a comment.