Either my night vision improved tremendiously or there is some really bright moonlight outside. It’s past 1:00am but I can see a lot from my balcony – both close-ups and remote objects. Shweet!
Month: May 2005
Fixing WordPress escaping
Most of my posts about WordPress were positive. Today I’ll mention one of the annoying features it has by default and how to fix it.
Escaping. By default, all text in the <pre>…</pre> block is passed through escaping subroutine. Most noticeble change happened to double quotes (“). They were escaped with the backslash (\). Needless to say that rendered many code bits useless.
The fix is very easy. One just have to install code-markup.php plugin. It has some additional functionality too, but for me all the value was in the unescaping routine.
I’ve installed the plugin for this site and the problem is gone now.
Perl obfuscations
The flexibility of Perl allows for extremely nicely looking code. On the other hand, the same flexibility allows people to do ugly things, which Perl is very well known for. Sometimes, though, I come across a piece of code which is both ugly and beautiful. Here is one example written by one of my collegues:
sub _uintvar { my ($v) = @_; $v = sprintf("%b",$v); $v = '0'x(-length($v)%7).$v; my @v = map {"1$_"} $v=~/(.{7})/g; substr($v[-1],0,1) = "0"; $v = pack("B*",join('',@v)); }
This was found in the production system. It works. And it was tested.
Now imagine that the name of the subroutine would be different in some non-selfdescriptive way. Would you be able to parse it, understand it, and say what it does? How about fixing a bug in there?
Static Subversion for Red Hat 6.2
I’ve heard a few harsh words about Subversion before. Mostly these came from sysadmins who complained about all bits and pieces Subversion requires to work properly. Some mentioned that it is not trivial to compile with the set of options that is different from the default.
Today I spent about three hours together with The Master of Strace trying to make Subversion command line client svn
work on one of our old machines that runs Red Hat Linux 6.2. The only way to success, it seems, was to compile the static version of svn
. Since we needed support for https:// URLs, we had to build with OpenSSL. OpenSSL is not trivial to compile statically too, because of it enourmous love of Kerberos5. While trying to make it work we also jumped through a number of versions of Subversion and other components.
Finally, we managed to build everything. In case you’ll ever need a statically compiled version of svn
(from Subversion version 0.17.1 (r4503)), you can get it here (the binary is about 7 MB):
As far as I am concerned it works just fine. It runs on Red Hat Linux 6.2 and can work (import, checkout, commit, etc) with repository running on one of the recent versions (1.1.4 if I recall correctly).
Needless to say that today I’ve heard a few more not-for-kids-ears words and phrases towards Subversion developers.
Are they for real?
Olga and I went for some shopping in Woolworth Ermes Olympia yesterday. We started off with a lunch in the caffeteria upstairs, as we often do. At first we were suprised as to how empty it looked. Usually there are at least a few people in the smoking area and twice that much in the non-smoking area. But when we entered, smoking area was totally empty, and there were about 10 people in the non-smoking area.
But when we paid for our food, we realized what happenned. The prices went up. And they went up a great deal. Usually, Olga and I paid about 6-7 CYP for a couple of sandwiches, a couple of drinks and some dessert. This time we paid almost 11 CYP. I checked the receipt and was stunned. Consider 1 CYP for a can of coke, for example. I don’t have a problem to pay this money for a glass of coke, if a waiter brings it to me, while I am sitting on some remote beach in the middle of nowhere. That’s fair. But how am I supposed to react when they charge me 1 CYP for a can of coke which I have to go pick up myself, drink it from the can, and at the place where it costs about 40 cents two floors below? And I am not even talking about a cheese cake for 3.50 CYP!
I was trying to find a reason for the price change, but failed. Everything else from the personnel and services to decorations and food remained the same.
Needless to say, now we have one place less to enjoy…