masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you just want some script examples, simply look in the /etc/init.d directory.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Look at the API docs for BufferedImage and the setRGB method (the one that takes an array as one of the arguments). How you transform those "pixels" into the RGB values depends on what you have stored, and how, in that "matrix".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Once again, it would help to know exactly what your problem is.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It might help to know what your problem is. So far you've spelled out what the task is that you're doing, but not what problem you're having with it. We are not going to do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The code you have written is correct... but java is a case sensitive language so might be there is some problem with the case..

check it carefully

To tell you the truth, the code is not correct. This line

int UQ=statement.executeUpdate("insert into questions (qid, question, answer, subject) values ('," + questionin + "," + answerin + "," + subjectin + ")");

is definately false (and the cause of the sql error, as noted earlier). Where is the closing quote (') after the variable questionin? And why are there no quotes around any of the others?

All this would not be a problem if the OP would two things that she should always do, and should have done from the beginning (but she probably learned from tutorials on roseindia, they love pushing this dope), which are:

1) Use a PreparedStatement. Do not cobble together a Statement like this. It is error prone in the coding, error prone in the execution (what happens if one of the variables contains a quote (') itself), and wide open to SQL injection attacks.

2) Don't use scriplets. They only still exist for backwards compatability and it is strongly reccommended not to use them anymore.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(field, amount);
c.getTime();

Read the API docs, they contain more than enough information for this sort of thing.

As mentioned, however, you should not be doing this in a JSP. Scriptlets have no place anymore in a JSP. They are only still allowed so as not to break old JSP (i.e. backwards compatability) but you should not be creating any new scriptlets. Use a Bean.

peter_budo commented: Nice example as always +8
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use Calendar and its add method.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It might help to know what you mean by "it didn't work" and "i get an error".

Also, did you pay attention to the fact that I said you needed to do some casting?

Also, simply go here, http://java.sun.com/javase/6/docs/, and you can look up the classes yourself. You should already have this link bookmarked anyway.

Edit: And the first link didn't work, because it looks like the closing paren ")" is included in the link, and it shouldn't be.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Insert the cd and reboot. (And make sure that cd comes before harddisk in your boot order.)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, what does writeUTF take as a parameter? (As a hint, here are the API docs for DataOutputStream http://java.sun.com/javase/6/docs/api/java/io/DataOutputStream.html).

And what does getSelectedIndex return? (As a hint, here are the API docs for JComboBox http://java.sun.com/javase/6/docs/api/javax/swing/JComboBox.html.)

Now, what do you think is wrong?

Look closely at the docs for JComboBox. There is another getSelected.... method that will work (as long as the items in the JComboBox are Strings, and you cast the return Object properly) for you, find it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What asteric?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Javascript is amazing, I didn't think you could touch mysql with it!
Everyone kept telling me to use php with my js to get into sql.
HAHA I feel like a million bucks!

Except that this isn't JavaScript.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As for the problem, you might want to use php for the multiple files. It's easier .

That's a question of taste, and opinion. Easier, I wouldn't say, just different.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The compiler messages might help. Just maybe. (Especially since 90% of the people here are not even going to look at the code without that even. And many of the others won't look because you didn't even bother to use code tags, so that the code woud actually look like code.)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And your question is?

No one is going to do your homework for you. Not only do we not condone cheating, but it is against the terms and conditions you agreed to when you created an account here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you're attempting to add the entire array. It doesn't work that way. Why don't you crack open the API documentation?

You're going to need to loop through that array and add each of the Strings separately. Or, crack open the API documentation and see if you can't figure out how to use a combination of an addAll call in ArrayList with an asList call from Arrays.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use the variable al not the Type/Class ArrayList when you call add.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, like I said, if it can be anything, than Google can help. I'm sorry, but you won't find much help here, finding a finished product in such a narrow field.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

javac then java?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I need this code for reaserch purposes...

And im not so fimiliar with verilog code....So i couldn't do the code....

Thankyou anyway.....

What do you mean "research purposes"?

If it is because you are doing designs, and want some tool to convert between the formats, then why does it need to be Java? Why won't just any tool that actually does the job work?

If you mean you want to "study the code" so that you can do something similar, forget it, as that is a very thinly veiled do my (home)work for me attempt.

So, once again, if you need to write something like this, than write it, and we will help you correct it. If you just simply need a tool that can do it, Google can help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, write some?

If this is your job to write this code, then write it. We are not going to do it for you. That said, if you have some problems, then post what you already have, post any and all error/compiler messages, and a complete, but succinct, description of the exact problem, and we will be more than happy to help you complete it.

If you simply need a finished product, Google can help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

CardLayout

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you included this mysql-connector-java-5.0.7-bin.jar jar file?

He's not using MySQL.

If not use the above first and if it doesn't work try the below

I think that the problem is with value you use for:
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

That is correct for MS SQL Server.

At first try to write: e.printStackTrace(); inside the catch(). You will get a better view of the exception.

He just did that.

I think that the problem is with the driver you are using inside the Class.forName() method,

No, it's only that he doesn't have the driver on the classpath.

try this: com.mysql.jdbc.Driver.
and this: jdbc:mysql://localhost:1433/nameOfTheDB

That would work if he were using MySQL, and it were running on the port 1433.


Sorry, don't mean to be mean, but that entire post seems to be entirely offbase. ;)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, not the mysql connector jarfile, the sqlserver connector jarfile. That error means that you don't have it included on your classpath. Add it to your classpath.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Add an e.printStackTrace() to your catch block and post the entire error message.

It's probably that you don't have the sqlserver driver jarfile on your classpath.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
public class TheCode {
    public void getDataFromDB(Dropdown b) {
        b.populateList();
    }
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's a common slang term for coffee.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. If you go backwards a day, you go backwards a day. It's a Calendar. Just like the one you have on the wall.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Look at the add method of Calendar (hint, you can give it negative numbers). Cycle backwards and use get(Calendar.DAY_OF_WEEK) and compare it to the GregorianCalendar method getFirstDayOfWeek().

masijade 1,351 Industrious Poster Team Colleague Featured Poster
Calendar a = new Calendar();
a.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
Date b = Calendar.getTime();

As an example. There's a bit more to it, depending on exactly what you want to do, but that's a start (and more than a start).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

He does know the answer, but it's your job that depends on it, so you had better learn how. you should have known at least something about it before you started that job. And you're begging here for finished code is completely, and utterly, rude.

Use Google, there are more than enough examples out there.

Once you have something, give it a try, and if it still doesn't work, come back, post what you have, and we'll (including jwenting, because he is very good and professional, but doesn't mince words) be more than happy to help you correct it, but we are not going to do your work for you, that's your job.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do you do a frame.pack() anywhere? I don't see one. Directly before frame.setSize do frame.pack().

And yes, JComponents can be nested, especially since nearly every Swing element is a JComponent.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Ah, didn't really pay attention to that.

You don't add things directly to the JFrame. You add them to it's contentPane

frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(component);
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Frame uses a BorderLayout by default. So, add one West, and one Center, or one Center and one East, or one East and one West, or change the layout to FlowLayout.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So? What do you have? We are not going to do your homework for you. Not only do we, personally, not support cheating, but it is also against the terms and agreements you agreed to when you signed up for an account here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't worry. I jump all over most of the people that simply dump their assignments here and expect to have it finished for them.

That's not what you did. This is how a forum is suppossed to work, I gave you a few ideas/pointers about what to do, but left you to do it, and you did it.

You'd be suprised at how many people scoff at that and try to get us to simply post working code for them that they can then cut-n-paste and turn in as their assigment.

They don't get it, and when they do, it's not what they expect. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What does the API documentation say about it?

They both say that the String will be evaluated as if by (and probably because it uses) valueOf from the respective Class. So, read the API docs for the valueOf methods of those classes and you will see what is, and what is not allowed. Double valueOf description even shows a regex you can use to "screen" input, in order to avoid a NumberFormatException.

This sort of question is always best answered using the API docs:
http://java.sun.com/j2se/1.5.0/docs/api/index.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Actually, you may use either l or L when entering the number directly, but neither of them are to be used when entering a String.

And a quick test showed that both variants throw an exception. I think you're missing the quotes on the last example, in the actual code.

Edit: Either that, or the code simply does not attempt to execute the second, as it get an error on the first. They will both compile. Try reversing those two lines in your code (if you have them) and you should notice that the other throws an exception, too.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, use setActionCommand to set the actionCommand to the counter's value, then use getActionCommand in the Listener to display it. That is hijacking the purpose of the actionCommand, a bit, but heh, nobody's perfect.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not really... Because im using jdk1.5 on WinXp platform.

And what does that have to do with anything? The character used to denote a long is still L and not l.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Since you do not use setActionCommand("String"), the actionCommand will be based on the text shown on the button. Since they all have the same text (i.e. none) all of the Dialogs will be shown, since all of the ActionListeners (and you have a separate one for each button) loop through all the buttons.

That loop (inside the ActionListener) is completely unnecessary, as each button will have it's own ActionListener. Just simply have it perform whatever action you want it to perform, as the button to which it is added is the only thing that ActionListener reacts to.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because a number, typed directly into the code (i.e a = 15), is an integer. If you want a short, or a byte, or a char you need to cast it.

Edit. Also, the "character" for long is L not l.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is a legacy Driver. It is only around for backwords compatability. Use com.jdbc.mysql.Driver instead.

P.S. No need to change your jarfile (depending on the version of course), just change the String in the Class.forName() or Driver.registerDriver() method call.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't worry about it. Happens all the time. Let me guess, a cut-n-paste error. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Look at the following two lines

for (int i = 0; i<grid.length; i++){
    for (int j = 0; j<grid[0].length; i++){

Which variable is being incremented at the end of the second for loop? Is that the one you wanted to increment? I don't think so.

Edit: And I'm just too slow! ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JTable?

GridLayout and a bunch of JLabels/JTextFields?

As above, but more complicated with GridBagLayout (or multiple nested BoxLayouts)?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, someone did your work (or most of it) for you, but left you with a little nugget to complete yourself, and so now, you'll post here (without even removing the comments that clearly spell out that someone else did it) hoping that we do even that litlle nugget for you?

What a maroon! (Spelling intended.)

Do Your Own Homework! This is not a homework service. Normally I would have been more than happy to help point out what was wrong (not do it for you, though), but looking at that code, which so clearly spells out that you didn't do it, and that you're then posting it here, in that form, clearly spells out that you didn't even attempt to finish it, just disgusts me.

majestic0110 commented: Agreed +2
masijade 1,351 Industrious Poster Team Colleague Featured Poster

mv

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What does the API docs say about what getText() returns (and whether or not there is even a write() method in JTextArea). And how do the tutorials show about using a FileWriter?

Come on man. You can at least make a real attempt. You can't just make stuff up as you go along, you know?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Correct.