-
Parse the camel
A quick note about the B::Deparse Perl module: use it to tame hairy (obfuscated) Perl code, even code like this. Use it like this: perl -MO=Deparse obfuscated.pl In the area of obfusctation, but more on the funny side there is Acme::Smirch and Acme::Bleach. Have fun! PS. You can exercise your skills on the perl one-liners.…
-
Random Java blogging
From the JUnit FAQ: Each test runs in its own test fixture to isolate tests from the changes made by other tests. That is, tests don’t share the state of objects in the test fixture. Because the tests are isolated, they can be run in any order. Very important to keep in mind if you…
-
Watch out for long running tasks with Java Timer
The problem? Write a code which will execute every N seconds. The solution? Using a Timer with scheduleAtFixedRate. Now you got two problems :-), unless you’ve carefully read the documentation which states (emphasis added): If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will…
-
Style is important
Because you are not writing programs for the compiler, you are writing it for the human who is coming after you (and he might be a psychopath who knows where you live :-)). Here is a nice related post from the creator of VirtualDub: Undoing indentation hell.
-
Modulo implies division!
When programming, if you write foo / bar, where foo and bar are variables, you usually instinctively thing “can bar be zero? do I need to add a check that bar is zero?”. However how many of you apply the same line of thinking to the modulo operator? I didn’t (until now – when it…
-
How to interpolate a string in Perl?
Perl (and some other languages which came after it :-)) have a feature called interpolation, whereby the names of the variables in strings are replaced by their actual values. This is both useful and dangerous (it can easily result in problems like command injection / SQL injection / HTML injection (aka XSS) – as with…
-
A great analogy for programmers
I found the the following great blogpost which extends the “rockstar programmer” analogy: Musical Analogy. Very insightful. I too like “jazz” programmers more than “rockstarts”, because they probably won’t have any problems with SDLC :-).
-
Negative zero – what is it?
Computers have two ways of representing numbers: One is called sign and magnitude – usually you have one bit specifying the sign (again, most of time you have 0 for positive and 1 for negative) and the rest of the bits specify the absolute value (“magnitude”) of the number. The other is ordering the numbers…