Michael Zalewski

Ranch Hand
+ Follow
since Apr 23, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael Zalewski

Biggest problem I had in a situation like this was the case of file names (and path names).

In Windows, file names are in both upper and lower case. But when you open the file, the file name is not case sensitive.

In UNIX (or Linux) you can create two seperate files with the same name (but with different case). In Windows, you cannot do this.

So if a logger class uses "mylog.txt" in one spot, and "MyLog.txt" in another spot, it will work differently on UNIX because these names refer to distinct files. In Windows, these names refer to the same file, which could have yet some other case in the actual filesystem name.
12 years ago
I'm pretty sure there is still no way to do a timeout on URLConnection.

In Java 1.5, you can set a System property (which specifies a system wide timeout for the entire JVM -- not a good idea from inside an application server and may not even be allowed by the Security Manager).

The best solution that I have found is to use HttpClient from Jakarta
Actually, I don't think it would be appropriate for yamini to use getOutputStream().

He (she?) is attempting to write a text file (tab delimited). Excel can open this file as a spreadsheet.

But you cannot put formulas into a tab delimited file. Or at least, if you do they don't come out as formulas in the spread sheet. The spreadsheet will show the forula '=SUM(B2:C2)' in a cell as though it were a string -- which is the only thing you can put into a tab delimited file for Excel.
It's hard to make this board display what I intended.

But '<' should never be in your web page. It should be '&lt;'. Once you do that, it's easy to make the page say <%, which you code as

You really should escape the '<' in your HTML text. Once you do that, it's easy

[ June 08, 2004: Message edited by: Michael Zalewski ]

Oh, yes. I get it. I missed the cases that the modules can be run on different JVMs in the distributed environments.

I'm not really satisfied with this explanation. My thinking goes like this:
There is such a thing as an ejb-reference, which you can stick inside a web application or ejb specification. So EJBs can go "inside" of a web application, or another EJB. That makes B and C correct.
But there is no such thing as a web-app-reference. So you can't stick anything into a WAR file to make it depend on another WAR. Nor can you stick anything inside a EJB specification to say that this EJB contains a web app as a component. Therefore, A and D are incorrect.
I thought the default Oracle format was DD-MON-YYYY, as in '06-JAN-2004'. I think that's the way dates come out in DB2 also. Actually, I think that is some kind of standard.
Anyway, if you have a string in a particular format, you can convert in Oracle using the TO_DATE and TO_CHAR functions.
For example, if you have a string that looks like '06-JAN-2004', and you want to display a string that looks like '01/06/04', you could
1) Convert the string to a Date with TO_DATE( string, 'DD-MON-YYYY')
2) Convert the Date back to a string with TO_CHAR( date, 'MM/DD/YY')
Putting it all together, it looks like this:
14 years ago
Apache SOAP should work, but you have to do a little configuration and tweaking. You do have to have the latest service pack, and install a later version of Xerces.
These links should be very helpful:
Apache SOAP Websphere Installation Instructions
IBM Developer Works on Apache SOAP and WAS 3.5
BTW, Websphere 3.5 is no longer supported by IBM (all platforms after November 30, 2003). You might want to recommend that your client upgrade to version 5 -- If the client does, than you can use Axis instead of Apache SOAP.
IBM Software Support Life Cycle
14 years ago
I really love the JUnit plug-in for Eclipse. You can set break points in your unit tests, then Run | Debug As .. | JUnit Test. When you hit the breakpoint, you can examine the stack, alter variables, and fix up the code without ever leaving the IDE.
I have two mistakes beginners make when using JUnit:
1) trying to build state into the testcase. It's really hard to do that, because JUnit has a classloader that will clear out your test case class for every test. It will even clear out the static fields.
2) forget to test methods in a superclass. You need to use judgement, because this is not always necessary. But for example, suppose a base class implements Comparable. The base class depends on the behavior of such things as equals(), hashCode(), compareTo(). These probably should be tested in each subclass.
14 years ago

Originally posted by karthik Guru:

Perhaps you could consider making a fixture

Once you have that, you can make your test methods concentrate on the differences between each test, instead of always adding the same parameters for each test.
You might also consider working on class FixWebRequest so it can take a querystring

But a warning: don't try to make the fixture too smart. You want to concentrate on writing test methods, not implementing behavior in the fixtures.
14 years ago
To manage this type of automation, put all the test classes into their own packages. Then use the junit task in ant.
You could even set up a seperate ant target for each class of test. And use a fileset to pick out all the tests that need to run in each target.
14 years ago
When you override a method, you replace the method with an implementation in the subclass.
When you overload a method, you create a new method with the same name as a method that already exists, but with a different argument list.
In the second example, s/b . So the next line [code]b1.m1(b2);[code] invokes the original method instead of the overloaded method, because the original method takes a type A as an argument.
To put it in another way, in the first example, type B has a single method which we could call 'void B.m1()'. In the second example, type B has two methods, which we would call 'void B.m1( A)' and 'void B.m1( B)'. Since the two methods have the same name, the compiler chooses which method to invoke by the types and numbers of the arguments.