Learn Something New Everyday

Posted By: Tony Baird

Last Updated: Thursday June 11, 2009

Every single day I learn something new and yesterday we no different with the development.  It was pretty tiny though but it did provide some confusion for a little bit and it was with Zend Framework.  The way we develop anything with the Vezoz in the front uses models obviously but also Zend_Db_Select to construct any query that needs to be created.  So rather than doing something like this:

$sql = “SELECT * FROM users”;

It will be something like this:

$select = $db->select()->from( ‘users’ );

The reason we do this is it provides the facility to mutate the queries very easily.  I’m building a query that has a lot of data and it’ll be displayed as a list paginated that means I need to calculate the total number of rows possible.  Most people would have to write two queries to handle this.  We do not as passing the select object into the pagination system it will drop unnecessary fields and replace it with a count.  This is great we’ve now only written one query to handle two situations and if it’s changed over time no worries it’ll be changed in the count portion as well.

So why does this matter?  Well I was building a query that in order to work properly needed to grab a set of rows and also join on another query thus creating a sub query.  As much as I tried I was unable to get Zend Framework’s Zend_Db_Select to work without error when a join is done on a query rather than a table.  A quick search I was unable to find a solution to this problem so as it stands it’s just a plain old sql query.  There isn’t too much of a negative to this it still passes the same sort of object back and if I can determine how to make it work later it can be switched thanks to it being part of a model.  So the code moves along for this portion not knowing better but it would be nice to eventually have it switched.

Status Update

Yesterday I talked about how the IP management system was nearing completion.  Well I am happy to say this has been completed and as far as having all the features necessary it is completed.  Usability will be improved but the goals right now are to make things work even if it’s a little more time consuming then what a final version will be.  We liked the HyperVM handling with ip pools so we found no reason to stray from the concept.  HyperVM however did not keep track of individual IP’s when they were not assigned to virtual machines while we do.  So here’s the steps on what goes on:

After this the system keeps track of the IP’s which are available which are not as each IP is individual and can easily be linked back to a virtual machine.  Other concepts we’d like to add later on are the following:

Both of these depend on our way of tracking bandwidth usage but OpenVZ anyways we can do it.  With Xen not so sure as Hawk Host does not use Xen so our goal is OpenVZ first.  I am sure there are other idea’s floating around about what could be done but that’s it for now on the IP front.

The other thing being worked on right now is the operating system management portion.  We’re going with the concept of there being categories of operating systems as well as operating systems themselves.  The reason being for the user you could display them OS’s that are strictly that and you could also display them ones with control panels.  Of course the ability to make the OS not public to the user is possible as well as completely disabling an OS from being used again are possible.  This portion should be completed early on today then onto creating virtual machine plans and virtual machines themselves.  I will talk tomorrow about how we’re adding the concept of plans and how it varies from others.

Ready to get started? Build your site from
$2.24/mo
GET STARTED NOW