masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use the Oracle JDBC Driver not the JDBC-ODBC Bridge.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nevermind that. See the link anyway.

See this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can try getting it from the UserAgent (google that), but many times that is not provided (due to varying user security settings). You can try planting some JavaScript onto one page and posting that info to the next link, but security settings may prevent this, as well. IOW, that is one of the things that is, many times, hidden.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The description says, however "removing indices greater or equal to s".

Also, start from the end of the list and move forwards. When you start from the "front" (or from the index to remove) the following happens.

List -> 1 2 3 4 5 6 7 8 9 0
Remove index 4 (the 5) and increment the index to 5
List -> 1 2 3 4 6 7 8 9 0
Remove index 5 (now the 7) and increment the inde to 6
List -> 1 2 3 4 6 8 9 0
Remove index 6 (now the 9) and increment the index to 7
List -> 1 2 3 4 6 8 0
End because the index is beyond the end.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, lets see what you've tried. But really, all you need to do loop from the end of list forwards until you reach the provided index.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

call repaint and/or revalidate on the componentPane after calling setVisible.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
rm `ls | egrep -v "(20110225104849|20110225104833|20110225104848)"`
masijade 1,351 Industrious Poster Team Colleague Featured Poster
set i=84
while [ $i <= 92 ]
do
  # whatever
  i=$(($i + 1))
done

or stick with the first version. What you don't seem to understand is that ".." is an operator (just like "+" is an operator) defined in Perl. It is, as you can see above, not available in Shell. It is a Perl language feature.

deepakkrish commented: Thanks for the ans +2
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because it is assuming that numbers that start with 0 are octal numbers. ctal numbers can only have digits from 0-7. If you only want to move files where the number is greater then 030 do

mv *[3-9][0-9].jpg *[1-9][0-9][0-9].jpg destination
rhoit commented: it was fast! +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Package it as a jarfile.

See this and this. As always the Tutorials nearly always help, even with this.

Nahiyan commented: Clear concept +2
masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's pretty clear to me. You are trying to compile something as though it where source code using JDK version 1.4 when it is actually code that needs a JDK of 1.5 or higher.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What does the method signature

public int getorder()

mean? And does the method actually fulfill that contract?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

if you want to display the buck object, you would do this:

System.out.println(buck.toString());

Actually, it is unnecessary to call toString in a print statement. The print statements (print and println, not sure about printf, though, I should probably look into that) as those methods automatically use String.valueOf(argument), which, for Objects, turns arund and calls toString() on that Object, itself. ;-)

Edit: He is getting the output he is getting because he hasn't defined his own toString() method, and so Object's toString() method is being used, which produces the output you see. (P.S. this line was more for the OPs benefit, as I am fairly sure you know this already. ;-) )

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am happy to pass on my knowledge (as pitious as it is), I just don't like doing other's work for them. ;-)

Edit: And I expect a bit of effort. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As I said, I had to do research, specifically on the charAt feature. It’s like a substring, and can be use to target a specific character in a string, and only that one character in the string; in this case since a variable is used it targets the character in the string based on the current value of the variable, which is based on the iteration of the for-loop.

In the first pass, the variable is equal to 0, therefore (i) is equal to
0, which points to the first character in the string. Given the input name of Jason, then (i) points to the (J) only for the myName.charAt(i) code.

Correct, charAt(0) points to the first letter (Strings are "zero-indexed", as are all arrays in Java, and a String is, essentially a char array. "zero-indexed" means the index of the first position is 0, some languages are "one-indexed").

It will then examine the myName.substring(0, i) code, and since the variable is 0, the substring method is (0, 0). Here, the static (0) should now capture the (J) and nothing else, and the variable (0) captures spaces, but it looks to me only spaces are captured for this pass. I don’t quite understand this.

Not quite, almost though. the two substring arguments are, respectively, inclusive, exclusive. That means the first argument is the actual index of the first character to be "read". The second argument is the index after the last character to be read. This means that substring(0,i) …

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the documentation for your web container.

Edit: If it is that it is a service from some third party provider, than ask them.

Shanti C commented: thanks for your quick response. +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. You can use the "length" together with a for loop and combination of two calls to substring with each iteration.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well now, that's more like it. See those brackets "[" "]"? Those are not legal sql. That is MS stuff.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This is not the code you're running considering the message

syntax error at or near "["

Edit: Not that you should be using scriptlets at all. And also most definately not be loading the driver and getting a new connection with every page load, use a pool.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It is the "path" on which "class"es will be searched for by the jvm/compiler.

Edit: And don't do this on the system environment CLASSPATH variable. I know I have told you this already, if running from a web container/app server place jars in the META-INF/lib directory (usually), if running/compiling from an IDE add the jars as references/libraries in the project properties/preferences for that project, if running from the command line using the -jar option then properly define the classpath attribute in the manifest file, if running/compiling from the command without the -jar option then use the -cp option.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use the method getResource which will return a URL to the loaded properties file so that you can use that url to both load and later store the properties.

Edit: Assuming, of course, that the URL returned is a "file:" url, if not you will not be able to store them back into the original location, so your program should check that to.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. Closing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If it is a text file, BufferedReader, if it is not explicity a text file BufferedInputStream, like always for reading files. For "removing" the "#", the replace method of String, for writing the file BufferedWriter or BufferedOutputStream using the same consideration, respectfully, as used for Reader/InputStream. Now at least try to write something.

newcoder310 commented: Crystal clear +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, you've declared name and color to be static. What does static mean?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because Component is an awt element not a swing element. Cast to JComponent.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Make one up and then use the ftype and assoc commands to create the associations (on windows, on Linux you probably need to use the "control panel"). Google those commands.

Edit: And, if you wish to "deploy" that association, then make sure whatever "installer" maker you have can handle the registry changes (on windows and the equivalent on *nix).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

