jwenting 1,905 duckman Team Colleague

These tools are all scams. The limiting factor on the time it takes to get data to your computer is hardly ever the bandwidth YOU have available (especially if you're on broadband) but rather the speed at which the host sends its data (which these tools can't affect).
And if you're on dialup (unless you're in the stone age and using a 33k6 or slower connection) your data is already compressed as the V56 protocol includes downstream compression (the actual line itself is still at 33k6, but the dialup server at your ISP will compress the data before sending it to you).

And if you install it on your own system, it does nothing at all to reduce bandwidth usage of course.

There's a word for things like this: snake oil.

jwenting 1,905 duckman Team Colleague

I've read a statistic a few years ago that stated quite bluntly that there's a bug in every 100 lines of code (in other words no program of over 100 lines is free of bugs).
These don't all have to be bugs in your own code, they can be bugs in a compiler or runtime environment that gets exposed by that code.

As an example:
I once wrote a small Assembly program (maybe 50 lines) that did precious little (this was during a university physics study where we got an assembly course, who can say that anymore...).
The program contained the following 2 lines of code:

mov ax, bx
mov cx, dx

This caused the program to crash when reaching the second of those statements.
When reversing the order of the statements (which should have no effect as the statements are not related in any way, acting on completely different memory locations) the program worked perfectly.
And no, that was NOT MASM we used :)

I believe that statement as a plausible average.

jwenting 1,905 duckman Team Colleague

Of course the definition of 'bad code' is also important.
Microsoft can in a blaze of publicity give such a guarantee by defining it narrowly as spyware or virusses which Windows indeed does not contain out of the box, users infect themselves (or in ever rarer cases are infected by launching infected applications or hardware which can be classed as infecting themselves).

jwenting 1,905 duckman Team Colleague

Creators of 3D modelling software seem to be extremely excentric. I've seen (and to a degree used) several packages and each works completely different from all the others even in the core concepts used.

ACAD indeed isn't bad (though I've only limited experience with it and that with old DOS versions most of all).
Could be because I'm somewhat partial to using command lines to input data and ACAD allows that. Makes for more precise working.

jwenting 1,905 duckman Team Colleague

That's your problem, not mine :)

jwenting 1,905 duckman Team Colleague

idiots... Just another "I hate Microsoft because Microsoft is a Big Corporation and all Big Corporations are Evil" group.

jwenting 1,905 duckman Team Colleague

AutoCAD can be scripted using VBScript.
I've seen it done but never done it myself, I guess there are books dedicated to the system (and probably a lot of documentation included with the product).

jwenting 1,905 duckman Team Colleague

And second: asking for preferential treatment by claiming you need something urgently (or "by noon and it's already 10AM") will be counterproductive.

Now for your question (12 hours sounds like a decent penalty :) ):
The simplest way would be to insert some logging statements at the beginning and end of your JSP.
JSPs are executed in linear fashion by the application server (effectively your JSP becomes the body of the service method of a servlet) so that would give you a timestamp for start and end of execution.

What it won't do is give you the complete execution time of the request, as that includes time taken by the application server, network latency and transmission times, rendering time by the browser, etc..
Those you can't really find out about and you can't control them, except the browser rendering which depends in large part on the complexity and size of the generated HTML code (as an example, we were able to bring the rendering time on one particularly complex page here back from 10 seconds to under 3 by making some minor changes to the html).
Tomcat of course should also be able to be configured to log every request and response with a timestamp, up to you to figure out.

jwenting 1,905 duckman Team Colleague

And if you're writing a console application, forget it :)
Some consoles will print output on the error stream in a different colour but you have no control over it.

jwenting 1,905 duckman Team Colleague

hmm, is it the start of the new school year where you are?
Get a good book, there's at least one I know of that develops just that as one of its core example applications, good luck in finding it (will give you at least some work to do before you turn in the code verbatim as your own) :)

jwenting 1,905 duckman Team Colleague

Well, given that the definition of "planet" isn't set in stone there's bound to be people (including scientists who often have highly inflamable brains) who will argue that these are not planets.

There is no limit as to what is a planet described in things like size and orbit.
And as these objects (there's actually 3 of them, though only one made the news) are both in a region where objects are not generally classed as planets (and with the orbits to suit) and are of a size which DOES class them as planets (as they're as large as or larger than the smallest recognised planets) there's option for debate.

