True is False
Usually I prefer to rant about the oddities of ruby but this time it's python.
Continue reading 'True is False' »
Things that have more than zero impact (on my live)
Archive for the ‘Programming’ Category.
Usually I prefer to rant about the oddities of ruby but this time it's python.
Continue reading 'True is False' »
I recently had a problem with my Website zimmer69.de. Some not so nice fellow told his opera browser to reload a 300k page every 5 seconds, moved it to some tab and forgot about it for weeks. He caused 2 Gb of traffic per day. Time to implement some cache control.
Continue reading 'Auto reload and poor man's http caching in PHP' »
Rails offers a nice function called constantize. It is easy to rebuild this (to some extend) in python. But the price is too high.
Continue reading 'Constantize in Python' »
The String#constantize method is a feature that makes rails fun to code with. This method converts a string to the constant that the string contains (or throws a NameError if there is no such constant). It makes it easy to store class-types in databases as strings and to code controllers that work with classes of the same duck type.
Most people know that eval on user data is dangerous, but noboddy seems to care about constantize. Beware, it is also dangerous and you should constantize with care!
Continue reading 'Constantize with Care' »
I recently found a shell injection bug in some Ruby-gem I use.
Shell injections scare me since a long time and I usually prefer to whitelist certain characters/patterns rather than to blacklist. This means that the system fails to the save side. Unfortunally it usually does fail - my whitelisting is to rigorous and data that would not cause any problems gets rejected. So I decided to take the opportunity to investigate how to prevent shell injection in my favorite scripting language (Python), the language I found the problem in and finally the language that I can not avoid (PHP).
Continue reading 'Avoiding Shell Injection in Ruby, Python and PHP.' »
In one of my rails-projects we had problems with deadlocks during transactions:
"A ActiveRecord::StatementInvalid occurred in ...: Mysql::Error: Deadlock found when trying to get lock "
Continue reading 'Mysql::Error: Deadlock found when trying to get lock' »
Having your private data on a laptop is dangerous, since it might be stolen. The only way to protect your data is to encrypt it. This post describes how to encrypt the home directory of your users on GNU Linux with the help of TrueCrypt and PAM. For convenience the login-password is used as encryption key. Continue reading 'Automatic encryption of home directories using TrueCrypt' »
I tweaked the robots-meta plugin by Joost de Valk for WordPress to support the noarchive tag. This prevents google and archive.org from providing cached versions of your blog.
I've put up a mercurial repo with my version at http://www.littleimpact.de/hg/robots-meta-hg/.