Archive for March 21, 2006

I’m not sure what I should entitle this…

What’s worse than a Monday at work? A Tuesday at work with nothing to do, and no real activity to be found worthwhile. So being bored out of my skull, I’ve caught up on my reading list. After months of tracking Ruby progress I’ve come to the conclusion – perhaps belatedly – that although its a very cool general purpose language it’s not really all that comparable to PHP.

But seriously, besides Ruby on Rails (duplicate a dozen times in PHP by now with limited success), ActiveRecord (duplicated…yada, yada, yada – I dislike metaprogramming of that nature), and a nifty pure OOP syntax it doesn’t really offer anything truly awe inspiring. If you’re a purist, with strict OOP-Forever ideals go have fun – but PHP just works better in the real world whether its familiarilty, wasting effort on another language to duplicate what PHP already does well, hosting preferences, or some other reason why PHP is preferable. Maybe in a few years with some maturity under its belt, and more widespread adoption…

Important to note I don’t bash it’s non-web usage. It’s a very nice general purpose language off the web app area. I have

Anyways, I ramble…as usual.

Just saw Iamsure’s small mention of my doodling in adding Performance Management to ADOdb-Lite.

So, spurred on by news at Maugrims Blog, I’m becoming excited at the prospect of using adodb-lite for a few projects (Next forum possibly included). Some of the phrasing he’s using in his latest posts has me nervous around just how drop-in it will be (shades of prior discussions about adodb-lite come to mind), but I’m more than happy to wait and try it out once he’s had a chance to hack on it.

Being drop-in, as in “strictly no changes” is not possible. One would need to reference the module to load in an ADONewConnection() parameter. Apart from that though its intended that’s as far as the changes go interface wise. There are a few areas where maintaining backwards compatibility with prior use have been added. I’ve retained a tiny version of the adodb_perf class for the static adodb_perf::table() calls. ADOPerfMonitor() function will probably stay – although all it will do is return a reference to the ADOConnection object which would include loaded modules, and therefore perfmon. This will keep prior $perf->UI() etc. use intact. Not sure there’s too many (if any) other BC issues – could be wrong, I haven’t focused on it entirely yet.

I suppose one changeable area is deciding which modules to load for any given request. Since modules are loaded via a ADONewConnection() parameter it need to be setup before creating a database connection – not later on when perfmon is needed. This introduces some need to be able to set up a module list to load, before creating a connection, specific to a request or PHP file. I think that’s the biggest block to using ADOdb as a “drop in” replacement for ADOdb – but then again it’s a large reason why ADOdb-Lite works so well. It only loads what you tell it to. I’ve never seen it as a problem before because an OOP method for creating connections is easily adapted – might be more difficult to perform selective module loading in a procedural app where the connection code is static – not capable of being dynamically changed by individual requests.

On to other things in this general purpose post -

Sourceforge updated its Software Map design moving to its new layout for these pages. They’ve added some very nifty filter functionality which beats the prior incarnation hands down. It made finding an open source stock portfolio manager simple at least – even found one in Ruby which looks very cool if needing a more dynamic method of defining a portfolio than editing a text pf file – still it’s new and it’s beta and it works. Might try it out for a few days – my needs are pretty simple. Thumbs up to the improvement.

Back on something else I decided to have a go at installing Blacknova Traders. People keep wondering whether I’ll ever actually host any form of game on my server – so while QS is in development I’m thinking of offering a few open source space strats in rotation. Maybe a BNT game for a month or so, then AATraders, then on to Quasar. I won’t be hosting Solar Empire or QS2 – I can use each for so many XSS and CSRF exploits its almost frightening. The install went well, though I couldn’t locate the default password for my account. Using the password retrieval function it ended up being a partial string of my email address…hmmm. Maybe I missed something in the configuration to create a unique random password – never actually edited the config files other than db_config.php. I’ll put the game live in a few days perhaps and do a little exploring – been three years since I last played BNT with Genesis.

Whoa – this is getting long. Boredom breeds verbosity… Until next ramble!

What happened to the Google ads?