jwenting 1,905 duckman Team Colleague

Ah, you must be using a 1.4 compiler.
I'm using 1.5 here.

jwenting 1,905 duckman Team Colleague

Well said. Everyone should be free to make his own choices and do as he likes as long as that freedom doesn't interfere with the freedom of others.
Therefore you're free to drive your car off a bridge to commit suicide but don't drive it into my car when I'm driving the other way because that's interfering with me :)

You're also free to think (and say) I'm a rightwing nut, as long as you leave me free to consider you a leftwing lunatic in return ;)

jwenting 1,905 duckman Team Colleague

Cable already is a monopoly and has been for years. Have prices exploded there?

I know here at least cable prices haven't gone up because there's stiff competition from DSL services. Of course cable performance is poor and the service cable companies offer is terrible because they KNOW their customers have no choice (wrong in case of internet access, but true in case of television/radio service where they hold a government granted monopoly in their area of operations).

jwenting 1,905 duckman Team Colleague

The most notorious of course is the quintessential "Marlboro man".
The first person to feature in their commercials died of lung cancer several years ago ;)

jwenting 1,905 duckman Team Colleague

OK, it indeed works.
Here's an example:

import java.lang.reflect.*;

public class TestClass {

    public int doSomething(int i) {
        return i;
    }

    public static void main(String args[]) {
        TestClass c = new TestClass();
        try {
            System.out.println(c.getClass().getMethod("doSomething", new Class[] {int.class}).
                               invoke(c, new Object[] {1}));
        } catch (SecurityException ex) {
          ex.printStackTrace();
        } catch (NoSuchMethodException ex) {
          ex.printStackTrace();
        } catch (InvocationTargetException ex) {
          ex.printStackTrace();
        } catch (IllegalArgumentException ex) {
          ex.printStackTrace();
        } catch (IllegalAccessException ex) {
          ex.printStackTrace();
        }

    }
}
jwenting 1,905 duckman Team Colleague

Python looks like fun.
Got some books on it and can read it pretty well, didn't spend much time on it so far (too busy with Java).

jwenting 1,905 duckman Team Colleague

You could start with the installation guide: http://docs.sun.com/app/docs/doc/817-7971?a=load

and then continue with the rest of the documentation: http://docs.sun.com/app/docs/coll/790.7

jwenting 1,905 duckman Team Colleague

After some more study (in the wee hours of morning) I found the solution (I hope, I've not tested it).
Rather than declare the argument as Integer.class define it as int.class (I know it looks strange).

These are special classes used internally by the JVM to represent primitive types.
They have the same name as the primitive types.

jwenting 1,905 duckman Team Colleague

The BDK is dead and burried. Its last version dates from 1997 or 1998.
http://java.sun.com/products/javabeans/software/bdk_download.html notes clearly that it's not working on 1.4 or later.
It also lists Windows 95, NT, and Solaris 2.6 as the only valid operating systems to use it on, telling something of its age.
It goes on to state the system is out of development and no longer supported.

There's a new project that's I think supposed to replace it: https://bean-builder.dev.java.net/

But you don't need a tool like that, may the Source Be With You!

jwenting 1,905 duckman Team Colleague

There are wrapper classes for every primitive type. Use those instead.

From the javadoc (which you DO you, do you?):

"Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary. "

jwenting 1,905 duckman Team Colleague

Take Sun course SL-275. It builds something like what you're trying to do as its final project.
Course takes a week, that phase takes about half a day.

jwenting 1,905 duckman Team Colleague

Expect more innovative services to take over like highspeed wireless connections.
Far cheaper to put up than cables underground but so far it's not been worth it because of the price protection providers had.

That's what you get when the government prevents a free market economy: stunted innovation.

jwenting 1,905 duckman Team Colleague

You got a lot to learn about multithreading and network programming I see.
Your server can accept only a single connection, ever.
Your client waits forever for input and as soon as it gets anything closes the stream.

jwenting 1,905 duckman Team Colleague

what's that got to do with Java?

There are some programs that might help you, IF you are lucky and the data hasn't yet been permanently destroyed (a delete only removes a file information block in the index of the drive, but if the actual data has been overwritten it's unrecoverable).

Another reason for backing up your stuff regularly :)

jwenting 1,905 duckman Team Colleague

