Thursday, November 25, 2010

Creating a SVN Repository

Create the repository

> svnadmin create svnrepo

> gedit svnrepo/conf/svnserve.conf

Enable the following lines:

anon-access = none
auth-access = write
password-db = passwd

> gedit svnrepo/conf/passwd

Edit/add user

Create project directory:

> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project
> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project/trunk
> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project/branches
> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project/tags

Import the project:

> svn -m "Your comment" import /path-to-source/sample-project file:///path-to-svnrepo/svnrepo/sample-project/trunk

Prepare work location:

> mkdir sampleProject
> cd sampleProject

Local check out trunk of project (without the folder itself):

> svn co file:///data/svnrepo/sample-project/trunk/ .

Remote check out (using SVN + SSH protocols):

> svn co svn+ssh://user@host/path-to-svnrepo/svnrepo/sample-project/trunk/ .

Create user and group svn:

> useradd svn

Add group svn to your groups.

Change ownership of all files in svnrepo/db to svn:

> chown -r svn:svn *

Add write permissions to all files in svnrepo/db.

Monday, November 22, 2010

Microphone Not Working in Fedora 14

If your microphone is not working on your new installation, just try this. It worked for me:
  1. Go to System --> Preferences --> Sound
  2. Select the input tab
  3. Switch from the existing configured microphone (probably microphone 1) to another one (microphone 2)
  4. Close the application and everything should work ;-)
It looks like this issue has been going on and off since Fedora 10...

Friday, November 19, 2010

Spring Property Editor for an Enumeration with Localized Names

Problem statement:
  • You use a property editor when you bind a nested Enumeration field of a form backing object.
  • You have localized names for the values.
When you write your PropertyEditor you should remember that the getAsText() method needs to take care of the translation:

@Override
public String getAsText() {

if(getValue() == null) {
return null;
}

SurveyStatus status = (SurveyStatus)getValue();
return status.getTranslatedName();
}

while the setAsText() method does not:

@Override
public void setAsText(String surveyStatusStr) {

if (logger.isDebugEnabled()) {
logger.debug("Read string [" + surveyStatusStr + "] for the survey status field");
}

SurveyStatus status = null;

if (surveyStatusStr.compareTo(SurveyStatus.ACTIVE.toString()) == 0) {
status = SurveyStatus.ACTIVE;
}
else if (surveyStatusStr.compareTo(SurveyStatus.INACTIVE.toString()) == 0) {
status = SurveyStatus.INACTIVE;
}

setValue(status);
}

This is because Spring implicitly uses the enumeration name for the value of your tag, not the translated name.
E.g. If you have a select tag, this is what Spring does for you:

<option value="ACTIVE" ... >

It makes sense, of course...