2016/05/11

Leadership: Trust


Trust
: belief that someone or something is reliable, good, honest, effective, etc.

Originally posted on LinkedIn.

I would like to devote the second post in my leadership mini-series to this fragile substance - to trust. As you can see in the definition, it is "just" a belief. Something that cannot be bought or ordered to people. On the other hand, it is very stable. Like your belief in any kind of God. It is something that does not change overnight. Usually a terrible experience changes someones belief in God. They either begin or cease to belief.

And the same is truth for trust. Gaining trust is a hard work. You can imagine this like a glass of water that someone holds. This would represent the level of trust this person has to you. The good thing is that you typically do not start with a completely empty glass. Let's say it is somewhat half to two thirds full. People are insane optimists.

The tricky part is that you can pour out all the water by a single act at any time. Or you can be regularly drinking from that proverbial glass. The only thing you cannot do is to put it under a tap and full it at once. Only little drops can be added to the glass especially when completely empty.

Now what can empty the glass? There is a plenty of things and it can be done even unintentionally (be careful to differentiate between intentions and looking for excuses). What are the most typical conscious acts that pour out the water? Here is a few examples.

First, quite simple thing - promising something and do not mean it, or actually never fulfilling the promise without showing any remorse. We are very limited in our powers and we are not capable of achieving everything even if we wanted. However, by giving promises that you do not mean or even never try to accomplish, we send a clear message out: "My promise does not mean a thing, do not believe it."

Second, saying one thing and doing another not only sends mixed signals but also shows a great level of inconsistency. It is fine to change our mind. We learn constantly and under the circumstances of new facts, we might want to act differently to what we originally anticipated. Just make sure this is clearly communicated. Or in some situations, it is perfectly fine to tell that you did not want to share your plan or opinion. This is definitely better than making up a fake story. Having this inconsistency too often is like saying: "Well, no matter what I tell, it is just some gibberish, you cannot count with it."

Third, it looks suspicious if you are nice to someone or help people for no obvious reason (and you are not Mother Theresa). There is no good turn without any motivation. In such a case, this often leads to the trouble with a hidden agenda or misuse of people. Either way, someone helps you to achieve your goal without knowing or even worse, by you masking it as their benefit.

And the last example, which can be very obvious, is called symmetry. Trust is a bidirectional relationship. It is very hard to build trust if you do not provide any. Just ask yourself, could you belief someone who does not trust you? I guess hardly ever.

Now the question is what can I do to gain trust? Except for avoiding the above, we can be open, honest, genuine, we should be the ones of high moral value. Simply lead by example. Typically, decalogue is a good manual which has just a tiny design flaw. Violating decalogue can be fixed easily during a confession. Trust cannot be regained that easy.

It looks simple and you might say that I just skipped through this part quickly with a very obvious statement. Here I would like to ask you to simply digest the statement, to validate all your daily acts against it. Demonstrating the trustworthy attributes is an extremely hard job.

I should have asked the following question at the beginning probably but why would I want to gain trust with people? I am the boss, people listen to my orders and then go and do the job. Really? Do they? What is the quality of the result? Do they work with passion? Nobody gets the best out of them if they do not believe in what they do. If there is no trust you need to breath down their necks to work hard. And the day you are not in the office is celebrated. If you do not watch closely and do not supervise at a great level of detail people will do nothing. And you cannot blame them. They do not know what to do without you. Not because you are that important (a big shock?). It is because you never gave them the responsibility because there is no trust between you.

Do you have a very detailed system of measurements of employees efficiency? Do you have a very detailed system to check the work done, to ? Or do you even check all work done by your team? Does not this approach sort of paralyze your organization? Would not it be better if everybody took the responsibility and accountability and did what just needs to be done?

If you would like to read more on changing your organization towards the one with open communication and trust, I would recommend you the following books:

  • Stephen R. Covey: The 7 Habits of Highly Effective People
  • Jim Whitehurst: The Open Organization
Image source Freepik.com

2016/04/20

Leadership: People or shovels?


Originally posted on LinkedIn.

I would like to open a new mini-series of posts on leading people. All I learnt about leadrship in the past was quite obvious and logical to me. So I wondered why I should tell the others how it works. And yet it seems like it might not harm to look at a few concepts...

