-
Efficient SQL pagination method
The usual technique for displaying data from an SQL query as multiple web-pages involves the LIMIT/OFFSET clause. For example for the first page the query would look like something like: SELECT foo, bar, baz FROM ozz WHERE … ORDER BY … OFFSET 0 LIMIT 10 For the second page you would do: SELECT foo, bar,…
-
Using Perl to access PostgreSQL under Windows
This appears by a non-intuitive problem for people. Below I assume that you are using some version of ActivePerl for Windows (5.8 or 5.10). First of all: Under no circumstances (ok, I rephrase: only under extreme circumstances) should you use DBD::PgPP. It is old, not very performant (given that its implemented in Pure Perl) and…
-
Calling variable functions in Perl
What I’m trying to say with this title is the following: # … lets say we have a value $foo …. # … and we want to call method_1 method_2 … method_N on it foreach my $method_name (1..N) { $method_name = “method_$method_name”; my $func = *$method_name; my $result = &$func($foo); # … } The trick…
-
Working with bitstrings in PostgreSQL
When working with short, fixed width binary data in PostgreSQL (for example: MD5/SHA1 hashes), an option to consider is the bitstring type. It has several advantages: Smaller data storage requirements (also – smaller index sizes). Storing an MD5 hash as characters representing hexadecimal numbers for example takes up 32 bytes, while storing it as bit…
-
Finding unused indexes in PostgreSQL
First some quick DB/index design tips: When you have a 1-1 relationship, you might consider putting the data in one table, instead of several tables and linking them with foreign keys. This will speed up data retrieval considerably. This needs to be balanced with the number of cases when the given values are missing /…
-
How to verify executable digital signatures under Linux?
The PE executable format (the one used by Windows) supports the use of digital certificates to verify the source of the file. Normally you can verify it using Windows Explorer (by right-clicking on the file and selecting Properties). It also shows up when you try to run an executable downloaded from the Internet with IE…
-
Vista and Dell woes
I’ve completed my first ever Vista installation on a relative’s computer and I’m entirely underwhelmed. First of all, the only hardware it recognized out of the box was the soundcard (LOL). Just to clarify: I’m talking about a recent model of the Dell Inspiron laptop line here. Second of all, it failed to read the…
-
Changing jobs
I think the proverbial cat is pretty much out of the bag now, so I might as well announce it: as of the first of November I won’t be working for BitDefender. It has been a fun three years, but I feel that it is time to go into a new direction. This will probably…
-
Link list
The “Last in a Loop” Bug – closures are one of those tricky things. This shows a typical example for (mis-)understanding them, and how to fix it. Via ajaxian: Degrading Script Tags. Very cool, I didn’t know about this behavior. Although, I’m not really sure where you would use it? If a part of your…