masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. Finished.

VernonDozier commented: Good program. +19
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, finished.

Salem commented: :) +36
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Two or Three words?

Billy Joe Jim Bob Thornton

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

SQL functions are part of SQL statements. Find an SQL tutorial.

Stored Procedures are written in SQl, find an SQL tutorial (prefereably for the DB involved). They are then called using CallableStatement.

Triggers are a table "property", find an SQL Tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Java != JavaScript

Next time, please find a JavaScript forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The only way to prevent decompilation is to not distribute your app. Provide it as a web-app and hope no one breaks into the server. Obfuscation makes it harder, and obfuscating and then, also, native compiling can make it even harder than that, but it would still be possible, and those people who will actually abuse that for their own profit and your loss will do it anyway. All of this only scares off the "casual" pirate, not the ones who could actually do some real damage.

kvprajapati commented: Informative +6
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Like I said, the first letter, obviously, identifies the shape.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do you not understand? The first letter is obviously the shape, and the points are on a grid. So figure out the lengths of the sides/radius and do the multiplication work. We are not going to do your homework for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

;)

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

Do you really want to copy the modified line to the end of the original file so that the same tag exists twice with differing values?

Also, you can avoid having to escape the "/" by using a different separator

sed -n 's;<idle>600</idle>;<idle>900</idle>;p'

Also, unless you are using variabls in the sed statement then you are better off using single quotes instead of double quotes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

#! is a built-in exec. The shell script is executed in the shell declared on this line.

$1 etc are the arguments provided on the command line (or provided on the function call when used inside a function)

~ means home directory.

And I hope this is not homework.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And which line there is line 29?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The exception contains a line number, so which line is it?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you are trying to dereference a null reference.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

i want a quick solution man

Then you'd better get crackin'!

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I guess you don't know what a joke is, then again, I haven't seen any effort on your part, yet, so I returned in kind. But, hey, it fulfills the requirements you listed.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
System.out.println("Please Enter 2 values:(number must range from 1 to 9)else display error message");
System.out.println("value 1: 3");
System.out.println("value 2: 8");
System.out.println("Fibonacci numbers are:");
System.out.println("11 19 30 49 79 128 207 335 542");
System.out.println("Even numbers are:");
System.out.println("* * 30 49 * 128 * 335 542");
System.out.println("Odd numbers are:");
System.out.println("11 19 * * 79 * 207 * *");
System.out.println("Try Again?:");
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Go to where the ".class" file is and type the command as java -cp . Abc

masijade 1,351 Industrious Poster Team Colleague Featured Poster

i am trying to create an array of strings with String [] s2=new String[25]
i will store every word in that array my line is "nikhil is a good boy"(s1) i am using substring to separate those words removing the spaces and put it into s2 array i want s2[0]=nikhil s2[1]=is s2[2]=a s2[3]=good s[4]=boy i wish to print the longest word in the string s1
please help

Okay, so let's go through a bit of what you are actually doing.

class maxstring {
    public static void main(String args[])  {
        String s1="nikhil is a good boy";
        int d;int x=0;
        d=s1.length();
        /* With this next statement you now have the following array
         * 0 --> null
         * 1 --> null
         * 2 --> null
         * ...
         * 17 --> null
         * 18 --> null
         * 19 --> null
         */
        String[] s2=new String[d];
        char ch;
        for(int i=0;i<=d-1;i++) {
            ch=s1.charAt(i);
            if(ch==' ') {
                s2[x]=s1.substring(x,i-1);
                x=i+1;  // x is 0,7,10,12,17
            }
        }
        /* all elements, other than the following are still null
         * 0 --> nikhil
         * 7 --> is
         * 10 --> a
         * 12 --> good
         * 17 --> boy
         */
        String max=s2[0];
        /* in the following loop all elements except those listed above
         * will throw an NPE, since those elements are null.
         */
        for(int i=0;i<=d-1;i++) {
            /* This statement compares the Strings alphabetically
             * I thought you wanted the longest String?  Shouldn't you
             * be comparing their "length()"s?
             */
            if(s2[i].compareTo(max)>0)
                max=new String(s2[i]);
        }
        System.out.println(max);
    }
} …
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where are you "getting" it? The exception provides a line number, you know.

Also, why do for(int i=0;i<=d-1;i++) when you can do for(int i=0;i<d;i++) .

I believe, however, that you problem is here

String[] s2=new String[d];

Doing that creates an array of reference variables that must point to a String, however, initially all the elements contain a null pointer. You need to make sure that every element actually contains a reference to a String or the line if(s2[i].compareTo(max)>0) will cause an NPE on any element where you have not explicitly initiated a String reference.

You can probably solve it by changing ....

