James Jennings

+ Follow
since Mar 03, 2005
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 James Jennings

That is an appropriate name. It appears that "nice" is in the eyes of the beholder.

Have a nice day.
14 years ago
Both of these classes compile on my machine. And if one compiles, both should assuming they are in the same directory.

The rules of this website require that for your ID that you use your your real name or a name that reads like a real name.
14 years ago
Higgins: Just play around until something works.

me: hmmm

(two days later)
me: by gawd Higgins, I think I've got it.

Higgins: what did you do?

me: uhhh. don't know. checked some things, unchecked others, made a few lucky guesses.

(In other words folks, the problem is solved.)
14 years ago
I hope I am not too far off-topic with this question.

I am new to both Ant and JEdit, so I am way down on the learning curve.
I have installed both of these tools, and I can get Ant to compile my programs both from the command line, and the System shell in JEdit. I cannot, however, get Ant to run from either the Ant Shell of the Console, or from the Ant tree using the following instructions from the JEdit Help file.

How do I compile my Java source in JEdit?
.... You can also use the �Ant� shell in the Console plugin or the AntFarm plugin to run complex builds on a project of source code files, using a build.xml file to specify build commands and dependencies.

Chapter 4. Run Ant targets from within jEdit.

There are two ways to run targets from the AntFarm tree.
1. Select the target in the tree and click the Run. If a project is selected the default target will be run.
2. Select the target in the tree, right click and select the Run menu item.

When I try either of these methods I get a Windows dialog box that says:

Windows cannot open this file:

To open this file Windows needs to know what program created it....

I created build.xml in JEdit, so if I have to run it from JEdit, I am chasing my tail. Can anyone familiar with JEdit help me with this problem?
14 years ago
Ernest I didn't understand. I reread you comment and now I do. I thought you were saying I should instantiate the BigInteger this way:

public BigInteger aBigInt = new BigInteger("12345");
14 years ago
Thanks fellows. What a quick response! javaranch is better than having a pair programmer sitting beside me. The pgm compiles now.

Ernest, I understand your comment about the string. I put the extra line in to make sure I had a string. I was trying everything I could think of.

(All the stupid mistakes I'm making, makes me think I'm getting too old for such demanding work.)
14 years ago
I would appreciate help on this problem. The code below will not compile.

import java.math.*;

class BigIntTest
private String sBigI = new String("12345");
public BigInteger aBigInt = BigInteger(sBigI); // line 6

I am getting this error message:

C:\Documents and Settings\James Jennings\My Documents\BigIntTest.java:6: cannot find symbol
symbol : method BigInteger(java.lang.String)
location: class BigIntTest
public BigInteger aBigInt = BigInteger(sBigI);
1 error

Tool completed with exit code 1

The java API says this:
public BigInteger(String val); // decimal String representation of BigInteger.

Translates the decimal String representation of a BigInteger into a BigInteger. The String representation consists of an optional minus sign followed by a sequence of one or more decimal digits. The character-to-digit mapping is provided by Character.digit. The String may not contain any extraneous characters (whitespace, for example).
14 years ago
I bought my copy of Refactoring by Martin Fowler on May 4, 2005. It is from the 15th printing, September 2004.

refactoring.com/errata.html lists 18 pages of errata (in my print preview) through the 13th printing; none for the 14th or 15th printings. Many of the errata, however, are repeated for each printing until the error was corrected.

Refactoring is published by Addison-Wesley, who are not bashful about charging stiff prices. Amazon discounts the book, which lists for $54.99 at a 14% discount at $47.14; Bookpool at $42.95, a 22% discount. And these prices are from online bookstores that usually give at least 30%. I seriously doubt that they are getting a 50% markup on A-W books. Discounts on the majority of A-W books is zero at Amazon, and at all local bookstores in my area (DC, northern Virgina, Maryland).

Changing an "assert" to assertTrue, or "assertEquals" will not change any pagination. In fact after pp. 93, 94, Mr. Fowler uses "assertEquals" for the rest of the junit section.

Authors do not have to "sit and revise each copy as it comes off the press." I would guess that most errata are reported to them by readers, and colleagues. Mr. Fowler acknowledges 39 people so far, who have reported errors to him for Refactoring. Besides he only has to revise one copy -- if he does it right, or better yet, none if he checks what he wrote before the first printing. Even after 15 printings, there is an error on page 98 in some code no less:

FileReader in = newFileReader (empty);

One only has to attempt a compile to find the error. After all, the section is about unit testing. And the junit section is the first I have read -- 10 or 11 pages.

Mr. Fowler does not give an email address to use for reporting the errors -- in the errata list, so the "typo" will have to remain unreported. He says he is too busy these days to answer email; probably doesn't even read it.

