jwenting 1,905 duckman Team Colleague

Just an example of the usefulness of CVS:

Today I visited a friend and did some work there. I checked the changes into CVS from over there, and when I got back home I loaded my regular development tool (JBuilder) and ran an update of my project which instantly gave me all those changes on my local harddisk.
No more remembering which files to copy from one directory to another, that's all taken care of.

jwenting 1,905 duckman Team Colleague

Ant is a build tool, similar to what make does for C.
It helps automate builds, making them far easier to perform in a way that can be easily reproduced.
Little use if you have a few files, but when your project runs into the hundreds or thousands of files it gets very handy.
Plus it can help in building your jars for you and for automatically running your unit tests and reporting the results.

CVS is for version control of your sources. Makes it easy to store revisions both as a backup (if you do it on a different drive or machine) and to have access to historical versions (maybe if you need to revert to what you had yesterday because you made a serious blunder).

I use both a lot, and plan to integrate them even more so that I can have ant build a jar of my applications directly from CVS for example.
http://www.pragmaticprogrammer.com/ have excellent books.
Get their books on CVS and project automation, they'll open your eyes.
http://www.pragmaticprogrammer.com/starter_kit/auto/index.html
http://www.pragmaticprogrammer.com/starter_kit/vc/index.html

EBook versions cost about $20 each, well worth the investment.
Paper versions cost a bit more, but less than printing the EBook yourself (for those who can wait for delivery or just don't like to read PDFs).

jwenting 1,905 duckman Team Colleague

You could test it of course by setting something in one program, then running another program to check whether that setting is still there :)

My GUESS is that they do persist, as the call can be influenced by a security manager. But I must admit I never tried it. If I need system props at all (usually file.separator, path.separator, and line.separator and little else) it's readonly.

freesoft_2000 commented: Good Call +2
jwenting 1,905 duckman Team Colleague

Where is your jarfile and where are you trying to do that?
And what's your classpath?

jwenting 1,905 duckman Team Colleague

NEVER eat exceptions. At the very least log the exception message, better yet is to log the entire exception stacktrace.

My guess is that either your read operation fails, causing the method to abort, or the data you're reading cannot be parsed to a double (empty string maybe?).

Your "while (temp = in.readLine() != null)" also looks highly suspicious.
I'm not sure (I'd never write it like that) but possibly it fails to assign a value to temp, or assigns the string representation of the comparison instead of the data read from the file.
Don't use such statements, rather split them up.

Try

String temp = in.readLine();
while (temp != null) {
  // blah blah
  temp = readLine();
}

instead.

And of course don't use variable names starting with a capital letter.
Use "catch (Exception e)", or better yet catch specific exceptions rather than a single blanket statement.

jwenting 1,905 duckman Team Colleague

Your line 14 is illegal there, it can only exist inside a method or an (static) initialiser block.

jwenting 1,905 duckman Team Colleague

I've 5000+ slides in my private collection. That's enough to allow me to change my desktop once a week for almost a hundred years.
And I photograph enough to add to that collection at a rate of maybe a hundred a week on average, so I'll never run out :)

jwenting 1,905 duckman Team Colleague

There are in the world more people knowing C/C++ than Java, it's true.
It's also true that many Java programmers also know C and/or C++ (and often several other languages as well, including Pascal, Python, Ruby, etc.), while many who mainly program C/C++ rarely know anything else.
And the more agressive stance against the lazy buggers who expect us to do their homework for them might indeed deter some from posting in the Java forum. But rest assured, if you have a legitimate question about a specific topic we're more than happy to lend you a hand with suggestions.

jwenting 1,905 duckman Team Colleague

And if it is, there will be ample time to change your code to use whatever replaces it, given the lax attitude Sun takes towards removing deprecated material (they've never yet done it, there's stuff in there that was deprecated 9 years ago).
As it is you have no alternative for getting system properties anyway :)

jwenting 1,905 duckman Team Colleague

yes, there was some talk.
But mainly that's to do with using Properties to store localisation information.
That's what ResourceBundle was introduced for, to include generic support for multi-lingual environments.

jwenting 1,905 duckman Team Colleague

I doubt Sun will deprecate Properties.
After all, PropertyResourceBundle which is one of the main concrete ResourceBundle children uses it internally :)

