7,116 Posted Topics

Member Avatar for dhr

After sorting the array, you just have to compare each entry with the one before and the one after it. The first one that's different from the ones both sides is the smallest unique value.

Member Avatar for BestJewSinceJC
0
824
Member Avatar for neutralfox

So, if you've got two threads executing at the same time, and they both try to use the same object (such as an OutputStream) at the same time, you can get "unexpected" or "unpredictable" results (aka absolute chaos). The synchronised (...) { ...} syntax mens that the current thread tries …

Member Avatar for neutralfox
0
102
Member Avatar for gabec94

Just as a matter of curiosity, I tried putting together a neat/compact version of this for my own amusement, and was surprised to see a strange pattern in the number of iterations needed for different number of decimal places correct. [CODE]Iteration 19 3.09162380666784, correct to ±0.05 (1 decimal place) Iteration …

Member Avatar for gabec94
0
1K
Member Avatar for jacline

Try sticking a couple of System.out.println("step n"); type statements in the listener and the paint method so you can see when/whether they are getting called. That should help you to pinpoint where it's failing. ps: not sure why you have a [iCODE]Draw graph = new Draw();[/iCODE] in the listener - …

Member Avatar for jacline
0
130
Member Avatar for itslucky

I don' t know how to do this via Hyperterminal, but if you use a (free) command line terminal emulator instead of hypercard, you should be able to use it to send commands using the ProcessBuilder class in Java

Member Avatar for JamesCherrill
0
120
Member Avatar for Hockeyfreak889
Member Avatar for Grub
Member Avatar for JamesCherrill
0
151
Member Avatar for deathwishgenius

(String)(Vector) looks unlikely. Whatever it is that follows is being cast to Vector, then immediately cast to String, which won't work. Try defining your Vectors with the appropriate types ,as in [icode]Vector<String> sv = new Vector<String>();[/icode] so you don't have all those horrible casts.

Member Avatar for JamesCherrill
0
105
Member Avatar for curtissumpter

I can't see the bit where you add the TextArea to your JPanel or any part thereof (?)

Member Avatar for curtissumpter
0
586
Member Avatar for leverin4

So, I understand that you need to keep each digit separate and have algorithms that loop along the digits (no matter how many there may be) to give the answer. For the multiply - write down two multi-digit numbers on a piece of paper and multiply them together by hand. …

Member Avatar for JamesCherrill
0
167
Member Avatar for samarthashok

It's saying that whatever class of object that is returned by photoElements.item(iElement) does not have a getAttribute(String) method. (Is id a variable? In which case it shouldn't have quotes round it). You need to look at the doc for photoElements.item to see what it returns, the look at that class's …

Member Avatar for Ezzaral
0
110
Member Avatar for hell_tej
Member Avatar for charlie81
Member Avatar for breandan
0
91
Member Avatar for xVent

YOu can make an executable jar file (google it) that will run when people double-click it, provided they have the java runtime already installed on their machine. If you're using Eclipse or something similar it create it for you.

Member Avatar for JamesCherrill
0
110
Member Avatar for 25kayden
Member Avatar for JamesCherrill
0
116
Member Avatar for add4

[QUOTE=add4;834392]Because i want to block some site.[/QUOTE] Then why not just put a dummy entry in the hosts file?

Member Avatar for Ezzaral
0
92
Member Avatar for jackiejoe

