Thursday, December 26, 2013

End-of-Year Review: Economic Flashbacks

At the end of each year we tend look back and analyze what has happened. In this post I will rent about economics and the financial crisis again.

It has been another year when all over the news, and in society in general, the financial crisis was a constant topic. We were, again, told that even though things seems to be going a little better we are still in a crisis and we, as a society, have to endure and support each other and accept low salary, extra hours, no Christmas bonuses, and so on.

Fortunately for me, I work for an open minded and realistic company. The rules are simple, if the company does well, the employees do well. If the company doesn't do well, we, the employees will do our best to make it better. However this is not the case for most of the companies in my country, that is Romania.

In my personal opinion there was never a crisis in Romania. At least not directly. We felt the effects of the crisis as exports dropped and banks decided to not loan people and divert all the incomes to their mother countries. But that's it. There were no huge surprises or bankruptcies. There were no big companies closed and unemployment is kept in check at one of the lowest levels in Europe.

However, the curtain of the phrase "We don't have money, it's a crisis!" allowed a lot of companies and politicians to hide behind those words and affect a huge part of the country's population. We knew politicians were stealing huge amount of money, but simple citizens and the media could do little. The president itself may very well be the heart of groups making money end up in the pockets of well placed, influential people. Of course, there are little or no proof, but that's how things work. Take for example the 10 billion dollars payed by the state for a highway that was never built and the money never recovered. Money doesn't evaporate.

So, in the early years of the crisis the government, back then controlled by the democrats, decided to reduce all the salaries and even pensions (though illegally). There was less money coming in to the state's treasury since less exports and external investments reduced the growth we were used to. We, the citizens, thought it will make the politicians steal less. It did not. They stolen probably even more, thinking about the dark times to come, and took away from the people. Well, they payed the price at last year's election, finally they were gone.

2013 was the first full year with a social-liberal-democratic government. An unlikely alliance with one goal, get rid of the democrats and the actual president. They managed the former, unfortunately not the later. I am sure they are also money hungry, and making their part in all of the state's businesses, but at least we stopped hearing about briberies like 40% of a 1 billion dollars highway must go to certain people otherwise the project is assigned to another company willing to pay. We also could observe some legal changes toward a better direction. We've seen that most of the salaries and pensions were reintegrated to the values they had back in 2010 when they were reduced. Some of the illegal cuts were also payed back retroactively.

We also registered a 3-4% economic growth. A very nice figure in my opinion. And an absorption of about 30% of the European funds, compared to about 5% in 2012. A lot of money.

Even though I still do not agree with at least half of the government's actions, at least I can see some of them are good and they are starting to produce positive results.

The private sector is a totally different story. Private companies can do whatever they want and believe me, they are doing huge profits, hidden under the curtain of the crisis slogan. About 40-45% of all the employees in the private sector are working the minimum salary imposed by the law. That is about $250 per month. And from that you have to subtract about 20-30% of different taxes. At the other end of the scale, there are only 2.5% that are earning more than twice the average monthly salary, which is somewhere at 500-600 dollars.

Most employees are kept in the dark, and if they dare to ask for a rise they are simply told "It's a crisis.". Meanwhile many companies are reporting record profits. The people, a huge part of the country's working force, thinks there is no other way, they have to work for the minimum wage. They gave up ... unfortunately.

And the banks are part of all this. They are in no trouble, at least not here in Romania. They probably never were. They are doing just fine. In fact I think they feel very well. All those house loans given before the house crisis are paying off. People continue to pay them. And while in many countries the interest rates were reduced to almost zero, they stayed more or less the same here, except the effects of the mandatory EURIBOR or ROBOR interest rates, which were reduced. But the banks are actually taking more than before. For example, when I bought my  house I payed about 5% EURIBOR + 3% the banks interest rate. Now, EURIBOR 0.3% and the bank's rate is about 4-6%. Yes, I pay less than in 2008, but the bank is getting more.

So, the banks are getting richer and more wealthy while telling us that we should be happy we pay less then before ... sure.

And the proof? Simple. Basically you can not get loans now. The banks are giving only very few loans or only those that are guaranteed by the state. For example if you want to by a car and you have a salary in the top 2.5% of the incomes, you have little chance to buy anything but the cheapest cars out there (I refer to new cars). It doesn't matter you could easily pay the car in less then 2 years, they will not risk it. Why should they? They can sit back, do nothing for the next 20-30 years while all those huge house loans will be payed. Good business. They are still supporting small credits, 200-300 dollars if you want refrigerator or a new TV or a new phone, but basically that's it. And they are doing that because the risk basically is zero. If you don't pay, the law permits them to take 30% or so of your salary and they will, in a couple of years, get the money back. And if they wont, they've lost almost nothing anyway.