We live in the era of automation. More and more of old job positions are getting replaced by machines. You might have seen some articles in your local newspaper how terrible this is and what the poor people are going to do when they get replaced by machines. Maybe it is time to move on. To give up on dull jobs that can be done by machines and use the best tool we have. Use the thing that makes us unique on this planet. Our brain!

There is some evidence that we should be capable of achieving that. I know, it is simplified. So how about this - we are likely to use our brain at work much more than we did in the past. This change already started as you mostly buy your coke from a machine.

So just imagine that your employees decided to think about what they do more than they ever did. Now comes the important decision. I can either be a manager and command my workers, or I can be a leader and lead my team. Is there any difference in that? Am I just playing with words? I do not think so, and those who do not understand this will have hard times trying to manage smart employees who use their brain.

A manager of a production line screams at the workers and they do what they were ordered. Those who scream louder have bigger truth. Motivation is zero.

Employees in the 21. century do not want to be treated like that. They can work their hands off for you but you need to give them a very good reason. To motivate them. But wait, why would you waste your precious time with that? You can fire the few rebels and hire new good sheep, or?! Really? Can you? Are your employees replaceable like shovels?

Let's have a look on the price of an intelligent employee. How long did it take for you to find the candidate? How many interviews did you have before you found the best guy for your team? What did this guy learnt while working for you? Did they grow in their abilities and career? How efficient they are now compared to their first day at work? Did this guy ever improved anything in your company? How about others? Isn't this guy a sort of leader to them? Won't they lose morale?

There are plenty of questions like that. What I wanted to point out is that maybe the value of such an employee is bigger today. As you already made the investments. You cannot replace people like shovels. They became diamond decorated shovels, if you will. To give you a better feeling of this, I might even ask you - would you change your child for the one of neighbors'? Why not?

People mostly need a leader. These leaders even do not need a formal authority. Like Mohandas Gandhi who never had any official function. A true and genuine leader is a guy who knows what he does, who understands his job, does care about the consequences and about others. A leader has a high morale value. Once people see you as a leader, they will like to follow you.

Let's consider a negative example as a contrast. Do you know Big Brother from 1984? He was everywhere, talking to people, telling them what to do, what not to do. And yet, nobody liked him unless tortured.

Where do you want to be? Do you want to be a manager or a leader?

2015/09/15

Book review: The 7 Habits of Highly Effective People + The 8th Habit: From Effectiveness to Greatness

From principles of personal development to the true fulfilment

  • Author: Stephen R. Covey
  • Ranking: I think the whole menkind should read this
It is a long time since I read a book that would have had such a great impact on me. I literally think that everybody should read both of the books. And mainly - people should start living according to the principles suggested in these books. I believe people would be more happy with their lifes.
The first boot (7 Habits) introduces some basic principles. Something like decalogue, if you will. While everybody might find these principles of life the correct ones, only a bunch of people around me actually live them. The book is full of deep experience and practical cases. I did not find any dull or boring parts and read it really quick. Stephen Covey (the author, 1932-2012) did a great pre-search of literature on this topic and do not hesitate to introduce even an opposite opinion.
The second book (8th Habit) concentrates on how to get to another level of effectiveness and happy living - to the greatness and on spreading this to your surrounding. The author admits that he was wrong when he believed the 7 habits are enough. The 8th Habit actually is not a single habit but a more complex approach on how to build trust and be the one who is worth following by others.
I did not read this book that quick as the first one and found some parts not that cool but it is also a recommended reading for everybody by me.
The next on my reading list by Stephen Covey is: Principle-Centered Leadership

2015/06/26

3G module similar to ESP8266

Anybody here who dares to create something like a small 3G module similar to ESP8266?
I think I do not need to introduce ESP8266 chip to you. In short, it is a small and powerful all-in-one WiFi chip. One can upload their own code to it, use several GPIO pins, it has low power consumption, and you can get it for under $4. This is ideal to start developing IoT appliances. But! Do you have WiFi signal everywhere? I don't.
So the next logical Google search would be for a cheap 3G module with similar abilities. You can find something like this for around $47. Wow, that is not a friendly deal.
On the other hand, you can buy an USB 3G modem in China for $10. It even has more stuff in it than I would need. I do not care about the plastic case and the USB/UART converter inside.
I would need a similar all-in-one chip with UART interface that would behave like a 3G modem. I would just connect a memory chip, external antenna, and a nano SIM card. The chip could have some more free GPIO ports which would support SPI and I2C. All for around $5-$8.
Am I asking too much? Isn't there anybody who would be able to design and develop anything like that? I am open to suggestions and wishing to support such a development!