Edit:

Scratch that, I'm not sure what you're trying to do with that "logic" so I'll simply second that "add a null check".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you're going to have ask at the site where you got jpcap from.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Did you download and install the "jpcap" Java API on the machine in question, or did you simply copy the jarfile from another machine?

If the second, then do the first, of course.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What happens if the String argument contains a single quote? Or even worse, something like

show("';delete from Staff_Details WHERE Address2 <> '");

Use a PreparedStatement.
http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

How about a grammar and spell checker?

kvprajapati commented: eye-opener +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

A better query would have been

SELECT a.userID as userID,  a.firstName as firstName, a.lastName as lastName, c.symbol as symbol, c.name as name
FROM Users a, UserStocks b, Stocks c
Where a.UserID = b.UserID
  And b.stockID = c.stockID  // or whatever the "ID Field" is here
ORDER BY userID, symbol

Learn to use SQL for what it's meant for.

http://www.w3schools.com/sql/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This may be a JSP producing this javascript, the error is, seemingly, in the javascript, however, so the question is better asked in the javascript forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, you should be using getString, but you should not be using "select *". You should be naming the columns. Also, per definition, a JDBC Driver need only allow access to a column once and only in the order in which they are returned. Which means that unless the columns are delivered in the following order: userID, firstName, lastName, symbol, name , you may have problems accessing them (and with the ODBC Driver you probably will, especially if it is an Access DB behind it).

To repeat, I would suggest designating the column names rather than using "*", and the column "name" may be a problem, in and of itself, since there is a large chance that is a reserved word, meaning it needs to be surrounded by quotes (or in Access, square brackets, i.e. "\"name\"" or "[name]" ). If neither of those work, attempt using the index (i.e. getString(5) ).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I guess it's just too hard to read documentation these days. So hard that other people need to do it for you, then write out their interpretation of what they read for you to read and interpret yourself.

So now two people have had to read and interpret something and who knows if what the "end user" understood and implemented is actually what the documentation said, but now one person has wasted their time waiting for someone else to read the documentation for them, and another person has wasted their time reading and regurgitating it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the manual. It is all explained quite well. You simply need to change the address and port in the configuration. That's all. The manual will tell specifically how and where to do so.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Change your application server/web container configuration to use port 80, rather than 8080, than use localhost.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By writing some code?

Why don't you do "Google Java Game Tutorial"? You might be surprised.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

P.S. What about reply 18 and the name discrepancy?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

BTW, Whether the above is the (or even part of) the problem, or just some sort of cut-n-paste error in the post, doesn't matter. You will find that 90% of the debugging work you will ever do is "attention to detail" stuff like you see right here. Basic Stuff. And if you cannot start getting that right you are going to have a very hard time. Especially when you insist that you have checked and rechecked and checked the stuff again. If you say that "on the job" and then someone comes behind you and finds this sort of simple "attention to detail" error, too often, you are going to be in hot water.

One of your daily mantras should be "attention to detail", say it, do it, live it, be it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use a debugger and find out what happens behind this line

String htmlFileName = this.cli.getHtmlFile();

You are only using "File" in the rest of it, so it has nothing to do with classpath, and as long as the filename is correct and you have permissions to both it and the directory its in, it will be found. It all, however, depends on what that method above returns (which probably depends on what you enter as an argument).

Also, from earlier

... the batch file ... ... --inputHtml /Harvester_new/build/classes/sample/data/rsearch.html ... ...
I kept it here C:\Harvester_new\build\classes\sample

So which is it?

If it is

/Harvester_new/build/classes/sample/rsearch.html

as you seem to indicate with the last line of the above quote and you use

/Harvester_new/build/classes/sample/data/rsearch.html

in the batch (as you posted above), then, well, yeah, the file won't be found.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you are on a windows system, you probably need to include the drive designation (i.e. C: ) on the argument.

c:/Harvester_new/build/classes/sample/data/rsearch.html

instead of

/Harvester_new/build/classes/sample/data/rsearch.html
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Post the code that's pointed at by that error.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Make a data class with methods for the varying actions that might taken on the PDFObject and give it also an addListener and fireEvent methods. The "Panel" class to display the PDF will be added as a Listener to the data object so that it can actually display everything that changes. Then I would make an abstract class with varying methods for calling the "data" methods and I would make all of my swing listeners extend this class. Those swing listeners then simply need to call the method from the abstract class which will then call the "data" method.

If you wanted to be complete, you would have the normal Swing and listeners running in the main (and of course event thread), the "panel" class in another thread (using invokeLater, or invokeAndWait to display the changes), and the "data" class in a third thread, with a synced queue between the listeners and the "data", and use wait/notify between the "data" and the "panel" classes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

