Monday, October 26, 2009

Configuring resin for remote debugging

I am using resin application server in my development environment. At times I need to debug my applications using resin container. I did some search and found a way to integrate resin to my IDE as follows.

For Resin-3.1.8.
I added few lines to my resin.conf file as follows
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-Xnoagent</jvm-arg>
<jvm-arg>-Djava.compiler=NONE</jvm-arg>
<jvm-arg>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</jvm-arg>


For versions prior to Resin-3.1.8.
I added few lines to my resin startup script as follows
httpd.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xnoagent -Djava.compiler=NONE -conf D:\resin\conf\resin.conf

Sphere: Related Content

Tuesday, October 6, 2009

Using sed to search and replace a token without opening a file

#!/bin/bash

i=0; while [ $i -le 47 ]

do

echo " Creating temp file for slice : $i"

sed s/slicenum/$i/g adspace_buy.ctl > adspace_buy.ctl.tmp

echo " Loading Started ..."

sqlldr userid=tfr_rep/welcome@datagen1-aswain:1521/tfrdb control=adspace_buy.ctl.tmp data=adspace_buy_data.$i.csv log=logssqlldr_log_adspaceBuy.log bad=logssqlldr_bad_adspaceBuy.log direct = true

echo "Loading Done for slice : $i"

i=`expr $i + 1`

done

echo "Script completed"

This script will search for a token slicenum in
adspace_buy.ctl file and replace it with $i value of the loop counter. Also it redirects the output to a new file adspace_buy.ctl.tmp.
After that this script uses sql loader utility to load the data to oracle database using this newly generated file. This whole process continues for 48 times.

Sphere: Related Content

To get the top 1000 lines of all the files in a folder in another folder keeping the original file name same

To copy files stripped from one folder to another
cd dir;
for file in *
do
head -1000 $file > ../dir_temp/$file
done

Sphere: Related Content