Archive for the ‘Code’ Category

Java Mail Problem

October 10th, 2004 Tony 4 comments

I recently upgraded my JDK to v5.0. After upgrading I was receiving the following exception when trying to send email via Java:

Exception in thread “main” java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport at javax.activation.MailcapCommandMap.(

The problem is that the new JDK j2ee.jar has an incorrect version of the class MailcapCommandMap in it.

Solution : Make sure you have the latest version of JAF (activation.jar). This jar has the correct version of MailcapCommandMap. Then delete the entire activation package from your j2ee.jar.

Categories: Code Tags:

using rsync to copy files from one server to another

August 17th, 2004 Tony 3 comments

if you need to move a lot of files such as moving your website to a new server, rsync via ssh is a super simple way to accomplish the task:

(execute on the new server)

rsync -av -e ssh username@oldserverhost:/home/old_home/ /home/new_home/

leave out the v parameter (verbose) if you do not wish to see the progress.

Categories: Code Tags:

browser emulator unnecessary for html browser testing!

July 21st, 2004 Tony 5 comments

today i was searching for a browser emulator that could ease the pain of testing websites for older versions of Internet Explorer. the bottom line is that there is no such thing. however, there is a VERY nice solution that doesn’t require dangerous multiple boot installations on your machine.

it turns out that Microsoft stretched the truth quite a bit when they told the federal courts that IE could not run independent of the Windows operating system. Skyzyx provides a handy list of zip files you may download. download each of the IE versions you desire, and then simply double-click the executable on your hard drive for each version you downloaded. you’ll instantly be surfing the web with old IE browsers all the way down to Internet Explorer 3.0! these files make no changes to your registry and do not impact your up to date version of IE.

note : i could never get IE version 5.01 to work on my XP box. it loaded upon clicking the exe but threw an exception whenever i navigated to any page. also, favorites are pretty much broken in every version this solution.

testing older versions of Netscape has always been quite a bit easier than IE. netscape maintains an archive of old versions of their browser. installation of any of these older netscape versions will not impact your up to date netscape installation.

Categories: Code Tags:

index php

June 18th, 2004 Tony No comments

want to change your index filename for your site but don’t have access to apache httpd.conf?

you can override the default index file by adding the following lines to your .htaccess file:

DirectoryIndex my-php-index.php

Options -Indexes

Categories: Code Tags:

Caching mySql Queries – mySql Cache for a Query

May 27th, 2004 Tony 1 comment

One of my servers is receiving a large number of full text queries so I’ve been thinking of ways to minimize the load. The current CPU load is quite low but for future scalability it makes sense to whip up a caching system. Fortunately I read the mySql manual before inventing my own wheel:

When in use, the query cache stores the text of a SELECT query together with the corresponding result that was sent to the client. If the identical query is received later, the server retrieves the results from the query cache rather than parsing and executing the query again.

C’est facile!

query_cache_size = 1000000

query_cache_type = 1

From: MySQL Query Cache

Categories: Code Tags: