Thursday, December 20, 2007

Music for December

EBM, industrial, and some other random stuff:

some trance and EBM:

mostly rock and pop, but there is a motherload here, possibly 40-50 gb:

Friday, December 14, 2007

Unix: find largest files / folder to free up space

Unix boxes like to fill up with log files, and when they get really full, stuff starts to break. These commands will tell you where the big log files sit so you can delete them or gzip them.

first, in root run
df -k
/dev/md/dsk/d3 4129290 4020939 67059 99% /var

then go to /var and find what it taking up all the space:
du -sk * | sort -m | head
2855134 mail
193102 tmp

so mail is taking up space, now lets look for files bigger then 100MB:
find . -size +100000000c -ls
22615 483984 -rw-r--r-- 1 root other 495339455 Dec 14 15:09 ./mail/access_log
113593 209784 -rw-r--r-- 1 root other 214696853 Dec 14 15:08 ./mail/servletd.log
208492 354768 -rw-rw-rw- 1 admin mail 363091751 Dec 14 14:29 ./mail/admin

now you can see what is steal your megabytes.

Thursday, December 13, 2007

the most useful program in the world

clear&&perl -e'$|=1;@l=qw{| / - \\};while(){print

i can think of like 9 uses for this already!

Websphere: starting up and shutting down

I have a websphere 6 clustered enviornment that i sometimes need to start up and shut down without using the web console.

there are 2 boxes in the cluster, one of them has the deployment manager on it.

each box runs 2 JVMs, which are called are called App1 and App1.1

The box that has the deployment manager needs to start/stop that, while the other does not.

[WAS_HOME]/profiles/AppSrv01/bin/ App1 -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/ App1.1 -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/ -username [user] -password [pass]
[WAS_HOME]/profiles/Dmgr01/bin/ -username [user] -password [pass]

[WAS_HOME]/profiles/Dmgr01/bin/ -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/ -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/ App1 -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/ App1.1 -username [user] -password [pass]

Wednesday, December 05, 2007

regex to split a document into words

Say you wanted to split a document into words, but works like are'nt shouldnt be split on the ' and numbers like 10,004,333 should remain intact, but other punctuation should be removed from the resulting word array.

A good way to do this is using Scanner's findWithinHorizon and a regular expression. This way you dont need to read the entire document into memory before processing it.

Teamsite DCT design considerations

I dont claim to be an expert on Teamsite, but i have put much blood sweat and tears into it. The following is my understanding of how teamsite tracks database changes, and what that means for anyone who designs datacapture templates and uses OpenDeploy.

The IWDELTRACKER tables uses the following info to track records: path of the xml, all its primary keys as defined in the dd files, and all its foreign keys. This works really well if you have 1 primary key, which is paired up with many foreign keys, but not so well if you have many primary keys, which are paired up with many(or one) foreign keys. This is the reason why one of my DCTs is flawed. In this DCT you make a resource, and assign it to many areas, so the primary key in that DCT comes from a replicant, and the foreign key comes from the main body. The problem we are facing with resource DCT right now is that if the user maps a resource to many areas, and then they delete some areas from the DCT, the changes are not deployed to the database.

Rules of thumb are:
  1. Only create top-down relationships
  2. NEVER use a replicant for a UID
  3. Always test for relationship deletions.

Tuesday, December 04, 2007

Oracle: convert nclob to nvarchar2 (part 2)

I needed to convert a column in a database from NCLOB to NVARCHAR2(2000) which is the max you can store in NVARCHAR2. The problem was that some columns in the table where larger then 2000 chars. To solve this i needed to use the oracle length function to select only rows who's lenth was less then 2000. In this example sql, the table that has the NCLOB is called THETABLE, and the column that needs to become NVARCHAR2 is called THECOLUMN.

dbms_lob.getlength(column) is the key to success here