Monday, February 26, 2007

log4j and Websphere Portal

After 3 weeks of my programs not working I was pointed in the right direction by a co-worker. it turns out that for log4j to work properly on my local server, I needed to have the class loader set to PARENT_LAST. I had seen something about this online once, but didn't know what it was talking about.

In my server settings there is a place that adentifies the class loaders for the EAR and WAR files that are in it. These need to be set to PARENT_LAST in order for log4j to work properly.

If using a websphere application (non-portal), this configuration is in the web.xml file. Still everything has to be set to PARENT_LAST in order for it to work.

Apparently having it set to PARENT_FIRST is useful in a live environment because the admin can change the logging setting without redeploying and get additional information from the application, it goes to some general log and not the log that log4j specifies in the properties file, but it's still useful to be able to make that change without redeploying.

Redeploying web apps in order to change a configuration is another annoyance of Java I have learned about. Since an exe is not deployed, but instead a war file (a zip file by another name). I figured we could just modify the contents. But a web server loads the war file into memory one time, and it stays there until the server restarts or that component is shut down or redeployed. In order to make a change the application needs to be redeployed basically. Thus any changes to the WAR file would be useless. I am a bit confused as to the benefit of having so many properties files and xml files on something that cannot be easily changed at runtime however, when the end result is the same as having all of the values hard coded.

Thursday, February 15, 2007

C# internal Setter

I just read a great blog about having different access modifiers for the get and set methods of a variable.

In order to have different levels you just add the access modifier to the set method.

public string Description {
get { return description; }
internal set { description = value; }
}


This is awesome. I've had many times when I wanted to restrict the setter to my local class, so there is a controlled validation before setting, but not allow any external class to set the value directly.

Tuesday, February 13, 2007

Finally new posts coming

I've been swamped with learning new things lately, I still don't know them, but I'm going to probably have some growing pains posts coming about the things I'm going through. ANT scripts were a killer for me this past week, I'm trying to learn more about them and post soon.

Thursday, February 01, 2007

Disk Defrag Pains

I was trying to install a Websphere a while ago, and after it failed 3 times another developer told me to defrag my hard drive before trying again because it would help. I didn't think it would, but he has run the install several times, and mine had failed so I took a chance.

I have 2 GB of RAM installed and had to defrag my 50 GB hard drive. It took several hours, and was painful, because the process never used more than 32 MB of RAM. What's the purpose of not taking advantage of the memory space available? It is frustrating that the built-in defragger practically froze my computer while only showing a 5% CPU usage and 32 MB of RAM.

Please take advantage of the resources that are provided with bigger and faster hard drives. I thought that maybe there would be some good tools on the web for doing this faster, but after researching I really haven't found anything that claims to be any better than the built-in tool.

If anyone knows of a better way to defrag than the built-in Windows tool, please let me know.