Wednesday, September 9, 2009

jboss - binding to all registered network cards

The JBoss Application server binds only to the local interface '127.0.0.1' since the version 4.0

Since this is not desired in a production system you can override this feature with the '-b' command.

An example to start jboss in the all configuration and bound to all registered interfaces would be


sh run.sh -b 0.0.0.0 -c all

Thursday, September 3, 2009

creating a project with maven2

it is kinda pathetic I'm using maven since several years now and just can't remember this one command.


mvn archetype:create -DgroupId=myGroup -DartifactId=myArtifact


so I write it down here to make it easier for me to lookup.

Wednesday, September 2, 2009

osx - set disk as startup disk via terminal

to set a disk as startup disk is quite simple just execute:


sudo bless -mount /Volumes/"name of your startup disk" -setBoot

Tuesday, September 1, 2009

run-app vs run-war

the main differences between these two commands is that:

run-app runs a grails applications and allows the reloading from resources
run-war generates a war file and runs the war file, so no reloading of resources.

Short during development you want to use run-app.

Monday, August 31, 2009

maven2 - define the context root of an webapp

Basically I have an application (ear) based on several jars and a war which I want to easily access with a context root of my choice.

Solution:


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<jboss>
<version>4</version>
</jboss>
<bundleFileName>
binbase-quality-control.ear
</bundleFileName>

<modules>
<webModule>
<groupId>edu.ucdavis.genomics.metabolomics.binbase.quality
</groupId>
<artifactId>quality-war</artifactId>
<contextRoot>/quality-war</contextRoot>
</webModule>
</modules>

</configuration>
</plugin>

Sunday, August 9, 2009

Method "ApplyConfiguration" with signature "" on interface "org.gnome.SettingsDaemon.XRANDR" doesn't exist

today I wanted todo nothing else than the change the primaery output of my laptop to the 40" display attached over DVI to watch movies on it.

Sadly since ubuntu 8.something I kept getting the following error message


Method "ApplyConfiguration" with signature "" on interface "org.gnome.SettingsDaemon.XRANDR" doesn't exist


So I upgraded to the newest ubuntu version. Didn't make it much better. So I could had given up here and start shouting all kinds off stuff about linux or trying to make it work.

So here is the solution:

the gui is basically broken and you need to execute the commands to adjust everything your self. Using 'xandr'

for example to turn off a monitor:


xandr --output LVDS --off


or to change the resolution


xandr --output DVI-0 --mode 1360x768 --pos 0x0


2 minutes later I had my configuration up and running.

Tuesday, August 4, 2009

synchornized groovy

Today I discovered the question:

I want to have a websites which fires calculations to a database server, but the controller should only execute one calculation at a time

how do you do this?

The first approach was to try to queue the ajax calls, which obviously won't work if two people run calculations at the same time.

So plan b was to use synchronized groovy code.



/**
* does the actual calculation
*/
def calculate_ajax = {

assert params.database != null, "you need to provide 'database' in the params object"
assert params.date != null, "you need to provide 'date' in the params object"
assert params.machine != null, "you need to provide 'machine' in the params object"
assert params.pattern != null, "you need to provide 'pattern' in the params object"
assert params.position != null, "you need to provide 'position' in the params object"

//needs to be synchronized so we don't kill the database server with this task
synchronized (LOCK) {
println new Date()
BinBaseQualityConnector.getQualityService().calculateSingleStandard(params.pattern, params.database, new Date(Long.parseLong(params.date)), params.machine, BinBaseQualityConnector.getKey())
render("<div class=\"after_complete\" style=\"width:${100 / BinBaseQualityConnector.getPattern(params).size()}%\"></div>")

}
}

static final def LOCK = "lock"


and a possible ajax call for this looks like this


<script type="text/javascript">
YAHOO.util.Event.onDOMReady(
function() {
new Ajax.Updater('${i}_${y}_${z}', '/quality-war/processing/calculate_ajax', {
method: 'get', frequency: 3,parameters:'date=${date.getTime()}&database=${database}&machine=${machine}&pattern=${pattern}&position=${z}'
});
});
</script>