Archive for the ‘Linux’ Category

Apps for programmers to keep you healthy and fit

Thursday, December 11th, 2014

Most IT people have trouble staying fit. I am also in upper limit of normal weight but I found some helpful apps recenlty.keep-calm-and-wait-for-ingress-invite-3

I believe that biggest problem is finding time to stay fit. Going to gym after works takes better part of the evening and you have to do it like 3 times a week which is not easy.

Firstly the famous 7 minute workout that some scientist say is as good as full scale training if you do it every day. Read more about it from http://well.blogs.nytimes.com/2013/05/09/the-scientific-7-minute-workout/

I have tried it for 2 months ca 5 times a week and I can see clear results already After first month I was able to do 50% more pushups. In 2 minutes I used to do around 45 and it went up to 70. I can see distintct muscles building from the mirror. I also feel not getting out of breath so easily. So this means it really works and makes you stronger. The app I use is https://play.google.com/store/apps/details?id=com.popularapp.sevenmins&hl=en

Second app for staying healthy is Ingress.  It is invite only augmented reality actiongame where you have to move around in the city from one portal to another and take these under you control. Usually I run for 50-100 meters from one portal to another, do actions on phone that is needed and run to another. Its is great hobby after the lunch for 10-15 minutes and while commuting between office and home.

It is amazing because the gamification moment helps you motivate to find some more minutes (or hours) to walk or run. Download it from https://play.google.com/store/apps/details?id=com.nianticproject.ingress&hl=en

Thirdly I have been able to lose some weight. There is nothing fancy here, just plain spending calories. In the summer I went to work and back with bicycle, I did some 30-40km trips with pulse in range of 130-140. This lasted 1,5h and used around 1800kcal. Considering that daily normal calorie intake is around 2500kcal then 3 times bicycling a week I lost around 5kg in 2 months. Unfortunately I had to make a pause because of knee injuryand then winter came with no daylight so there is big risk of getting killed in traffic. However same result can be achieved by same time and same pulse by walking, running, stairs climbing etc. App used is Endomondo https://play.google.com/store/apps/details?id=com.endomondo.android&hl=en

How are your experience with getting fit apps? Please write to comments.

Smartcuts: How Hackers, Innovators, and Icons Accelerate Success

Monday, October 27th, 2014

horse-pulling-carThis is must read book that everyone should read. I even listened this audiobook twice in a row to grasp the concepts better.

Have you wondered how typical US president career looks like? No, it is not advancing through all the voted positions one by one until you reach the top to become president. Instead typical president does something completely different and then switch career to become president. It rarely happens but if typical career politician will become president then history has shown how lausy job he has done.

Stand on the shoulder of giants, don’t start new things from scratch. Ask around and you will fins someone who has done it already so you can skip making a lot of mistakes.  If you want to use computer then should you know how electricity works or processor or operating system? No, you have to use what others have done already and only learn the specific program you use. I have found myself using this principle knowingly already a few times.

I love also 10x thinking principle. It generally means that improving something 10% is as difficult as improving 10x . Difference is that 10x principle makes you think differently. Most famous example is from Henri Ford, cars and horses. Making horses run 10% faster is similar in difficulty with making a car that can drive much faster than horse. This is the way how Elon Musk and his SpaceX can make 10x or 100x cheaper rocket launches than NASA can.

Startup CEO life is hard, experiences of Ben Horowitz

Monday, June 30th, 2014

If you are startup CEO or planning to be one then you will find many important lessons from book “The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers”hard-things

Book is very enjoyable to read, its almost like a thriller. It begins like biography of Ben from the times he build multibillion company at the time of .com bubble.  Besides all of the fun there are explained many critical things that startup CEO must know. A lot of attention is dedicated to building a team. How to choose best people and executives? How to keep them useful and engaged. How to fire your best friend and how to understand that firing must be done? What kind of people are suitable for what phase and what type of company executive positions?

All of these questions and more are answered in the book.

Read more from http://www.harpercollins.com/9780062273208/the-hard-thing-about-hard-things

Crucial Conversations: Tools for Talking When Stakes are High

Saturday, June 28th, 2014

sharedmeaningEvery once in a while you need to hold a conversations where stakes are high, opinions vary, and emotions run strong. For example it can be argument in work or family. It can be negotiating a business deal or a salary raise. People tend to use their worst skills in these situations where is matters the most. Situation is not better if you avoid the conversation altogether.

This books explains that in conversation it is important to hold safety and keep the dialogue going. It is very simple to slip into silence or violence and if you deviate from dialogue then both sides will suffer.

After having read this book I have noticed a lot of crucial conversations that I am involved in. Now I have much better idea how to behave when I am involved in one while before it just happened as it happened.