2015/05/10

Passion for life

I am not that kind of person that just quietly sits and waits for what is coming. I do not believe in faith, I rather have a control over things that are in the zone of my direct influence. Especially when it comes to the question how to make this world a better place to live. For that reason one might say that I have a Nose for trouble.
However, I still have the inner desire that makes me constantly go forward, the will to do something special. Not because of self-conceit but I still see many imperfections around me that need to be fixed. I cannot do everything so I am constantly thinking whether I follow the right direction.
This leads me to the fact that I have a very close example of what a man's life could be. From its very beginning till the end. Moreover, this is a way I would like to explain why the relation I have with my grandfather was so special to me.

Also, I am not going to summarize the sad facts about the end of the life. Mark Little did that very well some time ago. I would rather pick up the things I have learnt from this great example I had in my close family. Plus I want some of these things to be remembered.

My grandfather was born on October 18th 1925. The first world war was over, the second did not start yet but nobody knew. Many things were very different, there were no personal computers, no antibiotics (first commercially available in 1932)...
The economy situation in the former Czechoslovakia was not that bad and there was a promise of a great era coming. This did not come true and the Second world war started. My grandfather was 13 and he joined a guerilla (partisan) group fighting against Nazis. Once my grandfather stole a Mauser C96 from a German officer. An immediate death sentence would be clear when he had been caught. He used to say: "I could have been dead like thousand times.". This demonstrates courage to me and that you have to be brave and take risks if you are following the right path and you are living with your core principles. It is of course important to carefully select those principles (I might write about mine later).
There wasn't any long lasting happy era when the war was over as you might expect. The communists took over the rule in Czechoslovakia and they were not fun guys to play with. I would recommend everybody to read some basic facts about the 1953 Monetary Reform to get an idea.
So starting from ground zero, living in very bad conditions in a part of a warehouse (storage), my grandfather did not loose faith and simply went forward. When he was on his mandatory army service for two years, he was an army photographer. He created his own mixtures for developing photos and demonstrated a real passion for this "modern" art. My aunt was born around 1954, my father followed her in 1957.
The sixties were little better, there was again a glare of a light at the end of the tunnel. The atmosphere was more loose, people were able to travel abroad more, it was possible to play English songs on radio, the freedom of speech looked almost possible. Until the Soviets said no in the night between August 20th and 21st in 1968. The screws were tightened for another 20 years.

My grandfather became a Manager of the division for foreign automobile spare parts in Mototechna (the only company selling cars in Czechoslovakia, source only in Czech). Many people tried to destroy him on his career path but by sustaining high moral values and not following any dirty rules, they had only a little chances. Once it helped him that there was a Minister of agriculture with the same family name. My grandfather was openly picking holes in the company's management and a rumor started that he is so brave because his relative is a minister (which was not true). But as long as he was right there was only a little to object.
Many people were coming to him to ask him for a favour - they usually needed some spare part for their western cars that was not available on the market. They were also offering bribes immediately. My grandfather just did his job right. He tried hard until he managed to get that part. He did not take the bribe so he made many friends and acquaintances. This helped the whole family when we needed a good doctor for example.

My grand-grandfather was a rifle manufacturer. He also had a printer around the beginning of the 20th century. The Germans took them everything as both of these abilities were dangerous to them. So this rose another passions of my grandfather - guns and books. He was a professional hunter - like the one that feeds animals the whole year in the wood and then shoots them. He said that they would proliferate too much but I never bought that idea. However, he collected and read books related to anything he was doing: photography, weaponry, hunting, economy, customer care, traveling (see the Czechoslovakia adventurers Hanzelka and Zikmund), playing chess (I never won over him), fiction from all the world famous authors...
Before he started doing anything, he first studied a literature on the subject. While not having a university degree he had a great overview on almost any subject. Now there is a library in his flat. I developed him an application to create an index of all these books and spent the summer holidays in 2000 with him creating it. There are around 7000 books. Even in the wardrobes and closets where you would expect clothes, there are books!

