jwenting 1,905 duckman Team Colleague

You'd put the data in your web.xml or a properties file.
The username/password Tomcat stores is just for login to Tomcat itself (for sites that have authentication enabled) and then only if that authentication uses the default system (you can tell it to use different authentication systems like LDAP as well).

jwenting 1,905 duckman Team Colleague

dump the .newInstance(), it's superfluous.

Without knowing the actual error the cause of the problem will always remain guesswork.
But most likely you either don't have the correct driver or the database doesn't allow you to connect.

jwenting 1,905 duckman Team Colleague

That's illegal SQL if you want to set only a subset of the fields (which you want, as you aren't setting the PK field).
You have to supply the actual fields you're setting as well, and in the correct order.

jwenting 1,905 duckman Team Colleague

In most environments username, password, and database url (as well as the actual driver) are stored separately in a configuration file that's not maintained (exclusively) by the people building the application.

It's far easier for a DBA or systems administrator to change a properties file that has a username, password, URL, and driverclass entry than a single very large string.

Most ORM frameworks and other abstraction layers (which you really should use when doing for real database access) also expect them to be separate for that reason.
For example, JBoss expects the following configuration file for a Firebird database (the username and password are the defaults Firebird gets installed with, so everyone who knows Firebird should know about them, thus I'm not divulging secrets here ;)):

<?xml version="1.0" encoding="UTF-8"?>
<datasources>

  <local-tx-datasource>
    <jndi-name>TitanDS</jndi-name>
    <connection-url>jdbc:firebirdsql:localhost/3050:titan</connection-url>
    <driver-class>org.firebirdsql.jdbc.FBDriver</driver-class>
    <user-name>SYSDBA</user-name>
    <password>masterkey</password>    
    <min-pool-size>5</min-pool-size>
    <max-pool-size>20</max-pool-size>    
      <track-statements/>
      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
      <metadata>
         <type-mapping>Firebird</type-mapping>
      </metadata>

    </local-tx-datasource>
</datasources>
jwenting 1,905 duckman Team Colleague

hmm, the blatantly obvious: check whether the method actually exists in the same class you're calling it from.

And of course rename RenameImage to renameImage.

jwenting 1,905 duckman Team Colleague

also, ALWAYS close database resources after use.
And your connect string looks really weird.
Normally you'd pass username and password separately.

jwenting 1,905 duckman Team Colleague

I'm not talking open source here, just common sense.
The best protection for your intellectual property is not letting it out the door.
If that's not possible, make sure your customers know what they're licensed to do and what the penalties are for doing things they shouldn't (like decompilation and illicit redistribution).

jwenting 1,905 duckman Team Colleague

No, exes too can be easily decompiled and the source analysed (by someone who knows how).

ALL programs can be decompiled by someone who is determined enough.
The only reason some people ship what looks like executables when they ship Java programs is to enable them to be run on systems that have no JVM installed.
If you were to analyse those exes, you'd find that they're typically a JVM with all the classes added to the end as a jar file that's just copied into the exe and deflated at runtime.

Simple fact of life: The vast majority of peope couldn't care less about decompiling your program.
The vast majority of people (usually kids, almost never professionals) who think they need to "secure" their classes write code that's completely uninteresting to anyone who would look at it. There's nothing very clever or groundbreaking there that would give someone a business advantage for example.
The rest won't be stopped by anything.

If you don't want people to ever have the ability do decompile and read your sources, don't ship them.
Deliver your product/service through a web interface for example, or as a SOAP service.

jwenting 1,905 duckman Team Colleague

That's correct.
You fell into the well known trap of starting a longrunning operation from the AWT eventhandler thread.
Start it from another thread and pass it a reference to the label.

jwenting 1,905 duckman Team Colleague

start your own threads, kid.
And read some tutorials... What you want is
a) well described
b) inappropriate for doing in Java (unless you're using a database engine that uses Java stored procedures maybe).

jwenting 1,905 duckman Team Colleague

You really need to read a modern beginner's tutorial on Java and an introductory text on regular expressions if you can't answer those questions.
They're so basic any ultimate beginner's text should explain them.

By indicating you don't know what it is, you indicate you lack even basic knowledge, which just a few quick answers here won't provide (you'll just get stuck on the next question, and have to ask again, while doing some study of your own will give you the entire picture).

jwenting 1,905 duckman Team Colleague

start small, learn the individual technologies and see what their strengths and weaknesses are, then combine the strengths so you aren't bothered by the weaknesses ;)

In reality noone talks about "beans", they're just objects you use to pass data along.
That doesn't mean noone uses them, but they're so prevalent it makes no sense to treate them differently from other things (the BDK is dead and burried for years).

In a professional environment you'd use JSP solely for displaying data provided to those JSPs by servlets via objects set in the request or session. Those JSPs should use JSTL or JSF, no scriptlets at all.

The servlets may call EJBs to perform business logic, themselves doing nothing but forming a layer that translates between the JSP and the EJB and channeling data to the proper places, or they may contain business logic as well (usually delegated to helper classes).

In reality most people don't use raw servlets and EJBs directly, instead using frameworks to put everything together.
Spring is an excellent (and popular) framework.
Struts used to be popular but has pretty much lost its appeal by now (and rightly so).
Hibernate is also much used.

jwenting 1,905 duckman Team Colleague

And another problem: your insert (if it's executed at all, which is unlikely) doesn't get comitted to the database.
That means it's visible only to the current database session and will be undone when that session terminates.

I suggest you follow Sun's JDBC tutorial or read a GOOD introductory text about Java and JDBC.

jwenting 1,905 duckman Team Colleague

executeQuery cannot be used to execute anything except select statements.

And you shouldn't use scriptlet blocks in JSPs, it's considered very bad, leads to hard to read and harder to maintain code.

jwenting 1,905 duckman Team Colleague

check your URI for a small typo.

jwenting 1,905 duckman Team Colleague

if you feel it is, it might be ;)

jwenting 1,905 duckman Team Colleague

qwerty beelzebub buzzword gobbling froobs.

jwenting 1,905 duckman Team Colleague

it has nothing to do with JSP either (and anyone doing something like this in a JSP should be shot, preferably in the gut, and left for the vultures).

jwenting 1,905 duckman Team Colleague

where do you change orderNum in order to ever leave the recursion?

jwenting 1,905 duckman Team Colleague

installing Tomcat can be (if you don't need anythin fancy, and you don't for learning) as simple as unzipping the distribution archive somewhere (whereever you like).

jwenting 1,905 duckman Team Colleague

Anything you write in XSLT could be implemented using SAX and DOM,

but why reinvent the wheel (as you'd effectively be making something similar to XSLT if you wanted any flexibility)...

XSLT is relatively easy to learn (though hard to master), reasonably fast (if you know what you're doing), and extremely flexible.

jwenting 1,905 duckman Team Colleague

his Circle class only has a no-argument constructor ;)

jwenting 1,905 duckman Team Colleague

that might be easier to program, but it's not a desirable solution.
If the file gets larger it will inevitably be a LOT slower than modifying the existing file.
It could also easily lead to out of memory errors.

jwenting 1,905 duckman Team Colleague

XSLT is the tool for the job, you just need to write an XSLT stylesheet to perform the transformation you want, and away you go.

How you write that XSLT is the tricky part, books have been written about it. It's a complex programming language in its own right.

jwenting 1,905 duckman Team Colleague

It is the correct number. Remember most things in Java are zero based :)

jwenting 1,905 duckman Team Colleague

if the DrawingTool class draws with the forward() method it might...
I've never heard of that class so it's hard to tell.

jwenting 1,905 duckman Team Colleague

I've also seen 10+ year old software in use in even large (multinational large) companies...
So it's pretty likely that BC 4.5 is in use somewhere to this day, in a similar niche market as your market for DevC...
But with free and cheap versions of major implementations (Borland and Microsoft both for example) being available for commercial use now that's likely to change (though there's a lot more market for BC 4.5 out there than DevC as it can do DOS and 16 bit Windows development, which are handy for things like PLCs).

jwenting 1,905 duckman Team Colleague

and no company uses Dev-C either.

jwenting 1,905 duckman Team Colleague

His problem is almost certainly not caused by using TC 4.5 (which though old is still somewhat servicable and can produce 32 bit Windows code) but by a bug in his code.

jwenting 1,905 duckman Team Colleague

you could start by reading the manual, it usually contains instructions to do things like use the product.
If you can't read, you might want to have someone sign you up for classes to learn that first.

jwenting 1,905 duckman Team Colleague

You're both despicable.
You're destroying company property and wasting company time.
You should both be fired on the spot.

jwenting 1,905 duckman Team Colleague

You can't run ASP inside a JVM.
You can make an HTTP request to the server from which you got the applet, calling the ASP, and do something with the result.
Assuming of course you're hosting your applet on a server that can execute ASP.

jwenting 1,905 duckman Team Colleague

Tomcat comes with some rather nice examples which would answer your questions.

You will also want a GOOD MODERN book about JSP, like the latest edition (3rd edition) of O'Reilly's Java Server Pages book.
You'll also want something on good web application design (to avoid falling into the trap of putting business logic into your JSPs.
O'Reilly's Head First Servlets and JSP is a good choice for that.

jwenting 1,905 duckman Team Colleague

Easy way to check:
IF Java used pass by reference the following would work to swap 2 numbers:

public void swap(int a, int b) {
    int c = a;
    a = b;
    b = c;
}

As it is that method does exactly nothing outside the method.
In C++, which has pass by reference (though it's not the default), you can do this and it works:

void swap(int& a, int& b)
{
    int& c = a;
    a = b;
    b = c;
}
jwenting 1,905 duckman Team Colleague

Yes, this is similar to my reply. Strings cannot be changed. Therefore to change a string you have to make a new one. You will have 2 different strings in the heap.

No, you don't understand the difference between pass by value, pass by reference, and immutable variables.

Strings are immutable but if Java employed pass by reference that wouldn't matter.
It also doesn't matter in reality where Java employs pass by value exclusively of course.

jwenting 1,905 duckman Team Colleague

read some Unix tutorials.
This has nothing to do with Java per se, but core operating system knowledge.

jwenting 1,905 duckman Team Colleague

well, you're not using the official JDK there.
Check your $PATH and $JAVA_HOME environment settings and make sure they point to your JDK installation.
As it is you're pointing to gcj which is to put it bluntly a disaster, I'm surprised you got anything to compile and/or run under it at all.

jwenting 1,905 duckman Team Colleague

Sure, but to expect to magically find that "one" by visiting a website....

jwenting 1,905 duckman Team Colleague

Whatever happened to just being yourself?
If you need some company to arrange a mate for your and a book or website to tell you how to "snatch them up", maybe you should better stay single.

jwenting 1,905 duckman Team Colleague

Or any of a lot of others. This is a very common example of the networking capabilities of Java used in many programming courses either as an assignment or as a case study.

The fun is figuring it out yourself rather than taking some ready made solution and trying to make it look like something you made yourself ;)

jwenting 1,905 duckman Team Colleague

I think I got 8, but it may only be 7 (the 8th might be an optical illusion).

jwenting 1,905 duckman Team Colleague

And it's not an isolated case either. I've heard before of people committing minor crimes just so they can get arrested and spend a few days in prison where it's warm, they have a shower, and get 3 meals a day rather than having to spend their days out on the street where it's cold and you never know if you will have food.

jwenting 1,905 duckman Team Colleague

Interesting discussion on Volokh.com about this: http://volokh.com/posts/1160717822.shtml

jwenting 1,905 duckman Team Colleague

yup, run your own servers. Easiest when learning as you can try different configurations and servers without having to bother with uploading things, remote logins, etc. etc.

Tomcat is nice, but I'd use Firebird instead of mySQL for the database. Smaller, easier to install and use, and more friendly on your RAM and CPU.
That and it's got a far stricter SQL implementation, making it better for learning databases.

jwenting 1,905 duckman Team Colleague

Oh no, not another kid who can't think for themselves.
Whatever happened to originality and coming up with your own ideas?
Why not just ask people to post a complete project plan with full implementation right away so you don't have to bother posting other questions after you get someone give you an idea for a project asking to first create a project plan for you and than to create the code?
After all, you know as well as I do that that's what you're going to do next.

jwenting 1,905 duckman Team Colleague

There is no "best", at best there might be a "best" for some specific purpose.

I constantly wonder why people can't get that simple fact into their brains (or what passes for one).

jwenting 1,905 duckman Team Colleague

yup, cliche.
Both the question and the (rather obvious) answer have been posted too many times to count and as usual the person asking the question can't be bothered to do his own research towards finding that answer.

jwenting 1,905 duckman Team Colleague

It's a sheet made by women in small jungle villages on Java on homemade looms.

jwenting 1,905 duckman Team Colleague

That's a different question :)

For your first, you need to learn about classpaths. That's well described in any decent beginners' book, no need to repeat that here.

For the second, that all depends on the version of Eclipse. But when you select a class to run you can also supply parameters to it in the runtime configuration dialog.

jwenting 1,905 duckman Team Colleague

Nope, keep only the latest unless you have a very specific need to have an older one (like I do, we have some code which MUST be compiled with an older compiler for now until it is either reworked or the machines it runs on upgraded to a new runtime).