From my experience it's all but dead already.
AOP was a hot item a few years ago with tons of books and websites appearing that dealt with it (and several libraries and languages, including at least 2 libraries for Java).
But lately that's stopped almost completely, most of those projects seem dead in the water.

jwenting 1,905 duckman Team Colleague

An int is not an Object.
In 1.5 a new feature called autoboxing/unboxing was introduced that allows you to treat primitives like their wrapper objects in many conditions with the compiler handling the conversion between the primitives and the wrappers for you.

In 1.4 (and before) you had to do that yourself, which often was a more than a bit tedious task.
So you're going to have to do a lot of

myList.add(new Integer(i));
// ...
int i = ((Integer)myList.get(idx)).intValue();

where in 1.5 you can often do

myList.add(i);
// ..
int i = myList.get(idx);
jwenting 1,905 duckman Team Colleague

yes, that's the idea :)
SCJP consists of learning a lot of stuff by rote and answering 60something multiple choice questions (with a rather low passing score).
SCJD consists of creating a complete client/server application from scratch including the database server and all documentation without using anything that's not part of the JDK itself (so no 3rd party or even optional Sun libraries, and some standard libraries are also not allowed, for example JDBC is explicitly disallowed).

jwenting 1,905 duckman Team Colleague

And of course Tomcat would effectively be installed as a plugin to the webserver, requiring changes to the webserver configuration files (and thus a restart of the webserver itself).

jwenting 1,905 duckman Team Colleague

Crypto and chat apps have been done to death...

Doesn't mean you shouldn't consider them, but you might want to think outside the box.
In my experience doing something unexpected gets you browniepoints with graders.

jwenting 1,905 duckman Team Colleague

It is backwards compatible, that's not the problem.
The problem is that 1.4 isn't forwards compatible (it can't read a fileformat that didn't exist when it was created, not that weird actually).

Try to compile with the "-target 1.4 -source 1.4" options and see what happens.
If you've not used any 1.5 specific language features it should compile and yield a version 48 classfile which can be read and executed by a 1.4 as well as a 1.5 JVM.

jwenting 1,905 duckman Team Colleague

will keep it in mind.
Got the first draft of the network server done, now working on the client application, and then to glue them together :)

jwenting 1,905 duckman Team Colleague

Reflection is your friend.

