masijade 1,351 Industrious Poster Team Colleague Featured Poster

There is a tutorial tacked to the top of this forum.

A script can do just about anything, and they are very useful to linux users (at least those that work on the command line, as you can use them to combine many common tasks that are usually performed together among other things).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

if No main class variable defined is the error, then it is no standard JVM error that I'm aware of. I would say to read the documentation for the Mysaifu JVM, as the first option.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If that's your complete program, then you've forgotten to import the class Change, and yes, that class must be found on your classpath, see http://java.sun.com/docs/books/tutorial/getStarted/index.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes there is.

Now, to find out about it, Start your own thread, rather than hijacking this one, post the code you already have (you have some don't you) and ask a specific question about what is troubling you with it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What is your question?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Start your own thread. And then, state what the actual problem is (i.e. compiler/error messages or actual vs. expected results), don't just say what the end result should be and then dump alot of code. We are not going to even try to decipher it, in that case.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Good for you. Get started. If you have a specific question, post your code, any and all error/compiler messages you got, and a detailed description of your problem, and we will help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

SYOT Start your own thread and clearly state your problem and post both your code (or at least a small self-contained example that reproduces the problem) and any and all error messages.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And? Your question is? No one is going to do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

There is no script. It is a program. Have you ever written a program? Judging by your first post you have (unless someone did that one for you), so you should at least know the basic structure of a program. If not, take a look at at any tutorial (and there are millions of them), or at the program you have already done and figure it out.

Of course you are going to use the if and the while, and either a Scanner or a BufferedReader (or some other Reader/Stream).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Scanner or BufferedReader and an if statement and while statement. That's as much as you're going to get until you produce something on your own.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As far as the J2ME on the Dell, I would say to ask them.

As far as "communicating with the server", if the communication is normal network traffic, then why not? It would be quite hard to try RMI type stuff (although CORBA should, technically, work), but normal network traffic, of course.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well "name" (when you use quotes) is a value not a variable. So the value "name" will never be equal to the value null.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What exactly is the problem? Other than the fact, of course, that the method you're calling returns a value and you are simply ignoring that value, rather than storing it in a variable, evaluating it, then printing either it or the message.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I would have to assume that it is coming from the tee (and that error will only occur on the file handle being read, not the filehandle being written), so I have to assume that the find command is not finding anything. But that also seems strange, as I believe that should have the same effect as doing

echo "" | tee -a filename

which as far as I know should not produce an error. Are you certain the error is happening here.

That error also occurs when a quoted string is not ended properly in the script so the shell continues reading the script as a part of the quoted string, but reaches the end of the file before reaching the end of the string as follows:

#!/bin/sh
var="this is an unfinished string
cat filename  # never gets executed as the shell still considers this a part of the string above
# here the script ends and produces the error given above as the string is not ended
masijade 1,351 Industrious Poster Team Colleague Featured Poster

What are you trying to accomplish with

if ("name" == null)

Comparing a string literal to null will always be false.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

AJAX maybe, to connect to a Servlet (or some other serverside program) that returns the results.

But, in any case, this is a JSP/Java forum, not JavaScript, please post this type of question in a JavaScript forum, next time. I have already asked the admins to move this one.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

then do

find / -wholename='somename' -print | tee -a filename

Edit:

Although I am not familiar with "wholename" argument, I assume your find options are actually something different (and correct).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

... you cannot send a file over a socket.

Since when? How do you think FTP does it?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Next time, post to the javascript forum (not the Java forum, there is a difference), please. I have already asked the admins to move this thread.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course we can, but the question is, can you? It is your job and/or homework, so do it. If you have problems, then post your code and your complete error message, and we will help you solve it.

If you are looking to contract someone to do something, there is another forum for that, go there, or go to http://www.rentacoder.com.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Maybe, if we could understand what you just said.

But I believe you are talking about transparency (transparent windows/frames), google that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

There are a lot of syntax highlighting editors out there, emacs, vim, nedit, ultraedit, and textpad (not notepad) to name a few. Google any of those. (vim is a more graphical version of vi)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

delete every line from the first line to the exact line %!ab-cdef$ , and on the rest of the lines change any occurence of the following character sequence .#@%&*) to )

masijade 1,351 Industrious Poster Team Colleague Featured Poster

you may have better luck if you send the email as hypertext or have a html attachment.

try just enclosing the url in tags as such

String text=" Hello welcome,
click <a href=\"http://192.168.1.21:8080/tarka/resentemail.jsp\"> here</a> to enjoy ";

see how something like that works.

I don't know what class you are using but I would assume that you can send a HTML attachment, That will be displayed correctly in most mail applications and then any links you send will be displayed correctly.

Unless, of course, HTML display is disabled in the Mail tool, which many companies have it disabled by default.

Edit: But, once again, this is still a mail tool problem and has absolutely nothing to do with Java.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, as I have no idea what you mean by "rediffmail".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because jsp is not html (which is what you've written). JSP produces html, when compiled and executed by an application server (e.g. Tomcat, WebSphere, WebLogic, etc).

Go through this tutorial (its for the last version, but hey) http://java.sun.com/j2ee/1.4/docs/tutorial/doc/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then ask yahoo mail if there is any thing special you have to do to get yahoo to create "hyperlinks". I don't know why you're asking here, this is not anywhere even close to a Java issue.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Simply include the url. Whether or not that url becomes a "hyperlink" depends on the tool being used to view the mail.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Every time an error occurs in a JSP you will get a 500 http code at the browser. That does not tell us anything. It would really help to include that actual error.

But in general, move all this scriptlet stuff out of the JSP and into a Bean.

Tomcat has a Connection Pooling resource, use that, don't make the connection in the JSP, that causes a new connection to be made with every page load. Very bad for performance (and no way of controlling the amount connections that may be opened).

Use a PreparedStatement and its setString method rather than cobbling together a statement like that. What would happen if the user entered something like this for a username

'; delete * from prim where name like '%

Perfectly valid SQL and it would delete everything from your prim table (and that is a very mild example of what can happen). A PreparedStatement would prevent that sort of thing.

"org.gjt.mm.mysql.Driver" is an ancient Driver, only still included in the MySQL Driver distribution for backwards compatability. Use "com.mysql.jdbc.Driver" as the MySQL documentation recommends.

Nowhere in that code are you closing the statement object. Could be very bad even when you do close the connection. Close that in the finally block as well.

Close the ResultSet in the finally block, also.

I believe that's enough for now.

Let me guess, you got the example you used for creating this from roseindia, right?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I just noticed something, you use

ftp -n $Server <<End-of-Session
......
End-of-session

Those two tags don't match. That "End-of-(S/s)ession tag needs to be written exactly the same in both places.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

David Eddings fan - yes, great books.

I spelled it that way on purpose, used that name in Ultima Online years ago and it kind of stuck.

Just wanted to check that that was what it looked like. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

An interface cannot implement anything, since an interface is not an implementation. An interface can only extend interfaces (exactly one).

Edit:

PS If you are a David Eddings fan, it is spelled Belgarath not Balgarath. If not, then please ignore.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As long as the first String is always of the same length and does not vary over the "tabStop index" length. printf (if you're using a late enough version of it) is, of course, the proper way to do this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What the hell is wrong with the Date, Calendar, and SimpleDateFormat classes (that do all this bs for you), and reading the API doc for those.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because everyone of your constructors are redefining them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

change

mput "go*"
bye
rm go*
End-of-session
exit 0

to

mput "go*"
bye
End-of-session
rm go*
exit 0

Because the rm go* is being fed to the ftp command (everything up to "End-of-session" is being fed to the ftp command), but the ftp session ended at "bye", and if it hadn't you would have removed the files on the remote machine (if anywhere). That's why you move that command down after the "End-of-session" line.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

All of that about Herb Schildt also applies to that roseindia site, in General.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, not just post your code, look a little closer at the OP, and you will see a list of multiple choice questions. He really just wants his entire homework/test done for him. He has no desire to do it himself, at all.

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

We are not just simply going to do your homework. Tell us your answers, and we might, I repeat might tell you if you're right.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, if you knew the right way, why did you suggest the wrong way?

As I said:

You can also scratch your back with a butcher knife, but I wouldn't suggest it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

U can write all code using scriptlet. Simply start scriptlet,create connection, write and execute update query, close connection and scriptlet.
For Ex
<%
create connection
Create query
resultset
execute query
close connection
%>
Hope it provides u some help!!

U can find example code in google.

Which is, of course, exactly the wrong way to do it, reagardless of whether it works or not.

You can also scratch your back with a butcher knife, but I wouldn't suggest it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I will go out on a limb, and assume that you passed this hash to a method, and call the print statement in that method. In this case the print statement needs to be changed to:

print "$HeaderHash->{'Deal Name'}\n";

If that is not the case, then as KevinADC has said (and cerf_machine repeated without acknowledgement), your problem is elsewhere.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Look at the last line of parthibans post again. You were already provided with an answer for this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hello,

I have a script I've used on pre-Solaris 10 that works just great. Now on a Sol10 box, it is bailing on this line with this error: syntax error at line 27: `|' unexpected
Here's the 'offending' line:

creation=`echo $backupid | sed 's/^.*_//'`

I'm a bit confused as to why this isn't working as I've pulled it out of the script and can run it successfully from the command line directly. Any ideas?

As always, thanks for the help!!

It shouldn't really make a difference, but the following change is always worth while, and worth a try:

creation=`echo "${backupid}" | sed 's/^.*_//'`

Edit: Since you're using ksh, you may also wish to change "echo" to "print".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I don't know that there is anything to solve. If you are using the database for authentication, and the database is not case-sensitive in this respect, then that is just the way it is. Maybe if explain more clearly than "I have a ogin form and the DB is not case-sensitive". As you can see, from the summary of your post, tht those two things have nothing to do with each other, so we don't really know what your problem is. I can say however, that if you are not using at least MySQL 4.0, then you should update, preferably to at least 5.0 (if not higher).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

An "update" command does not produce a resultset. And, execute, as the error message clearly says, returns a boolean, not a resultset. And <%=rs("name")%> doesn't mean anything. You shouldn't be using scriptlets, anyway, as I already said.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Find someone who can translate my advice for you, then start to implement it. I am not going to do it for you (if that is what "give me a complete reality then code" means, and I think it does). And as far as "Or helps me to fix thiscode" goes, I already did.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What I can understand about that code (without ever running it) is as follows:

1) You are using alot of scriptlets. This is bad. JSP is meant for the presentation layer (the view of an MVC), and nothing else. Move all of this scriptlet stuff to beans (or other context level items), and if any part of this JSP is to receive a post request (or file upload or any other request that requires "real" action), then that part should be a servlet that does the action, then forwards to a JSP for the presentation.

2) "org.gjt.mm.mysql.Driver" is the old (ancient really) mysql driver, use "com.mysql.jdbc.Driver"

3) don't do this time="m"+String.valueOf(month)+"d"+String.valueOf(day); In your statements (which we will get to in the next point) use a Date. If you absolutely must have the Date in a String format, then use SimpleDateFormat and a pattern to create it, don't cobble it together yourself.

