Saturday, November 23, 2013

How to kill (softly) a software project

1. Monolith.
Keep the whole code base as a one big stack. That way after few years no one will know how it exactly works. You can always try to hire more and more highly skilled developers to work on it (if you have enough money and there are still such people on the market), but most of their time will be spend on solving problems that were purely created by such design. Simply speaking, 80% of your money will go into preserving the current "state of art", not into new business features.
There is another problem, driven by complexity - dependency war, when feature A uses library L in a version v1, but module C used by feature B needs L v2. This is the case when you have a good dependency management system - otherwise they can go silently into your prod but later will need endless time to debug them.

2. Closed stack, NIH.
There should be an enormous effort to add a new Open Source library. Three levels of managers that have no dev-clue should agree. A procedure to get a new CPAN module should be such a pain in the ass that no one would like to do it again. Forget about cloned images, maven/sbt/capistrano/perlbrew/setuptools/gradle or system packaging for easier distribution on your servers. That way your money will be spend on rediscovering wheels again and again. This seems to be a common approach in many big companies with "secure programming" and "not invented here" paradigms. It is a quick way to kill any innovation like newer templates, better JSON handlers or just day to day improvements.

3. Always stay with the same database. Do not try to evaluate new versions, forget about all these crappy no-sql approaches. Who cares what Redis could be better than Memcache, that Mongo could do a better job that MySQL, that Cassandra could be better than your oldy-goody shared disk? Enough is enough.

Oh, crap. What is wrong with so many companies?

Tuesday, October 30, 2012

Want to do maths? You are 120x better off with Scala than Perl

To be honest, I did expect some difference in performance between statically typed Scala (JVM-based language) and dynamic Perl... but maybe not that big. Anyway, check it out.

Here is a very simple way to compute prime numbers:

==== PrimeNumbers.scala
object PrimeNumbers {
   def isPrime(n: Int): Boolean = (2 until n) forall (d => n % d != 0)
   def main(args: Array[String]): Unit = {
    (8999999 until 8999999+200).map(x => if (isPrime(x)) print(x+" ") )

sub isPrime {
    my $n = shift;
    grep( $n % $_ == 0, (2..($n-1))) ? 0 : 1

for(8999999..(8999999+200)) {
    isPrime($_) && print "$_\n"

time scala PrimeNumbers
9000011 9000041 9000049 9000059 9000067 9000119 9000127 9000143 9000163 9000193
real    0m3.187s

time perl
real    6m23.221s

Really? This huge JVM-bloated Scala is about 120x faster in such things than Perl... can't belive!

(Perl v5.14.2, Scala 2.9.1)

Friday, May 4, 2012

Missed your Germanwings flight departure from London Heathrow or Stansted?

Do you trust your airline when checking your flight departure? If they have no idea of "local time" and concept of time zones, be careful or you can miss your flight! I just wonder how many passengers of Germanwings airline flying from UK are going to find that their flight has just gone... according to schedule.... errrr... what schedule? They publish departures times in "their" time zone, not the local one. It is weird, but... well... it is Germanwings. You've been warned.

 Germanwings airline website:
London Heathrow airport website:

Ps - I spent some creative time working with time zones code. It is definitely not an easy thing even if it seems to be quite obvious.
Ps 2 - Germanwings has no email, only premium phone numbers. No way to report them a bug, sorry Germanwings passengers.
Ps 3 - It is not like intermittent - after 2 weeks, they are still proud to have this silly bug.
Ps 4 - It looks like Germanwings... well... I hope they are never going to fly from New York or Dubai.

Tuesday, November 8, 2011

Grub, no count down after failed run, how to fix it

This default grub behavior could be very annoying especially with virtual machines running headless or whatever should stand up after failure. It could be fixed by modifying make_timeout () in /etc/grub.d/00_header: Original code: ****
make_timeout ()
    cat << EOF
if [ "\${recordfail}" = 1 ]; then
  set timeout=-1
  set timeout=${2}
**** here is how to fix it: ****
make_timeout ()
    cat << EOF
if [ "\${recordfail}" = 1 ]; then
  set timeout=${2}
  set timeout=${2}
**** /I know it is a "secure programming" approach in terms of how this code looks like now... and yes, it is/ The original hint is taken from here:

Tuesday, October 11, 2011

cssh - cluster ssh - do your cluster work easier

This is a very simple but powerful tool for interactive work with many machines at once
Just log in to them
cssh node1 node2 node3
and do the same operations on all of them.

It needs x-window (mmm, just wonder if there is a pure-text replacement?) and it is worth to configure ssh keys and perhaps ssh-agent to make your logins easier but still safe.
cssh comes with packages for ubuntu/debian, not sure if redhat/centos rpms catch up here. This project page is
Many thanks for this tool!

Tuesday, September 27, 2011

CPAN of the week

Carp::Always - this is what you need when perl -MCarp=verbose doesn't work the way you expect it. Spotted in some post by JRockway.

Mock::Quick - mock whatever you want, but also takeover/partially override existing modules and classes. The beauty of certainty for TDD or just when escaping from too many dependencies.

Sunday, June 5, 2011

Git ignore file

I just find myself like searching for this again and again as I am not a very heavy git user now, but setting global core.excludesfile seems to be very similar to svn/cvs approach.

How to ignore certain types of files in git?

1) Put the excludes in your $GIT_DIR/info/exclude file (.git/info/exclude), if this is specific to one tree.

2) Run git config --global core.excludesfile ~/.gitignore and add patterns to your ~/.gitignore. This option applies if you want to ignore certain patterns across all trees.

/taken from StackOverflow by Emil

Wednesday, March 16, 2011

Back ticks equivalent in cmd / windows

How to get a result of one command and use it in another command in Windows shell, like with backticks in Unix/Linux shell?

Here is a working example:

for /f "tokens=1* delims=" %%s in ('gnuwin32\date +"%%Y%%m%%d_%%H%%M"') do echo output_%%s.log

> output_20110215_1057.log

Works in Windows XP, Vista, Windows 7.

1) The variable used in a for loop must be a one letter (at least in XP, Vista)
2) gnuwin32 is a set of GNU tools like grep/sed/awk/date which can be run natively in Windows without cost of additonal Cygwin-like layers

