28 November 2007

25 November 2007

A kdb tick/q demo

1) Install q and kdb tick, including k4.lic file

2) In install dir

mkdir data
mkdir logs

create file tick/schema.q containing:
test:([]time:`time$();sym:`symbol$();size:`float$();price:`float$())

3) create a start.sh script for kdb
#!/bin/bash
export QHOME=/usr/local/bin/q
export PATH=$PATH:/usr/local/bin/q

$QHOME/l32/q tick.k schema $QHOME/data -o 0 -p 30000 >> $QHOME/logs/tp.log 2>&1 &
$QHOME/l32/q tick/r.k :30000 -p 30001 >> $QHOME/logs/rtdb.log 2>&1 &
$QHOME/l32/q $QHOME/data/schema -p 30002 >> $QHOME/logs/hdb.txt 2>&1 &

4) run start script

5) In a seperate q session insert some data
h:hopen `:localhost:30000
h ".u.upd[`test](`ibm; 10000.0; 98.0)"

24 November 2007

Subversion auto-props default

Its a shame that subversion's config for auto-props dont have some sensible defaults or allow me to set them on a per repository basis. Here are some that I use in my ${home}/.subversion/config.

[miscellany]
enable-auto-props = yes

[auto-props]
*.q = svn:eol-style=LF;svn:mime-type=text/x-q
*.sh = svn:eol-style=LF;svn:executable=ON;svn:mime-type=text/x-sh
*.java = svn:keywords=Id;svn:mime-type=text/x-java-source
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg

18 November 2007

Maven Help

mvn --help

Lists the profiles which are currently active for the build:
mvn help:active-profiles

Displays the effective POM for the current build, with the active profiles factored in:
help:effective-pom

Prints out the calculated settings for the project, given any profile enhancement and the inheritance of the global settings into the user-level settings:
help:effective-settings

To get help on a plugin:
mvn help:describe -Dplugin=xxx -Dfull
mvn help:describe -DgroupId=xxx -DartifactId=xxx -Dfull=true

Apache Archiva Maven Repository Server

Seems like a pretty decent Maven Repository server. I've set it up to manage my own Maven repositories, including my own "external-public" repository which proxies access to a number of the big external Maven repositories.

Its easy to install and all configuration is done through the web interface. As well as configuring repositories and connect repositories so one can proxy another, it adds user management to secure access via various roles. The docs on the home site aren't great but google and you will find other good config howtos.

For more detail on functionality see http://www.devzuz.org/blogs/oching/2007/11/05/1194233400000.html

Creating a default Maven project

mvn archetype:generate

This will ask multi-choice questions regarding creating a new project/module.

Or you can directly specify all options as:

mvn archetype:create -DgroupId=com.parwy.testproj -DartifactId=testproj -DarchetypeArtifactId=maven-archetype-quickstart

Archetypes include:
maven-archetype-archetype
maven-archetype-bundles
maven-archetype-j2ee-simple
maven-archetype-marmalade-mojo
maven-archetype-mojo
maven-archetype-plugin-site
maven-archetype-plugin
maven-archetype-portlet
maven-archetype-profiles
maven-archetype-quickstart
maven-archetype-simple
maven-archetype-site-simple
maven-archetype-site
maven-archetype-webapp

The default is maven-archetype-quickstart

13 November 2007

Web frameworks

I not had to do any web development for years but thought I'd archive this link away in case I need to look at them again. Hopefully, by the time I ever come across the need to do web development, the tools and frameworks will have evolved much further.

12 November 2007

What belongs on the domain model and what belongs on service classes

This article hit home, I have often tried to balance what belongs on the domain model and what belongs on "even more domain-specific" service classes. Poor old Gavin took some flak though... I totally agree with his follow up to the criticism.

11 November 2007

Bulk search and replace using sed

This little snippet replaces occurrences of oldString with newString in all files named *.txt in the current directory and below, keeping a backup of the original files.

for i in $(find . -name "*.txt"); do sed 's/oldString/newString/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done