Tim McMurry

Greenhorn
+ Follow
since Oct 31, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim McMurry

Wanting to run a single method in a test class TestMyClass is propably sign of poor design of the tests, but can it be done from the commandline without using Ant ?
Normally when I run JUnit tests explicitly, I do:

I would like to only run a single specific @Test annotated method from TestMyClass.
10 years ago
Hi,

I am working on understanding how the trio : web server app - Container app - servlet, functions. For this I am reading a nearly worn-out copy of "Head First Servlets and JSP" from my local library.
In chapter 2 there is an exercise where one has to determine wether server, container or servlet is primarily responsible for a certain task. In the solutions the task "Converts a response object to an HTTP response" has been put in the server-column. Is this a typo or dos eg. Tomcat actually know how to do this? I put it in the container column.
10 years ago

Tim Holloway wrote:
Some days I can.t type at all!



I was a little surprised for some split-seconds that the United Nations shipped a version of the JDK

But very good to know this. Thanks.
A thread on the openjdk mailing list on this issue:

http://mail.openjdk.java.net/pipermail/jdk6-dev/2009-May/000505.html
10 years ago
Thank you mr. Holloway,
I was unaware of the problems with Open JDK. Seems like I will have to use a JDK different from the default one in my linux distro
10 years ago
Sorry I should have written that I changed $JAVA_HOME to /usr.
10 years ago
Hi,

also the book by Forman & Forman "Java Reflection in Action" from Manning is very good and describes situations where a Java programmer
could obtain elegant solutions to problems that might be hard to solve without reflection.
10 years ago
Hi all,

thank you for the different detailed suggestions. I changed my $JAVA_HOME to /bin and things work. This is not a nice solution I guess, so I will use your replies to try get things done properly when I have finished my coding assignments for Monday where I need the comcat running
It seems that tomcat adds a /bin/java I didnt except or perhaps I just misunderstand what $JAVA_HOME ought to point to.
10 years ago
I could try to create a symlink, but that looks like an ugly hack.
10 years ago
Hi,

wasnt sure wehter I should post this here or in the tomcat section, but ended up here since it looks like
I am missing something elementary.

I have installed tomcat 5.5 on a linux machine following the standard install instructions.
After having started tomcat using $CATALINA_HOME/bin/startup.sh I get:

Using CATALINA_BASE: /home/mcmurry/tomcat
Using CATALINA_HOME: /home/mcmurry/tomcat
Using CATALINA_TMPDIR: /home/mcmurry/tomcat/temp
Using JRE_HOME: /usr/bin/java
Using CLASSPATH: /home/imcmurry/tomcat/bin/bootstrap.jar

However when I open a browser and point it to http://localhost:8080 I receive the "Could not connect to remote server" message.

Checking catalina.out in the logs folder shows a possible reason: " /usr/bin/java/bin/java: not found"

I have set my $JAVA_HOME to /usr/bin/java and cannot work out why tomcat adds /bin/java to the folder it looks for.
10 years ago
I like this suggestion.
Thanks.

Adding more functionality to the Downloader it seems that everything would be more elegant using URLRequest. Strange requirement in the exercise to disallow this, basically you have to design a class thats already existing and in better design then one could do for now !
10 years ago
Hi,

I have completed an exercise where one had to construct a simple class wich given a hostname, a portnumber and a filename would
download the file. This was to be done using only Sockets, so no use of eg. URLConnection.

I often get beat for putting too much in a single class, so now afterwards I am redoing the exercise trying to create some class-overload in a sensible way.

I have made a class HTTPRequest which wich holds info about the target to download: Hostname and path to target. The only
non-trivial method in this class is a method that writes an HTTP header to a given BufferedWriter returning the BufferedWriter after having written the 2 first
standard HTTP header request lines to it.

Now I cant really decide wether the Socket used should go inside the HTTPRequest class. My first thought was that it would make sense to have a Downloader class
which created the socket from a user-given hostname and port (which defaults to 80) which also created the appropriate HTTPRequest which would then write
the request to the OutputStream gotten from the Socket. But this looks a bit strange "conceptually" since now the hostname "sits" in two places, the HTTPRequest and in the Downloader. So where do I go wrong with my "modelling" ?
10 years ago
Ok,

then I get it, I assumed the claim about Unicode meant that the compiler itself would figure things out.

Thanks for the reply

10 years ago
Hi,

I have a source file from a repository that causes a warning when I compile on my local machine:

"Unmappable character for encoding UTF8"

I have googled and found a "fix", which is to specify an encoding as an optional parameter when invoking the compiler.

However, I have always heard that Java sources could use Unicode, so whats up ?
10 years ago
Hi,

thanks for the inputs. I get new homework by asking a question, when is it due ?!
I am reading up on the exception-handling mechanism to come up with qualified arguments against. To my beginner-eyes
it seems at first that it would be hard writing the code so compactly without using try-catch.
It might be time for learning to use a profilimg tool to compare the time usage for the method using try-catch with a rewritten version of it.
Only problem is, I love the commandline and think IDE's are for when you have learned enough to be able to do by hand everything your IDE can.
But there doesnt seem to be many options for commandline profiling
10 years ago
Hi,

I am reading about reflection at the moment. In the book the following example is given. It shows a method which tries to locate
a method defined by its name and type of its arguments for a specified class. It first looks to see if the method is a declared method in the class
and otherwise traveses the inheritance-tree above it, to see if it has inherited the method:


Is it generally ok coding to use try-catch for the purpose of handling program "flow" ?
10 years ago