Tuesday, June 10, 2008

XSLT transformation for removing a single element/node

For some reason this took me a while to figure out. If you define an empty "template", the processing will be skipped.

<xsl:stylesheet version='1.0'

xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match='ElementToSkip'/>

<xsl:template match='*'>

<xsl:copy>

<xsl:apply-templates select='@*|node()'/>

</xsl:copy>

</xsl:template>

</xsl:stylesheet>

Thursday, May 15, 2008

Tunnel mysql through ssh

If you are looking to tunnel mysql through an ssh connection, use the following command on your desktop/client machine:

ssh -L 3307:localhost:3306 user@some.host.blah


Once established, you can connect to the remote mysql instance by connecting locally to port 3307.

This is useful when using a GUI application on a remote server where the MySQL port is closed off by firewall rules.

--Noel

Tuesday, April 29, 2008

Calculate the total of lines within all files

Ignoring the SVN directories, calculate the total of lines within all files.

find . -type f -exec wc -l '{}' \; | grep -v '\.svn' | awk 'BEGIN { c = 0 } { c = c + $1 } END { print "Total number of lines: "c }'

--Noel