Okay, and your question is?
If you read the API docs for ArrayList you will find a method for retreiving an Object at a specific index. Use it.
Okay, and your question is?
If you read the API docs for ArrayList you will find a method for retreiving an Object at a specific index. Use it.
And that is still attempting to insert text into a number field.
You shouldn't be using scriptlets anyway. Those are maintenance nightmares. Break that stuff out into a bean.
Edit: And, if you were to use PreparedStatement (like you definately should be) and not cobbling together a statement like this (which is error-prone and an exterme security risk, it makes SQL Injection attacks just oh so easy), you could avoid this problem all together.
Ensure the jarfiles that contain them are on your classpath.
And your question is?
That exception usually comes when trying to insert to (or query in a where clause against) a number field using letters and not digits.
Edit: I.E. 'Z' instead of 0
PS: By the way, what is that counter for and how it is different from the reputation points?
On your profile page is a new "helpfulness percentage rating". These ups and down go toward that (the reputation still exists alongside this though, and these don't seem to affect that).
Well, that is how things are done.
ProcessBuilder
Or study up on the file format of rpm's and write a parser.
Or google and see if a "Java RPM API" already exists.
package thisIs.a.valid.packageAnd;
public interface MyInterface {
}
There is a "sticky" thread at the top of the Java Forum. Start there.
so with an array, say you set it to 10, and you dont use all 10, you will get an error on compiling.
No. But it will if you to try to add an eleventh.
arrayList makes the array the right size based on what you putting into it?
No. It creates a small array (internal to the class, I believe the default size is 10), then when you go to add an eleventh item, it creates another array of 10 (or possibly one of 20 copying the items from the first, but I'm not sure, I'd need to check the source) when you go to add the eleventh item, and another when you go to add the 21st, etc, etc, etc. But you, as the programmer, do not need to worry about that, as you see only a single index.
Well, put it into a Class and try it out. Do the instructions say you actually need to do anything other than make it compilable (and remain functional, of course).
This is your quiz (you could, at least, have left off the question which makes it undeniably a quiz/homework question).
What do you think is wrong with it.
Correct, and, as I said in your other thread, it is because the image file (as referenced there) doesn't exist. Read the API docs for the getResource method carefully and completely.
It probably means that the image you're trying to load doesn't exist. To change which image you're showing you need only change the image file you're loading, of course.
And your question is?
I can tell you that the "nextLine" call should come right after the print to which it corresponds, though.
The point of all this is?
if (readLine.equals(pattern)) {
...
Of course.
It is a container, like a panel. How do you use a JPanel?
The second option is better as "\n" is platform specific and is not always guaranteed to get the effect you wanted.
Of course, you can place the two "parts" on their own panels and simply give those panels line borders.
Start your own thread.
It provides a sliding bar, not a scrolling bar, that "resizes" the two panels. You can, however, fix the slider position thereyby creating the exact "divider" that you want. You simply need to place each "half" on it's own panel, and those panels as the two "parts" of the splitpane.
Did you use it, or only instantiate it?
JSplitPane?
No. I am not going to do your homework for you. You already read lines from the user in that code and I can guarantee you've already used an if statement at somepoint in your course. You can at least make an attempt at doing your own hoemwork. Then again, I can pretty much guarantee that this isn't your code either, and so you are lost in the woods. Well, you've been given enough hints to at least be able to find the edges of those woods on your own, and you are going to have to do that before I give you anything more.
An if statement? Using the equals method of String?
You need to take a third input, right? So start with that, then maybe you can figure out how to continue.
With an actionlistener, some JDBC code (that runs in a different thread), and an SQLQuery.
That is what I said, that super() is added by the compiler, if you don't add a super call yourself. I simply illustrated what the code effectively was. In fact, if your classes looked like this
public class ClassA {
public ClassA(String s) {
System.out.println("Class A constructor " + s);
}
}
public class ClassB extends ClassA {
public ClassB() {
System.out.println("Class B constructor");
}
public static void main(String[] args) {
new ClassB(); // explicitly call ClassB constructor
}
}
You will get the compiler message "Implicit super constructor ClassA() is undefined. Must implicitly invoke another constructor."
Because the first line of every constructor, is a call to a super constructor. If you do not add it yourself (i.e. call a specific super constructor) the compiler automatically adds a call to the default constructor of the super class. And, yes, obviously, this call will finish before the constructor in which it is to be found. To be complete your code is actually as follows:
public class ClassA {
public ClassA() {
super(); // the default constructor of Object
System.out.println("Class A constructor");
}
}
public class ClassB extends ClassA {
public ClassB() {
super(); // the default constructor of ClassA
System.out.println("Class B constructor");
}
public static void main(String[] args) {
new ClassB(); // explicitly call ClassB constructor
}
}
That is definately not what you want. Look at the File class, it's listFiles() method, design an icon for each "filetype", add an actionlistener to this "button", and with that actionlistener, open a JDialog. On that JDialog place the icons.
There is not a "one-click" solution to this, unless you use JFileChooser. That is the only "folder displayer" in the Swing arsenal that I am aware of. Any other view you will have to do yourself.
An actionListener that opens a JDialog, but you'll have to create your own "view".
Open command prompt and type
java -version
That is the JRE version, not the JDK version.
javac -version
No, you can't. You need to either create a new thread for each file, which is wasteful, or create and pass a list of files, rather than just one. Or, have the thread, essentially, ask for the next file (i.e. call a method in the "main" class to retreive the next file to work on).
The JDK is the Java Development Kit. It contains the compiler, the packager, a profiler, a previewer, and other tools, as well as a complete JRE.
The JRE is the Java Runtime Enviroment, basically the "java" command.
The JVM is the Java Virtual Machine. This is what you start when you type "java ...", and it then loads and "executes" your classes.
That is an OS question. On linux simply add an & to the end of the command. On windows, prefix the command with start (I believe).
Do you have a question?
java test.Main
not
java test\Main
I had figured it out finally ,actually i only need to add a new Data Source under System DSN categories of ODBC Administrator,then point the Database to the AddressBook file.Anyway, thanks for ur help.
In other words, before posting here, you had not created an "AddressBook" DSN. You would be better off (if you insist on using Access at all) in investigating DSNless connections, however.
Did you create an "AddressBook" DSN?
If not do so or Google "DSNLess connections".
Because you need to "extend" it a bit further. I never said that was complete. I am not here to do your homework for you.
n1.prev.next = n2
n1.next.prev = n2
n2.prev.next = n1
n2.next.prev = n1
And I'll leave it to you to figure out whether this goes before or after that above.
Edit: And to figure out whether or not it will need any "special" handling if the two nodes immediately follow one another.
The concept is fairly simple, when you can use "temp" references. It's when you can't that it gets hard.
n1 = getNode(idx1)
n2 = getNode(idx2)
temp = n1.next
n1.next = n2.next
n2.next = temp
temp = n1.prev
n1.prev = n2.prev
n2.prev = temp
This is, of course, not thread-safe, though.
This suggests that you should not be creating an array with all the combinations if you don't have to; and you don't have to!
You can simply check each UC/LC combination in turn as you generate them, without any need to store them all. Change the method to something like:
public boolean checkCombinations(char[] word, String encryptedPassword)
That is, essentially, my first suggestion, except to pass all the encrypted passwords (assuming there would not be millions of them), so that each "mutation" of the word only need occur once. ;-)
it won't clear all the space, but will free up whatever's not in use.
Just a note, the JVM itself must do this before it throws a Heap Exception. An OOME Heap Space full will never be thrown due to unreclaimed heap space. Only due to all of the heap space being actively used.
That's what I think I'm doing for the most part. I think I run into problems with words like "dichlorodiphenyltrichloroethane". It's the longest word I have, with 31 letters. So it has 2, 147, 483, 648 combinations by itself. Am I allowed to make arrays that large? I have a
public String[] getCombinations(char[] word);
function that would return an array of size 2, 147, 483, 648, with each possible combination of letters stored inside each array slot.
I made an error in my initial calculations. There are a total of 8, 348, 224, 722 possible combinations in the word file, not 181 million...
I've made arrays with millions of memebers (I had Gigs of memory available though).
You are going to have to show more code.
Sounds like your "temporary" string array may not be so temporary.
But, seeing as how the "password" file is not large, I would read the file completely and keep it's contents in memory, then start with the first word in the "dictionary", compare it in it's original form to all passwords (removing the password from the "to search" list and adding it to the "found" list as soon as it is cracked), then "mutate" the first word to it's next possible configuration and check it against the passwords.
IOW, create two lists, read the encrypted passwords from the file and add them, in encrypred form, to one list. Then take the first word, encrypt it, compare it to the encrypted words in the list, placing the clear text word in the second list and removing the password from the first list when a match is found. Then mutate that word and encrypt it again, and check again. Rinse, lather, repeat, right down the line of words (for a brute-force check) until the first list is empty. There is no reason to keep all the mutations in memory.
Have you done those things that are listed in the exception?
Check any firewalls. Check that the DB is running. Check that the DB is configured to accept TCP/IP connections and that it is actually listening on the port mentioned.
If you are unable to do those things, then find a Microsoft forum to ask how.
So
1. is there any standard java notation having the binding idea?
I thought I just said no to that.
2. do you have any other ideas?
thanks
Yeah, use setText() and getText.
There is no reason that the setting of the value, and the updating of the textfield (and vice versa) can't take place in the same method so that doing both is still just a single method call.