jwenting 1,905 duckman Team Colleague

A far better and far more up to date book is Head First Java by Kathy Sierra and Bert Bates.

jwenting 1,905 duckman Team Colleague

exactly what are you trying to install and from where?
Best you go to http://java.sun.com/j2se/1.5.0/download.jsp and download the installation you want.
If you want the compiler, get the JDK, else get the JRE.
Download the offline installer just to make sure it's not something on your network.

Also read the installation instructions carefully, you may want to print them out.

jwenting 1,905 duckman Team Colleague

oh, they can monitor you just fine. After all, every bit of data you use comes in through their servers so they can count them all.

They'll just use a more sophisticated mechanism...

And they may even cut you off completely for violation of contract by blocking their metering software from reporting its findings.

jwenting 1,905 duckman Team Colleague

s=s+"."; ;)

jwenting 1,905 duckman Team Colleague

no. It's an html file containing an insane number of applet instances. It doesn't contain any of the Java code relating to those applets though.

jwenting 1,905 duckman Team Colleague

yes Richard. It's really nice.
Now if only there were Tiger implementations for SCO OpenUnix and AIX we might be able to switch...

jwenting 1,905 duckman Team Colleague

Remember that arrays in Java don't grow so you need to take care of the buffering yourself.

If you move say 5 places to the right, create a buffer of 5 elements.
Move the last 5 elements out of the array into the buffer, then move every element in the array (except those 5) 5 places to the right.
Finally most those 5 elements into the first 5 positions in the original array.

jwenting 1,905 duckman Team Colleague

well, there's probably a function in there that you can use.
But as noone here except maybe you (and I doubt you took the trouble...) has ever seen it we're not going to be able to help you further.

Do your own homework and do your own THINKING. Way too many kids come here expecting to be turned into programming gurus by simply copying sourcecode produced by others and never having to exercise their brains.

jwenting 1,905 duckman Team Colleague

far simpler:
set largest and smallest to the first number.
if largest<second number set largest to second number
else if smallest>second number set smallest to second number
if largest<third number set largest to third number
else if smallest>third number set smallest to third number


It seems you're trying to create a String representing the number to be output?
Try using Integer.toString(int) instead. It's the standard way.

jwenting 1,905 duckman Team Colleague

experiment, that's all I can say. Just having it explained yet another time isn't going to do much good if you don't see the logic yet.

jwenting 1,905 duckman Team Colleague

Of course an array is not a hashtable...
There's a hashtable class in the STL, use that.

jwenting 1,905 duckman Team Colleague

Disconnecting from the internet will mean they get hit even less frequently...

The ONLY reason there's less nasties being distributed through FF is because it's too new and not widely used.
FF gives a false sense of security. There's a spade of critical security holes which are going unplugged, a phenomenon well established in the OS world (after all, making nice new things is more fun than fixing bugs so that doesn't get done...).

FF is far from a decent browser. I've done some testing and it's got serious problems with W3 compliant HTML and ECMA compliant Javascript. Things any decent browser should be able to cope with.

jwenting 1,905 duckman Team Colleague

edlin is a line editor.
That means you can edit only a single line of text at a time.

To find out how it works, go to a commandprompt and type edlin followed by a filename (for a nonexistent file...).
You'll get a prompt. Type a question mark (?) and press enter, this will give you a list of commands.
Some commands will change a line of text or allow you to change it or enter it, others will work on the file.
To cancel edit mode, use Ctrl-Z (F6).

Here's a very short test session:

C:\DOCUME~1\wtg>edlin test.txt
Nieuw bestand
*1i
       1:*hello world
       2:*this is a test^Z
       3:*^Z
*E

C:\DOCUME~1\wtg>type test.txt
hello world
this is a test
C:\DOCUME~1\wtg>
jwenting 1,905 duckman Team Colleague

in other words: use what you can but always be prepared to step back to something older for whatever reason.

jwenting 1,905 duckman Team Colleague

Not really. Many companies are working towards doing new development in 1.5, especially IT shops.
Remember that schools are often way behind the technology curve. Just check the number of threads in the C++ forum from people asking about 15 year old compilers which they are given to use in school.
In the real world those things haven't been used in a decade, yet apparently teachers still think them good enough for classroom use.
As a result these kids will need extensive retraining when they enter the marketplace.

What I'm doing now is using the 1.5 compiler but not the language features.
We compile everything for deployment on a machine running a 1.4 compiler anyway using an ant job.
For experiments I use everything I want :)

