Vim 8.0 Released!

The team behind the greatest text editor of all times has release the new major version – Vim 8.0.  It’s the first major release in 10 years!  Brief overview of the changes:

  • Asynchronous I/O support, channels, JSON
  • Jobs
  • Timers
  • Partials, Lambdas and Closures
  • Packages
  • New style testing
  • Viminfo merged by timestamp
  • GTK+ 3 support
  • MS-Windows DirectX support

For a more complete list and details, have a look here.

The TL;DR summary: Vim provides a lot more power now to plugin developers, so we’ll be seeing a boost in both new functionality and old ways getting better.

Here is a mandatory Slashdot discussion with your usual Vim vs. Emacs flame.

P.S.: Emacs has recently released a major update too …

What is the shortest and most effective code ever written?

Quora runs the question, that by now has plenty of awesome answers.  But this one is my favorite so far:

The ‘true’ program in Unix from the 1970s was an empty file. The shell interpreted that as a shell script which ran and resulted in no error status, so the result was zero. Zero is the shell exit code value that represents ‘success’ or ‘true’ within if and while clauses.

So, no program can be shorter than that. And it was entirely effective at meeting its specification.

False was much longer, being

exit 1

Once lawers got in, both programs were sullied with plenty of copyrights. BSD also eventually established a format for identifying shell scripts explicitly, and those codes got added to the file too. Eventually, ‘true’ stretched to hundreds of bytes of copyrights on top of the shell script format intro code. Now, annoyingly, Linux and Mac OS have made it a compiled binary program. In Ubuntu, it is a 22K binary with an 18K code size. Ugh.

At least writing a correct C program for true can be very short. It is one of the few C programs that should require no #include files, and can be simply:

int main(void){return 0;}

Of course make sure to add lots of copyright notices.

An Interview with Brian Kernighan

An Interview with Brian Kernighan

John Wait: Many popular newer programming languages trace their roots to C. Unix has had direct and indirect influence on many newer operating systems. To what do you attribute the longevity and popularity of both C and Unix?

Brian Kernighan: Both C and Unix strike a very good balance among expressiveness, efficiency and economy of means. That means that they are a good base to build on: the good ideas are worth stealing and the efficiency sets a standard of comparison.  It’s also easier for people to make a transition from something familiar than to make a big change, so a language or system that has significant elements of familiarity is more likely to be a success.

Via LWN.

Unix learning tips from Miguel de Icaza

Miguel de Icaza – a very well known programmer in Linux circles – shares a few tips to having a better experience in Unix environments.  Here is a summary of what he recommends:

  • Read, learn, and memorize the “Unix Programming Environment” book by Kernighan and Pike.
  • Read and learn the “Unix for the impatient” book by Abrahams and Larson.
  • Learn Emacs.
  • Use Midnight Commander, which Miguel is the author of.  Here is a handy manual.
  • Keep a copy of the “Unix Power Tools” book nearby.
  • Learn touch typing.

These are all solid recommendations.  I’d suggest to use Vim instead of Emacs, but that’s more of a personal preference – learn one or the other.  And I can’t agree more on the touch typing.  That is indeed the most important skill that you will ever learn.  Right next to the camp fire starting.

At this point you might be thinking “I am awesome”, “the world is my oyster” and “Avatar 3D was not such a bad movie”.

But unless you touch-type, you are neither awesome, nor you are in a position to judge the qualities of the world as an oyster or any James Cameron movies.

You have to face the fact that not only you are a slow typist, you do look a little bit ridiculous. You are typing with two maybe three fingers on each hand and you move your head like a chicken as you look at you alternate looking at your keyboard and looking at your screen.

Do humanity a favor and learn to touch type.

Working with named pipes in Perl

The collegue of mine came across a problem that developed into an interesting solution that I decided to share with the world. Actually, I think the world is pretty much aware of the solution, but just in case that I will ever be looking for this solution again, I’ll have it handy here.

The task at hand was to do some processing of the logs on the fly. The syslog was configured to filter the appropriate logs into a named pipe and a Perl script was written to read from the said pipe and do all the processing.

The original piece of code looked something like this:

open (SYSLOG, "< $named_pipe") 
  or die "Couldn't open $named_pipe: $!\n";

while () {


The problem came with syslog daemon restarts. Every time the syslog was stopped, the EOF was sent to the pipe and the script stopped reading it.

Continue reading “Working with named pipes in Perl”