masijade 1,351 Industrious Poster Team Colleague Featured Poster

Java != JavaScript.

Please request to have your thread moved to the JavaScript forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhhm, awk is a really large subject. O'Reilly publishing http://www.oreilly.com/ produces an entire book (and a good one at that) dedicated to sed and awk. Try that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

it doesn't work at my side:

# sed -e 's/\+62018\([0-9]+\)\+\+/+62018\10++/' file
UNB+UNOA:1+5030917029608:14+5000119000006:14+070509:0850+62018000100020++INVOIC

@OP:try this

awk 'BEGIN{FS="+";OFS="+"}$6~/^62018/{ $6=$6"0"}{ print $0 }' file

Of course. "+" is only a valid regex character in perl. Sed doesn't recognize it as the "1 or more" function. So do like this instead:

# sed -e 's/+62018\([0-9]*\)++/+62018\10++/' infile > outfile
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Stick to one thread. Either in this post, or your other one, post the code again (using code tags this time). Post, also, the complete error message and comment the line referenced in the error message.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Could you be at least a LITLLE more specific. Post the entire error message, together with the code (abd use code tags) and mark with a comment, or something, the line referenced in the NullPointerException.

As far as to your question "y the null pointer exception is coming" (which I assume is supposed to be "Why am I getting a NullPointerException?") is, because you are using a reference that hasn't been defined.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

sed -e 's/\+62018\([0-9]+\)\+\+/+62018\10++/' infile > outfile

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please don't send me personal messages about this. Keep the conversation here, so that anyone else with this type of question can also benefit.

Post your code here, and then we can continue.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not any more. AFAIK.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read up on J2ME (or with the newest versions JME).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By assigning the date object to a session variable at login, then simply displaying that date at every other page load rather than creating a new date (as you are doing now). A new date object will always hold the current time at the time of construction (at least when created using the default constructor).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Oh, this is classic, posting a question onto a thread about projects in Java (in the Java Forum of course) that is two years dead, and asking for a project in VB.

This question is just guaranteed to get a lot of responses, just none that the poster will want to read, or be able to use.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please don't cross post, it is considered rude.

Please continue with the original thread: http://www.daniweb.com/techtalkforums/thread77555.html

And do what was asked of you there (namely repost your code using code tags, in that thread).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

iamthwee is right, you should be using ArrayList. You cannot increase the size of an existing array. You have to create a new array that is one larger than the current array, then you can use System.arraycopy to copy the existing elements from the old to the new array, than add the new element.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Are you trying to say "not less than", if so why don't you just say "greater than"?

>
// instead of
<!

Edit: Nevermind, I'm an idiot, they're Strings so greater than and less than are not what you want anyway. Doh!

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try using POI (it is an apache project) or JExcel.

You won't be able to do it with the Jet engine AFAIK.

You could always break up the spreadsheet (I know, this is not an option).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Here I am giving a scenario to set class path

suppose jdk is installed in c;/java/jdk1.5

then follow the below three steps to set class path

set JAVA_HOME=C:\Java\jdk1.5.0_07

set path=;%path%;%JAVA_HOME%\bin

set classpath=%classpath%;%JAVA_HOME%\lib\tools.jar

If Java is installed in c:/java/jdk1.5 (and I am assuming it is c: and not c; as posted) then JAVA_HOME should be c:/java/jdk1.5 and not C:/Java/jdk1.5.0_07

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The ImageIO method read(InputStream) produces a BufferedImage. Read the API for tht and try it out.

Edit:

Of course, ImageIO also has a read(URL) method that also returns a BufferedImage. So, rather than reading the link (URL) found in the src attribute of the IMG tag, you could simply feed that link directly to ImageIO.read Check that out as well, as it will probably save you time.

And always remember, the API is your friend.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Change the 61 to +61 for all files more than 61 days old or to -61 for all files less than 61 days old (Both not including exactly 61 days old). 61 (without a + or -) means eactly 61 days old.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The exec portion of the find command must be ended with the two literal characters \; And before this you must provide the argument to ls. The argument is the file found and you pass it the command with the two literal characters {} So your complete command will be find -type f -mtime 61 -exec ls -ltr {} \;