So go ahead and learn to tame the Tiger, but keep in mind that in the real world you may as you experience find that you will be faced with older versions (when I started at a new job in 2003 they were still using 1.3, having shortly before upgraded from 1.2. First thing I did there was install 1.4.2. There I had the power, being the in house Java guru, don't expect that in most companies).

jwenting 1,905 duckman Team Colleague

As to washers: remember that the motherboard is grounded to the case through the screws. Washers might prevent grounding leading to charge buildup which can cause serious problems (including shorts and sparking).

jwenting 1,905 duckman Team Colleague

If money's no object an NVidia Quadro FX would be the only card to seriously consider.

Something like this: http://www.pny.com/products/quadro/fx/2000fx.asp
Retail price (special order only) €1600-€1700

jwenting 1,905 duckman Team Colleague

You should never expect to learn anything from just reading a textbook.
You HAVE to apply what you read immediately and frequently thereafter in real programs.

If your book has exercises, DO THEM. If it doesn't, think up some of your own.

jwenting 1,905 duckman Team Colleague

Some additional info after more testing and fooling around...

If the server is not the class implementing Remote you DO need to use rmic and create the stub class. From another example (O'Reilly's networking book)

import java.rmi.*;
import java.net.*;

public class FibonacciServer
{
	public static void main(String[] args)
	{
		try
		{
			FibonacciImpl f = new FibonacciImpl();
			Naming.bind("fibonacci", f);
			System.out.println("fibonacciserver listening");
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
import java.rmi.*;
import java.rmi.server.*;
import java.math.BigInteger;

public class FibonacciImpl implements Fibonacci
{
	public FibonacciImpl() throws RemoteException
	{
		UnicastRemoteObject.exportObject(this);
	}

	public BigInteger getFibonacci(int n) throws RemoteException
	{
		return getFibonacci(new BigInteger(Long.toString(n)));
	}

	public BigInteger getFibonacci(BigInteger n) throws RemoteException
	{
		System.out.println("Calculating the " + n + "th Fibonacci number");
	}
}

This scenario requires the stub to be generated. It does not require the skeleton class when run under Tiger so the lack of that doesn't cause trouble.

jwenting 1,905 duckman Team Colleague

1) this is not the place to ask questions.
2) no we're not going to respond in Italian. You learn English when you want to use an international forum

jwenting 1,905 duckman Team Colleague

Use one partition only.
It makes no sense creating multiple partitions. Your friend was probably thinking about performance when he advised you to create a separate partition for your pagefile but this is useless (in fact it may well be counterproductive).
Had he told you to use a separate harddrive he'd have been correct.

Your machine is quite good. As you don't tell what videocard you have I can't say anything about that :)

jwenting 1,905 duckman Team Colleague

Check out any decent book on data structures, all should have information on defining trees and iterating over them.

You may also look at the sourcecode for java.util.TreeMap or java.util.TreeSet and take inspiration from there.

jwenting 1,905 duckman Team Colleague

Sure you can. You might not be able to run the very latest version (but check the specs and try) but a 1.3 and likely a 1.4 should be able to work just fine (I've run those on Windos NT4 which is as old).

jwenting 1,905 duckman Team Colleague

I'm starting to.
But as our customers are mainly running systems for which no 1.5 JVM is as yet available we cannot start using the new features yet for commercial purposes.

I do plan to probably start for the 1.5 SCJD once that's available after taking the 1.4 SCJP hopefully next month (we've ordered the exam voucher but not received it yet so I can't schedule the exam session right now).

1.5 has some nice new features. The option to create a terse new loop without the need for defining an Iterator or loop counters can be nice if you do a lot of looping (which we do).
Autoboxing and unboxing can save quite a bit of typecasting (at least in theory, we don't use a lot of primitives in Collections).
Generics could save a ton of typecasting though and is one thing I have been looking forward to.
Metadata IMO is a step back and should never have been added. I won't be using it most likely.

Performance seems better too, like each new version the runtime is faster than the previous one.

jwenting 1,905 duckman Team Colleague

there's also an old article on onjava.com about it (posted about a year ago). Tells you some of the things to take into consideration.

jwenting 1,905 duckman Team Colleague

There is a wrapper class Character which can be used to store chars as Objects.
This is equivalent to classes like Integer, Boolean, and Double (among others).
If you're using 1.5 (Tiger, 5.0) that wrapping will be taken care of for you.

If you use the correct Tree from the collections API your sorting will be done for you and all you'll need to do is create an Iterator over the tree (which the Tree can give you) and iterate over that.

The API docs should help you find and use the classes you want.
I find it highly instructive to once in a while just sit back for an hour or so and browse through it. Despite having used Java professionally and fulltime since 1999 I still find things in there I never knew existed.

jwenting 1,905 duckman Team Colleague

well, in low temperatures different liquids can be substituted.

In fact your idea isn't as farfetched as you think. It is entirely possible to create calculating machines in hydraulic circuitry and such has indeed been done.
While not entire computers AFAIK, things like flipflops and transistors have been created using hydraulic and pneumatic (which is closely related, using gasses instead of liquids) components.

jwenting 1,905 duckman Team Colleague

Intro

I've been fooling around with RMI today for fun and learning and got some serious headbanging when I couldn't get any of the examples I have in books by respected authors to work with JDK 1.5 (a.k.a. Tiger). All tutorials and examples on RMI say you should run rmic on the serverside objects you register in order to create stub and skeleton classes.

Yet if you do this with the 1.5 version of rmic you will

  1. not get a Skeleton class
  2. your server will not run, with an obscure error that the stub class (which IS generated) can not be found

Some serious delving into the JDK release notes told me that the skeleton class is indeed no longer created by rmic using the default options. It also hinted at the stub classes now being created by the JVM on the fly when you run the server and client applications. From this I theorised that my fault had been following the printed examples (all written for J2SDK 1.4)...

Time to put theory to the test

I deleted the generated _Stub class, crossed fingers, and started my server. Surprise surprise, it worked just fine. Next came the client (for the occasion moved to a different directory). It too worked as expected and called the server to get a response which arrived and was printed.

Now for some code :D

Step 1: define the remote interface

This can be any interface …

jwenting 1,905 duckman Team Colleague

You're working in C++. C++ has operator overloading.
You're working on a mathematical addition operation. It makes in this context perfect sense to define an operator in (or as a friend of) your complex class.

As a start I'll give you the headerfile for a complex number class I implemented for fun a while ago.
The implementation of the methods and operator is trivial and I leave that to you.

#include <iostream>

using namespace std;

class complexNumber
{
private:
	float real;
	float imag;

public:
	complexNumber();
	complexNumber(float rPart, float iPart);
	~complexNumber();

	complexNumber operator+(const complexNumber& c);
	complexNumber operator-(const complexNumber& c);
	friend ostream& operator<<(ostream& s,  const complexNumber& c);
};

When properly implemented you can use the following testcode on it:

#include "complexnum.h"

int main()
{
	complexNumber t(1, 1);
	complexNumber t2(2, 2);
	complexNumber t3 = t + t2;
	cout << t << endl << t2 << endl << t3;
	return 0;
}

As you see I created not just a + operator but also a << operator so I can output a complex number directly and consistently.

The output of that small program should be

1+i
2+2i
3+3i

jwenting 1,905 duckman Team Colleague

nah. Plug the date into a Calendar and get the correct field out of it...
Something like

Calendar calendar = new GregorianCalendar();
calendar.setTime(birthdate);
int dayOfBirth = calendar.get(Calendar.DAY_OF_WEEK);

The biggest mistake many beginners in Java (or most languages) seem to make is to not study the standard library.
It contains a TON of very handy utility classes that can really make your life easy.

jwenting 1,905 duckman Team Colleague

The best way would be to search the net for existing components and purchase one of those.
Writing all that stuff from scratch is very likely to be more expensive than picking something that suits your need off the shelf in some online store.

jwenting 1,905 duckman Team Colleague

the trite answer is indeed the one true answer.
Anything that's not in the standard docs is non-standard.

A slightly more concise answer would be that as long as you keep to what Stroustrup describes you should be fine.

jwenting 1,905 duckman Team Colleague

recursive function would be my choice. Far cleaner.

jwenting 1,905 duckman Team Colleague

Sure. You can create a program that mimmicks the actions a human would take.
You'll need to do quite a lot of stuff with HttpURLConnection, URL, and classes like that though.

Beware though that site admins won't like it and may well ban you permanently if you do it.
It's a technique used mainly by spammers...

jwenting 1,905 duckman Team Colleague

and actually write some code...
Just putting a few {s and }s and a void or two into your assignment doesn't constitute an effort...

jwenting 1,905 duckman Team Colleague

Apple or *NIX? :mrgreen:

No, a computer without a powersupply :cheesy:

jwenting 1,905 duckman Team Colleague

this is hardly a tutorial...

There is no way to send SMS from any language without special hardware.
Usually what you do is you contract a company that has the hardware to send the messages for you, and they provide you with an API which you can use to send them the messages to be sent.
You will then get charged per message and probably have to pay a subscription fee as well.

If you expect the volume to be very high it may be worth buying the hardware yourself and contracting directly with a mobile phone network to be allowed to send messages on their network.
You'll then be provided with the necessary APIs to control the hardware by the hardware vendor.
Again you're going to pay a fee per message and a subscription fee but these will be lower.

jwenting 1,905 duckman Team Colleague

What exactly do you want to achieve?
Do you want to continue processing a request received in one servlet in another one or do you want to include the result from one servlet call into the result of another?

If the first, you need only 2 lines of code:

RequestDispatcher rd = request.getRequestDispatcher(dispatch);
rd.forward(request, response);

(dispatch is the URI inside the same web application you are forwarding to).

If the second you have more work to do, probably involving an HttpURLConnection and some Streams to capture the result.
You may want to do that in a separate thread as well and somehow be notified when you have retrieved all the information.

jwenting 1,905 duckman Team Colleague

The object that first uses the object in synchronised code owns the lock.
There's no easy way to find out what that is, you'll need to diagnose your code to figure out in what places objects are used in a concurrent way and then figure out a means to deconflict them.

Better of course is to design your code from the start to make deadlock impossible ;)

jwenting 1,905 duckman Team Colleague

It's all hardware related (apart from my AV, firewall, mail- and webservers).

With 4 harddrives, a DVD burner, and a dozen USB devices, it just takes time for all that to power up and have their drivers loaded.
After that it's mainly the DSL which takes a while to come up, which delays the startup cycle of my mailserver and firewall.

jwenting 1,905 duckman Team Colleague
#include <string>
jwenting 1,905 duckman Team Colleague

For one that will only work on Windows machines, not anywhere else.
Try to write Java code to be platform independent...

Look at the class System for a method getProperties().
This will retrieve the system properties which, among other things, contains a reference to the current working directory as well as to the current user's home directory.

jwenting 1,905 duckman Team Colleague

Such things are pyramid schemes.
Pyramid schemes are illegal.

jwenting 1,905 duckman Team Colleague

I don't have the facts to determine whether or not the man is giving money to terrorist groups. I do know that both the Israel and US claim he is, but I also know that the terrorist rumors began to surface after a quote taken from him in a speech in the 80s. He claims the quote is false.

I learn more toward him not being a terrorist, because his messages all appear to be peace, and I happen to really like his music. It wouldn't be as much fun jamming to him if I knew he was a terrorist. :/

Remember that Arafat preached peace for decades even while launching terrorist attacks on Israel.
In his book (which is the PLO charter) peace means "a world under Islamic rule where there are no Jews or Christians".
The USSR preached peace which in their vocabulary meant "communist world domination".

I don't say he was a terrorist just that his acts and statements were of a nature which make him a likely suspect for being a terrorist sympathiser and maybe a fundraiser or recruiter.

And yes, I know not all Muslims are terrorists, just as not all Christians are IRA members.

jwenting 1,905 duckman Team Colleague
while (amount < 1000000)
{
  add interest to amount
  increase age
}
jwenting 1,905 duckman Team Colleague

they're nice but more than I'm currently willing (or able) to spend on something that won't be my main machine but rather an experiment.

thought the Imacs would be rather too slow to be useful, after all why else are they being dumped in numbers ;)

jwenting 1,905 duckman Team Colleague

So all you need to do is find out how to most efficiently give change?

How do you determine what combination of coins and bills to use in a store? All you have to do is put that reasoning into code.

Say you give $1.26 in change.
How many dollars is that?
When those are gone, how many quarters are there in the leftover amount?
etc. etc. etc.

It's not hard.

jwenting 1,905 duckman Team Colleague

The performance penalty alone is enough reason.
The rest is historical. Until recently Vector was not part of the Collections framework. It still is an oddball with regard to implementing methods of the framework.
Personally I don't understand why Sun didn't just deprecate the class seeing as a perfectly functional alternative is available.

ArrayList is a far cleaner as well as better performant solution.

jwenting 1,905 duckman Team Colleague

arrays are fixed size...

jwenting 1,905 duckman Team Colleague

Check the collections API, there are some sorted implementations you can use.
No sorted List is provided but it isn't that hard to make one if you use another collection to back it which is sorted itself (or use that one directly if you have no need of the List interface per se).

And before I forget: don't use Vector. It's an old relic and has long since been replaced by the far more efficient ArrayList.