Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Chris Stehno

Ranch Hand
+ Follow
since Feb 26, 2001
Plano, TX
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 Chris Stehno

In Java 5 and 6 there is something that might be just what you are looking for in the java.lang.management package, called GarbageCollectorMXBean (the getCollectionTime()) method.
These beans have a small learning curve if you have never used MX beans before but they can come in pretty handy.

Hope this helps.
9 years ago
I agree with what Jeanne said, but as far as additional learning areas... the big ones I would focus on or at least familiarize yourself with are the XML apis, the collections apis, and Swing.
I would also highly recommend browsing through the JavaDocs in detail... it may sound like reading a dictionary, but you can often find things you never knew existed... and also you will have a better understanding of what the Java library provides by default.

Hope this helps.
9 years ago
If I am understanding you correctly, yes, you are having an issue with rendering it that way... if you look at the rendered html you will probably see a comma separated string or something similar.

What you need to do is use JSP tags (or scriptlets if you have to) to loop through the values in the array when you generate the options so that the selected values are selected in the html

Something like:


That is somewhat psuedo code since I am not really clear on the details of what you are doing. The "c" tags are Core JSTL tags that should be available on any current version JSP server or you can install them yourself from the Apache Taglibs (http://jakarta.apache.org/taglibs) project.

What you will end up with is that the "selected" items will show up preselected in the html.

Hope this helps.
9 years ago
JSP
There are unit tests and then there are integration tests. Unit tests are isolated test of just the specific class (or limited set of classes) that you are working on, just a DAO class or just a service class, etc. Integration testing is when you put the classes in a more real-world test harness like cactus and other in-container testing.

For mocking in unit tests I use JMock (http://jmock.org) which makes the creation of mock objects (with assertions and constraints ) trivial and you dont have to create a lot of extra mock object classes.

DAOs can often be an edge case that are difficult to unit test in a really meaningful manner, but you can still make sure that all the external pieces used are routing things properly.

Good luck and I hope this helps at least a little.
10 years ago
You might want to look into something like IKVM - http://www.ikvm.net/ which allows you to use Java libraries in your .NET applications or develop .NET applications in Java.

Hope this helps.
10 years ago
It's not ideal but you might try decompiling the vendors code and checking out what they are actually doing under the covers (using Jad - http://www.kpdus.com/jad.html or something similar). Sometimes this can reveal the real bug and at least maybe you can find a better work-around (or push on the vendor a bit harder).

It seems odd that such a core java method would fail like that... you might also search Sun's bug database to see if there are any bug tickets reported on this (unless it is truly the vendors issue).

Good luck.

Chris (nice name by the way)
10 years ago
You should look into the Apache POI project: http://poi.apache.org, specifically the section for their Java Word document format implementation: http://poi.apache.org/hwpf/index.html

Hope this helps.
10 years ago
Ten years ago when Java was "the new kid in town" there was a lot of talk about it and a lot of controversy. The old-school C/C++ programmers poo-pooed it as being a toy or just for the web.

When I found myself saying similar things about Ruby and Ruby on Rails, I considered it a warning and started learning it. :-)

I have been using Ruby for only a short while and am starting to use it for all kinds of automation scripts. I have also started learning RoR and am blown away by its powerful simplicity. What would take a week to do in Java (even with Hibernate and Spring) took a day with RoR.

Is it the right tool for every job, no. Is it another tool for your tool box? YES!

There is also some interesting work closer to the JAVA_HOME :-). If you look at Groovy and Groovy on Rails (Grails)... they are providing a lot of what Ruby and RoR provides but with a more Java flavoring.

Good times ahead :-)
11 years ago
You might try upgrading to 1.5 update 11, or whatever the most recent verison is now. You might also try adding more memory to the heap, like -X128M for 128 MB... it doesnt seem like a memory issue though.

What OS are you running on and are you sure that you installed the proper JVM for your OS. Maybe reinstalling the version you have (or upgrading as I mentioned above)

Not sure what else it could be.
Just noticed... you are also using "com.sun.*" packages. You should remember that these are not part of the official Java API and are not supported. Thy could disappear from the API without warning or deprecation.
Generally they should only be used in extreme circumstances, if ever.
11 years ago
I guess my question would be, why do you want to do that? Why not just use Tomcat or one of the other java servers? If you want something lightweight and embeddable try Jetty (http://jetty.mortbay.org).

Writing your own server completely from scratch is quite an undertaking. You need to consider the proper implementation of all the protocols you support, security, scalability, etc.

If its just a fun personal project, you should look at how the big projects do it... they are all open source.
11 years ago
Actually, you should not be using that class, it is one of Sun's internal unsupported classes. If you need a base64 codec, I recommend the Jakarta Commons Codec API (http://jakarta.apache.org/commons/codec/).

If you really do need that class for some reason, it is most likely in the runtime.jar or one of the other library jars that make up the core JDK (but only in Sun's).

Hope this helps.
11 years ago
Sorry I am going to be a little lazy on this one and just point you to references:

http://en.wikipedia.org/wiki/Dependency_Injection
http://en.wikipedia.org/wiki/Inversion_of_control

That should clear it up. Hope this helps.
A lightweight container is one that has few (or fewer) additional requirements such as required 3rd party libraries, servers, or other services.

Spring is a lightweight container because you can just use it. Set up an application context and configure some beans.

EJB requires a Java application server like JBoss or WebLogic to manage all of the EJBs and other supporting technologies (JNDI, RMI, JMS, DB, pooling, etc)... therefore it is considered "heavy".

Each has its place, though heavy containers seem to be less favored these days since in many cases they are overkill.

I hope this helps.
Spring's documentation has very good examples about using their JDBC API (http://springframework.org/documentation). Also the JavaDocs are very robust and useful.

Hope this helps.