jQuery plugin for saving function chains

$custom = $.save().show().toggleClass("two")
                               .find("a").css({color:"red"});

Defines a $custom jQuery function chain, without actually executing it on anything. This allows to reuse a list of effects at a later point and on multiple selections with:

$custom("article");


Continue reading "jQuery plugin for saving function chains"

Input sanitizing with object-oriented superglobals

Input filtering is a major security issue. PHP 5.2 introduced the filter API. Problem is, almost noone uses it. Not only was it introduced too late/recently, it also has an extremely cumbersome API.
You know, I'm all for procedural interfaces; but this is one case where it makes less sense. What I'm using instead for new projects is following scheme:


print $_REQUEST->name("var");

save($_POST->text->comment);

mysql_query("SELECT * FROM t WHERE name='{$_GET->sql[name]}' ";
 

Did I just use a bare input variable in a mysql_query?


Read the whitepaper. Download the reference implementation.


Continue reading "Input sanitizing with object-oriented superglobals"

project roster

Today I've set up a project roster. It's mainly for posterity, but also to keep track of current involvements.

http://milki.erphesfurt.de/projects/

Continue reading "project roster"

XHTML hipsters

It's bad.

Many people are deploying XHTML without actually using it. Many years ago it was a hot topic for standard compliance. But even now as it it's fading into technicaly irrelevance, people keep using it purposelessly.

Continue reading "XHTML hipsters"

Sensible use of PHP namespaces not catching on

PHP 5.3 introduced namespaces, a long overdue syntax feature. Let's not talk about how parser fixing lazyness lead to the questionable syntax. There is a bigger problem showing up. PHP developers are exceptionally prone to cargo cult programming.
There I said it.

I'm hereby complaining, because sooner or later it'll creep into code I have to maintain. Deeply nested namespaces seem to be the newest framework pandemic.

Continue reading "Sensible use of PHP namespaces not catching on"

Picking the least worst blog software

So, I didn't have a real homepage in quite a while. Jumping on the fading fad, I've been looking for a blog software the whole weekend. It seems my requirements are too quirky.

- Extensibility, yet unbloated core
- Configuration data doesn't belong into the database.
- Parameterized SQL, and keep the queries few
- XHTML is pointless unless you use other namespaces and app/+xml
- If I didn't need a spamsafe comment feature, I'd write it myself.
- Non-cumbersome templates would be nice.

Continue reading "Picking the least worst blog software"