public class PropertyResourceBundle extends ResourceBundle {
    /**
     * Creates a property resource bundle.
     * @param stream property file to read from.
     */
    public PropertyResourceBundle (InputStream stream) throws IOException {
        Properties properties = new Properties();
        properties.load(stream);
        lookup = new HashMap(properties);
    }

At the moment there's no way to get systemproperties through ResourceBundle, certainly not directly.
Conceivably this could of course be rewritten but I see little reason to.

jwenting 1,905 duckman Team Colleague

I used IE2 around 1993, so while 15 years is a bit long it's not that far off :)

jwenting 1,905 duckman Team Colleague


Do it yourself.

No need to shout, I think he got the clue when I told him the same :)

jwenting 1,905 duckman Team Colleague

15 years ago (sigh, has it been THAT long?) when we used IE2 (or Netscape 2 more often) you'd not have encountered sites using XHTML, Flash, Javascript (certainly nothing like now), CSS, PNG, Java applets, ActiveX controls, etc. etc.
Those just didn't exist :)
Try looking at sites like many Apache projects, Project Guthenberg, W3C, and sites creates for mobile devices. Those are close to what people were writing in those days, plain HTML with maybe a few simple graphics.

jwenting 1,905 duckman Team Colleague

I guess the adminclient is trying to connect to the server you're trying to administrate but that server is either not running or you're behind a firewall which is blocking the request.

I've not used Axis but those are the main reasons for "connection refused" errors in general.

jwenting 1,905 duckman Team Colleague

Most exploits are aimed squarely at holes in things like Javascript, ActiveX, and Flash.
All those are not available in IE2.
IE2 shows HTML and that's it. Javascript was I think introduced in IE3, plugins in IE3 or IE4.

jwenting 1,905 duckman Team Colleague

Don't shout.
Don't claim your problem is more urgent than that of anyone else.
Show some effort, don't ask us to do your work for you.

And take a long hard look at the Date and Calendar classes, and DateFormat to format the output.
Information you can find in the API docs.

jwenting 1,905 duckman Team Colleague

It's a good book but hardly a tutorial style tome for classroom use.
Put one or two in the school library (or better yet keep them in the lab), that's enough.

jwenting 1,905 duckman Team Colleague

looks pretty good actually. And no trouble with flash ads I see :)

jwenting 1,905 duckman Team Colleague

Problem

Due to a rather annoying and very old bug in JTable you will never get a horizontal scrollbar on a JTable even if the table is wider than the JScrollPane you placed it in. According to the bug report this is due to an error in the handling of the autoresize functionality of JTable.

Solution

There are two ways around this: the first and easiest (which may be good enough for most people) is to turn OFF autoresize on your JTable using table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); (where 'table' is a JTable).

The second (more involved) way is to fix the responsible function in JTable (which would involve creating a custom subclass of JTable).

