Archive for October, 2004

DNScat works!

Sunday, October 31st, 2004

pppd noauth debug nodetach passive 10.0.0.1:10.0.0.2 pty “./DNScatServer -o tadekp.afraid.org -p 50000″

pppd noauth debug nodetach pty “./DNScatClient -o tadekp.afraid.org”

SNV $Id$ Tags

Thursday, October 28th, 2004

I discovered that $Id$ tags won’t work in SVN by default. You need to add the following properties to the file you want the tags to be replaced:

svn propset svn:keywords Id “$file”

I found a nice webpage discussing SVN <-> CVS migration.

Perl injection

Thursday, October 28th, 2004

!/usr/bin/perl -w

use re ‘eval’; #this evil command enables it!

$a = “bla”; $user_input = “(?{print “we’re executing this code ;-)\n”;})”; $a =~ /$user_input/;

!/usr/bin/perl -w

@files=ls $ARGV[0]; print “file list: @files\n”;

Encode URL in perl -one liner

Thursday, October 28th, 2004

perl -e ‘use URI::Escape; while(<>) { chop $_; print(uri_escape($_).”\n”);} ‘

Java 1.5 and String operators

Thursday, October 28th, 2004

Java 1.5 changed the implementation of StringBuffer and introduced a new StringBuilder (actually both inherit from AbstractStringBuilder). It looks + operator can be either compiled to use StringBuffer (slower, but synchronized) or StringBuilder (faster, thread unsafe). (more…)

Java access modifiers

Thursday, October 28th, 2004

Just a reminder:

  • package protected - Scope that indicates that an instance variable is visible to other classes within its same package, or to subclasses of the class containing the instance variable. This scope is the default scope in Java, and is indicated by no scope indicator.
  • private - Scope indicator that hides an instance variable from all other classes, regardless of their package or their class hierarchy relationship to the class containing the variable.
  • protected - Scope indicator that makes an instance variable visible to subclasses that inherit from the class containing the instance variable.
  • public - Scope indicator that makes an instance variable visible to any class, regardless of package or class hierarchy relationship to the class containing the instance variable.

DB2 log analysis

Wednesday, October 27th, 2004

A cool perl one-liners from Diego:

perl -ne ‘$name = $1 if /application name=(.);/; /text=(.(SELECT|INSERT|UPDATE|DELETE).*$)/i && print “$name => $1\n”;’ db2audit.txt | less

perl -ne ‘/text=(.(SELECT|INSERT|UPDATE|DELETE).$)/i && print “$1\n”‘ db2audit.txt

PQA - Query Analyzer for MySQL/PostgreSQL

Wednesday, October 27th, 2004

I found a nice program PQA written in Ruby to show query statistics based on database logs. That sound like almost exactly what I needed, so I tried it on MySQL MT log files and some other data. There were a few bugs that I fixed.

In addition I added a new report printing unique queries and when they occurred. It seems to work fine and with help of awk/make/gnuplot generated a few nice graphs.

AspectJ in ANT

Wednesday, October 27th, 2004

Supposedly works, and there are three ways of doing it. Note that there can be a problem when using it with Javac and source lists:

“Beware of using regular source lists with this; javac may prune unchanged files, which excludes them from the compile process for ajc, which requires that all files affected by any aspects be listed explicitly.”

I haven’t tried it yet, but it looks like a nice thing to know.