My grandfather never stopped learning new things and kept himself aligned with the state-of-art in technology and computer science. This created a strong contrast between him and other grandfathers I saw around. Old people usually keep telling that everything was great 40 years ago and young people are all spoilt. I never heard that from my grandfather and I do not think this is true. I can see why it is easier and comfortable to simply stop where I am. Fortunately, I never saw this as an option for me.

When I demonstrated interest for electronics when I was a kid, my grandfather gave me a lot of books on that topic. I did not think about anything bigger at that age and I dreamt of a career of a repairman of electronic devices. I was always curious how things work, so when my grandfather bought a first computer Didaktik M (which was a Czechoslovakia clone of ZX Spectrum) I immediately started investigating how it works. The games were boring and I was discovering Basic programming. But how come my programs were not that fast as the original games?

In early 90's, my grandfather bought Commodore 64 in Vienna. This one was much cooler but even harder to understand as there was nobody around to teach me and manuals were in German. Also no books were available around. I already did not have this computer when I realized that there was an underlying assembly language that allowed better efficiency of the programs than Basic v2.
All in all, it was my grandfather who showed me the bigger picture and brought me to the computers.

He managed to learn working with a PC when he was 68 years old. In the environment where I grew up this was a typical no-go. People in their fifties were all scared: "I do not want to touch it, I am afraid I would break it!". He needed it for his work - he was an administrator and a bookkeeper for several properties owned by his friends. He did that until all his clients died some time around 2000. So he did not retire actually.

Short after 2000 he bough a digital camera and a color inkjet printer. He was able to take a picture of his friends visiting him and immediately print it. You should see those ladies admiring him. My grandmother died in 1993 so we encouraged him to have a look around. But he always said that he did not wanted to have a crush on an old hag. His theory was that the woman's age should be half the age of the man plus seven ;-)
Sadly almost all of his friends died many years ago.

After a very long adventurous life he was perfectly ready to die. Until the last summer he was able to completely take care of himself. Unfortunately because of a bad hearth condition he had to permanently move to a retirement house/hospital.
During my last conversation with him, he told me: "I did not expect the dying to be so hard, I just thought I would die and that's it. I do not like it this way, I hope to die soon. I am sorry but I cannot make it to your wedding the next year".


He died couple of days later on November 24th 2014 aged 89.

Is there anything he could take away with him? Any of these 7000 books? Any achievement he did? Who did he influence in his life except me? What is then really important in one's life?

The obituary notice below translates the last line of the following verse by Rabindranath Tagore (aka Rabi Thakur).

Traveller, must you go?
The night is still and the darkness swoons upon the forest.
The lamps are bright in our balcony, the flowers all fresh, and the youthful eyes still awake.
Is the time for your parting come?
Traveller, must you go?

We have not bound your feet with our entreating arms.
Your doors are open.  Your horse stands saddled at the gate.
If we have tried to bar your passage it was but with our songs.
Did we ever try to hold you back it was but with our eyes.
Traveller, we are helpless to keep you.  We have only our tears.




2015/04/27

Reasonable Wearables

The results of the wearables hype are slowly getting into our homes and everyday lives. My feeling is that many people around are too focused on simply one thing. The watch! How do you understand the term wearables? Does wearable equal to watch?
I have read some interesting reviews and articles about the cool new hardware. For example this one: What The Apple Watch Could Be.
I do not have any wearables at home but so far, I am not so excited on having some. The feedback I was able to observe was rather mixed. Starting with I got too many notifications, it is crucial to configure the notifications properly to I got interrupted still.
Let's try to step out of the box and try to redefine the term wearables by specifying the requirements.
  • I want to be able to get notified about important events - an incoming message, phone call, appointment in my calendar, anything around me.
  • I want to be able to have this type of notification at hand, without the need to find my phone (yes, that lazy I am).
  • I want to be able have a phone call, read a message, lookup any short information.
  • I must be able to suppress anything of the above easily when I want to run in a distraction free mode.
  • As a bonus, it would be great if it could prevent some dangerous situations for example.
  • I must be able to continue my daily routines while doing anything on this list.