The code that you need is listed (I haven't tried it!) in bug report #1027936

Override JTable.getScrollableTracksViewportWidth() to honor the table's
preferred size and show horizontal scrollbars if that size cannot be
honored by the viewport if an auto-resize mode is selected. Here is
the suggested change:

/**
     * Returns false to indicate that horizontal scrollbars are required
     * to display the table while honoring perferred column widths. Returns
     * true if the table can be displayed in viewport without horizontal
     * scrollbars.
     * 
     * @return true if an auto-resizing mode is enabled 
     *   and the viewport width is larger than the table's 
     *   preferred size, otherwise return false.
     * @see Scrollable#getScrollableTracksViewportWidth
     */
    public boolean getScrollableTracksViewportWidth() {
   	if (autoResizeMode != AUTO_RESIZE_OFF) {
 	    if (getParent() instanceof JViewport) { …
cwarn23 commented: thank you times 1 million. Solved my problem with a short deadline +12
jwenting 1,905 duckman Team Colleague

Another rather annoying issue:
When you go to the tutorials section it's impossible to post. You need to first enter an existing tutorial, click on the "click here to comment" link, then click back to the beginning of the tutorials section using the link on top (which is a different link from the tutorials link from the main page), and then you can post something.

jwenting 1,905 duckman Team Colleague

encode just the part after the last '/' and you should be fine.

jwenting 1,905 duckman Team Colleague

Take a look at URLEncoder. It will encode the URL String into a String you can pass to a URL object.

jwenting 1,905 duckman Team Colleague

1) use code tags
2) follow the Sun coding standards, which you can get from Sun.

Doing both will make your code a lot easier to read and debug, as it stands I'm not even going to try.

jwenting 1,905 duckman Team Colleague

solid black, who needs more?
It's obscured by application windows anyway...

jwenting 1,905 duckman Team Colleague

You can get viruses on a computer?

The Guide explains how the entire population of the planet Golgafringa was exterminated by a virus contracted from a dirty telephone, the same could happen easily from a computer keyboard.

jwenting 1,905 duckman Team Colleague

Platform: Windows XP SP1 (WinNT 5.01.2600)
MSIE: Internet Explorer v6.00 SP1 (6.00.2800.1106)

2 problems there. Both have been updated a lot since and are now at SP2.

Then these.

C:\WINDOWS\System32\ndupinwx.exe
C:\WINDOWS\System32\dkfqomrq.exe
C:\WINDOWS\System32\??chost.exe
C:\Program Files\apsi\wtta.exe
O2 - BHO: (no name) - {06CBB302-3027-2876-B64E-B7FB3EDC4AF2} - (no file)
O2 - BHO: (no name) - {098B2816-B4D3-3673-D079-F2C9806EDCDE} - (no file)
O2 - BHO: (no name) - {530B7D08-CAE3-EA46-E81F-C9EE8580BEBD} - (no file)
O2 - BHO: (no name) - {570B7D7C-CAE3-9147-E86D-BFEE8B80BECE} - (no file)
O2 - BHO: (no name) - {B333FFD7-73DB-5379-54CF-1EF25F8EC6AF} - C:\WINDOWS\System32\yzsrqvtv.dll
O2 - BHO: (no name) - {BE709C45-AFC1-EC7A-3096-3BB6E6204E4F} - C:\WINDOWS\System32\atpcyyyk.dll
O2 - BHO: (no name) - {CAD9FD7F-C0C0-F76C-BF7B-0F88956FE05A} - (no file)
O4 - HKLM\..\Run: [nwiz] nwiz.exe /install
O4 - HKLM\..\Run: [dla] C:\WINDOWS\system32\dla\tfswctrl.exe
O4 - HKLM\..\Run: [2f28c8bed102] C:\WINDOWS\System32\authz859.exe
O4 - HKLM\..\Run: [Win32] C:\Win32\dll\Win32k.exe -starthide C:\Win32\dll\Win32.exe -local
O4 - HKLM\..\Run: [f405760d6a13] C:\WINDOWS\System32\basesrv2.exe
O4 - HKLM\..\Run: [AlcxMonitor] ALCXMNTR.EXE
O4 - HKLM\..\Run: [ndupinwx] C:\WINDOWS\System32\ndupinwx.exe
O4 - HKLM\..\Run: [dkfqomrq] C:\WINDOWS\System32\dkfqomrq.exe
O4 - HKCU\..\Run: [Sjjd] C:\WINDOWS\System32\??chost.exe
O4 - HKCU\..\Run: [Notn] C:\Program Files\apsi\wtta.exe
[/qoute]

some of the may be genuine but on my machine (which I know to be clean) none of them exist.

jwenting 1,905 duckman Team Colleague

I have not seen a CS degree as a pre-requisite to this phenomenen which I normally see in middleware groups. :)

Which I normally observe as being populated largely by CS grads (at least at the decision-making level) :cheesy:

jwenting 1,905 duckman Team Colleague

1) Javamail
2) java.io.File
3) java.io.RandomAccessFile

jwenting 1,905 duckman Team Colleague

Umm, yeah... well I guess... if you actually LIKE getting viruses, trojans, and other malware; not too many people like that though. :rolleyes:

NOOO! Free software, love letters, and pictures of nekkid Anna Kournikova.
And of course all those returned documents you can't remember sending. Got to know what's in those.

jwenting 1,905 duckman Team Colleague

I try to use getClass().getPackage().getName() to get the package name of an object to insert into a log message.
Sometimes it works, at other times it throws a NullPointerException.

