Tuesday, 28 March 2017

Suggestion for Supper

Pancakes with Greek yogurt and cherry jam, apples with cinnamon and oatmeal cookies with almond butter. Bon App├ętit :)

Monday, 27 February 2017

Snake bites

The programming language that bites me most terribly & keenly is ... no doubts ... Python. This time it was a global variable eps (epsilon) and I did not add the "self." prefix to the one that I really wanted to use in a method of a class. The nightmares of C programming and its common best practices come back! All in all, avoid global variables also in Python, or these snake bites can be deadly at the end of the day.

Monday, 20 February 2017

Bug in pthread_cond_timedwait or we need an improvement?

pthread_cond_timedwait returns ETIMEDOUT instead of e.g. EINVAL when provided with "timespec *restrict abstime" whose tv_nsec part exceeds 999999999 (basically, it's more than 1 second). Furthermore, IMHO pthread_cond_timedwait should return ETIME instead of ETIMEDOUT (if we follow comments in: http://bit.ly/2kgHEhj). Anyway, if you want to avoid a few hours of debugging then make sure that your tv_nsec is correct in each timespec struct!

Friday, 3 February 2017

"sudo checkinstall" instead of "sudo make install"

The pain of removing packages installed from source has reached its ultimate peak and it's the highest time to move to checkinstall. This gives us a very handy ability to remove a package from the system using the system packaging tools: e.g.  

dpkg -r custom-protobuf

So current flow of commands for any installation from source is:

sudo checkinstall

Wednesday, 21 December 2016

Laws in Physics vs. in Computer Science

The laws of physics and nature are unchanged and we just have to discover them. It requires a lot of imagination and thorough study to fully explain and prove a law. A beautiful and rewarding effect is that later on we can predict certain phenomenon or simply what will happen next based on the laws. An example is the Fermat law that says that light always traverses the path that gives it the lowest running time. You can, for example, infer that because the atmosphere is denser than the vacuum, the light that comes to your eye from the Sun is curved and in reality when you watch a sunset, the Sun is already below the horizon, even though it is still visible.

On the other hand, there are no true and unchanged laws in computer science. The design of systems changes and the way it does can be surprising as every designer/human being has different preferences and can even change a commonly accepted "good design choices". An example is a mismatch between OS page size and DBMS page size, 4 KB and 8 KB respectively. The database can fetch 8 KB pages randomly, for example, because of the index-based scan. On the other hand, the OS notices that the application (DBMS in this case) starts from fetching 2 pages in a row (2x OS page of 4 KB - gives the 8 KB page fetched by the DBMS) and OS assumes that it must be a sequential scan of pages, so it additionally prefetches another 2x 4 KB pages (16 KB in total), the second 8 KBs in vain. The other 2 pages won't be read subsequently. Afterwards, DBMS goes to a totally different location to fetch another 8KB page.

The systems could have a built-in level of adjustment (probably built-in Machine Learning components) that could simulate the nature and automatically improve as the time progresses, for example changing the number of pages to 3 in a row to trigger sequential scan assumption in the OS. The computer environment should imitate better the natural environment.

Thursday, 27 October 2016

$ fortune

$ fortune
Real software engineers work from 9 to 5, because that is the way the job is
described in the formal spec.  Working late would feel like using an
undocumented external procedure.

Monday, 10 October 2016

Thouhgt of the day from Quora

"Get a good education, find someone you love, do something you're good at and don't stop until you're the greatest at it. That way, you don't care what people think of your life or your pictures, you can just live your life the way you've always dreamt." http://bit.ly/2d7irxs Feynman: "What do you care what other people think?"