What do you think of now? Apple Watch or Google Glass? The later was stopped already. And both of them violate the last requirement.
How about headphones? Many of us wear them already almost all the day. Let me try to explain to you what my most favorite wearables would look like.
First, we need to start with the best hardware inside. The Headphones are able to connect to WiFi, 3G or Bluetooth. The Bluetooth might be soon replaced by something that does not take 3 seconds to get connected.
They are still Headphones, so their main task is to play music or sound. We need a HiFi Digital to Analog converter. Not like all those noisy wireless headphones we have nowadays. The sound must be crystal clear.
The Headphones should be able to operate standalone (without any mobile phone near to them), playing my music stored in the cloud, getting notifications on emails.
The Headphones should be able to connect to my mobile phone to tell me about text messages or incoming calls. The Headphones also have microphone in it so I can make a call. The microphone can be used to filter outside noise while playing music too. Btw. can you imagine having a phone call with your wrist?
I can configure what happens to the music while a notification comes. Either the music keeps playing in the background or it can be paused. I can browse through the emails, messages, agenda using simple voice commands. Everybody is used to people having phone calls on the street so this even does not look weird. The Headphones can also have a couple of buttons in case you wanted to stay quiet. And of course, you can control the Headphones with your mobile phone, smart TV or tablet.
A nice voice of your choice can read out loud subjects of your emails. None of them actually gets marked as read (unless asked) for you to still have to check them.
You can keep walking or driving a car with these Headphones.
For hearing impaired, the Headphones can work as an amplifier. They can be sensitive to ambulance/police siren and selectively amplify that over your playing music (mishearing an ambulance can be dangerous).
When I want to enter the distraction free mode, I can simply take the Headphones off. They can detect it so they stop the notifications, pause your music and remain silent. Of course you can just stop the notifications and keep listening to the music, there is a button for it. This is especially important because I usually do not want to get the notifications all day long. I want to process them in batches.
It would be also possible to configure the Headphones when to tell you about all the notifications that happened since the last check.
The Headphones can easily measure your heart beats and depending on the time of the day and the location, they can fine tune the music style according to your current mood. Or they can control your smart home and dim the lights when you fall asleep at 10pm while listening to the music on your couch at home.
Wouldn't it be great to have such Headphones? So far it looks that I need to start producing them.





2015/04/19

Minimalism

I once put down an quotation I found in a book. Albert Einstein was supposed to have said that, unfortunately I could not find a reference to it right now. The quotation reads:

"The explanation of the world and its causes must be simple and elegant in the end. The 'world formula' that is not simple and elegant cannot be true."

There is one more quotation by Albert Einstein that is definitely his and you can verify that online:

"Everything should be made as simple as possible, but not simpler."

I really like these as the real minimalism is very close to my hearth. I can demonstrate that on a tool set that I use for my daily work. As an IT engineering manager, I spend a lot of time working on a computer. The biggest bottleneck at my work is the way I make the computer do what I want it to do. There is a desktop environment controlled by a keyboard and a mouse. This did not change for decades now. I am a little bit skeptical about revealing a surprisingly more efficient way anytime soon. So I try to be as efficient on these devices as I can.

For the desktop environment I use Fluxbox. It does its job and it does it fine. Simple lines around the windows, no fancy 3D effects, no shades, no amusement park stuff. I do not have any icons on the desktop itself, just a B&W picture with my friends. I run the most used applications via shortcuts, usually Win key plus some letter. For those not associated with any shortcut I press Alt+F2 and type the name of the application. I use several desktops, each having a dedicated meaning. The second one is for a Web browser for example. This means that I can immediately get (Win+F2) to the application I am looking for. When I see my friends looking for the windows through various desktops on Ubuntu, it looks really cool and is filled with a lot of eye candies. But it takes time. IMHO this is not a well spent time.

You might say that I am just trying to be a weird nerd. I would like to assure you about my only goal which is being efficient.

Btw. I love shortucts! A single key press (well, technically multiple keys at the same time) and bang, the desired action just happens. No need to move from the keyboard to the mouse and back. Mouse is for web browsing, keyboard is for the real work ;-)

Most code developers probably know that from their favorite IDE. It can go beyond that. You can approach that as a great exercise for your brain. Always try to learn a new shortcut. There are also some other good options (hint: lookup the linked series name on youtube).