Does anyone have any insight into the conditions under which getPackage() returns null ('cause that's what's happening)?
The classes in question are inside a package (as all classes should be).

In this test the call returns the package name as expected.

package wtg.test;

import java.util.*;

public class MapTest {
    public MapTest() {
        super();
    }

    public static void main(String[] args) {
        System.out.println(new HashMapTest().getClass().getPackage().getName());
    }
}

This code does not

package suncertify.db;

import java.rmi.RemoteException;
import java.util.*;
import java.util.logging.Logger;

public class LockManager {

// lots of other methods and declarations

public long lock(int recordId) throws RemoteException {
        Logger.getLogger(getClass().getPackage().getName()).entering(this.
            getClass().getName(), "lock");
        synchronized (locks) {
            while (locks.containsKey(recordId)) {
                try {
                    locks.wait();
                } catch (InterruptedException ex) {
                    Logger.getLogger(getClass().getPackage().getName()).
                        info(
                            "InterruptedException while waiting for lock to be released");
                }
            }
            long cookie = System.nanoTime();
            locks.put(recordId, cookie);
            timestamps.put(recordId, new Date());
            Logger.getLogger(getClass().getPackage().getName()).exiting(this.
                getClass().getName(), "lock");
            return cookie;
        }
    }

// more methods

}
jwenting 1,905 duckman Team Colleague

no time to write html?
If I were your instructor I'd automatically fail any work turned in that's obviously (and believe me, it's almost always obvious) created using a generator or wysiwyg editor.
LEARN the language, don't hide your ignorance behind a button.

jwenting 1,905 duckman Team Colleague

It also has some serious errors...
1) you don't need to restart your computer when you're running XP, NT, or Win2K.
2) you should set JAVA_HOME and refer to that in your path instead of the full installation directory. Many applications expect JAVA_HOME to be set and it also makes upgrading a lot easier :)
3) of course the actual directory to set depends on the exact JDK version you're using and where you install it.

But apart from that it's a nice checklist :)

jwenting 1,905 duckman Team Colleague

I've nothing against Microsoft, but the concept of someone from Microsoft who's an expert in their products writing (while a Microsoft employee) a book about a competing product doesn't inspire confidence (it wouldn't have inspired confidence if it were anyone else writing a book about a product from a competing company).

Hf Java is an excellent book. I didn't read all of it but have read others in the series and others by the same authors.
It's designed to be FUN while teaching, causing the material to stick in the mind and inspiring the students.

All books out of the "teach yourself in XXX" series are extremely shallow, not recommended except as an introduction into a topic where you later use other books to get to know that topic.
I'd not recommend them to anyone, except as that, an introduction to see if a topic is worth further study.

Jeff Langr's book is designed (as is HF Java) to be used in a classroom environment as well as for individual study.
As I said I proofread it :)

The JDK 1.5 Developer's notebook is hardly a beginners' book, neither are certification books or pattern catalogues :)
HF Servlets and JSP is also hardly a book for beginning Java programmers. One should learn to swim before attempting the deep ;)

I am completely self-taught in Java, learning as I went along from a huge pile of books.
My first one was …

jwenting 1,905 duckman Team Colleague

Deittel is not very good, anything from a Microsoft employee specialising on C I mistrust automatically :)

The best currently on the market are:
Head First Java (Sierra/Bates) and
Agile Java (Langr) (which I proofread before it went into print)

jwenting 1,905 duckman Team Colleague

you should NEVER EVER put classes or jars from the JDK installation in your classpath.
It's not needed and can cause problems.

You SHOULD put the current directory ('.') in there or else pass it as a classpath to the java compiler and runtime always.

If you still get a NoClassDefFoundError you're missing something on your classpath, which will pretty much always be a library you need for some import or other.

jwenting 1,905 duckman Team Colleague

I'd rather tech moved at a slower pace but was more thoroughly matured before hitting the market.
As it is many products are launched before they're ready just to beat the competition, and the consumer is left with equipment that doesn't deliver on promises.

jwenting 1,905 duckman Team Colleague

http://www.vim.org
All you need.

jwenting 1,905 duckman Team Colleague

a far bigger problem is the flood of flashing text, scrolling text, flash applets, and such crap that people will start to post.

