Ditch MAMP on Snow Leopard

I was fond of the stack XAMPP offered when I developed on Windows and lazily continued used XAMPP/MAMP once I moved to a Mac OS X based workstation. Unfortunately, the latest releases of MAMP have attempted to restrict the utility of the stack in an effort to raise revenue through a less restricted "Pro" version. Developers on Snow Leopard are much better off moving to standalone installations of everything MAMP offers. There are many ways to install PHP, MySQL, Apache, and phpMyAdmin - all with a list of pros/cons. Without debating the merits, here's what I did to replace MAMP:

1. Dump your MAMP Mysql databases and save them for import into your standalone MySQL install

mysqldump --all-databases > ~/old-mysql-data.sql

2. Install a more recent copy of MySQL server than the one delivered with Snow Leopard

I already had macports installed, so the choice here was easy. The following command installs the mysql binaries under /opt/local/bin/ port install mysql5 mysql5-server

3. Import your data into your new MySQL database

First, be certain to shutdown all the MAMP servers (MySQL, Apache, etc...) - then start your new standalone MySQL sudo /opt/local/bin/mysqld_safe5 & Finally, run the following: mysql

4. Install phpMyAdmin on the SL delivered Apache installation

Install it fresh, or just copy your MAMP installation to ~/Sites where it will be available under http://localhost/~your-username/

5. Enable PHP5 on the SL delivered Apache installation

Open /etc/apache2/httpd.conf and enable the line: "#LoadModule php5_module libexec/apache2/libphp5.so" by removing the pound. Then in the Mac System Pref -> Sharing, turn on (or if it was already on, turn off/on) Web Sharing. If you need to move any vhost or SSL config directives from MAMP to the SL Apache install, you'll make those changes to files in /etc/apache2/extra/

6. Optional - Configure PHP by creating a php.ini under /etc

I'm content to use the PHP installation already delivered by SL, but there is no default php.ini - simply create one under /etc and it'll be read automatically. You can now remove the MAMP training wheels and proceed developing with full standalone versions of your stack - happy trails.
Posted by Eric Simmerman
 

How to undo a SVN commit from the command line

SVN 1.4 added a feature to support easy rollback of a SVN commit. It's documented in SVN help, but unfortunately SVN help only makes sense if you already understand what it's trying to explain. Here's the easy commit revert command to run against your working copy:

svn merge -c -[REV] [REPO]

Replace the brackets with the offending revision number and your SVN repository respectively. For example, to undo the changes made by revision 42:

svn merge -c -42 http://example.com/svn/trunk .

Posted by Eric Simmerman
 

Import GnuCash data into MoneyDance

GnuCash served me well while I was running Ubuntu as my primary desktop but since moving to a Mac Pro I've been disappointed in the performance and non-native nature of the GnuCash Mac port. I decided to migrate to MoneyDance and was quickly dismayed to discover GnuCash's poor support for standards based exporting. This GnuCash wiki-entry describes a few convoluted approaches to data export but the items it references are hopelessly outdated and generally do not function for the latest stable release - reason enough to ditch GnuCash. MoneyDance hadn't solved the problem on their end either but their wiki does reference a Perl script that converts the deprecated GnuCash Postgre storage format into a MoneyDance XML file. Since I knew that the development release of GnuCash supports a SQLite storage format I decided to see if I could update Sid Reed's aforementioned script for this new SQLite container. I'm no Perl Monger, but I do know regular expressions. My updated script worked well for me and seamlessly converted several years of GnuCash data. Please read the pre-requisites section in the header of this GnuCash to MoneyDance Migration Script before attempting to run it. In addition to the linked zip archive, this script is also available on github. Enjoy!
Posted by Eric Simmerman
 

Customize article row count for Cerberus public knowledgebase community

I've been evaluating the opensource Cerberus Helpdesk as an alternative to the closed source Kayako esupport. I like how Cerberus separates the creation of multiple knowledgebases that can then be published across multiple community portals. Instead of one comprehensive knowledgebase presented to all customers, I can use Cerberus to present product specific knowledgebases. It's a nice concept that should make it much easier for a customer to locate support information and thereby reduce the number of support tickets generated. Customizing the public facing portals for my Cerberus installation was straightforward. The admin console provided a good degree of flexibility, but I wanted a bit more so I manually modified usermeet.core/templates/portal/sc/module/index.tpl in order to insert analytics scripts and some more detailed customization. That was easy, but my next mod proved more difficult. By default, Cerberus displays 10 articles on each page of search results and I wanted to increase that count to 20. Cerberus' architecture actually makes it a bit tricky to determine the control flow used by the community portals but I eventually traced the article retrieval flow to the DAO_KbArticle class in plugins/cerberusweb.kb/api/App.php and changed the default limit on the search method from 10 to 20. The limit is set as a hardcoded constant in the method signature....yuck. After the change, 20 articles were pulled from the database on each request, but there were still only 10 displayed in the portal. It took a lot of searching to find the missing piece and it was yet another hardcoded value in plugins/cerberusweb.kb/api/sc/kb.php where $view->renderLimit was set to 10. Changing this gave me the desired row count on the portal. The Cerberus team has put together a nice product but given that one of its core competitive features is its opensource nature, I'd like to see the codebase refactored to better facilitate this type of customization. Values like these limits could easily be defined in framework.config.php instead of scattering hardcoded settings across multiple files. That said, at least I had to option to manipulate the software - something I can't do with Kayako's offering.
Posted by Eric Simmerman
 

Resolving a "CA key usage check failed: keyCertSign bit is not set" error in Tomcat

After installing a new GoDaddy SSL certificate in Tomcat 5.5.x my web browsers were able to properly negotiate SSL connections, but when back-end code attempted (specifically when CAS attempted to validate a ticket through Cas20ServiceTicketValidator) to connect using SSL the "CA key usage check failed: keyCertSign bit is not set" error was being thrown.

My tomcat server is fronted by Apache2 and Apache handles SSL negotiation. I discovered that I had improperly installed the intermediate certificate for GoDaddy and while modern browsers just ignored the resulting misconfiguration, Java was complaining.

I had set the SSLCertificateChainFile directive to point to the "cert-chain.crt" file. The mistake is understandable given the near identical naming of the directive and the file...but alas that intuitive connection is erroneous. The directive instead needs to point to the gd_intermediate.crt file that GoDaddy also provides. Here's what my correct config looks like on RHEL5:

SSLCertificateChainFile /etc/pki/tls/certs/gd_intermediate.crt
Posted by Eric Simmerman
 

Compiling mod_caucho on RHEL 5.3

There is a known issue with APR that prevents the compilation of mod_caucho on RHEL 5.3 out of the box. Additionally, for some reason my installation of APR uses the name "apr-1-config" instead of "apr-config" so that to compile mod_caucho I had to do the following:

  1. Run configure --with-apxs
  2. Execute 'apr-config --cppflags --cflags'
  3. On my server this resulted in '-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread'
  4. Append the output of the above command to the "CFLAGS" line in config.status
  5. Run make; make install;
FYI, I also had to overwrite the "plugins" variable in the Resin configure script to manually set apache2 because the script was detecting and using apache1
Posted by Eric Simmerman