ImageIO find that class in the API docs, or Object(Input/Output)Stream look up those in the API docs (and tutorials).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If I was on chapter 7 of SCJP study guide I would have answered correctly ;) , but I'm only chapter 3 :$

Technically, you were correct, and, in fact, that way may even be quicker than using the Collections manner, it's just longer to write, and not quite as "code reusable". ;)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What html file?

If you mean one of the arguments such as

--inputHtml /Harvester_new/build/classes/sample/data/rsearch.html

then make sure you have the argument correct.

Also, if you copied jars somewhere, then you still need to include those jars on the class path (or unjar, which I wouldn't suggest) as including a directory in the classpath will not automatically include all jars within those directories.

multicoder commented: "still need to include those jars on the class path" +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am sorry. Which collection class has sort method?

Collections

That is a Class in and of itself, much like Arrays.

kvprajapati commented: Great eyes! +3
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, as long as it's not JME implementing Comparable or creating a Comparator is the way to go, but there is no reason to use Arrays. Collections also has sort methods. No reason to convert to an array and back to a list, leave it as a list.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Even though the PDF document is something you "see", it is not, truely, part of the view (IMHO), it is the Data, and I would handle it as such and have all actions that affect it run through the controller.

Just my two cents. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

To make "set" a bit clearer (seems like it's needed) we'll go through that.

set HARVESTER_CLASSPATH=.;./sample

HARVESTER_CLASSPATH = .;./sample

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;JTidy-minimal.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;all-gui-util.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;allhomes-listing-feed-binding_v0_2.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;commons-httpclient-3.1.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;commons-lang-2.4.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar;commons-lang-2.4.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;harvester-smurf.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar;commons-lang-2.4.jar;harvester-smurf.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;log4j-1.2.14.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar;commons-lang-2.4.jar;harvester-smurf.jar;log4j-1.2.14.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;xbean-minimal.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar;commons-lang-2.4.jar;harvester-smurf.jar;log4j-1.2.14.jar;xbean-minimal.jar

set HARVESTER_CLASSPATH=%HARVESTER_CLASSPATH%;testng-5.8-jdk15.jar

HARVESTER_CLASSPATH = .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar;commons-lang-2.4.jar;harvester-smurf.jar;log4j-1.2.14.jar;xbean-minimal.jar;testng-5.8-jdk15.jar

java -Xmx512m -classpath %HARVESTER_CLASSPATH% ...

java -Xmx512m -classpath .;./sample;JTidy-minimal.jar;all-gui-util.jar;allhomes-listing-feed-binding_v0_2.jar;commons-httpclient-3.1.jar;commons-lang-2.4.jar;harvester-smurf.jar;log4j-1.2.14.jar;xbean-minimal.jar;testng-5.8-jdk15.jar ...

masijade 1,351 Industrious Poster Team Colleague Featured Poster

But these are all jar files which executes fine with batch file, but I am trying to execute the application which I have not jarred yet.

So? So then you use the directories where the "pre-packaging" classfiles are rather than the jarfiles.

I got ur point too.But how the classpath gets set multiple times in the command java -Xmx512m ....

It doesn't get set multiple times. "set" in batch is a command.

set <VARNAME>=value

and you use a variable in batch with

%VARNAME%

I should think that would be somewhat self-explanatory for any programmer looking at that.

Or else it looks for the appropriate classpath value to assign in place of '%HARVESTER_CLASSPATH% '

see the explanation above.

Is the scenerio clear enough now

Regardless of what the "scenario" is, if the program is written to need 20 libraries, and you try to run it without using any, it's not going to work. It's as simple as that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You're problem is that you are not setting the classpath. Look at all those set commands. Those are setting the classpath, you are attempting to execute the command manually without a classpath. Of course you are going to have problems.

Had you mentioned, and then shown this in your last thread we might have avoided all of this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please stop PMing me.

Post this "batch" script your talking about and post the entire and exact command line command you are using to execute the program manually.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The error is nullpointerexception, right?

kvprajapati commented: right +3
masijade 1,351 Industrious Poster Team Colleague Featured Poster

No we did not create a problem, simply got the code to run far enough for that already existing problem to be noticed. This thread is already too long IMHO, and this current error has nothing to do with the original error, so it is time for a new thread.

You are not "creating" any classpaths in your code, you are simply executing the program with a classpath so that it can find anything at all. It now looks as though you are attempting to compile some code within your code, which, as already said, is a new problem.

You are, however, in really very far over your head attemtping this SOS with the level of knowledge you've shown here for the basic tenants of the language that every programmer should learn as one of their first lessons.

multicoder commented: Sounds very knowledgeble person +1