Saturday, December 17, 2011

Start|Stop PostgresSQL Service on Mac

The idea comes from this post: PostgreSQL startup items for MacOS X

With a little refinement, I have a new script for those who install PostgresSQL from a dmg package as me. This is my pgsql_svr.sh

#!/bin/sh                                                                                                   

start(){
    echo "Starting PostgreSQL"
    sudo -u postgres /Library/PostgreSQL/9.1/bin/postmaster -i -D /Library/PostgreSQL/9.1/data &
}

stop(){
    echo "Stopping PostgreSQL"
    sudo -u postgres /Library/PostgreSQL/9.1/bin/pg_ctl -D /Library/PostgreSQL/9.1/data stop
}

restart(){
    echo "Restarting PostgreSQL"
    stop
    start
}

usage(){
    NAME=`basename $0`
    echo "Uasage: "
    echo "$NAME start|stop|restart"
}

if [ "$1" = "start" ] || [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
    $1
else
    usage
fi


NOTE: You need sudo to run this shell script.

Wednesday, November 2, 2011

Java: Unable to install breakpoint due to missing line numbers

If you try to debug in Java and get this error, like in Eclipse, it most likely that you build the class with some other tools, like Ant, other than eclipse. So the .class files generated by these kind of tool do not include debug information. The debugger will complain missing attributes.

To solve this, simply delete those .class files and rebuild with eclipse by:
Project -> Clean, or use command: ant clean
Project -> Build

After that, you should able to toggle breakpoint and start the debugger without error:)

Wednesday, October 5, 2011

java.lang.NoClassDefFoundError: org/apache/tomcat/util/buf/B2CConverter in Tomcat Deployment

If you have the same problem in deploying your webapp with ant, in Tomcat 7. Then copy the following jars to your lib directory of ant:

catalina-ant.jar
tomcat-coyote.jar
tomcat-util.jar
tomcat-juli.jar

Friday, July 1, 2011

PIL Installation Error: Bad value Of libz, Recompile With "-fPIC"

Solution:
Recompile zlib with "-fPIC" option after configure. Modify as following:
CC=gcc
to
CC=gcc -fPIC

Then make install.

Thursday, June 30, 2011

Solution to mod_python 3.3.1 With Segmentation fault (11)

This is actually a bug in mod_python 3.3.1. What happens is that when some deprecated functions are invoked, it tries to throw out a deprecated warning. However, unfortunately, mod_python will crash at this right time.

The solution is simple, just use this patch:
Attachment