masijade 1,351 Industrious Poster Team Colleague Featured Poster

Are you using Java 1.5 or later? If so, make it an Integer array, rather than an int array. Then "empty" spots will be null and you just (after having filled it with the random numbers) cycle through with an == null check. And, you can still do array[j] = 1; or some other int, because autoboxing will automatically convert it to an Integer. You can also, later, use the Integer as if it were a normal int. That seems to be easiest solution.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

oh my dear ! i am working with tomacat apache 5.0.28 but in order to work with beans there is also need to make a java file and place it in classes in tomcat directory .thats why i am running the program on jdk 1.5 +kawapro5 in order to connect the mysql database with jsp.

Servlets are also java files (and JSPs are too, indirectly, since they will be translated to one the first time accessed after being changed). There is no reason you cannot test the Bean inside of the application. I assume you know how it will be used, so simply perform those actions through the browser (and at first you can have the bean log all sorts of things as kind of a "ppor man's" debug). Either that or write a separate Class that does nothing but call all the methods of the Bean, and which contains a main method, and call that. Then, like I said, include all jars on the command line with the -cp option. It's not that hard.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If your application runs in tomcat, place any and all jarfiles that it needs into the WEB-INF/lib directory of the application. You should know what the jars are, since you are the one writing the application. If you can no longer remember the name of a specific jar, then download it again. If, after placing the jar(s) in WEB-INF/lib, you still get a ClassNotFoundException, then you have either copied it to the WEB-INF/lib directory of the wrong application, or you have done something to the Tomcat configuration which prevents it from loading libraries in that directory. What that might be, I cannot even begin to tell you. All of this, of course, assumes that you are accessing the application through Tomcat, and a browser, of course. If you are attempting to execute something from the command line, then you should use the -cp option to specify the classpath (specifying the full complete path to each individual jarfile needed) when you type java (if the class will even function from the command line, which Servlets and JSPs definately will not (and most, if not all Beans, also should not, except indirectly, i.e. accessed from a different class which is executed).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

2masijade I beginner in java too. So sometimes copy jars to jre folder (when project not compiled and i am angry :) )

And as a quick fix to get something compiled or run for the first time when you are frustated, and it is not meant as a solution, but rather just a quick stopgap, I don't object to it that much (although it still should not be done, it shouldn't get to that point, but sh1t happens sometimes). The real problem comes in (at least the point where I get upset about it) is when I see someone suggest that as the solution for a problem.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Cool, get started.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Google can.

Or did you have a specific question?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As long as the object properly implements serialisable then you can send it through an ObjectOutputStream wrapped around the OutputStream retreived through socket.getOutputStream, and read through an ObjectInputStream wrapped around the receiving ends socket.getInputStream.

And, of course, RMI and CORBA are other possibilites as long as you define your stubs correctly. Sun provides an RMI tutorial here http://java.sun.com/docs/books/tutorial/rmi/index.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I have the same problem. Try to copy MySQL connector jar file to
%JAVA_HOME%/jre/lib/ext/

Bad, bad, bad. Never copy anything to the lib/ext directory of the jre. Learn how to use and set classpaths properly. If he has the proper jarfile, and places it in the WEB-INF/lib directory of the web application he is trying to reach, the classes will be found. If they are not, he has done something wrong. Either copied it to the lib directory of the wrong application, not copied the right jarfile, or, maybe, somehow or another, changed the tomcat configuration so that it does not look there. Sorry to say it, but all of those things are "his problem", and copying anything to the lib/ext directory is not the answer, regardless of whether or not "it works".

peter_budo commented: I agree. "Never copy anything to the lib/ext directory" +5
masijade 1,351 Industrious Poster Team Colleague Featured Poster
// the code which would generate a Unicode file from a CSV ( Comma Seperated File) given as input.
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sure, post the code you already have together with any errors (or unexpected results) and we will be glad to help you correct your code.