As there are many crucial conversations happening all the time then I believe this books is mandatory reading for everyone who wants to be successful.

See more from http://www.vitalsmarts.com/crucialconversations/

Book Review: “The Lean Mindset: Ask the Right Questions” by Poppendieck-s

Monday, March 17th, 2014

While most people think of The Lean Startup: How Today’s Entrepreneurs Use Continuous Innovation to Create Radically Successful Businesses as THE Lean book then The Lean Mindset: Ask the Right Questions is great resource for second point of view. Angle of approach is also different. While Lean Startup is more like a guide to startups of how to build it then Lean Mindset is short but useful book about lean mindset in general.

I liked the books extensive references, all its claims have strong references like a doctoral thesis to keep sceptics busy. I am not going to explain here all the principles of lean but my key takeaways from this book are:

  • Make your customers LOVE your product, exceed their wildest dreams.
  • Keep your team happy
  • Follow scientific process to make it happen

I definitely recommend this book for newcomers into lean world or people who want to have a quick reminder of how things are supposed to work. I also recommend to check out good Lean principles at Poppendiecks home page

 

Speed reading – first impressions are positive

Thursday, March 13th, 2014

Some time ago I decided to start reading best-selling business books an hour a day every day. My current book is Thinking, Fast and Slow which is super useful but also over 500 pages long. It takes weeks to finish it so I decided to give a try to speed reading. At first my reading speed was around 200 words per minute. After a few weeks of practice I can do at least twice the speed with still much room for improvement. Considering English is not my native language then I am happy so far.

There are several important concepts which help you read faster.bypass_subvocalization

  • Re-reading (Regression) – Read everything only once.Some sources say that reading sentences over can waste 20 minutes in every hour. If you resist re-reading then you can increase speed by 50% alone (40min to 60min an hour). First you can feel that you did not understand the text but I have seen myself understanding the text even without re-reading.  Most books explain concepts thoroughly which helps you understand it with following sentences and it really works.
  • Subvocalization – Don’t listen to voices in your head, it slows you down.
    This is actually the hardest part. When you read and hear someone talking the text in your head then your maximum reading speed is limited by the speed of your talk.
    Key here is to see words as images. When you watch a house for a fraction of second then you get huge amount of information: door, windows, color, roof etc etc. This proves you that you don’t need to describe loud all details of house for understanding what it is. In the same way you can take words as images and you will comprehend much faster.
  • Fixation – Take in several words at a time
    There is tiny pause between your eyes focusing from one word to next. During reading your eyes are usually focused 200-250ms a time and pause between fixations is 20-40ms. When making less fixations your reading speed can be up 10% from fewer pauses only. When spending same amount of time looking at 2 words a time instead of one then your reading speed is doubled.

Don’t forget that every skill needs practice and you cannot become expert speed reader in a few hours just like you cannot become chess master immediately after learning the moves. I recommend free online tool http://spreeder.com/ for practising speed reading. Go ahead and ramp up your speed to 600wpm which overwhelms your subvocalization so your brain needs to start working differently to understand the words. Be relaxed and don’t try too hard to understand everything at first. This is just the practice before you can start to really exploit the new skill.

Good luck in tripling your reading speed and learning ability!!

Book Review: “Outliers: the story of success” by Malcolm Gladwell

Thursday, March 13th, 2014

outliersBooks is all about people and groups who stand way out from the crowd. Now I understand why Steve Jobs and Bill Gates are so much more successful than most people. Unfortunately for all of you it was less about their personal greatness and much more about right timings and coincidence although personal ability is precondition.

Learn how to see the opportunities and exploit them by getting the book from Amazon

Bill Gates case was that he was born exactly right time so when he was in 8th grade then his Lakeside private school got limited access to mainframes at 1968. Mainframe access was very hard to obtain at time. Another major coincidence is that in nearby University of Washington and he could get his hands on mainframe for free between 3am to 6am during the night. Some more opportunities and he was way ahead of other with 10 000 hours of practice when time was ready. If such early access was immediately available for millions of people then nobody would even know the name Bill Gates.

I got myself another very practical knowledge regarding raising kids. If you compare kids aged 6 then exactly 6 years and 6years 11 months have relatively different abilities so older ones are always seen as more brighter and thus developed more. Thus older kids get more practice and eventually get much better than just a few months younger companions. This is very easily seen in Canadian hockey teams where most of people are born in beginning of year rather than end. If you see such situation with your child then you must be able to notice it and give extra push on your own to level the playing field again.

In general most of the stories in book is about getting early opportunity to something to become perfect with 10 000 hours of practice when time is right. You never know what the next big thing is but if for some strange reason you are well prepared when it hits then you have high chance of becoming successful.

How to make Apache, PHP, vhosts, Laravel, mcrypt and JSON work in Ubuntu 13.10 after upgrade