So, it is so sad when you can see through the curtain of the crisis and see how so many people are exploited unjustly and kept working for minimum wage just because there is a fictional crisis out there...

Friday, December 20, 2013

Programmer's Diary: The Bluetooth Hell Continues on Linux

In my previous post I described an elaborate way to configure your bluetooth device on the badly behaving Bluez and newer kernels. Well, things seems to be changing again.

My distribution, Sabayon, pushed yesterday a newer pre-release of Bluez 5.... something. Now pairing actually works from KDE, however the bluetooth service segfaults when I connect my keyboard. Mouse connects though without a problem.

What is even funnier is that even though the service goes bye-bye, and I can not remove or add devices, once connected both mouse and keyboard works, with the service crashed!

csaba ~ # systemctl status bluetooth
bluetooth.service - Bluetooth service
   Loaded: loaded (/usr/lib64/systemd/system/bluetooth.service; enabled)
   Active: failed (Result: signal) since Fri 2013-12-20 19:08:15 EET; 14s ago
     Docs: man:bluetoothd(8)
  Process: 20461 ExecStart=/usr/libexec/bluetooth/bluetoothd (code=killed, signal=SEGV)
   Status: "Running"

Dec 20 19:08:01 csaba bluetoothd[20461]: Bluetooth daemon 5.12
Dec 20 19:08:01 csaba bluetoothd[20461]: Starting SDP server
Dec 20 19:08:01 csaba systemd[1]: Started Bluetooth service.
Dec 20 19:08:01 csaba bluetoothd[20461]: Bluetooth management interface 1.3 initialized
Dec 20 19:08:15 csaba systemd[1]: bluetooth.service: main process exited, code=killed, status=11/SEGV
Dec 20 19:08:15 csaba systemd[1]: Unit bluetooth.service entered failed state.

So it seems to be no problem, right? If the service crashes after my devices manage to connect, all I have to be careful about is to first connect my mouse, and only then my keyboard. Wrong! Bluetooth devices have this habit of entering in a sleep mode after a few minutes, so they reconnect automatically after an idle period of time when moved or touched. I must have my service up and running at that point.

In lack of a better idea ... I mean in lack of a lot of free time, because ideas I have plenty, here is a one liner crontab entry that will issue a start to your bluetooth daemon. Just put it in /etc/crontab

* * * * *       root    systemctl start bluetooth

If the service is already running, start will do nothing, if it does not, it will start it. Still, I have to remember to enable my mouse first, but in the worst case scenario I will need to wait one minute to connect the keyboard... or grab my other, non-bluetooth, keyboard and restart the service.

Monday, December 16, 2013

Linux Tip: How to Pair your Bluetooth Device when Using Bluez 5.x and Kernel 3.11-12

It seems like there are problems with Bluez 5.x and newer kernels, especially post 3.10 ones. Since 3.13 is not yet out, these tips apply to kernel 3.11 and 3.12.

I specifically tested and applied the solution below to pair my Microsoft keyboard and mouse. My specifications are as follows:

[bluetooth]# version
Version 5.10
csaba ~ # uname -a
Linux csaba 3.12.0-sabayon #1 SMP Tue Dec 3 15:10:14 UTC 2013 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz GenuineIntel GNU/Linux

So if you were looking for things like:
I can't pair my bluetooth keyboard on Linux
My bluetooth mouse won't work on newer kernel
My bluetooth headset pairs but doesn't connect
My phone can be discovered but not connected or paired over bluetooth
... then here is how to do it with bluetoothctl.

csaba ~ # bluetoothctl 
[NEW] Controller 00:15:83:3D:0A:57 csaba-0 [default]
[NEW] Device 7C:1E:52:A8:47:74 Microsoft Bluetooth Mobile Keyboard 6000

Start bluetoothctl. Mine found the keyboard automatically with it set in discoverable mode. However, it is possible you will need to enable scanning. Just write:

[bluetooth]# scan on

If it is not showing up at this point, you may have problems with your bluetooth receiver or the device is not set in discoverable mode (with that "connect" button pressed).

After my device was found I wen on immediately and tried to pair it. However, it asked for no PIN or anything, it just timed out with an error that I failed to provide correct PIN code. This made me think, maybe I missed something. And I did.

[bluetooth]# default-agent
No agent is registered

There was no default-agent. Now, I do not exactly know what these agents are, so if you know, feel free to comment below with details. However we can easily start one.

