PHP

warning: Creating default object from empty value in /var/www/drupal6.pyxos.net/drupal-6.28/modules/taxonomy/taxonomy.pages.inc on line 33.

KeePassX XML Generator in PHP - Convert PWManager to KeePassX

I couldn't get KeePassX to import my PWManager files natively, so I needed a way to do this in a multi-step fashion (I want to use keepass format so I can have the same password program/database on my computer and G1).  The easiest appeared to be:

  1. Export from pwmanager as CSV
  2. Custom script to convert from CSV to keepassx XML format
  3. Import in keepassx

So this "step 2" was the problem.

I found a forum post on the keepass xml format, so the next step was writing something to convert it, and so we have the PHP KeePassX XML Generator.

Currently it's set up to convert the CSV file generated by pwmanager (entered on stdin, xml dumped on stdout).  But I created a set of classes that should be easy to use for generating a valid keepassx xml file.

Disabling PHP's register_globals in userland

So you have a large PHP deployment that is (still? - this is 2008!) using register_globals. How do you test individual pieces of the site without being able to change the ini variable via .htaccess? Try this code out:
<pre>&lt;?php
if (ini_get('register_globals'))
{
        $__sgs = array('_ENV', '_GET', '_POST', '_COOKIE', '_SERVER');
        foreach ($__sgs as $__sg)
        {
                $__k = array_keys(${$__sg});
                foreach($__k as $__v)
                {
                        if (isset($$__v) && ${$__sg}[$__v] === $$__v)
                        {
                                unset($$__v);
                        } // end if superglobal var = local var
                } // end foreach superglobal key
        } // end foreach superglobal
} // end if register_globals
?&gt;</pre>

Ruby-on-Rails is not a PHP killer

My suspicions about RoR appear to be vindicated; at least by one person anyway.

I've tried to read some examples and howtos about Ruby and Ruby-on-Rails. The language seems very elegant, but I always heard that it's slow and suspected that it's ability to do lots of different things was limited. I've picked up some python recently and found that using objects for everything (mostly) works out very well. In PHP 5, OOP is very well supported (with some caveats) and if you have a firm grasp on OOP, PHP can even begin to look like Ruby (see: fluent interface).