Older blog entries for robocoder (starting at number 328)

Just popped in to read the blog roll. Advogato's recentlog is downright spammy looking...

Piwik 0.5.5 was released a couple of weeks ago. One critical bug fix, some index improvements, and an IP anonymizer were the big highlights.

While Matt leads the big feature development in 0.6, I've been contributing small patches and improving our Trac reports. (This was a good opportunity to brush up on SQL JOINS.) Generating the graphs for the project's metrics will hopefully be easy to automate. (I hope to revisit the BMI and Fix Responsiveness graphs at a later date.)

Ok...back to work...


Working on a new plugin for Piwik (and ActiveAnalytics) to provide in-app download/install of plugins. I've prototyped the client and mocked up the digital download store (not pretty). Building our own hosted extension repository (ala Wordpress & Typo3) -- for third-party developers -- may be next on the horizon... (being discussed).

PHP mbstring.func_overload is evil.

There's no mb_substr_replace() function, so you can't pass a value from mb_strpos() -- ie overloaded strpos() -- and expect it to work. Also, if you use substr() on binary data -- precisely because it's binary safe -- then you really don't want/expect to use mb_substr(). And there's no way to disable this at runtime via ini_set().

I just borrowed a snippet from ZendFramework and applied it to Smarty' s outputfilter.trimwhitespace.

Detecting this and coming up with workarounds is fugly.

Re-inventing the wheel. Sure, I could have used the ip2c library from FireStats, or the geoip code from MaxMind, but the former doesn't support shared memory and the latter is just fugly looking code.

So, I just coded/tested/benchmarked a new IP-to-country plugin for Active Analytics -- it'll be an optional, third-party plugin for Piwik. It can search the database in either a flat file or shared memory. (The difference is in the 10ths of a millisecond per query on my antiquated test box.)

In hindsight, I wasted a lot of time over-3ngin33ring the solution. I thought it would be safer to sign and check the integrity of the shared memory segment for users in a shared web hosting environment. I later realized this was a non-problem because shared web hosting doesn't offer access to shared memory (due to security and resource concerns). This came as a relief because signing and verifying killed the performance benefit of using shared memory.

[ed. "engineer" is a protected title here in Ontario.]
Active Analytics is bloatware, and it's intentional. Based on Piwik, the package will be further padded to include new plugins and complementary self-hosted solutions.

So far, I've commited my workspace to Sourceforge as a new project ("Active Analytics"). The differences are few at the moment:

  • the directory layout reflects my installation preferences (i.e., public, private, and user folders).
  • non-core plugins (that I developed or coded by other devs) are revision controlled so that I can sanity test them when there are upstream changes (read: compat busters).
  • a couple of rejected patches are included for stability ... at least until the root cause defect is found

We're nearing the release of Piwik 0.5, and I noticed we'd made the 1500th check-in to our svn repository in additon to reaching 1000 tickets created in Trac. So, to reflect on our development journey, I whipped up some pretty charts of the project's software development metrics (using a handful of Perl scripts, MySQL, OpenOffice, and Gimp).

17 Jul 2009 (updated 17 Jul 2009 at 05:15 UTC) »

Granted this is "PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch (cli)", but my fondness for PHP is nonetheless waning...

print memory_get_usage()."\n";
Simple enough. But sporadically, I get:
apang@olympus:/tmp$ php test.php
Segmentation fault
That doesn't instill a lot of confidence when you're trying to figure out where your long running PHP script is leaking memory like a sieve...

Wait there's more.

print memory_get_usage()."\n";
print memory_get_usage()."\n";
You'll have to dig into the Zend Engine internals to figure this out:
apang@olympus:/tmp$ php test.php
I'm presuming there's some voodoo Zend Engine optimization going on under the hood (as opposed to some observer effect).

My absence says it all. Coding/blogging isn't really practical when there's a newborn cradled in one arm. ;)

Still, I've been a busy bee on Piwik, especially now that I have commit privileges. ;) We pushed 0.4.1 out the door primarily to address issues raised by PHP 5.2.10, but there are a lot of other fixes as well, in addition to now being able to manually (programmatically) trigger a goal from the browser.

You can't believe everything you read on Twitter. There were tweets purporting that the Ontario Ombudsman's office had adopted Piwik for its web site, but I just checked and they're currently using GA. =P

25 Feb 2009 (updated 13 Mar 2009 at 13:34 UTC) »
Don't force your infinite wisdom on me.

I'm not the first to notice this, and I probably won't be the last, but it deserves repeating, "don't use Prototype."

Here's one reason: the Prototype JavaScript framework doesn't play nice with others; it breaks "for..in" globally, intentionally. What's ironic is their workaround for json.js.

21 Feb 2009 (updated 22 Feb 2009 at 00:14 UTC) »

+1 to Ta0kira for his flurry of non-syndicated posts. My nitpick would be that sometimes the syndicated posts are OT.

+1 to Apenwarr. Yeah baby, long live hand rolled lexers and parsers! (That brought back fond memories of my university days taking Compiler Design.)

-1 but self::patOnTheBack() for fixing the language and country detection bugs in Piwik. Boo-hiss-scratch for whoever was responsible for using the proposed ISO 3166-1 alpha-2 country code "sp" instead of waiting for the officially assigned "rs" for Serbia. A hex on you and your bloodline that I have to detect "sr-sp" in every visitor's browser's Accepted-Language and fix your mistake.

319 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!