masijade 1,351 Industrious Poster Team Colleague Featured Poster

find /path/to/directory -type f -mtime 61 -exec rm -f {} \; 61 (days) works for everyting except it is one day short for July August and 1 to two days long for (January/February) / (February/March).

Edit: make it 62 if it absolutely must be every last day for two months. Retaining too much is usually better than retaining too little.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So? RMI can still be used, you simply run both the client and the server on the same machine, but that does not preclude you from using RMI.

Of course, you can always simply open a socket connection between them over localhost and use ObjectInput/OutputStreams.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Google RMI

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you are writing to the logfile in the following manner scriptname >> logfilename Then change it as follows (for a really quick fix): scriptname | tee -a logfilename | mailx -s "scriptname" email@address

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Browser pointed at http://java.sun.com/.

Or, go there with the browser, download said documentation, unpack the resulting file, and (again) use the browser to view it (or "plug it into" your IDE, if you are using one).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

"Linking" 2 or more JSPs is not the problem. Most projects contain many JSPs, Servlets, Beans, Tags, Listeners, and other components. The problem is attempting to use them from two different machines. They need to be part of the same application.

Eidt: But, as mentioned above, you can, using HttpUrlConnection (or HttpClient from apache, etc) have one call the other and use the response.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the JDBC and Swing Tutorials.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, because in BlackJack (21) 10 - King are all 10 and an Ace is either 1 or 11.

I would say, when an Ace shows up, total the rest of the cards, then decide how much to assign to the Ace depending on the difference between the current total and 21.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JavaScript != Java.

Please find a JavaScript forum and post your question there.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As in?

What is your problem?

What are you attempting to do, and what is actually happening?

Are you getting errors?

Have you, as yet attempted to code anything?

If you have any code, post it, and answer the questions above, then we can help you a bit more.

If you simply want General info, go to http://java.sun.com/docs/books/tutorial/uiswing/layout/flow.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but this ia a Java forum. JavaScript != Java. Please get this moved to a JavaScript forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, Ahem, there is a tutorial link pinned to the top of this forum. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The problem is, you have declared an instance variable s.

Then in initializeStuff you want to give it a value, but what you really did was declare and define a variable local to initializeStuff rather than defining the instance variable.

Change:

void initializeStuff() {
        String s = "aaa";
    }

to

void initializeStuff() {
        s = "aaa";
    }

or

void initializeStuff() {
        this.s = "aaa";
    }
fowlergod09 commented: His reply was a great help. Thankyou +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, it will compile just fine without it. main, as far as the compiler is concerned, is a method just like any other, but when you try to execute a class and the method definition public static void main(String[] args) does not exist, you will get the exact error message you are showing. The method must be defined exactly as above with the following possible variations

1) args can be any name you want, it does not have to be exactly args 2) String[] args may also be String args[] (keeping point 1 in mind)

Those are the only variations allowable (as they are not really variations, the definition is the same, it is just typed a little differently). Having something else will prevent you from executing your program, but it will still compile with ease.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do you mena, to no avail? It definately should work. Vectors may not be the best choice (at least from an efficiency standpoint), but it should work. It would probably be helpful to show the code and provide the complete detils to any error you may ahve gotten.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, you can remove files and directories from your path with a single find command as follows: find /path/to/backup/root -mtime 4 -exec rm -f {} \; If you also want a list of files deleted in this manner than do as follows: find /path/to/backup/root -mtime 4 -exec rm -f {} \; -print It is not necessary to write any kind of real script for this simple task. This is, of course, assuming that you are using a unix/linux variant.

Edit: Well directoriews won't be deleted, but you can do as follows with a second command to get empty (and only empty) directories find /path/to/backup/root -mtime 4 -type d -exec rmdir {} \; -print

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I simply used scriptname as a stand in for the name of the script. But lets use a more commonly known script for this, i.e. the inetd script from /etc/init.d

