Install ack on mac osx

mkdir ack
cd ack
wget http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/ack-1.86.tar.gz
tar xzvf ack-1.86.tar.gz
wget http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/File-Next-1.02.tar.gz
tar zxvf File-Next-1.02.tar.gz
cd File-Next-1.02
perl Makefile.PL
make
make test
sudo make install
cd ../ack-1.86/
perl Makefile.PL
make
make test
sudo make install

Change mysql root password

After mysql is installed, run the following command:


mysqladmin -u root -p password YOUR_NEW_ROOT_PASSWORD

Back to blog

No blog for a long time...I will be back.

Google Code Password

Google code provides a great integrated experience with Subversion repository. You can login into Google code with your GMail username. But be careful, you should use "GoogleCode.com Password" instead of the GMail password. Or you won't be able to authenticate and will get the following error:


svn: PROPFIND request failed on '/svn'
svn: PROPFIND of '/svn': authorization failed (https://projectname.googlecode.com)

Intellij Ruby Plugin Setup

I tried to install Intellij Ruby Plugin on Mac OS X Leopard. Following the instruction, the installation was fairly straight forward. Then I tried to add Ruby SDK into the plugin. I started with /usr/lib/ruby, /usr/bin/ruby, /usr/bin as home directory, and got "The directory selected is not a valid home for Ruby SDK". What?...My ruby installation does exist in this directory. Actually, Ruby SDK home path has to be /usr

Hope this will save you some time...

BTW: Intellij collapsed twice after I set up the ruby plugin. Not sure what's going on there.

SVNLabelIncrementer in CruiseControl

SVNLabelIncrementer in CruiseControl is supposed to get the latest revision number for the project, and use this revision number as part of the cruisecontrol build number.

Unfortunately, we always got the revision number from the last successful build as the new label. For example, if the local working copy has revision-10 before CruiseControl build, and the current SVN repository revision is 12. We will get 10 as the revision number even if we get revision 12 code in the build. It's kind of annoying, isn't it?

After some investigation, we found that the SVNLabelIncrementer class was using "svnversion" command to get the revision number. Let's look at the definition of "svnversion":

svnversion — Summarize the local revision(s) of a working copy.

Apparently, that's not what we want. We want the revision number of the remote repository.

In the end, we modified the code to use "svn info" to get the remote svn repository revision. I have attached the code here, hope this helps other folks.


package net.sourceforge.cruisecontrol.labelincrementers;

import org.jdom.Element;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*
To properly set this up put the following in your cruise config.xml




*/

public class SVNLabelIncrementer extends DefaultLabelIncrementer {

private String targetURL;

private String username="";

private String password="";



public String incrementLabel(String oldLabel, Element buildLog) {

String SVNRev = "";

try {
SVNRev = getSvnRevision();
} catch (IOException e) {
e.printStackTrace();
}

String label = getNonSubversionPartOfLabel(oldLabel);
if (SVNRev == null || SVNRev.equals(""))
return oldLabel;

return label + "." + SVNRev;
}

protected String getSvnRevision() throws IOException {
Process p = null;
try {
String[] commands = new String[]{"svn", "info", targetURL, "--username", username, "--password", password};
p = Runtime.getRuntime().exec(commands);

BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String thisLine = stdInput.readLine();
while (thisLine != null) {
if (thisLine.startsWith("Revision:")) {
return thisLine.split(":")[1].trim();
}
thisLine = stdInput.readLine();
}
} finally {
if (p != null)
p.destroy();
}
return "";
}

public boolean isValidLabel(String label) {
return super.isValidLabel(getNonSubversionPartOfLabel(label));
}

private String getNonSubversionPartOfLabel(String label) {
int index = label.lastIndexOf(".");
if (index == -1)
index = label.length();
return label.substring(0, index);
}

public String getTargetURL() {
return targetURL;
}

public void setTargetURL(String targetURL) {
this.targetURL = targetURL;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}



Install and Config MPlayer on Ubuntu

I tried to install realplayer on Ubuntu 7.0.4, no luck, even if I fixed the RealPlayer and SCIM conflict. Suggested by Yi, I decided to install MPlayer.

Follow the instruction on: http://ubuntuguide.org/wiki/Ubuntu:Feisty#How_to_install_MPlayer_Multimedia_Player, to install MPlayer.

There was some extra steps to get MPlayer to play a rmvb file on my Vostro 200 box with Intel GMA 3100(G33) graphics card and DELL E207WFP wide screen LCD.

Error code: error opening/initializing the selected video_out (-vo)device
Solution: Open a mplayer, select configure (right click mouse --> Preferences) select Video section and after select xv or x11

Error code: cannot find the codec matching -vo and video format 0x30345652
Solution: install codec available in aptitude using the command:

sudo aptitude install gstreamer0.10-pitfdll gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs w32codecs

Error: The video does not zoom correctly
Solution: sudo gedit /etc/mplayer/mpalyer.conf
and uncomment the following setup:
monitoraspect=16:9
zoom=true

Now I could play the rmvb video files without any problems. Next time, I'll get audio fine tuned.