Sunday, October 20th, 2013

I just upgraded my Ubuntu from 13.04 to 13.10 an suddenly my PHP dev environment does not work anymore.

Investigating changes I found that apache2.2 was replaced with apache2.4 and php 5.4 was replaced with php5.5.

Firstly vhosts did not work and all local sites showed only “It Works” default page.

There was new 000-default vhost created but removing it and restarting apache2 did not have any effect. Turns out that you need to add .conf extension for all of the vhosts definitions in sites-available and sites-enabled.

Next issue was that my Laravel sites did not have mcrypt extension anymore. This is bug and workaround is

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart

Now having php5-mcrypt working came another issue

Call to undefined function Illuminate\Foundation\json_decode()

First I suspected Laravel defect but soon it turned out that composer dump-autoload had same issue and everything else that used json_decode as well. Reason behind it is php builtin json module license agreement which stated

“The Software shall be used for Good, not Evil.”

This does not agree with the Free Software Foundation’s (FSF) freedom 0:

“The freedom to run the program for any purpose.”

As a result Debian Ubuntu and other free and open-source distros removed the Crockford JSON implementation from PHP. Some sites suggested using pecl-json-c and some other workarounds but actually fix is pretty easy. Just install it via ubuntu apt-get feature

apt-get install php5-json

Final “issue” is more strict server security. Comment in /etc/apaches/apache2.conf says

# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.

My vhost DocumentRoot was outside /var/www so I got either forbidden or not found when I navigated to rewrite-d url-s. Solution was adding following directory to /etc/apache2/apache2.conf

Error could be “AH01630: client denied by server configuration:”

<Directory /home/username/devprojects/>
        AllowOverride ALL
        Require all granted
</Directory>

I hope your adventure in making PHP development environments work again will be faster than mine 🙂

New mysql user does not work in Ubuntu fresh install

Tuesday, October 15th, 2013

I have observed that after installing fresh mysql-server the new users will not be working. Everything looks good user exists, password exists but login never works. Finally I SOLVED the issue although root cause is still unknown. If ou know hte cause then please leave it to the comments.

I create the user and test the login like below.

mysql> create database testbase;
Query OK, 1 row affected (0.06 sec)

mysql> grant all privileges on testbase.* to testuser identified by 'testpass';
Query OK, 0 rows affected (0.06 sec)

mysql> Bye
smartman@smartman-ThinkPad-T500:~/developer$ mysql -p -utestuser
Enter password: 
ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES)

Solution is deleting users which have no username set and only host.

mysql> select host,user from user;
+------------------------+------------------+
| host                   | user             |
+------------------------+------------------+
| %                      | testuser         |
| 127.0.0.1              | root             |
| ::1                    | root             |
| localhost              |                  |
| localhost              | debian-sys-maint |
| localhost              | root             |
| smartman-ThinkPad-T500 |                  |
| smartman-ThinkPad-T500 | root             |
+------------------------+------------------+
8 rows in set (0.00 sec)

mysql> drop user ""@"localhost";
Query OK, 0 rows affected (0.04 sec)

mysql> drop user ""@"smartman-ThinkPad-T500";
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user;
+------------------------+------------------+
| host                   | user             |
+------------------------+------------------+
| %                      | testuser         |
| 127.0.0.1              | root             |
| ::1                    | root             |
| localhost              | debian-sys-maint |
| localhost              | root             |
| smartman-ThinkPad-T500 | root             |
+------------------------+------------------+
6 rows in set (0.00 sec)

 

PHP locale not working in Ubuntu

Tuesday, September 24th, 2013

I was working with Laravel 4 and trying to format Carbon object dates according to locale. However App::setLocale(‘et_EE’) did not have any effect. Going lower level and setting setlocale(LC_ALL, ‘et_EE’) did not change locale either. Carbon uses under formatLocalized method PHP strftime so issue relates to this also. Some have suggested to use

utf8_encode(strftime("%A, %d de %B",time()));

But it is not perfect solution either.

It turns out that OS must support the locale. You can check all available locales in your machine with

locale -a

If your webapp supported locales are missing then add these with command

locale-gen en_US et_EE

Removing locales is easy also, just add –purge to the command, which removes all other locales and keeps only the ones you specify.

locale-gen --purge en_US et_EE

I had another specific issue with locale et_EE, by default it is encoded in ISO-8859-15 ( et_EE.iso885915 ). If all application is in UTF-8 then dates will have special chares ÜÕÖÄ corrupted. To force UTF-8 only ( et_EE => et_EE.utf8 ) I had to make changes in this file

/usr/share/i18n/SUPPORTED

and edit there line et_EE ISO-8859-15 to et_EE UTF-8