Friday, March 07, 2008

Path does not start with a "/" character

Problem:
I get this error when using the tiles plugin when building out some tiles:

java.lang.IllegalArgumentException: Path .some.tiles.path does not start with a "/" character

first, lets pretend that the tile in question looks like this:
<definition name=".some.tiles.path" extends=".some.other.tiles.path"> ..some stuff.. </definition>

Solution:
ive noticed that the reason for this error can be one of the following:

1. if you look at the tile that this tile extends, and what that tile extends, until you find the tile that extends nothing, that tile should have a definition like this:
<definition name=".some.base.tile" path="/a/real/path/to/some/jsp/somejsp.jsp"> ..some stuff.. </definition>
the key thing, is that the path of the parent tile starts with a "/" character

2. if #1 is not your problem, then you might have a duplicate definition of the tile name which the error talks about.

3. Another thing that can happen is that your tiles path that you are referencing in struts-config.xml does not exist at all, because maybe you misspelled it, in which case that same error is thrown.

Friday, February 22, 2008

B. Fleischmann - Gain Lyrics

I have looked everywhere for the lyrics of the song "Gain" by B. Fleischmann which is found here on you tube by the way. They dont seem to exist on teh intarwebs.

Anyway, i have transcribed them as best as i can, if anyone thinks i got something wrong, please leave a comment.


B. Fleischmann - Gain Lyrics

lets face another day
lets see another fence
lets have another crash
lets get another chance

where all reason ends, i put my heart
where foresight ends, i want to start
as long as i haven't tried to gain
i will not stop, will not complain

lets give it one more try
don't want to make you cry
how else can we survive
unless we dry our eyes try our lives

where all reason ends, i put my heart
where foresight ends, i want to start
as long as i haven't tried to gain
i will not stop, will not complain

Thursday, February 21, 2008

JSP syntax: empty checks, params, misc

This stuff is so elementary that i am always annoyed to forget it every time i dont use jsp for a few months.

1. Get params from the url request, ie http://dogself.com?param1=test&something=poop
<c:out value="param1 is: ${param.param1} something is:${param.something}"/>

also there is ${params} for getting lists, but i would need to read up on that

2. checking if a request attribute is null or empty:
<c:if test="${param.page != null && not empty param.page}">
<c:import url="${base_html_dir}${param.page}"></c:import>
</c:if>


3. setting variables:
<c:set var="thingToSet" value="${1+ 3}">
this by default has the scope of 'page', also can be 'session' defined by attribute 'scope'

ill add more as i go

Wednesday, February 13, 2008

Document base /path/to/ROOT does not exist or is not a readable directory

I recently installed tomcat 5.5 on my slicehost, and it was somewhat painful, probably because i deviated from the basic setup so much.
Anyway, one last error (in /var/log/tomcat5.5/catalina.out) that i was getting was this:

SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/mk/public_html/ROOT does not exist or is not a readable directory

I was setting up my app context path using CATALINA_HOME/conf/Catalina/localhost/ROOT.xml and so it was strange that tomcat was looking for a directory called ROOT.

Solution:

I was overlooking this warning before the error:
WARNING: A docBase /home/mk/public_html/dogself.com inside the host appBase has been specified, and will be ignored

the problem was that i set my appBase inside of /etc/tomcat5.5/conf/server.xml to be /home/mk/public_html/ and this was a parent directory of app's docBase.

Changing the appBase to /home/mk/public_html/webapps solved this problem.

Wednesday, February 06, 2008

Music for february

this place has lots of rock from back when i used to listen to rock:
http://saintsmythe.illemonati.com/tsx/

Recently i've been interested in a progressive metal band called "Sonata Arctica", this place as a decent selection of them:

http://www.rockandroll-server.com.ar/GOD/mp3/Sonata/


a ton of DnB:
http://www.riotnerd.com/nmp3s/

thats all until i find more betterer stuff

Thursday, January 31, 2008

find duplicate files on your machine

ive had need for this before. A program to find duplicate files on your computer. i have been told by a very reliable source that this is good:

http://www.beautylabs.net/software/dupseek.html

so i am going to write it down so that next time i need this, i will have it

dupes are evil

Thursday, January 24, 2008

Java: reading / writing international characters

It is actually very easy to support international characters in java. The only trick is knowing the charset that the text is encoded in. Most of the time is a safe bet to try UTF-8 if you dont know. If you use Apache's HTTPClient it has methods to get the charset of the stream you are reading from.


Tuesday, January 22, 2008

Music for January

this place has lots of kraftwerk and other interesting stuff:

http://elf.art.pl/

this place has a BUNCH of music, lots of normal music with weird Japanese bands i've never heard of:

http://side7.homeunix.net/s/mp3/

