13th July 2009
The two graphs below (clickable) are for CPU and RAM use during a period of a program going wild between 23:17 and 23:41 (24+ minutes of server’s downtime). The program was run non-root, it just consumed all the memory it could. It was killed by kernel, so the server started responding without any interventions – which were hard to perform, because none of the services (including ssh) were responding during downtime.
If you happen to be developing a C/C++ program – do use mtrace and valgrind, those are huge helpers against the problems akin to that shown on the graphs.
Posted in *nix, Programming, Software | No Comments »
6th July 2009
I have read manpages of rsync today.
I feel enlightened.
I had a dream of rsync being one of the legendary nix Super-Cows.
A tiny perversive part of self created a PDF version of rsync manpages (43 pages).
It seems that Super-Cows can damage the brain, when stared at too intensely.
Posted in *nix | 4 Comments »
29th June 2009
If you ever need to glimpse at the properties of the Poisson distribution with lambda=0.16, or find the factorial of 6163338 (as a gamma function), then Wolfram|Alpha is a perfect tool for you (unless you have some math package at hand).
The motto of Wolfram|Alpha is Making the world’s knowledge computable. Basically, it is like Mathematica plus a growing corpus of factual numeric data, plus a system to interpret user’s input. This is a nice online reference and computation platform.
Posted in Links, Software, Web | No Comments »
26th June 2009
Recently, I have come across an excellent piece of advice called Ten simple rules for getting published. The only thing I have to add is that final rule #10 should be kept in mind while checking through all the previous rules – e.g. when editing someone’s submission, make sure that you are in position to be the editor for that article, and make sure your decision will influence chief editor’s decision – otherwise there’s no use reviewing.
PLoS Computational Biology, where the “simple rules” were published, has a Ten simple rules collection, which includes a handful of other useful advice articles, like 10 simple rules for selecting a postdoctoral position.
Posted in Links, Misc, Science | No Comments »
12th June 2009
Here’s the ultimate proof :
One can clearly see that on weekends the number of unique visitors of my blog drops drastically to about 40-50% of the working week average.
And yes, that is an almost perfect 5+2 pattern, which I’m observing for many months, like a week-long circadian rhythm. “Almost perfect” must be due to the differences in time zones.
I wonder if the same pattern is characteristic for most web-sites… That is, if people mostly do the browsing at work, and not at home.
Anybody wants to share the secret cycles of one’s blog audience?
Posted in Misc, Web | 2 Comments »
11th June 2009
There is no way I’m aware of to do what the title says. However…
I’m sure that you are aware of the fact that floats representation in any programming language is limited by the precision of the internal binary representations. In other words, you can never have an exact float representation – there will always be some precision associated with the float you are working with. The simplest example is the difference in precision between the float and double types in C.
Suppose I have the following code fragment:
[C] if ( result.score >= input->raw_cut_off ) [/C]
Both result.score and input->raw_cut_off are of type float, and can have positive and negative values. When compared with the greater than or equal ( >= ) operator, it is not always that condition is true – for the precision reasons shortly mentioned above.
As I already said, there is no precision specification for equality operators in C. But it is quite simple to “invent” precision specification; e.g. if I wanted to test for equality only, I could write
[C] if ( fabsf( result.score – input->raw_cut_off ) < 0.000001 )[/C]
In this example, I'm effectively asking for 6-digit precision for the equality comparison of floating-point values. Note, that if you replace that 0.000001 with the actual precision limit of the floating type you are using, you will be "exactly" comparing floating-point numbers - up to that type's precision, of course .
The first-most example with the >= operator can be rewritten as
[C] if ( result.score > ( input->raw_cut_off – precision) ) [/C]
where precision is exactly what it is named, e.g. precision = 0.000001.
Sources used:
Posted in how-to, Programming | No Comments »
8th June 2009
Found here.
Recursively set directories only to drwx-rx-rx (755):
find . -type d -exec chmod 755 {} \;
Recursively set files only to rwx-r-r (644):
find . -type f -exec chmod 644 {} \;
Recursively remove carriage returns (^M) from the end of all *.php files:
find . -type f -name “*.php” -exec /home/user/dos2unix.sh {} \;
In all these cases, {} is replaced with the filename/directory find has found matching your parameters; \; at the end just stops exec processing.
Posted in *nix, how-to, Links, Notepad | No Comments »