Wednesday, 25 February 2009

Subversion - how to undo a change

Assume that revision 25 contains the changes we are undoing.

In order to undo a commit that has been made to the repository we just tell SVN to apply the reverse of the changeset to our working copy in the current directory.

svn merge --change -25 .

easy.

Friday, 16 January 2009

Log4J properties file

Conversion Patterns

Below are some examples of conversion patterns.

%d [%t] %-5p %c:%L %x - %m%n

date [thread] p? class:line x? - message newline

Similar to the TTCC layout except that the relative time is right padded if less than 6 digits, thread name is right padded if less than 15 characters and truncated if longer and the category name is left padded if shorter than 30 characters and truncated if longer.

and the reference

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=ERROR, CONSOLE

# CONSOLE is set to be a ConsoleAppender.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

# CONSOLE uses PatternLayout.
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c:%L %x - %m%n
#log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c:%L - %m%n


# Print only messages of level WARN or above in the package com.foo.
log4j.logger.com.hibernate=ERROR
log4j.logger.org.apache.commons.httpclient=ERROR
log4j.logger.org.apache.axis=INFO
log4j.logger.com.brock=DEBUG

Two Way SSL in WebLogic

Here is a good article about setting up 2 way SSL in WLS, so I don't forget

Two Way SSL

Here is the JVM system property for outputting network debugging

-Djavax.net.debug=all

How to "ping" an SSL server

openssl s_client -connect www.b2b-onramp2.openreach.co.uk:9443

How to oveerride the keystore
-Djavax.net.ssl.trustStore=c:/tmp/keystore.dat -Djavax.net.ssl.trustStorePassword=store12345

Wednesday, 31 December 2008

BASH arithmetic

How to add using bash

type something as an int
typeset -i VARIABLE

Add something
VAR=$((${VARIABLE} + 1 ))

It is just that easy! Here's the quick reference for more useful bash stuff

And finally a sample script so I never have to write this again

[bm@nerdbox dir]$ cat test.sh
#!/bin/bash

TODAY=$(date +%Y%m%d)

BACKUP_FILE_MASK=/var/app/archive/services/services_${TODAY}
BACKUP_FILE=${BACKUP_FILE_MASK}.tar

typeset -i COUNTER=0

JAVA=/usr/java/jdk1.5.0_12/bin/java
UPDATER_JAR=~/service_updater/service_updater.jar
CONFIG_FILE=~/service_updater/service-updater-config-11_3.xml

[[ -e ${CONFIG_FILE} ]] || die "cannot find config file: ${CONFIG_FILE}"

while true ; do

if [[ -e ${BACKUP_FILE} ]] ; then
COUNTER=$(($COUNTER + 1))
BACKUP_FILE=${BACKUP_FILE_MASK}.${COUNTER}.tar
else
break
fi
done

echo BACKUP_FILE = ${BACKUP_FILE}

Sunday, 7 September 2008

How to customise cool Picasa tools

I have a heap of picasa web albums which I like to have slideshows of on my personal blog, which is very nice, but, I want a bit more functionality from my slideshow applet, so here I go.

What I would like to do is have a small combo box that lists the various albums I have available and the user selects one of them. After that the slideshow kicks off with the selected album and everyone is happy.

Sounds easy enough, right?

Lets see.

Well I finally got around to doing this and here's what I came up with..

The slideshow is a flash swf file that sits in an <embed> tag. The tricky part of it is the feedurl parameter that tells picasa which feed to serve to the slideshow player. In my url it has a id for the album which is the only thing that changes between the albums, like this

host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fbrockwmills
%2Falbumid%2F5228351820043835105%3Fkind%3Dphoto%26alt%3Drss

so I set up a select form with the various album Id's as the values and the name as the selection text, then wrote some javascript to remove the embed element and replace it with a new one, with the new id value from the drop down list.

Easy!

Is it sensible, that's my question.... Also is there a way to access the Picasa data (feed URL, Album names, etc) dynamically instead of hard coding them into the blog widget.