That script you run as /etc/init.d/inetd start to start inetd and as /etc/init.d/inetd start to stop inetd

in the first case $1 is "start" and in the second case $1 is "stop" That is the $1 when used in the case statement. $1, $2, ..... $NF take on a different meaning when used inside awk. An awk command reads input (in this case standard input) line by line and separates the line into "fields" based on consecutive whitespace. i.e. the line "hello world" will result in $1 being hello and $2 being world.

To understand that complete command perform the following steps (eth0 is the most common network interface in linux. If you have something other than linux you will determine for yourself what the interface is. Use ifconfig to find one.)

1) type ifconfig eth0 (this is the first part of the command)

2) then find the first line that starts with inet , but not inet6 (this is the grep part)

3) then remove all alphabetic characters from that line (this is the sed part)

4) Then take the first "word" from that line, i.e. all characters up until the first "whitespace" character, disregarding leading whitespace (this is awk part when $1 is used)
if $2 is used then take …

masijade 1,351 Industrious Poster Team Colleague Featured Poster

$1 is the first command line argument givben when the script is called (i.e. if the command is scriptname hello then $1 is hello).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, start coding. If you have a problem post again, with your code and a description of your problem, along with any error messages (complete) and we will help, but we are not going to write it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What it looks like is, either the user "postgres" doesn't exist in the DB, or the provided password is wrong.

Edit:

Or the provided user does not have permission to access the Tablespace/SID/whatever_it_is_called_in_PostGreSQL requested in the URL (the part after localhost).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

wc -l

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the Sun I/O Tutorials to find out how you work with an InputStream.

An InputStream is NOT a String representation of the entire page contents. It is a "Stream" that you have to read byte by byte (although wrapping it in other objects, i.e. a BufferedReader, will allow you to read it line by line, rather than byte by byte). But that is too much to explain here, so please read the I/O Tutorials at Sun.

http://java.sun.com/docs/books/tutorial/essential/io/index.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You need to call getInputStream(), to get the inputStream of the response (actually, in relation to the response it is an outputStream, but in relation to your Java Program it is an inputStream), then you can read that, but remember, it will be HTML, so any images will be found as IMG tags, then you then need to retrieve with another HttpURLConnection and its getInputStream.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

At this spot in the code:

person.setAccount(resultSet.getString(1));
person.setPassword(resultSet.getString(2));

insert above that

System.out.println("Results:  "resultSet.getString(1) + ":::::" + resultSet.getString(2));

That way you can take a peek at what has been returned. If no "Results" line is printed, then nothing has been found.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What is "the necessary result"?

Are you getting compile errors? If so post them.

Are you getting runtime errors? If so, post them.

Are the results you are getting something different from what you expect? If so, post exactly what it is expect, and, exactly what it is you are getting.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What are you talking about?

Look up HttpURLConnection in the API or HttpClient from apache. And, no, neither of these things will give you finished code to simply execute and do what you want. Nothing ever will.

Both of these are APIs, of which you can search and find tutorials for, but you need to use them in your coding in order to do what you want. Trust me, you can do both a Get and a Post with either of them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Start your own thread.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I haven't even looked at that code, because you haven't really asked a question.

What part of this are you having problems with?

Are you getting errors while compiling? If so, post them.

Are you getting errors while running? If so post them.

Are you seeing results other than what you expect? If so, post what you expect, and what you are getting.

Is there some part of the assignment that you do not understand? If so, ask the teacher, that is what he is there for.

Now, after you have read these questions, and decided you want to post here again, then please, repost the code as well, and this time use code tags. (Use the "Go Advanced" button below, then the "Code" button that you find there.)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I assume the error says that it does not implement some method or something to that effect, right?

It would have really helped to know what the error was, but I believe I have found it anyway.

This line

public void actionperformed(ActionEvent event)

should be

public void actionPerformed(ActionEvent event)

Notice the capital "P". Without that, you claim to be implementing ActionListener on line four, but since you do not include that method (which is part of the implemented interface) then have not implemented it, hence the error on line 4.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Or the "equals" method of String, in this case.