Setup 64bit CentOS (PHP5, MySQL, memcached, ketama)

I recently had to set up a few CentOS servers with PHP , MySQL , memcached and ketama, and ended up writing this script to do it. You can grab the whole thing from subversion (you’ll need the php folder as well). ...

June 23, 2008 · 3 min · Dave Perrett

Default Values With Hibernate Annotations

To set the default value of a field with Hibernate, you can use the columnDefinition argument : ...

December 5, 2007 · 1 min · Dave Perrett

MySQL Delete On Joined Tables

If you want to (for example) delete all users with the guest role from your database : DELETE FROM user WHERE EXISTS ( SELECT * FROM role WHERE role.id = user.role_id AND role.name = 'guest' );

December 2, 2007 · 1 min · Dave Perrett

Appfuse "failed to lazily initialize a collection of role"

If you are getting a failed to lazily initialize a collection of role error in AppFuse , you need to un-comment the lazyLoadingFilter filter and associated filter-mapping in src/main/webapp/WEB-INF/web.xml . <filter> <filter-name>lazyLoadingFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>lazyLoadingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

November 27, 2007 · 1 min · Dave Perrett

Hibernate OneToMany Relationships

Here’s an example of a one-to-many relationship using Spring MVC and Hibernate with annotations. The Album class has many Photo s, and each Photo belongs to an Album. ...

November 26, 2007 · 3 min · Dave Perrett

Hibernate 'TYPE=storage_engine is deprecated'

If you are getting errors similar to WARN [main] JDBCExceptionReporter.logWarnings(49) | 'TYPE=storage_engine is deprecated; use ENGINE=storage_engine instead' in hibernate, it probably means you are using MySQL5 but have your application set up for MySQL4. In your applications database settings config file ( pom.xml in my case, otherwise might be in properties.xml or something) change the hibernate.dialect setting from MySQLInnoDBDialect to MySQL5InnoDBDialect : <hibernate.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernate.dialect>

November 21, 2007 · 1 min · Dave Perrett

Multiple DBs in CakePHP

Edit : To avoid confusion, cake has quite a nice mechanism for defining multiple DBs already (the database.php file), and if you only want to define a finite set of DBs, this is not the way to do it. This method is only useful if you want to have multiple DBs with the same structure (a database for each customer, for example). ...

June 4, 2007 · 7 min · Dave Perrett

Installing MySql/PDO for PHP

I was getting something like this trying to run an application built on the Zend Framework : ...

April 2, 2007 · 1 min · Dave Perrett

Installing Trac

Before you do anything, Install Subversion . Install Python : ...

February 19, 2007 · 3 min · Dave Perrett

Svn server w/ Apache

Make sure you have a newish version of libtool $ wget http://ftp.gnu.org/gnu/libtool/libtool-1.5.22.tar.gz $ tar xvzf libtool-1.5.22.tar.gz $ cd libtool-1.5.22 $ ./configure $ make $ make install ...

February 18, 2007 · 3 min · Dave Perrett