Populate DropDowns with jQuery and CodeIgniter


UPDATE: I’ve updated this post with a more comprehensive walkthrough, more code examples, and a downloadable archive that contains all the relevant files.  It’s located here: More AJAX Dropdowns with CodeIgniter

CodeIgniter is my first choice for PHP rapid development frameworks. It’s lightweight, powerful, and easy to use. However there are a few common tasks that are not documented as well as they could be. For instance, populating the options in a dropdown select field using AJAX is certainly possible, but you’ll search long and hard before finding a good tutorial or a recipe for actually doing it.

While creating a dynamic form for a client’s project database, I had to figure out how to query the database using AJAX and populate several form fields based on the results of that query. So, for posterity’s sake, I’ve decided to document exactly how I accomplished it. First of all, this method uses CodeIgniter version 1.7.3. For the AJAX functionality, I use jQuery version 1.4.2. The database is MySQL with InnoDB tables.

Now, the application that I’m discussing here is basically a project management app with CRM functions. For this specific form, the user has to assign a “Client” to a project. Based on which Client is assigned, the user can choose a “Contact” for the project. So, the initial form is loaded with all “Clients” who already exist in the database (A future post will detail how I handle dynamically adding a new Client from the form). When the user chooses a Client from the “Client” dropdown, an AJAX request is made to the CodeIgniter controller to retrieve all of the contacts associated with that Client. The AJAX response is then used to populate the “Contacts” dropdown.
Continue Reading…

How to replace Nautilus in Ubuntu 10.04


Screenshot of PCmanFM2 replacing NautilusOne of the negative aspects of switching to Ubuntu is having to deal with the Nautilus File Manager.  Nautilus is tightly integrated with Ubuntu, so it has some really neat features.  For instance you can open FTP sites in Nautilus just like any other folder.  However, Nautilus is notoriously SLOWWWWW!  I mean it can bring you to a screeching halt.  Plus, I’ve been having issues lately with it just crashing, then I have to re-start Nautilus from a terminal.

So, long story short (too late!) I’ve installed PCmanFM, which is a lightweight, speedy file manager with plenty of bells and whistles.  Now once PCmanFM is installed it would be nice to have it integrated with Ubuntu, be the default file manager etc…  So here’s a simple way to replace Nautilus with PCmanFM WITHOUT having to completely remove Nautilus.

Note: this solution leaves Nautilus in place.  It simply  replaces Nautilus with PCmanFM as the default file manager for the active user.  If you have a multi-user set up, you’ll have to do this for each user.  It’s as simple as:

As sudo, open the following files in gedit:




Replace the MimeType contents from pcmanfm2.desktop with the MimeType contents from nautilus-folder-handler.desktop.

In a terminal run:

update-desktop-database -v

And your default file manager should now be PCmanFM instead of Nautilus. It works on the desktop and in the Places menu, although some applications may call Nautilus directly.

How to set up .htaccess files for a CakePHP install


CakePHP is a very popular php/mysql based rapid development framework. It allows developers to quickly put together the “underpinnings” of a web application without having to re-invent the wheel. However, even the simplest of tools can have its little quirks, and CakePHP is no exception. CakePHP favors a “convention over configuration” style, which means that things have to be done a certain way, files have to be in the correct location, and classes have to have proper names. Continue Reading…

The 5 Best Online Project Management & Collaboration Tools


When working on any software project, it is highly important to be able to plan, manage & track the project. Project management is a highly sought after skill & project management software is a billion dollar per year industry. So what’s a small business owner to do, when good project management software is expensive & hard to use. Luckily, online project management software has been flourishing lately. These tools are SaaS, or software as a service tools, meaning that there is no installation. They run online, and all you need is a web browser. However, as with anything else there are good, bad & indifferent choices. Some are expensive, some are underpowered and some are just too darn complicated to use. So, without further adieu, here are my top 5 choices for managing projects online.
Continue Reading…