Folk probably (or not) remember the day when there were two squat text blocks from AdSense on every page hosted by quantum-star.com . I removed them back in October I think when redesigning the public web offering to get rid of that phpNuke horror. Just to warn people who have a habit of stating an ad-free website is cool – it’s not so cool when you are needlessly forgoing a little income to pay for the hosting.

So the ads will be making a return. As before they’ll all be fairly small Google AdSense types – all text and no images. You don’t have to click them, you can probably I assume block them, and feel free to do so ;-). I’ll just work towards getting at least one cheque in a year to pay for a few month’s hosting. The ads will not however appear on the blog – it’s my personal space, so not interested in giving space to a bunch of ads here.

In anticipation of ruining everyone’s browsing with ads ;) , I checked my own account for the first time since May 2005. Really, before now I saw no point. I was a bit surprised to see the number $80.36 appear. It was $35 or something last Spring before I took those months off for study. That covers (or will) about 4 months hosting costs – or at least compensate me for 4 prepaid months.

Anyway, enough of my rambling…

More on ADOdb-Lite and Perfmon…

Mondays, there is nothing worse than a Monday back at work after a busy tiring weekend.

In between St. Paddy’s Day celebrations, the Rugby celebrations (Triple Crown for us!), and Sunday’s cleanup of my Study (the small dark place packed with three PCs and boxes of books), I managed to make some additional headway on adding Performance Management to ADOdb-Lite.

The main change since my last post is that I’ve switched to using the Module system in ADOdb-Lite. I thought the classes were fairly non-dependent (almost exclusive) for perfmon but turns out that’s not the case when using ADOdb-Lite. The perfmon module requires a selection of methods not supplied by default in ADOdb-Lite – nor in current modules, e.g. MetaType() in ADOResultSet, ServerInfo() in ADOConnection, so it’s back to a module structure. Which is fine if a bit different – it means the perfmon methods are now attached to the ADOConnection object (which is extended from by modules). Not sure yet how this impacts BC usage of NewPerfMonitor() since it makes it defunct (the connection will load the relevant module as an ADOConnection child). That is, there is no separate adodb_perf object as with ADOdb.

Other noted issues still remain (even after downloading the latest version):

- There’s no mysqli support for perfmon in ADOdb
- htmlspecialchars() still par for the course
- Still the mysqli “native” dataProvider value
- Lots of confusing setFetchMode() calls and use of global $ADODB vars. All this controls fetch modes. It’s just mind bogglingly complex. I’m just cutting out these and waiting for a use case where its lack breaks something – It’s better to live in ignorance than be driven insane ;-).

After the above I have a polling monitor running for PostgreSQL 8.1 and MySQL5 – haven’t tested earlier versions. Pulling out the Log records for SQL queries however has proven more difficult.

Other issues:

- Mysql code (MySQLi is a mirror image), one query in particular, will not work for mysqli with MySQL 5. Needs to be fixed and a check added if this is not a problem using 4.1+ – possibly a check using the MySQL version() function. This causes the SuspiciousSQL() method to fail – same happens for ExpensiveSQL() etc.
- Still lots of messy bits from mixing PHP and HTML.
- The modules specific to each driver contain a lot of duplicated code at the moment. Would be nice to parcel this separately so as to provide default fallback functions. Not sure how to go about this within the constraints of the module system other than to add a parent class somewhere to extend the ADOConnection object, before the specific perfmon class child classes.
- No support for PDO (par for the course in ADOdb-Lite anyway). This is needed since I work on a project using PDO exclusively (internal business app).
- Table switching (setting a custom table name) requires a static adodb_perf class – just to hold the static adodb_perf::table() method. I’ve stuck this into the adodb-perf.inc.php file with the adodb_*() functions used in ADOdb. Providing it for BC and nothing more – might even remove it if it’s a minor upgrade issue. How many such calls could be used in an app?

Where things stand a lot of progress was made – despite the whining ;-). Mainly the last few things are personal takes, and areas which ADOdb lacks to start with. Perfmon in ADOdb is currently useless when using mysqli or PDO. My guess is the code would work just fine with mysql but I’m not interested in leaving it there and honestly haven’t bothered testing it on MySQL4 yet.