jwenting 1,905 duckman Team Colleague

I went through the entire book 3 times, did the practice questions the third time around and kept revising until I got them all right.

Took the exam and was done with nearly an hour left. Scored 85%.
Might have scored higher had I gone through my answers yet another time but from experience I know that's usually counterproductive as you begin to doubt things you got right the first time around.

Indeed, take LOTS of time studying for the exam. You may also want to defer the exam until you can go for the new 5.0 exam for which there is as of yet no good study material available (it's too new).

If you think a mock exam, any mock exam, is too hard you're not ready!

jwenting 1,905 duckman Team Colleague

Ditch the old crap that VS6.
Why start out learning something that's going on 10 years old? You'll be teaching yourself outdated skills, almost worse than useless.

The ONLY reason to use old versions of software for study is when you have a business requirement to use that specific version and only that version (for example if you're having to maintain Windows 95 machines you will have to learn Windows 95 maintenance and not XP).

jwenting 1,905 duckman Team Colleague

Kathy Sierra and Bert Bates' book is the best by general concensus :)
http://www.amazon.com/exec/obidos/ASIN/0072226846

I used nothing else (well, several years of professional experience can't hurt).

From what I've heard about ucertify their product isn't very good. Certainly not good enough to justify the money spent on it.

Exam cram books are useless, they don't teach you what you need to know in any way that sticks (and you do want to retain that knowledge now do you?).
I've read an earlier version and while nicely written there are better books out there (see above).
I've also read an earlier edition of the other book cheenu mentions, and it's nice. But it's not up there with Kathy's book.

Of course you also need a copy of the Java Language specification, which you can get online from Sun, and a copy of the Java API documentation similarly straight from Sun.
Both are also available in bookform if you prefer dead trees.

jwenting 1,905 duckman Team Colleague

he may, but I made it up myself (no fan of him :) ).

jwenting 1,905 duckman Team Colleague

If you think Java is complicated, try some entry level tutorials first before diving into creating multithreaded networked applications.
Sun has some great tutorials, and O'Reilly has their excellent "Head First Java" book to get you up and running.

jwenting 1,905 duckman Team Colleague

Don't expect people to open attachments.
Rather post the relevant sections of your code and the errors you get using the code and quote tags and explain why you can't make sense of those errors (in my experience they're usually a great help to figure out what you did wrong).

jwenting 1,905 duckman Team Colleague

My motto (and yes, I am paranoid): just because you're paranoid doesn't mean they're not after you.

jwenting 1,905 duckman Team Colleague

Cheap sells in bulk, low quality means high repeat sales as people need to replace the stuff more often.
If you want to you can still get quality but expect to pay for it.
Take photo cameras. The best SLRs go for several thousand Euro, but despite the fact that those will last 10-20 years many people opt for cheap 100-200 Euro cameras that will last maybe a year at most at which time they'll want to replace it anyway because there's a new model and you can't be seen with last year's model now can you?
Fashion is the ultimate marketing tool, it convinces customers that they have to replace their perfectly fine things (whether clothes, PDAs, cameras, or even their furniture) regularly.
You seem to not be receptive for such marketing (neither am I), and probably see right through a lot of other marketing crap as well (such as advertising trying to pursuade you that something you bought last year is now suddenly completely useless just because there's a "new and improved" version available).

But you do seem stuck in the idea of wanting to pay next to nothing.
Look in the next higher market segment and you'll find the quality you want, quality that will last you a long time, saving you money in the long run.
It may not be in stock from your retailer, who has an incentive in higher percentages of sales income to sell you the …

jwenting 1,905 duckman Team Colleague

Give it some random thought?
I think if you do some research and thinking you'll end up with a lot of ideas.

jwenting 1,905 duckman Team Colleague

If it's as meaningful and well put as your question I'd start by completely rewriting it, including a more generous use of things like whitespace, interpunction, and other language features that make a text easier to read.
As you may notice I have a tendency towards using longer than normal sentences as well but I do know when and where to use commas and paragraphs :)

jwenting 1,905 duckman Team Colleague

We're not here to help anyone with illegal activity.
In fact I hope you get reported to law enforcement for trying to get people to help you commit a felony.