For the keyboard, there are various options, everybody is likely to find their own way. The key principle is, in my opinion, to make it a thing you do not take care of. You should not think about using it, you should not think about what key to press. Truly keyboard with blank keys helped me to address this problem. The first two weeks were a real nightmare but definitely wort it!

I did not find anything special for the mouse so far. Just and ordinary one, large model that fits my unusually long fingers. I tried trackball, or the mouse allowing you to hold it under a different wrist angle. But these did not work for me. Simply, it is the mouse, intended for the leisure time on the Internet, so not a big deal to me. Reading what I see takes more time than cursor navigation.

As I already mentioned, I incorporated these optimizations to be effective. To spend the appropriate time in the Quadrant no. 2 (see image below) as suggested in the book The Seven Habits of Highly Effective People by Stephen Covey.

Why I am talking about all of this stuff? This is a simple question. My impression is that we are constantly exposed to technology that tries to pull us into Quadrant no. 1. The amount of such distractions is increasing in the form of more interactions on social networks that gets closer and closer to you. What do you do when a phone beeps while you are reading a book? Do you look at the phone? However, I would like to talk about this in more detail the other time.

Now I wonder, is it just me who is obsessive by being efficient? What optimizations did you incorporated in your environment?

2015/04/16

My era of commits

I committed myself to commit something every single day. To just improve the world a little piece every day. GitHub is not the only way how to achieve that of course. However, I have multiple projects there that really need some attention and improvements. So this is what I selected for now as a metrics of my goal.
I do not have a defined time for how long I am going to continue with this. So far I find it fun and it looks cool in the statistics. I am likely to stop/pause this while I will be on our honey moon this summer (come on, I can be committed but I am not a workaholic).
So far this resulted in the following benefits:
  • I really do something on those projects everyday, even when I am tired and not in a mood for it. Usually this can be overcome easily, it is just sufficient to start.
  • The projects move forward in big leaps and there are no periods of radio silence.
  • I managed to implement even features I would not think I could do that easily.
  • The projects are getting public interest, I managed to attract more students to do their seminar works or internship on them.
  • I learned many new things, it is easier for me to stay in touch with recent technology news and watch what is new on the Internet.
What are your commitments to make the world a better place to live?

https://github.com/marvec

2014/09/19

Vintage photo style in Gimp

I was seeking for some way how to make a vintage effect to photos in Gimp. I discovered several tutorials and combined them together to something that works for me. Here is the recipe mainly for me not to forget it.

  1. Create three layers in the picture and fill them with colors. Listing their attributes from top to bottom in the Layers window:
    • Some "computer" blue color, the one like in old Dos times. I used 0949e9, Opacity around 17. Layer mode Screen.
    • Some pink color around e865b3, opacity 20, layer mode Screen.
    • Light yellow, like yellow paper for taking notes. My color is fbf2a3, opacity around 60, layer mode Multiply.
    • Now goes the original layer.
  2. Increase contrast to something around 21 in the original layer.
  3. Slightly decrease Hue (-9), increase Lightness (+9), and lower Saturation (-30).
  4. You can further add dark corners. Create a new layer right above the original picture. Use Eclipse selection tool to select the whole picture. Feather selection by reasonable amount of pixels (depends on the photo size, I use 150-400px). Invert selection and fill the corners with black. Set the layer opacity as desired.

More glares can be added by a separate multiplied layer with white and yellow color paintings.

2013/08/26

JBoss Developer Studio freezes with XSD, WSDL, SwitchYard editors

Recently I started facing a strange issue on my ArchLinux boxes with JBoss Developer Studio (which is an enriched Eclipse under the covers). I was not able to open XSD, WSDL or SwitchYard visual editors. Part of the GUI just froze. Clicking on the close button opened the close dialog which allowed part of the interface to be redrawn.

I was quite desperate about it. It only affected my ArchLinux x86_64 boxes. I used multiple JVMs (Oracle, OpenJDK), different window managers (Fluxbox, Openbox, Gnome Shell). I verified the same Linux kernel in Fedora does not cause the issue. So what now?

What gave me some guidance was this command I found on StackOverflow (you must provide your own process number):

cat /proc/803/maps | awk '{print $6}' | grep '\.so' | sort | uniq

I compared the libraries before and after opening the problematic editor.

