Thursday, December 23, 2004

ResultSetMetaData.getTableName(int col)

Just FYI: ResultSetMetaData.getTableName(int col) is NOT implemented in ORACLE or many other JDBC's for that matter. It seems Informix, I think, is the only one who actually implemented this function!!

Why would you need functionality this since you obviously performed the query in the first place so must have know which table(s) you were working with?

One, as in my case, you are writing a DB Admin tool and are dynamically displaying the returned Record Set and need to know which table was accessed to pass that to any other functions that need to alter that same table.

Two, you have performed a JOIN or nested SELECT and would like to know which table a particular item is associated with.

This function was just what I was looking for and would be useful if only it wasn't a tease. Obviously the SUN JDK 1.4.1 people thought it was important to put in the spec and now we just need to get the DB developers to get on the boat.


I recently dealt with this error in some JSP code I was writing and did not see much information out there on a cause and solution so here is what I found out.

I had already tracked the problem down to some code that should have been correct:

<display:column property="<%=rsmd.getColumnName(i)%>" title="<%=rsmd.getColumnName(i)%>&nbsp;&nbsp;&nbsp;&nbsp;"
sortable="true" headerClass="sortable" maxLength="20"

When I remove the after the <%=%>the rsmd.getColumnName(i), it works correctly but when I add any other characters inside of the title value it fails.

The Problem: With the displaytag tablib you can not dynamically create strings from jsp and text inside of a key-value pair. You can place just JSP or just text inside the value but not the combination of both.
The Solution: Create a temporary String variable to hold the value you would like to place in the value pair and then only reference that string.

<% String columnTitle = rsmd.getColumnName(i) + "&nbsp;&nbsp;&nbsp;&nbsp;";%>

<display:column property="<%=rsmd.getColumnName(i)%>" title="<%=columnTitle%>"
sortable="true" headerClass="sortable" maxLength="20"

Hope this helps someone else,


Tuesday, December 21, 2004

CoolWebSearch is Evil!

I spent 4 hours last night trying to remove CoolWebSearch from a friend's roomate's computer and eventually had give up and go home and sleep. This Evil program installs its self by taking advantage of one of the many IE/Windows security flaws.

This PC did not have windows update running so it had all of the exploits available. I first installed the updates, there were 18 of them, and then preceded to try and remove the CoolWebSearch. I tried cwShredder which had worked for me on my Father-In-Law's PC but no luck this time. CoolWebSearch had installed a keylogger and about every kind of porn dialer, favorite, and spyware. After many many many runs of Spybot Search and Destroy and manual attempts I was unable to fully remove all of the many instances of this. It works its evil by making multiple copies of its self to make sure that if you don't get all 20+ copies one of the remaining .exe or .bat files will reinstall. You can tell you have this many ways but in this case the homepage was set to about:blank and every time you browsed with IE it opened up a different pop-up window or search page etc. Also they had a keylogger which was recording their passwords etc. I had them change them right away (but not with that pc of course). Anyways this PC was so infected that the best route will be to wipe the PC and reinstall the OS etc.

Moral of the story: ENABLE AUTOMATIC WINDOWS UPDATE to protect your pc. Spyware is not only annoying but it can ruin your life and credit by transmitting all of your personal information and passwords through a backdoor to anyone who knows where to look. Also to protect yourself even further, throw away IE and Outlook and browse with Firefox and check your mail with Thunderbird.

Good luck out there!

Friday, December 17, 2004

Merry Christmas

Merry Christmas .... I know I am wild to say such a potentially dangerous thing but since I am feeling wild .... Merry Christmas If you are offended by this greating of joy and hope, I am sorry that you don't yet know the joy of CHRIST.

Wednesday, December 15, 2004

How to Disable Qmail Double Bounces

When you receive junk mail to a non-existant address from a spammer who's address is spoofed Qmail tries to send a reply to the spammer stating that Qmail couldn't deliver their message. But, since the address doesn't exist Qmail recieves notification back from the other server saying that address doesn't exist and you, as the postmaster, get a notification from Qmail stating "the bounce bounced".

SOLUTION: Send double-bounces (bounced bounces) to a black hole.
1) In the qmail alias dir (/var/qmail/alias), make a file .qmail-doublebounce and just put a # in it.
2) In the qmail control dir (/var/qmail/control), make a doublebounceto file and put doublebounce in it.
3) Restart Q-Mail (/etc/init.d/qmail restart)

That will relieve you of all the worthless double bounce notifications at the postmaster address.

Tuesday, December 14, 2004 Settings with cPanel Website Hosting

My website is hosted on a server which uses cPanel as its website management tool and has a pretty default file system structure. A few gotchas I found while setting up this blog to work with my cPanel managed remotely hosted site might be helpful to go over.

Publishing Tab:
FTP Path -- Because cPanel's default FTP home location is one directory too high put the value should be public_html/
Blog Filename -- Even though this is not required you better put a filename here if you want your blog to work. Mine is obvious just look at the address bar above.

Archiving Tab:

Archive Path -- Same as FTP path this must have public_html/ If you have placed your archives in a sub folder such as /archive/ then this value would be public_html/archive/
Archive Filename -- prepends the date (adds it to the beginning) of this value so if you don't put anything her you will just get something like 2004_12_02_ as your filename which nicely displays all of the html code when you click on it. So put something like archive.html here and all of your archive pages will work.

Site Feed:

Site Feed Server Path -- Same as both above this must be public_html/
Site Feed Filename -- Just has to be something with an .xml extention so I choose the default atom.xml

That's what I used to get this up and running and things seem to work pretty well. Again, this is my setup and yours will probably be very different depending on your setup but if you find that all your blogs are ending up a directory higher than you thought or if you can't find your blogs when they are published and you find them up one directory from your web root give this a try or put whatever your main html directory is instead of public_html/