Im Not Playing Any More
.. rantings and blog of Chris Williams @scampiuk
.. rantings and blog of Chris Williams @scampiuk
PHP programmer for a mere 6 years, I've worked on creating social communities and content management systems while teaching myself the language. For the last few years I've worked on free-to-view and pay-per-view live streaming / in-demand streaming media sites 247.tv and livesquash.tv, We travel around the world filming live sporting events, often doing post-production work for TV in the process.
There have been great advances in the social component market over the last year or so. Old staples such as Community Builder have had more competition with the likes of JomSocial. All with the goal of quickly turning your Joomla! site into a social hub - have we lost track of an important question: Could we do it in the first place?
I get may people asking me about linking external databases with Joomla! because they have found my ExternalDB plug-in on the JED - but people often look for different things when they tap in this simple phrase into Google.. I'm going to try to clear up things a little to get people working in the right direction.
I think it's been about a year that we've been using Amazon Web Service as our main servers now. I think because I can't remember exactly! However long we've been using it, we've used it to manage our media servers and web servers without to many problems, just the occasionally steep learning curve.
How many times have you looked on one of your clients web sites - the site you've spend more than a few hours getting the template right, the content imported and the typography just right - only to find a huge image that's been shrunk down to under 100px?
Wowza Media Server is a very nice tool, and with the use of their images on Amazon Web Services, very very fast to get additional servers up and running when you need them for as long as you need them. The documentation to set it up as an edge for Flash Media Interactive Server can be a little, err, thin at times however, and sometimes you don't have time to spend an hour going through the forums to work something out!
ExternalDB was created for internal use at HORIZONSolutions.tv to overcome a simple yet common problem - how to connect to an external database, or multiple external databases, for multiple components / plugins / modules without having to duplicate the connection details again and again.
We created a plugin, ExternalDB, which allowed us to set these connection details once and get on with it! Because of the kind of work we do we often have to query multiple databases to retrieve things like tournament information, player rankings and other such things that can't be moved into the local dataset as you would want to in these situations.
It's such a useful tool to us know that we install it with nearly every Joomla! deployment that we do.
What it does do |
What it does not do |
|
|
This is where most of the confusion is, by what I read in my email from people asking me how to use it! This is a code solution to using external databases. There is no way of using this without modifying some code. That out of the way, here's how to use it in that code.
ExternalDB simply creates a new jDatabase object with your given connection details - nothing clever but simple to maintain connection details. Here's a sample of code from one of our components...
// Create new ExternalDB instance, using the details that we set earlier.
// 'resultsDb' is what we called the DSN
$dbxo = new externaldatabase ( 'resultsDb' );
// Create a new jDatabase object, connected with the details from the above selected DSN.
// We call ExternalDB objects $dbx just as a standard practice
$dbx = $dbxo->getDB ();
$sql = "SELECT * FROM sport WHERE site = 2"; // Some simple SQL..
// Now you use your ExternalDB object in exactly the same way as you would the regular DB object..
$dbx->setQuery ( $sql );
$dbx->query ();
$res = $dbx->loadAssocList ();
I hope this clears up things! We'll be working on moving this over to 1.6 very soon.
I've been charged with my usual creation of components and modules. It's nothing special, nothing to taxing or complicated, but with the Joomla! 1.6 beta coming up soon, I'm temped to wait and see...
I know I'll have enough to do with J! 1.6 to migrate some sites to it, or more likley, migrate our `standard batch` of plug-ins and modules (you know the ones, the three or four things you always install), just hoping that the development teams for nearly everything are keeping an eye on the development Google Groups for any potential problems (and feature conflicts - I site K2's hierarchical category feature). I've also got to manage my own list of modules/components/plug-ins!
So - how to go about developing new things, now? We've been told that if we adhere to the framework, all will be well. Will it? The alpha is getting better (try the SVN version for a different thing breaking each day
) So the options are...
I don't like ether of these options, so I'll add a third..
Don't develop it
Simple, wait until 1.6 is out. I'm sure the clients won't mind that.
After a little googling I stumbled over this PDF from Matt @ Last.fm, which gives a wonderful idea of how Last.fm deal with their scaling issues.
While some things won't work for our implementations of products, mainly because we're using Cloud Computing rather than maintaining our own hardware - however there are some very good ideas in here.
Worth a read while you're digesting the last of the mince pies!
http://www.smashingmagazine.com/2009/12/10/how-to-explain-to-clients-that-they-are-wrong/
How to tell your clients that they are wrong in what they want!
I'm trying to resolve the problems caused by the self taught nature of my PHP coding. It's not a huge problem, however I do know that there are things that I don't know, don't do with the greatest efficiently as I could be doing.
So, how do you un-learn those years of bad habits? Those methods for doing the every day mundane and routine things that I've developed over years of programming?
![]()
Chris Williams
chris@imnotplayinganymore.com
PHP & Joomla! Developer
![]()
![]()
![]()