39a41,42
> /usr/lib/gtk-2.0/2.10.0/printbackends/libprintbackend-cups.so
> /usr/lib/gtk-2.0/2.10.0/printbackends/libprintbackend-file.so
50a54,56
> /usr/lib/libcom_err.so.2.1
> /usr/lib/libcrypt-2.18.so
> /usr/lib/libcups.so.2

This was a trace of a pretty old Eclipse bug. Surprisingly, the bug is still present in Eclipse Kepler with Gtk 2.24.20.

I tried the suggested workarounds by disabling CUPS server in /etc/cups/client.conf and passing -vmargs -Dorg.eclipse.swt.internal.gtk.disablePrinting to Eclipse. Both helped a little, but did not make Eclipse completely usable.

What really helped me was installing cups-pdf package, enabling CUPS via

systemctl enable cups.service

Then I started the service with

systemctl start cups.service

And configured a PDF printer at localhost:631.

I cannot express my happines about running CUPS on my machine :-(

2013/05/17

Book review: Well-grounded Java developer

Vital techniques of Java 7 and polyglot programming

  • Publisher: Manning
  • Authors: Benjamin J. Evans and Martijn Verburg
  • Ranking: I would definitely recommend this book

Originally, I wanted to write a complete review of this book but I found some really good reviews already available on the internet. What I would like to say is that this book is exactly what the title reads. If you want to be a good Java developer and you mean it, you should know all the information in this book. A great thing about it is that it has a very balanced level of details. The information are presented in a compact well understandable form without wasting the reader's time. So if you did not read it yet, go to the nearest book store or library.

2013/01/03

HashMap serialization issue

Today, we discovered an interesting behaviour in Oracle JDK 7 with my colleague. This also affects OpenJDK 7. There is a change in the implementation of the HashMap serialization. If you serialize and then deserialize a HashMap, two private fields are changed. The first is threshold and the second is table. While these changes do not seem to have any effect on the public behaviour of the class, it makes various testing a little bit harder.

For example, you developed a client/server application that exchanges some objects. These objects might hold some properties in a HashMap. To test the correctness of the communication channel, you send a serialized object from the client to the server. The server deserializes the object, changes an attribute and sends the serialized version back to the client. The client performs the same changes to its version of the object and serializes it too. Then the client compares the serialized byte arrays. With JDK 7 it finds them different and this is a problem in my opinion. Or do you find it a completely insane integration test scenario? I already found it in many projects so I suppose it is not that uncommon and bad.

A reproducer can be found at GitHub. I also logged an issue with Oracle. They are now about to review it. However, I suppose they are not going to fix the issue since it does not influence the public API. Who cares about testers...

2012/09/05

How to really delete a commit from Git

I really wanted to remove a huge binary file from a Git repository that has been committed by mistake. I found a bash script on the internet but the data still remained in the .git directory.

After some changes I came to this solution that really worked for me. But do not try that at home, it might corrupt your data!

#!/bin/bash
set -o errexit

if [ $# -eq 0 ]; then
    exit 0
fi

if [ ! -d .git ]; then
    echo "Error: must run this script from the root of a git repository"
    exit 1
fi

files=$@
git filter-branch --prune-empty --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD

rm -rf .git/refs/original/ && git reflog expire --expire=now --all &&  git gc --aggressive --prune=now && git repack -a -d -l

2012/07/20

JBoss Technologies 1 in Czech

I would just like to bring your attention to my recent blog post on JBoss. The target audience is the Czech JBoss Community, so the article is in Czech only.

2012/04/11

Move a java keystore certificate to openssl

A very good article on moving a self-signed certificate from a Java keystore to an openssl based keystore. Just the last step is missing:
openssl pkcs12 -name my_alias -export -in test.crt -inkey test.key -out keystore.p12

2012/01/07

Byteman plays with Drools

Due to my recent suspicion that there is a bug in Drools I needed to monitor its guts in detail. To be more specific, I needed to see what is in the working memory after execution of all rules.

Debbuger was not a good option since there were hundruds of invocations of the problematic part and I needed to get overview of quite a large amount of data. If I inly could store all the data for each invocation in a file and then grep through it.

But wait! Of course I can. Byteman will help me! The identified point in source code was execution of fireAllRules() in org.drools.common.AbstractWorkingMemory. Ideally, just before return from the method. So here is the corresponding rule:

RULE Debug fireAllRules
HELPER org.drools.planner.examples.tournaments.helper.BytemanHelper
CLASS ^org.drools.common.AbstractWorkingMemory
METHOD fireAllRules
AT EXIT
IF TRUE
DO
  printWorkingMemory($0.getKnowledgeRuntime());
ENDRULE

Just a few notes to it:

  • ^ means to apply to child classes as well
  • $0 refers to this

As you can see there is a custom helper class to print the working memory content since Byteman rules are little bit limited in the supported Java syntax.

import org.drools.impl.StatefulKnowledgeSessionImpl;
import org.jboss.byteman.rule.Rule;
import org.jboss.byteman.rule.helper.Helper;

public class BytemanHelper extends Helper {
   protected BytemanHelper(Rule rule) {
      super(rule);
   }
   
   public void printWorkingMemory(Object obj) {
      StatefulKnowledgeSessionImpl session = (StatefulKnowledgeSessionImpl) obj;
      debug("vvvvvvvvvvvvvvvvvvvvvvvvvvv");
      debug(session.toString());
      for (Object o: session.getObjects()) {
         debug(o.toString());
      }
      debug("^^^^^^^^^^^^^^^^^^^^^^^^^^^");
   }
}

And now I was able to get some nice output of individual working memories! So the resulting bug is JBRULES-3337.

2011/12/04

My Gimp Magic

I'm a Linux user (distribution-agnostic) so I have to bolt my seat down in the airplane but once done, it is really comfortable. The same thing applies to Gimp. Today I spent some time with it on a fresh installation and found out all the good plugins I ever used. The important point here is that there are only three of them to do what I really need. And, of course, all of this can be done manually in a clean Gimp installation but it might take ages.

Contrast Blending aka HDR Photography

High dynamic range imaging is a set of techniques that allow displaying images with big differences between dark and light parts on a limited device. A limited device is a usual computer screen or a printed image. None of these media can fully display the range that a human eye is able to see. So we need to make a compromise in the scene.

There is a great Gimp plugin and tutorial for HDR blenging. The basic principle is to take three pictures with different exposure values (dark, normal and bright) and mix them together. A good algorithm can do that pretty easily for you. A sample picture can be seen below. In the left upper corner, there is the dark exposure. In the upper right corner, there is the normal exposure, the bright exposure is placed at lower left, and, eventually, the result image is at lower right. Note that you can see the background, while there is the candle wick still visible below the light.

HDR Photo

Layer Effects

In Photoshop, layer effects are built-in. These effects can do some easy manipulation with the image and is one the most criticised lacks of Gimp. Fortunately, there is a plugin that can be easily installed and works pretty much the same way.

Layer Effects Demo

Shadows and Highlights

This plugin allows you to manipulate dark and light parts of the scene. It can automatically extract these parts into new layers and by using the layer opacity you can configure the light in shadows and darken the bright parts.

This is not such a miracle, but it is very useful in infrared (IR) photography.

IR Photography

The biggest issue with IR photography is that usual DSLR cameras have a fixed built-in IR filter before the image chip. This is to avoid unwanted light. But for IR photos we want it! The solution (except for camera disassembly or buying Sigma SD14 with removable filter) is to increase exposure period. It can take several minutes to get enough light with an IR filter on your lens.

Now, when we have a photo, how to process the red scene we obtained? There is a great Photoshop IR tutorial. But I wanted to do that in Gimp. There is a tutorial in a forum that resembles the Photoshop procedure. To summarize that:

  1. Realize what is in individual color channels - red is brightness, green is sharpness, blue is noise.
  2. In Gimp go to Colors, Levels and try Automatic or set a reference white point (which is something that produces most IR light - a green leaf on a sun for instance). You can also setup individual channels as you like.
  3. In Gimp select Colors, Components, Channel mixer and switch the red and the blue channels. This is done by setting 100% for blue and 0% for red with the red input channel and vice versa for the blue input channel.
  4. Now is the best time for the Shadows and Highlights plugin.
  5. Finally, you can try Colors, Hue/Saturation and add a little bit of Hue (+15 - +24) and possibly add some Saturation as well.
  6. Bonus step is to open Colors, Curves or Colors, Levels and fine tune the image colors.
IR Photo
. .