LZMA - better than bzip2
Everyone sometimes needs to compress something: doing backup, sending files over Internet etc. Most of us uses gzip or bzip2. It's known than bzip2 has a bit better compression ratio but it's much...
View ArticlePipe in bash can be a trap!
Today a colleague at work tried to debug a script in bash that didn't want to work as he expected. He hit one of traps people get into when writing bash scripts. Let's look at the code that find the...
View ArticleC++ exception specifications are evil
When I began to program in C++ I was already experienced in C and had written some code in Java. After writing few thousands lines of code in this language I felt comfortable with all of it's goodies...
View ArticleAll about Linux signals
In most cases if you want to handle a signal in your application you write a simple signal handler like: void handler (int sig)and use the signal(2) system function to run it when a signal is delivered...
View ArticleUsing Valgrind to debug memory leaks
Valgrind is a wonderful tool useful mainly to debug memory related problems in C/C++ programs. I don't know a better tool to find memory leaks. Although output of this program is often clear and...
View ArticleThreads and fork(): think twice before mixing them.
When debugging a program I came across a bug that was caused by using fork(2) in a multi-threaded program. I thought it's worth to write some words about mixing POSIX threads with fork(2) because there...
View ArticleUsing dd as a Swiss Army knife
Here are some useful examples of how a programmer (but not only) can use the dd command as a Swiss Army knife. Many of us are used to use a command similar to this one:dd if=/dev/sda of=sda.img...
View ArticleNot so obvious multi-thread programming specific bugs.
We all know that when writing multi-threaded programs one should remember about few more details like locking, using thread-safe libraries etc. Here is a list of not-so obvious bugs specific to...
View ArticleComplexity of std::list::size() is... O(N)
I want to share my recent "discovery" that was very shocking to me. Reading comments to a slashdot story about the C++0x standard I read something very interesting: std::list::size() has O(N)...
View ArticleProfiling Input/Output performance
There are various nice tools for program profiling when it comes to CPU usage like gprof or oprofile. Those tools will tell you exactly which functions in your code consume most CPU time, where they...
View Article