Notes on Java, Solaris, PHP, LDAP…

May 13, 2008

Filtering via Perl on commandline to extract values

Filed under: Java — negev @ 3:16 pm
Tags: , , ,

My superb admin showed me two tricks. He invokes perl and passes it the regular expression from the shell. Perl processes standard input and writes to standard output.

The first one collects all user emails and then it gets their unique email domains. The second one collects values of LDAP attribute companyDomains and again gets their unique values.

mysql -h mysql-server -u user -ppassword db-name -e ‘SELECT email FROM users’ | perl -nle ‘/.*@(.*)/;print $1;’ | sort -u | wc

ldapsearch -x -h ldap-server -D “cn=readonly,o=services” -w password -b o= users “(objectClass=organizationalUnit)” companyDomains | grep -P ^companyDomains: | perl -ple ‘s/^companyDomains: //;’ | grep -Pv ‘^\d’ | sort -u



Filed under: Java — negev @ 3:00 pm

What a wonderful tool: SmartSVN. Its diff view is phantastic. It shows which lines got modified, nicely connects the pristine and working listing. It highlights the *parts of the lines* which were changed – that is really sweet.

How ScriptAlias confused me

Filed under: Java — negev @ 2:56 pm

As I don’t use CGI often, I have to read confusing Apache documentation and google everytime I configure them. Somehow it looked as a good idea to add ScriptAlias statement to my Apache2 vhost config. However, it didn’t help at all and it broke it down. So now I know: I don’t want to use it normally.

# Following line is BAD BAD, it makes CGI not work!
#ScriptAlias /cgi-bin/ “/Users/peterk/”

# Following works nicely
<Directory “/srv/www/vhosts/”>
Options FollowSymLinks ExecCGI
AddHandler cgi-script .cgi
AllowOverride All
Order allow,deny
Allow from all

Blog at