I did not ask for a new edition, only that obsolete, broken code be changed, or listed in the errata. A new edition would not be a bad idea, however, since the Java language has gone through two updates since the book was first published; the last one, Java 5, was a major revision.

Also, if bringing the book up-to-date causes repagination, then it is probably time for a new edition. If the book is popular enough for 15 printings, then a revised edition is not going to bankrupt anyone. But then we have to contend with the excessively busy author.

Maybe someone could tell me how authors and publishers work these days. How is a manuscript submitted? Is it tattered typewritten pile of pages, or submitted electronically as a file from which plates can be made directly? Who proofreads these days? The printer, the publisher, the author? No one? How do all these errors remain undiscovered until the books get into the hands of people have to cough up real money to proofread them?

My point is that the state of computer book publishing today is deplorable. The books are full of errors, often printed on cheap paper, and priced far too high. If it keeps up American computer book publishing may end up like the American automobile business. Exported to Japan and Germany. Then, it may surprise us to see who can write better English.
15 years ago
I have heard from some old hands that assert was added to java 1.4, and therefore junit had to replace it. I think that was several years ago.

This situation raises a question: why does a publisher who charges top dollar, and gives booksellers such a minuscule margin, and an author of such great renown fail to keep a popular book up-to-date for changes in the java language -- either by updating the book, or making mention of obsolete code in the errata list? Am I asking too much for my $55?

And why the little snippets of code when the entire program listing in question would only take up a half page. Or was the book written only for the cognoscente?
15 years ago
Two other errors to fix in the High Lama's code:

class FileTesterReader has to be public, and there is no assert method in JUnit. There is an Assert class, but the method to use in this program is assertTrue(...).

That wraps it up. Now it works the program works as advertised in this $55 bloated pamphlet. The book has some good things in it, but it is overpriced for what one gets.
15 years ago
I have seen mention here of Design Patterns by the Gof, and Joshua Bloch's book Effective Java.

I own both. I cannot understand either of them. IMO, if you understand them, you don't need them. If you don't understand them, you don't need them. By the time you do understand them .... Why can't I see the Emperor's new clothes?

But someday I am going to read them and understand them. Just for spite.

There is a satirical review at amazon.com of Bloch's book by someone using the nom de plume Charles Henry Higgensworth III of Boston, Massachusetts.
15 years ago
Thank you Henry. That fixed the problem with the compile. Mr. Fowler left the instance variables out of the snippets of code in the book. But I should have seen that myself. Just got blinded by a guRu, and perseveration.

Now however, junit says:

1) testRead(FileReaderTester) at FileReaderTester.main(FileReaderTester.java:11)

Mr. Fowler got an "OK" Maybe, he left something else out of the book.
15 years ago
on my previous post the line:
FileReader filereader = new FileReader("data.txt");

does read:
FileReader fileReader = new FileReader("data.txt");

in the program. Somehow it got changed in the copy and paste.
15 years ago
I am new to junit, and am trying a program from Martin Fowler's book Refactoring, pp. 92-94. I have added the BufferedReader following the example on p.454 of HeadFirstJava.
I have reached the point where I have only three compile errors. They are:

cannot find symbol variable reader (lines 29, 39)
inconvertible types line 39
(these lines are identified with comments in the listing below.)

I have tried everthing I can think of without success. Can anyone tell me what is wrong?

I am a beginner, but am leery of posting this on the beginner forum for fear of dire consequences. Besides it doesn't seem very beginner to me.


import junit.framework.*;
import java.io.*;

class FileReaderTester extends TestCase
public static void main (String[] args)

public FileReaderTester(String name)

protected void setUp()
try {
FileReader filereader = new FileReader("data.txt");
BufferedReader reader = new BufferedReader(fileReader);
} catch (FileNotFoundException e) {
throw new RuntimeException("unable to open test file");

protected void tearDown()
try {
reader.close(); // line 29
} catch (IOException e) {
throw new RuntimeException("error on closing test file");

public void testRead() throws IOException
char ch = '&';
for (int i=0; i<4; i++)
ch = (char) reader.read(); // line 39
assert('d' == ch);

public static Test suite()
TestSuite suite = new TestSuite();
suite.addTest(new FileReaderTester("testRead"));
return suite;
15 years ago
You Are 45% Normal <em>(Somewhat Normal)</em>
<center> </center> While some of your behavior is quite normal... Other things you do are downright strange You've got a little of your freak going on But you mostly keep your weirdness to yourself

<div align="center">
How Normal Are You?

So that's why my son keeps asking, "Dad, did you take your medicine, today?
15 years ago