Thursday, February 10, 2011

Mr Openoffice is happy with default A4 page

This is that kind of thing that you know you want to change, but there is always no time to do it. But it is just a minute, really!

1) change page format
2) save it as a template (File -> template)
3) set this template as a default (File -> template -> organize -> commands -> set as a default tpl)

Do it, do it!

Monday, April 5, 2010

Rails, flushing buffer log - what a waste of time to fix it

It was so stupid...

There was a ruby on rails application. There were some changes in a production server. Some missing libraries needed to be added. You are fixing one thing then another, try and fix, try and fix and so on. That is fine as long as we know what needs to be done.

Finally this application was ready to work in development but not in production mode. There was nothing on screen nor in log/development.log even with enabled -u (debug) flag for script/server (you should have ruby-debug gem and ruby-dev package also as a dependency).

What is wrong as I am still getting "Application error
There is an error in this application. Please let us apologize for this inconvenience and help to fix it by reporting this problem to site-master", why there is NOTHING in the log or maybe - where is this f..$%&* log at all? log/production.log is untouched even after shutting down the server.

Ok, probably the error is somewhere in differences between environments so maybe this could be a database.yml, different place of connection socket but why I can not see even a simple error message about this?

After some time for browsing forums, groups and so on the proper solution was to add
Rails.logger.auto_flushing = 1
at the end of my config/environment.rb

My question is - even if this large buffer is understandable solution for heavy production environments why I cannot see anything after closing down my server? Should not this log be flushed then?

If you want to check your logger settings...

Run your rails console:


and then type:

so it looks like:
script/console production
Loading production environment (Rails 2.3.5)

and check @auto_flushing= value.

If you have @auto_flushing=1 then you are at home.

Monday, June 1, 2009

Auto-complete cmd in Windows (like in bash)

Mostly for Win-XP: It is really handy to have an auto-complete with standard windows shell, cmd. Surprise: it works! The default expand sequence is Ctrl-F.

To change it to more popular tab, open (win-R) regedit and go to HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor, change CompletionChar and PathCompletionChar to 9.

That's it.

Open your cmd window again and enjoy.

The more detailed description you cand find at

Sunday, December 14, 2008

Matrix, Paweł Hajdan, Chromium and Chrome

I just heard this news yesterday being in Warsaw for a couple of hours: Paweł Hajdan Jr, the member of "Matrix", became a first external commiter to Chromium Code.

See Chromium Blog


"Matrix" is a name of the group that I started 5 years ago to improve the software development and internet services delivery for Polish Scouting Association, Paweł was the youngest guy at the first Matrix meeting 5 years ago. It was really nice to see him again with his talk about security in web applications given to the members of Matrix group.