Oh, wait, you wanted a handout, didn't you. Well, you are not going to get one. We will be more than glad to help, but we are not going to do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In addition, even if we did want to help you, after your demand that we drop everything else and concentrate on your, I repeat your problem, that question (demand?) you posted just does not contain anything that we could work with.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It takes 9 command line arguments (which are filenames), reads the content of the first four, doing varying operations on the data within, and writes results to the last five. It seems to have to do with loan balances, fees, and, seemingly, the determination of FICO scores.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The blind leading the deaf is just a "cute" way of saying that the help being given (at least by some) is bound to cause a lot of confusion, misdirection, antics, and probably dangers. Not that they are intended, but they are going to happen (and it will usually by comical).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

& as for he 2nd suggestion, yes I commented that on purpose. as the readdata() is inside main()...........please tell me whats going wrong here.


If I remove 1 "}" at the end as I think there is an extra. the above error is not there anymore but its showing another one:

Syntax error, insert "}" to complete MethodBody

    at dbpack.chartdb.main(chartdb.java:15)

on this line............. public static void main(String[] args) {

Well, I'm sorry but you cannot do that (comment out that }) as then your main method is not ended, or you then are (as noted above) are defining a method within a method.

Go through your code carefully and balance your braces "{ }", properly, then try to compile again. If it still does not compile, then post your modified code here again, with the new, complete, error message, and we can continue.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Oh man, the deaf leading the blind.

I have no idea where this "save it to the bin folder" stuff got started, but here ye, what rubbish.

I know, I know, now you're going to come back with, but it works and its better than nothing, so whats wrong with it.

Well, if your foot itches you can cut it off, it works, and it's better than nothing, but there is still definately something wrong with it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I believe this may be your problem

public static void main(String[] args) {
        // TODO Auto-generated method stub
        //private void  readData()
    //}
        
    private PieDataset readData()        {

Did you really mean to comment out the } at the end of your main method? Somehow I don't think so.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you simply want to run already compiled classes, you should not need to do anything special (AFAIK).

If you wish to compile 1.4 sources, then you also need the -source=version argument for javac.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Copy that jar file into WEB-INF/lib, not into just any generic tomcat lib directory.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm not sure the code you posted there will even compile. You have a for block using a runCount variable inside of a try/catch block inside of a for block using a runCount varaiable (again) inside a try block with no catch block (at least not posted).

Clean that code up, first, then try to run it again, and if it still doesn't work, then ask again. And, once you do cmdProcess.waitFor(), any code below that point will not execute until the command has finished. Which, since you are not consuming the Streams of the process, might be never, if it produces enough output to fill the buffer.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, this code is fairly bad, I'm sorry, I don't mean to be offensive, I'm just stating the way it is, but for a quick fix try this.

You are currently doing this

for (int iDay2 = 1; iDay2 < 8; iDay2++) {

which is essentially cycling through an array of days organized as

{ Calendar.SUNDAY, Calendar.MONDAY, Calendar.TUESDAY, Calendar.WEDNESDAY, Calendar.THURSDAY, Calendar.FRIDAY, Calendar.SATURDAY }

So, think about it. What do you need to do to change the order of days you are interested in?

Setup an array in the order you want it (the days should still be in the proper order of course) and use that array in the for loop.

Like this:

int[] days = { Calendar.MONDAY, Calendar.TUESDAY, Calendar.WEDNESDAY, Calendar.THURSDAY, Calendar.FRIDAY, Calendar.SATURDAY, Calendar.SUNDAY };
for (int dayIndex = 0; dayIndex < days.length; dayIndex++) {
    int iDay2 = days[dayIndex];
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course, be forewarned, that unless you have locked the table you're using (and if you don't know how then just forget I mentioned that as I am not going to explain it), then between the time that you get the total with that query, and then actually pull the records from the database, the number of records could have changed (i.e. records added and/or deleted).

You would be much better off rewriting the dbFpsProdMap.getProdMap(sLang,1,200); method to internally produce an ArrayList, that can be grown dynamically and simply returning an array created from that ArrayList. (I'm assuming that sLang is the resultSet, if not pass it the resultSet and let it populate itself.) Then it will probably look like either dbFpsProdMap.getProdMap(sLang); (If sLang is a resultSet) or dbFpsProdMap.getProdMap(sLang, rs); (If it is not.)

The method can then, simply cycle through the resultSet adding FPSProdMap Objects to the ArrayList as it goes, and then, as mentioned, return an array created from this ArrayList.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't bother sending me PMs. My last post was in response to your rude second post, but it does contain information that you can use to create what you want, we are not going to do it for you.

Google a bit, man ftp and read the .netrc file section. Then try to create your script. If you have problems post your script here and you will get help, but simply saying, "Give me t3h codez!" does not cut it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

When you initiate the array (i.e. int[][] array = new int[20][20]; ) every position is already filled with 0 (since a primitive cannot be null). So, if zero is not one of the numbers you are using, simply cycle through the arrays with a nested loop replacing 0 with 99.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well this is guaranteed to get you answers.

Have you never heard of Google?

Or even the command "man ftp", since that, itself, describes the .netrc file and your "logfile" can be simple output redirection ">".

Id10t

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try

sed -e '/[\{\}]/d' -e 's/ = /=/' -e 's/;$//' filename > tmpFile
. tmpFile
rm -f tmpFile

That will turn all those lines with = signs into variables and source them, cleaning up afterwords.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Guys, sorry but just give me exactly how the code should be written, so i cn turn in my assignment by tonight! Like i said i'll never be a java programmer and i am just trying to complete this class.. I have no shame here but there has been an over kill of progrmming classes just to complete a BSIT degree it is almost tlike I am going for a computer sicence degree vs. info tech... thta is the reason i went for the IT vs. CS to avoid too many programming classes.

You're doing this type of GUI stuff and never learned how to write a main method? How many other times has someone else just given you exactly how the code should be written?

And this is just classic. You should definately not receive either a BSIT or BSCS if you cannot even grasp some of the most basic concepts of programming. You may not be angling to be a programmer, but to work in the IT field and have absolutely no grasp of programming concepts, qualifies you as nothing more than a "Data Entry" candidate, at best (or manager, it seems, sometimes).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Ok... as u say sir, let me explain what i think for this coding

I need an output 
     1
   121
  1331
 14641
151051 and so on

so as my thinking its like first u intialize one n=1 so intially printing 1 will do and then moving to the new line will also happen at the run time of program....
Next line will start with 1 and end with 1, the middle number would be addtion of n+1
The third line would be addtion of above line ie. 1,(1+2),(2+1),1
and so on

for 3rd line it wuld be: 1,(1+3),(3+3),(3+1),1
for 4th line it wuld be 1,(4+1),(4+6),(4+1),1

Very good, two points out of three, now as jwenting said, try putting that into code, which was the third point. If you really have problems with it, they can be overcome. Comment nearly everyline that actually does something, with what it is suppossed to do, if you have to. That way, you will immediately be able to tell if what you are doing is actually bringing you closer to your goal.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Write down what your exact requirements are, then, in words, try to describe what you think you need to do in order to arrive at that point.

Until you sit back, concentrate, and do this step, you are just poking around in the dark. No offense intended, but that is exactly what that code above is doing. You haven't designed a real plan of attack (and possibly do not have a clear understanding of what is needed), and so you have just thrown something together on the off chance that you might get lucky.

So, as mentioned, sit back and write out exactly what the requirements are and what you think you need to do to arrive at that point. Then make another attempt at programming it. If it still doesn't work, then post all three of the above mentioned items here, and we will help you further.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Seems like String one is the ONLY applicable method.
At the call options are create and Object using "null" or create a String using "null".. Object doesn't have a constructor that takes argument (only one c'tor that takes no args) whereas String does.. So only one method applicable and that is public void ob1(String s1)

What? That sopln("whatever") is not a constructer, it is simply an abbreviation for System.out.println. And the other two public void ob1(Whatever w) definitions are methods, not constructors.

The only constructor involved anywhere in that code is on the line A a = new A(); .

So, as you can see, both methods where applicable, but the String is most applicable.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Java will always take the most specific applicable method. In this case, using null, the String one is the most specific, applicable method.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do you have so far, and what problem is it giving you?

FileReader with BufferedReader and String.split,
or Scanner are good starting points, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Like I said, lets see what you have. I am not just simply going to do it for you.

I will help you correct yours, but in order to do it, I need to see it. If you're not willing to show it, them I will have to assume that you "made up" that output that you suppossedly got and are just fishing for someone to do your homework for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Should be if (dec8 == 0) .

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So what, exactly, do you want use to do. I saw a few statements in that post, but no question.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Isn't there something in standard library for this?

Everything jwenting listed is in the standard library.

I just noticed a class called ClassLoader and I was wondering how you'd use it. It's abstract, so I'm a little confused about using it. Can someone show me an example of how to use it?

So lets say I have Bob.class with a constructor Bob(). After getting the String Bob, how would I load the class at run time and construct an object Bob?

Google for some ClassLoader tutorials/examples. You should be able to find a whole lot of them.

While your at it, Google for reflection tutorials, as well, as that will also play a big part.

Once you have some code, almost regardless of how much, and cannot advance any further, come again, post that code, state your problem (clearly and concisely), include any supporting info (i.e. compile and/or runtime exceptions), and we can help you further.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, seeing your code would be a good starting point. And use code tags

masijade 1,351 Industrious Poster Team Colleague Featured Poster

We could use a little more information.

Do you get an error message when you run it?

What is it suppossed to do, and what does it actually do?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please don't double post. Here the original thread.

http://www.daniweb.com/forums/thread84032.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do you mean

I want to send the values in the text box to java

?

If the textbox is part of the applet, "java" already has the values.

I think what you are looking for, however, are ActionListener and the getText() method of JTextField. Check out those two classes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, let's just pick a braod topic, say tell me about, and then wait for specific detailed information about our nearly meaningless question, shall we?

Do a little research until you have at least a general idea of what it is you want to do, Google and standard wikipedia are both good starting points, as is your local library. Then hammer out an action plan, and, at least, a loose design plan, and start coding. When you then, have a specific question, come back and we will be glad to help, but we are not going to do your research and/or work for you.

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

Try looking into the HTMLDocument and HTMLEditorKit.Parser Classes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
// code related to antivirus

There I wrapped "code related to antivirus" in code tags.

Try Google, please.

If that doesn't work, try asking specific questions, not "give me teh codez".

peter_budo commented: I will donate that antivirus ;) +7
masijade 1,351 Industrious Poster Team Colleague Featured Poster

change

export PATH=$ORACLE_HOME/bin

to

export PATH=${PATH}:${ORACLE_HOME}/bin
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I do. I was unable to find another 'how-to' for this problem, so when I found the answer I decided to post it. I hope it was useful, but I understand better solutions may be out there. Please let me know if you know of one--I would surely benefit from it.

Okay, just wanted to make sure. A lot of new posters here come through and start answering years old questions (usually that have already been satisfactorily answered and they, many times, answer them wrongly) and just dig up a bunch of old threads that the "older" posters consider finished, and it many times just raises some irritation.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You do realise that this thread was nearly 3 years old, right?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So read a quick Networking tutorial on Sun. They are easier to use than the lockfile routine you just tried.

Then again, you didn't write that code.

Read the networking tutorial, give the ServerSocket a try, then, if it doesn't work, post your code here and we will help you correct it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

it will work!!! but only as a method, not thread. It won't run simultaneously :)

If you read his thread,
that is exactly what he said.

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Go back to reply number 1.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Runtime.exec()

Read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html If you insist on using Java to do this. I feel, for something this simplistic, and server undemanding, php or a simple CGI would be more than enough and any kind of Java/JSP (which would require an entire framework) is extreme overkill. Ajax, IMO, would also be overkill. Simply let the button be a standard submit button.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I thought you wanted to write a game (at least that is what the first post said) not simply scrape one (although the first post said this, too).

You also said you wanted to master the language (once again according to your first post), but now you are not even willing to attempt to debug the code you scraped from somewhere else.

I don't think anything else needs to be said.