4) Use preparedStatements. Instead of smt.executeQuery("update counter set today="+today+",first=first+1 where date='"+time+"'"); use

stmt = conn.prepareStatement("update counter set today=? first=first+1 where date=?");
stmt.setInt(1, today);
stmt.setDate(2, new java.sql.Date(calendar.getTimeInMillis()));
stmt.execute();

This is much more reliable than cobbling together your own statements, formats Dates, escapes Strings, and protects you from SQL Injection attacks.

5) Enclose all of the Database stuff in one or more try/catch blocks, closing the resultsets and statements (and connections if you get a new one each time) in a finally block, or you will leak DB resources. And when you do that, do not …

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course you can always forego maintaining a separate file, and still execute su on a single command as follows:

#!/bin/sh
cat > /tmp/someObscureName.sh <<EOF
#!/bin/sh
echo "Please enter the password for a2billing user and confirm it: "
createuser -W -S -d -r -e a2billinguser
createdb -e -O a2billinguser a2billing
EOF
su - postgres -c "/tmp/someObscureName.sh"
rm -f /tmp/someObscureName.sh
exit 0

I'm just not a big fan of providing alot of semicolon separated commands into a single su -c. It is cleaner and easier to understand/maintain this way, IMHO. (Even if a single line might be more effecient.)