But a better way by far would be to use JUnit (http://www.junit.org) as a testing framework.
It supports complete automation, you effectively write test scripts (as Java classes) and JUnit executes then and shows the results.
You can even integrate it with Ant (http://ant.apache.org) to provide fully automated testing as part of your build process.

jwenting 1,905 duckman Team Colleague

GCJ is a very poor implementation. It's platform specific (like all native compilers), extremely incomplete (effectively utterly useless), and generally a pain in the ass when trying to set up Java correctly on any machine it's installed on.

executable Jars and JNLP (Java WebStart) are the way to go.

jwenting 1,905 duckman Team Colleague

It's not the JVM version, it's the JVM implementation details.
If Apple failed to provide a mapping of some core datatypes to their internal format in their JVM (I don't think the JVMS obliges the implementation of any such mappings) you get an exception.

The UnsupportedClassVersionError is thrown when you try to run a class on an older JVM than the one it was compiled for.
In this case the class was compiled for 1.5 and Safari apparently has a 1.4 JVM.
If you're running MacOS 10.3 or earlier you will not have a 1.5 compliant JVM as Apple doesn't supply one for any OS except 10.4 (or whatever the latest is).

jwenting 1,905 duckman Team Colleague

Java has built-in XML support yes.
Create a DocumentBuilder which can turn an XML file (or datastream) into a DOM object.
Then you can call methods like getElementById(String) or getElementsByTagName(String) on that to get your elements.
On those you can then get attributes, child elements, text values, etc.

Strangely the built-in XML handling lacks the ability to write XML documents to some output (either Streams or Files).
But here Apache Xerces comes to the rescue :) http://xml.apache.org

jwenting 1,905 duckman Team Colleague

What do you mean your users? Are you teaching a class or something? Will however see the code?

I'm working on my SCJD exam. That means an examiner from Sun will see the code (and run it), and I hope some colleagues as friends as well if I can find people to test it first :)

And of course I work in the business, I doubt our customers would like such messages :eek:

jwenting 1,905 duckman Team Colleague

if you're into Ethiopian cooking it doesn't matter what the weight is.
Just hold some rice (a few grains will do) near (but no closer than half a meter) from a cup of boiling water.
Reuse that rice for the next year.

jwenting 1,905 duckman Team Colleague

Of course what he's doing/planning isn't really to make a compiler but to call an external compiler :)

jwenting 1,905 duckman Team Colleague

An XML element is anything between (and including) a start and end tag.
So this is an element:

<className>
  XMLBuild 
  <constructor>[Ljava.lang.reflect.Constructor;@16897b2</constructor> 
  <superClass>class java.lang.Object</superClass> 
  <classes /> 
  <methods>public java.lang.String XMLBuild.CreateXML(java.lang.Class) throws java.io.IOException private static java.lang.String XMLBuild.Version() </methods> 
  <fields /> 
</className>

in which for example

<methods>public java.lang.String XMLBuild.CreateXML(java.lang.Class) throws java.io.IOException private static java.lang.String XMLBuild.Version() </methods>

is a child element (which is also an element).

These are also nodes, as all elements are nodes (as are text and empty strings like in your case "XMLBuild" which is a textnode but not an element).

jwenting 1,905 duckman Team Colleague

if you disable resize the maximise (which is a resize operation) button is disabled.
Minimise (which is not a resize operation as it simply hides the window) remains enabled.

jwenting 1,905 duckman Team Colleague

It's an AWT exception thrown by datatransfer operations if the datatype isn't supported.
Things like drag and drop, clipboard operations, etc.

I guess the error occurs on different vendor implementations of the JVM? Possibly on macs or unix?

DataFlavors are static descriptors for data types. You get this exception if the DataFlavor you want doesn't exist on the platform you're running on.
Or according to my Swing reference (which is almost as cryptic):
"an unusual aspect of drag-and-drop in the Java environment is flavor maps. A flavor map is a mapping between a device-dependent data type and the Java device independent data type. This allows the Java applicatio to transfer data with a native application without requiring the Java application to know the specifics about the native data types."

jwenting 1,905 duckman Team Colleague

yes, something like that :)
Thought to be a tad more friendly with my users though :p

try {
            Integer.parseInt(timeout.getText());
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(this,
                                          "Timeout interval must be a number",
                                          "Input error",
                                          JOptionPane.ERROR_MESSAGE);
            return;
        }
jwenting 1,905 duckman Team Colleague

Python is good for learning.
Java has a lot more resources available for it though, and is used more in the real world (making your new skills more marketable at least in theory).

jwenting 1,905 duckman Team Colleague

Interesting. And darn that I've no time to look into it (and found out about it a month after it started).

jwenting 1,905 duckman Team Colleague

It's quite easy to build a basic webserver in Java (it's used as an example in several books about network programming in Java).
The question is what do you want it to do and support?

jwenting 1,905 duckman Team Colleague

Yes, but it's shorthand that's part of the language specification.
It's like writing e.g. instead of "for example".
If I were to write "fe" when I mean "for example" noone'd understand me, right?
Same if I were to write x+; when I want to write x=x+1; the compiler will complain :)

jwenting 1,905 duckman Team Colleague

The JSP will need to have access to the class of course. That means importing the package the class is in.
After that you can instantiate it like everything else.

BUT (and that's a very big BUT) you should really not do that. You should use a servlet for stuff like that and use the JSP (which you should build using JSTL) only for displaying results.

You should at all times strive to write JSPs without any Java code at all.

jwenting 1,905 duckman Team Colleague

Centering the window:

// Center the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        frame.setLocation((screenSize.width - frameSize.width) / 2,
                          (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);
frame.setResizable(false);

turns off resizing of the frame (which also disables the maximise option).

this.setUndecorated(true);

Add this to your frame constructor to remove all windows decorations (including the system menu, window borders, window title bar, etc. etc.).
I don't think you can remove these one by one in Java (but others may know a way).

jwenting 1,905 duckman Team Colleague

I consider correct use of language to be extremely important for people creating software.
After all, software is a description of what a computer is to do written in a language.
If you can't even be bothered to use natural language correctly to communicate your thoughts, you probably don't bother to do the same to that computer.
And if you're incapable of communicating in natural language, you're also incapable of learning the skills needed to communicate with that computer effectively as those skills are passed along in that natural language.

Given that there is a highly disturbing trend of people incapable or unwilling to communicate in natural language using that language correctly and that trend coincides with a similar trend of those same people failing to write software that works, there does seem to be a strong link between the two phenomenon.