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.

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.

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.

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.
RequestId:2e5ed254-51cf-42f4-9efe-3dc26e5ea902
Time:2013-05-24T09:55:56.6088493Znumofmessages33132.

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.

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

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.

About Me

I'm 25 year old programmer, who finished studies on UAM in Poznan, Poland. Now I'm Natural Language Processing Engineer but I used to work as a PHP programmer for a few years. I'm also using Perl, Bash and Java in my personal projects. Fascinated by Perl lately, I'm currently exploring it's possibilities.

This blog is my database of useful tips, tricks and code snippets. I made it to easily find all those things - internet is very big and web browser bookmarks sometimes disappear ;) If you find something that helps you, feel free to use it, any way you like :)