JTable really is the right way to do this, so it's worth the one-time effort to learn about them! Here's a quick sample of what you need to create a suitable table model (I haven't compiled this, so expect the odd typo, but it should be good enough to get …

Member Avatar for javaAddict
0
2K
Member Avatar for denniskhor

I think your last big if test should be all && not || - ie (word not in file 1) AND (word not in file 2) AND ... but I'm not sure. It would help if you used a code=java tag rather than just a code tag so we get …

Member Avatar for denniskhor
0
120
Member Avatar for manfosys
Member Avatar for heysebas

Add methods to the stand-alone classes so their functionality can be called from Java, eg public sendChat(String nick, String message). Then, in the GUI have entry fields for the required data, when the user clicks OK, get the data from the fields and use it to call the functionality via …

Member Avatar for JamesCherrill
0
1K
Member Avatar for K?!

You could create a little class to hold the event description and the database ID (and maybe any other relevant stuff). You can add those class members to the JList, and it will display them by calling their toString() method, so define a toString() that just returns the event description. …

Member Avatar for K?!
0
116
Member Avatar for add4

You don't set the timeout in the constructor, it's an optional parameter on the connect(...) method.

Member Avatar for JamesCherrill
0
108
Member Avatar for ZeRo 00

Do you want the second panel to be open all the time, or do you want it to appear when the user selects a film in the first panel?

Member Avatar for JamesCherrill
0
112
Member Avatar for farhan.foxtrot
Member Avatar for jackiejoe

Yoy seem to be on the right track here - copy the data fromn the TextFields into the fields of your Adult object (using the set... methods, or just putting all the values in the new Adult(...)), then add the Adult object to the array. NB Java arrays begin with …

Member Avatar for jackiejoe
-1
3K
Member Avatar for get2tk

Sounds like you need to send TCP/IP messages between the two machines using Sockets. To get started see [url]http://java.sun.com/docs/books/tutorial/networking/sockets/[/url]

Member Avatar for JamesCherrill
0
62
Member Avatar for ice_cool

tracks.add(new Track()); looks for the constructor Track() but you didn't define one, just one with a whole string of parameters

Member Avatar for verruckt24
0
189
Member Avatar for rsoler

Looks like a job for a regular expression: [url]http://java.sun.com/docs/books/tutorial/essential/regex/[/url]

Member Avatar for JamesCherrill
0
80
Member Avatar for Dhaneshnm

Maybe because your txt value exceeds the 16 char max size that you set for the text box?

Member Avatar for Dhaneshnm
0
214
Member Avatar for SSagar
Member Avatar for Ezzaral
0
493
Member Avatar for neutralfox

Good morning neutralfox. Wow, that server code really has been cleaned up! All you need to do in response to the button being clicked is to get the text from the input field and pass it as the parameter to the server's send method. The only problem I see in …

Member Avatar for neutralfox
0
89
Member Avatar for neutralfox

ss.accept(); blocks its thread waiting for an incoming connection. Because you run that on the Swing thread everything gets blocked, and the whole program freezes until an incoming connection is received. You normally spawn a new Thread to run the accept() in. ps. Its not a good idea to have …

Member Avatar for neutralfox
0
2K
Member Avatar for sammyboy88

You've forgotten to put the values of mouseX and mouseY into the two TextFields

Member Avatar for JamesCherrill
0
78
Member Avatar for jackiejoe

Check that your code for Couple has a setVisible(true) in its constructor

Member Avatar for weblover
0
120
Member Avatar for fraogongi
Member Avatar for JamesCherrill
0
180
Member Avatar for jdbarry

Your cacAveragePrice method needs an ArrayList as a parameter, and when you call it you don't supply a parameter

Member Avatar for jasimp
0
189
Member Avatar for jk_bscomp

[QUOTE=jk_bscomp;824917] If I will run my Server program, the output will be 0:0:0:0:0:0:0:1. [/QUOTE] Is that an IPv6 address?

Member Avatar for JamesCherrill
0
174
Member Avatar for etc123

Sorry to hear that your Google search facility is broken. :icon_cheesygrin: Anyway, I did a Google search for [icode]JDBC ODBC driver[/icode] on your behalf, and this [url]http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/bridge.doc.html[/url] was the very first entry.

Member Avatar for JamesCherrill
0
72
Member Avatar for The 1

Sorry, don't have the time to do much on this, but start with a Card class (52 instances!) and a Player class (that holds a list of the Cards that the player holds, the player's current cash and bet, and has the logic for stick/twist etc). Maybe a Dealer class …

Member Avatar for VernonDozier
0
193
Member Avatar for kjetil4

If you want to read/write an object via writeObject / readObject the object's class must implement the Serializable interface. It's a bit weird, because that interface doesn't define any methods! It's a sort of flag to Java that if you define the class (Archive) as [icode] implements Serialiable[/icode] then you …

Member Avatar for kjetil4
0
633
Member Avatar for koolhoney07

1. Java integers are 32 bits. 2. Java Strings are 16 bits per character 3. To compare them or use the String in arithmetic expressions, you first need to convert the string to integer with something like [icode] int i = new Integer("12345"); [/icode]

Member Avatar for verruckt24
0
2K
Member Avatar for tuse

This may help [url]http://www.roseindia.net/java/beginners/java-create-directory.shtml[/url]

Member Avatar for JamesCherrill
0
95
Member Avatar for blackrobe

compareTo returns -1, +1, or 0 depending on whether the string sorts before or after, or is exactly equal to the other string. You're testing for +1, so that's why you get false "equals". To see if one sting occurs inside another one, use String.indexOf(String), which returns the index where …

Member Avatar for JamesCherrill
0
143
Member Avatar for c0dex

Executing a long-running process in the Swing thread is a big no-no, for exactly the reasons you have discovered - ie the whole GUI hangs up while the process executes. Your only solution is to run the FTP process in a separate thread. Just place the call for your FTP …

Member Avatar for JamesCherrill
0
204
Member Avatar for tazjaime

I suspect that 11 factorial is greater than the maximum value of a Java int (about 2,000,000,000), so you'll have to use a different data type (eg long) to go bigger.

Member Avatar for JamesCherrill
0
202
Member Avatar for PhiberOptik
Member Avatar for llemes4011

Hold x velocity constant, set an initial upwards y velocity (depending on how hard he jumps). In each time interval reduce the y velocity by a fixed small amount (modelling the effect of gravity). As the y velocity reduces to zero then goes negative he will follow an inverted parabola, …

Member Avatar for llemes4011
0
112
Member Avatar for jooa

That's a lot of code to scan, but I can't find anywhere where you actually call anything to do an FFT. And maybe I'm being dumb, but I can't find any code to do an FFT anyway. Can you point me in the right direction?

Member Avatar for JamesCherrill
0
403
Member Avatar for PhiberOptik

As in mouse clicks? Look at the Robot class in java.awt, it allows you to move the mouse, click left/right button etc under program control.

Member Avatar for sillyboy
0
114
Member Avatar for rayda

The End.