When you execute a select query the first call to next() will "fetch" a specific number of records into a "cache" and then use that cache until the next next() call goes beyond it and fetches the next "set" of rows. The slower the network connection the more it behooves to increase this fetch size (depending on available memory). Default wise it is, for most DBs, 500, which should be enough, but you can play with it. See the API docs (for either ResultSet or Statement or maybe, even, Connection, I forget). Also, I would simply display a "wait" message while the initialisation occurs and then show the GUI after everything has been initialised. There is not much you can do about the network. If you feel you must use a "copy" I would suggest a MySQL DB on the local side as well and set it up as a replication DB.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, you have a homework assignment due on Saturday, and download code out of the Internet on Thursday (that you don't understand), and expect us to finish it for you. Well, well, what will have you done to earn your grade, then?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As long as there are no "quoted" fields in the csv, then simply read it line by line (using a BufferedReader wrapped around a FileReader and BufferedReaders readLine method) and use split to split the line to a String[] and take index 3.

Edit: Also, if you don't need to retain the file, then use a BufferedReader, wrapped around an InputStreamReader, wrapped around the inputStream from the HttpURLConnection and parse it directly from the web.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Actually, that won't work, anyway. As if you replace all o with x then all x with o your string will consist of nothing but o

Step 1: get string
Step 2: replace x with z
Step 3: replace o with x
Step 4: replace z with o

Why do you feel the need to do it in one?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well start out by defining a class and within that class defining the two methods described above, as a start. Then, in the main method, ask for input and convert it using those methods.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, so lets see what you have. And, if by "help" you mean that we should write (any part of it) for you, then you can forget that now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? Nobody writes error free programs in a first draft (or even 100th, many times), so what's the problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No? Which site did you accidentally log into and post this question?

kvprajapati commented: :) +11
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, lets say your locks are numbered 1 - 5 (looking at your max min loop).

Now, lets say two threads are working, one doing a forward sort and one doing a backword sort. Now, lets say the one doing the forward sort gets a lock on say lock three, and the one doing the backward sort gets a lock on lock four. Now, each of these threads (due to your "stacking" or "embedding" of locks) wants to get the lock on the lock object that the other thread already holds. Boom, deadlock.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

We are not here to do peoples work for them. They learn much better when they actually do it themselves. Besides the fact that our own conduct rules here ask that you not do that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Arrays.sort()

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The method is the one given, the only other method is to use a while loop and continue generating numbers, comparing them to the ones already generated, until you generate one that hasn't been generated yet. Not very effecient, that. If you are simply looking for cut-n-paste code (for an obvious homework assignment) then you are on your own.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That question seems to be backwards as JNI is meant to allow Java to use things written in other languages, not the other way around. Now, if that question is to "use printf from C in Java" then I would understand it, and that tutorial would help. IOW, find the library in which C's printf resides and write a JNI interface to that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

btw, you would probably need to use Integer.parseInt somewhere in order to do the comparisons..

No.

I would say to simply do

if (!string.trim().matches("^[+-]?[0-9\\.]+$")) {
    System.out.println("is not a number");
}

The only problem is that that misses things like 001.002.003 (i.e. strings with numbers and multiple dots). The other question is, though, "is 234,567,890.21 a number in your mind"? If so, it just got infinitely more complicated, and even more than that because that number in European notations is "234.567.891,21".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course. Do you need it outside of the try block, though? Currently you have declared it within so it will go out of scope there, too.

P.S. I hope that that is not your real catch block, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry (not) but this?

Nick Evan commented: Yup. +16
masijade 1,351 Industrious Poster Team Colleague Featured Poster

What got into you? Not that most of that information is not both misled and misleading. In any case, closing this zombie.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you, as yet, done what the second line of that Note says? BTW, you did notice that is a Note and not an error, right?

minimi commented: Thank you! +0
masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's not an "apache setting". It is a "Web Container"/"Application Server" configuration. I.E. Tomcat, Glassfish, Sun Application Server, WebSphere, WebLogic, JBoss, Jetty, etc. Find out which one you are going to use and read its documentation.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Here is the concurrency tutorial as a starting place: http://download.oracle.com/javase/tutorial/essential/concurrency/index.html

Which I provided in the first reply. ;-)

Ezzaral commented: Indeed :) +14
masijade 1,351 Industrious Poster Team Colleague Featured Poster

It looks okay, but I'm not going to try it either. As far as the "<Contact>" see this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I've tried this -->

/* This is from the application piece */
JFrame myframe = new JFrame("My Frame");
myframe.addWindowListener(new WindowAdapter() {
     public void windowClosing(WindowEvent e) {
        Runtime.getRuntime().exit(0);
     }
  });

Don't use addWindowListener (you can but it's not current and not suggested for "standard" activities). Rather then that use the line suggested earlier.

/* This is from the action event of the button */
JButton close = new JButton("Close");
close.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent e) {
        myframe.dispatchEvent(new WindowEvent(close,WINDOW_CLOSING);
     }
  });

This part is good. You can either continue to use it as is, or change the dispatchEvent line to a combination of setVisible(false) and dispose.

Seriously, just to close a Frame? It's ridiculous..

No it's not, it's generic. Regardless of what action you want to take the action is coded the same way. In fact, by using the WindowListener version above you can then have the program take some specific actions before closing such as flushing streams, closing varying types of connections, etc, etc. It is, however, better to have those actions (if you are going to do it in that manner) is a shutdownHook and simply call exit (as above).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. That message says you are getting to the DB but that the DB is denying access.


Network problems would be something else, as would mistyped urls. You have either the wrong user, wrong pass, wrong db, or wrong grants.

gunjannigam commented: Thanks for current and fast help +2