Unix: Compress or delete files older then X days

Problem:
I have some logs in some directories that i need to back up if the file is at least 12 days old, if the file is older then 24 days, i need to delete it

Solution:

to compress:
find <path within you're looking> -xdev -mtime +<number of days> -exec /usr/bin/compress {} \;

to delete:
find <path within you're looking> -xdev -mtime +<number of days> -exec /usr/bin/rm -f {} \;


Note: This was tested on Solaris 8

Examples:

find /usr/local/apache/logs/ -xdev -name "sar.*" -mtime +24 -exec /usr/bin/rm -f {} \;
find /usr/local/apache/logs/ -xdev -name "sar.*" -mtime +12 -exec /usr/bin/compress {} \;

Tuesday, January 15, 2008

Cooking: How to make sushi rice

Making perfect sushi rice is hard, it has to be cooked though, soft and sticky. Ive always had trouble doing it because i would end up burning the rice on the bottom of the pot (i dont have a rice cooker). My rice wouldnt be sticky enough to stick to the seaweed. My friend Sam always emphasized to me how important it was to make the rice "just right" when making sushi.

Enough, babble! i found a blog entry that makes cooking sushi rice easy! it actually came out great the first time i tried the oven method.

http://beyondsalmon.blogspot.com/2006/02/technique-of-week-how-to-make-sushi.html

Thursday, January 03, 2008

how to: use cron

ok, now that i really know how to use the cron i should blog it incase i forget

this assumes you have nothing in your cron / or your crontab is in sync with hostname.cron because you always use this method to modify the crontab.

0. run crontab -l to make sure your crontab is empty, if its not, paste what it has to the bottom of the file you make in step 1

1. make a file called hostname. cron and add this into the top of it for later:
#########################################
# #
# Cron file for [username] #
# #
#########################################
# min hour dom month dow usr cmd
# use '*' as skipped element

2. add your stuff to it, here is a better explanation on what to add:
01 * * * * echo "This command is run at one min past every hour"
17 8 * * * echo "This command is run daily at 8:17 am"
17 20 * * * echo "This command is run daily at 8:17 pm"
00 4 * * 0 echo "This command is run at 4 am every Sunday"
* 4 * * Sun echo "So is this"
42 4 1 * * echo "This command is run 4:42 am every 1st of the month"
01 * 19 07 * echo "This command is run hourly on the 19th of July"

3. save your file.

4. run this:
crontab < hostname.cron

done!

useful info happily stolen from here: http://www.unixgeeks.org/security/newbie/unix/cron-1.html

Wednesday, January 02, 2008

do you like guns, knives or real estate?


I recently made a website using adobe contribute and i need it to start being found on the internets:

http://TheTraditionalHunter.com <- go here if you want to see some 600$ pocket knives, or muzzle loading guns and other neat stuff. I have some high res pictures up that are pretty neat.

http://www.BayStateHomesForSale.com
<- go here if you are planning to buy/sell a house in MA or NH, they have a nice MLS search (thing that lets you look up houses for sale in the area).

Thursday, December 20, 2007

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
qq{$l[$_++%@l]\x0d};select($z,$z,$z,.2*(rand(2)**2))}'


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.

FOR SHUTDOWN:
[WAS_HOME]/profiles/AppSrv01/bin/stopServer.sh App1 -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/stopServer.sh App1.1 -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/stopNode.sh -username [user] -password [pass]
[WAS_HOME]/profiles/Dmgr01/bin/stopManager.sh -username [user] -password [pass]

FOR STARTUP:
[WAS_HOME]/profiles/Dmgr01/bin/startManager.sh -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/startNode.sh -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/startServer.sh App1 -username [user] -password [pass]
[WAS_HOME]/profiles/AppSrv01/bin/startServer.sh 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

Friday, November 30, 2007

IWDatacapture.callServer call fails / caveat

problem:

when i build teamsite DCTs i always find a new and wonderful way to break something.

Today i was building a DCT that used IWDatacapture.callServer to call a cgi script that would get some stuff from the database and then out put it into a hidden frame and do a javascript callback to the parent window.

everything was going well until i made the mistake of making 2 calls to different IWDatacapture.callServer cgi scripts one right after the other. one of them would always fail.

solution:

The problem stems from the fact that CGI scripts that output html make use of a single blank.html file to write out their contents. If you call 2 of them "almost at the same time" one of them will overwrite the other's blank.html file and cause it to fail. The only reasonable solution is to combine both CGIs into one file and let it write to one blank.html file, you can also try to make sure that CGIs dont get called at the same time, but that would be difficult to control.

So it seems that its probably a reasonable requirement to only allow ONE IWDatacapture.callServer call per DCR, otherwise things might break. How sad.