[bluetooth]# agent on
Agent registered

And we try to pair now...

[bluetooth]# pair 7C:1E:52:A8:47:74
Attempting to pair with 7C:1E:52:A8:47:74
[CHG] Device 7C:1E:52:A8:47:74 Connected: yes
[agent] PIN code: 241178
[CHG] Device 7C:1E:52:A8:47:74 Modalias: usb:v045Ep0762d0013
[CHG] Device 7C:1E:52:A8:47:74 Modalias: usb:v045Ep0762d0013
[CHG] Device 7C:1E:52:A8:47:74 UUIDs has unsupported type
[CHG] Device 7C:1E:52:A8:47:74 Paired: yes
Pairing successful
[CHG] Device 7C:1E:52:A8:47:74 Connected: no

So we are halfway there. Paired, but not yet connected. I also noted at this point, that the "connecting" LEDs on my devices were still blinking. So the keyboard and mouse did not yet know about the computer. But I could see them...

[bluetooth]# info 7C:1E:52:A8:47:74
Device 7C:1E:52:A8:47:74
        Name: Microsoft Bluetooth Mobile Keyboard 6000
        Alias: Microsoft Bluetooth Mobile Keyboard 6000
        Class: 0x002540
        Icon: input-keyboard
        Paired: yes
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: yes
        UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
        UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v045Ep0762d0013

So I went on and trusted the device.

[bluetooth]# trust 7C:1E:52:A8:47:74
[CHG] Device 7C:1E:52:A8:47:74 Trusted: yes
Changing 7C:1E:52:A8:47:74 trust succeeded

Then connecting worked. The blinking LEDs turned off. Great. And the connection remained ON.

[bluetooth]# connect 7C:1E:52:A8:47:74
Attempting to connect to 7C:1E:52:A8:47:74
[CHG] Device 7C:1E:52:A8:47:74 Connected: yes
Connection successful
[CHG] Device 7C:1E:52:A8:47:74 Modalias: usb:v045Ep0762d0013
[CHG] Device 7C:1E:52:A8:47:74 Modalias: usb:v045Ep0762d0013

I did reboot my computer and the settings are persistent. I know these devices are working correctly on my computer, I had them paired and working for the past year or so. In fact, if you had them paired before you upgraded to 3.11-12 kernels, you will have them working. Only pairing fails.

I could not find out a way to make pairing work from KDE or other desktop environments.

I hope I could help some of you, and save you some precious time.

Have a nice day.

Saturday, December 14, 2013

Programmer's Diary: Global Day of Code Retreat Retrospective

This year, 2013, I was the one organizing the Global Day of Code Retreat event in Timisoara, Romania. It was an amazing day and this is a small article to show everyone how I perceived the event.

First the Bad Things
  1. I felt quite under pressure, especially at the beginning, so many things to think about...
  2. We almost remained without food ... I forgot to order it in time. Crazy!
  3. There were less then expected people :(
Now the Good Things:
  1. I learned a great deal about facilitating and organizing events.
  2. The event went well, we managed to ditch all obstacles.
  3. I was amazed how well some participants perceived the event.

And now let's talk about what actually happened throughout the day. I planned for 6 sessions, we managed to do 5. I thought there will be quite a few people familiar with TDD, there were probably 1-2. But that is not important, we felt good, programmed and learned a lot.

Below are some of the most memorable quotes from attendees, told at the closing circle. I am proud of each of them, and I am proud I could help them open their minds to new concepts and ideas.

What did you learn today?

"There are different, successful ways to write software."
"It was the first time I actually did TDD so I learned quite lot about the process itself."
"Maybe we should think about more designing tests and less about designing code."

What surprised you the most today?

"I could write working code without the debugger."
"In the last session I felt my mind blowing. I managed to finally think about tests without thinking about all the production code's design. It was amazing."

What will you do differently next time?

"I will start reading some books."
"I will start learning other programming languages to understand the philosophy behind their culture."
"I will try to write more often tests before code and not after."
"I will try out some coding katas."
"I will try to take baby steps and let my tests guide my design."
"I will research a good testing framework for .NET."

*quotes are approximate

I am proud I could today facilitate an event where programmers had the opportunity to learn and they took it and learned great things. I was surprised and pleased by their dedication and openness and they also started quite interesting discussions which led to short brainstorming mini-sessions.

Total headcount:
~7 people from Serbia
~7 people from Timisoara

~7 kids from Coder Dojo (thank you for joining us, it was great)

   2 people from Macedonia
   1 person from Germany
+ 3 organizers and facilitators

I am happy I've met you. See you next year!