Clean SOAP output with tcpdump

14. desember 2011

I often have to resort to tcpdump to debug the input and output to production services consuming SOAP messages. The problem with tcpdump is that the ASCII output is littered with binary garbage at the start, and this makes it a rather laborious thing to clean up. The following article is a description of some scripts, along with the source code, that cleans up the output. Les resten av dette innlegget »

Counting occurrences of a word matching a regex

14. desember 2011

This is a brief code snippet showing how to use command line tools to count the occurences of words matching a regex. In the following example, I am trying to list all the unique hits on the urls from the apache access log matching «/chart». Les resten av dette innlegget »

Matching Java method signatures with sed

10. november 2011

In the process of removing PMD warnings from our main product at work I was trying to automate some parts of this process by using sed (Stream EDitor), a command line program common on all Unices (such as OS X and Linux). I had already been using a regex in Vim to do remove final modifiers from methods on a file by file basis, but thought it might be quicker to do this using «find» and «sed» in stead. Boy was I wrong 🙂 But mainly just because of the different regex dialect of sed that took me a long time to figure out.

The problem was mainly due to trying to match square brackets, such as in «final public int[] myMethod(int[] args)». Les resten av dette innlegget »