Archive for July, 2010

How does motivation work?

Recently I have come across this great old parable of stone cutters.

A man came across three stonecutters and asked them what they were doing. The first replied, “I am making a living.” The second kept on hammering while he said, “I am doing the best job of stonecutting in the entire county.” The third looked up with a visionary gleam in his eye and said, “I am building a cathedral.”

Although these three men were doing the same job, there were three different answers. I think this is a great example of motivation “in action”.

Inception

Inception could be the greatest action movie with the original story for a few past years. Definitely recommended to check it out!

PHP: How to get microseconds

Sometimes it could be necessary to get time with microseconds part. Especially it is good for something like logging when multiple entries are recorded per second and preferably to know how they are spread out.

At first glance everything looked very easy:

print date('Y-m-d H:i:s.u') ;

where u is microseconds.

However it turns out PHP manual has a tiny note which states

Since this [date()] function only accepts integer timestamps the u format character is only useful when using the date_format() function with user based timestamps created with date_create().

Which means that u kind of works but in case of calling within date() function the result is always .000000.

So the straight forward solution could be something like this:

print date('Y-m-d H:i:s') . substr((string)microtime(), 1, 8);

But the drawback of the solution above is two calls to the time related functions which potentially may cause some accuracy issues.

Thus even better solution is doing just one call of time function:

list($usec, $sec) = explode(' ', microtime());
print date('Y-m-d H:i:s', $sec) . $usec;

Five Ws

Popular in journalism, the Five Ws (also known as the Five Ws (and one H), or Six Ws) formula can be adopted in software project management.

  • Who? Who was involved?
  • What? What happened (what’s the story)?
  • Where? Where did it take place?
  • When? When did it take place?
  • Why? Why did it happen?
  • How? How did it happen?

Even short answer on each question above gives a good story on something happened. Especially if that took place unexpectedly. Documenting those answers could be very helpful to make a step forward and resolve the situation as well as better understand how to prevent similar issues in the future.

Speaking on preventing similar problems to occur. H. William Dettmer made a good point that manager’s value is assessed not by the importance of the tasks he\she is working on but whether he\she is solving the same issues multiple times.The quote is actually applicable to (software) engineers too who normally should resolve the problem for good instead of hiding it or inventing another ‘temporary fix’.

Yo Hollywood

Two good friends of mine shot this great video right in the office using just iPhone 4! Check out behind the scenes photos to see how.

The movie is also available in 3D.

Scottish Voice Operated Lift