masijade 1,351 Industrious Poster Team Colleague Featured Poster

So search for some Auth module on CPAN/ActiveState that might help you. There are lots of them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you tried using his suggestion yet? If you had, you would see that the expression syntax error should now be gone. The problem was that the variables char, words, and lines contained something like "86 filename" rather than just "86". With the above change they will contain just "86". So, the expr syntax error is corrected.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but why are you posting an answer to a question that is 18 months old, and, according to the OP's last response, is solved.

And your answer is wrong, I might add. You are attemtping to use array indexing into an ArrayList, which won't work, and is exactly the problem that was already solved in this thread.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. Java is pass-by-value and pass-by-value only.

When you pass an object rather than a primitive, you are not actually passing an object. What you have is a variable that is only a reference to an object, and when you pass this, what happens is that the reference value is copied, and the copy is passed. Now you have two references to the same object.

Because of this you can use the methods of the object and see the result outside of the method, but changing the variable inside of the method will have absolutely no effect outside of the method.

You should probably read the following two articles. The second one is the one that is important, but you probably won't understand the terms they use if you do not read the first one.

http://www.javaranch.com/campfire/StoryCups.jsp
http://www.javaranch.com/campfire/StoryPassBy.jsp

BestJewSinceJC commented: A very old post, but a great explanation. I keep seeing people have this problem too... +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Most of these are also not the type of things Java should be used for, as the majority of them would require a Runtime.exec call. And those, almost always, defeat the purpose of using Java.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, I don't mean to sound mean-spirited or sarcastic, but try a JavaScript Forum. Java != JavaScript

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but Do Your Own Homework. Or at least make an attempt at it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
System.out.print(((Crules)theList.get(0)).lp); //line 31

What is returned from the ArrayList (at least before Generics) is an object of class Object, so you need to cast this object to the correct class before you can access its fields and attributes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, for one, you will need to check the elements of the array to know when to stop processing, and where to add the next element. Also, I believe that as soon as an array is declared, the memory that will be needed is reserved immediately (at least that is how arrays work in other languages) so by declaring it artificially large you will be using much more memory than is needed, and this could wind up being a problem.

Moreover, I don't understand your statement about "many attributes" and ArrayLists. What exactly is it you are trying to do?

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

Well, supplying the errors you are getting would be helpful.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What you need is ActionListener, addActionListener, and actionPerformed,
all used almost exactly like the equivalent methods in the ProperChangeListener you are using now. Check out the API doc for JButton and ActionListener, and maybe the Swing Tutorial (almost all of the Swing tutorial examples use an ActionListener).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

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

Start from the first Tutotial "Getting Started" and work your way down the list. Also, you will do your self a big favor if you actually type the examples given, rather than cut and pasting them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That depends. If you use the same connection, then, obviously, autocommit will still be deactivated. If you close the question and get a new one for the next transaction (without Connection Pooling) then autocommit will be activated on the next transaction (unless you deactivate it again). If you use connection pooling, it depends on what your connection pooling "agent" does. Some of these tools will actually close the connection and immediately reopen a new one and return that to the pool. Some will simply clean the connections up and recycle the same connection. And some will do none of the above. They are all suppossed to return a connection that acts as one freshly opened, so aurocommit shopuld be active (but I would not trust this). In any case, when in doubt, set autocommit manually before every transaction block.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you have MySQL 5.0 or later you can start your mysql server with the option --sql_mode="NO_ZERO_DATE" , or to be even more restricitive --sql_mode="STRICT_ALL_TABLES" , so that insertion of invalid dates will cause an error (and not be inserted). If you are 4.1 or earlier, you will have to check the date programmatically before the insert so that entering of invalid dates does not occur (which you should be doing anyway).

Edit:

Also, if you can afford to ignore records with invalid dates, then when selecting your records insert

AND HireDate != '0000-00-00'
AND OpenDate != '0000-00-00'
AND EditDate != '0000-00-00'

into your Where clause so that invalid records will not cause your statement to crash.

Otherwise, do not use getDate to get the Date Column. Use getString and then parse the date using SimpleDateFormat and catch any exception in order to set the date with a default value (say new Date(0) maybe). This will also keep your statements from crashing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
if echo "$var" | grep "," >/dev/null 2>&1
then
  echo "Variable contains char."
else
  echo "Variable does not contain char."
fi
masijade 1,351 Industrious Poster Team Colleague Featured Poster

How about posting what you have so we are not guessing about how you are currently doing things when trying to present a solution that doesn't involve too much of a rewrite.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You do really need to look at some Applet tutorials. An applet does not use a main method, a standalone application does. Go to http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted.html for the Sun Applet tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, yes, seemingly they can run from everywhere, or you wouldn't be getting an internal server error, but rather the contents of the script spilled out onto the browser (or the browser asking you what you wanted to do with ".pl" file).

As to why it is failing, hard to say. I would say to send 1and1 a copy of your simple example and ask them why it might be failing.

Another thing to try, when it is a perl file, they may have something that checks that you are actually running in "Taint" mode (i.e. /usr/bin/perl -T) and when you are not fail your script in some way. I don't know if you have tried this already, but make an attempt at using -T.

Also, do have access to logs anywhere. The logs should have some better explanation as to what went wrong with your script.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but I need to comment.

That is some leap, going from needing to know how to convert integers to strings (http://www.daniweb.com/techtalkforums/thread61013.html) and then to needing to create your own programming language.

Wow.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
int i = 0;
String str = "" + i;

// or

int i = 0;
String str = String.valueOf(i);
masijade 1,351 Industrious Poster Team Colleague Featured Poster

This question makes no sense. Do you want a jsp login page or a cgi login page written in perl? The two things are entirely different beasts. If you want the latter, then please post on the perl forum or the cgi (if there is one) forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Very pretty

do
you
have
ques-
tions!?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

There is a Net::SSH CPAN module that is easy to install, and needs a preinstalled OpenSSH, and I don't think it can do SFTP. There is also the module Net::SSH::Perl. This module does not need a preinstalled OpenSSH (or any other other SSH install), but it does need a whole slew of other CPAN modules (various encryption and MessageDigest Modules).
There is also a Net::SFTP Module, but this modules relies on the Net::SSH::Perl Module, so have fun, since, like I said, There are a whole slew of Modules that Net::SSH::Perl needs, and one of them only compiles "directly out of the box" on Linux. If you have Solaris (or other Unix flavors) you will need to change a few lines in one of the C Code files to get it to work (or at least that is the way it was when I downloaded it last a couple of years ago). It is one of the encryption modules, it uses some "endian" variable names that differ from system to system, and this is what needs to be changed.

Sorry about that big run on paragraph above, I got a bit long winded.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JavaScript != Java

Find a JavaScript Forum

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Runtime.exec( ) ;

Search on JavaWorld.com for a good article about the traps and pitfalls of Runtime.exec

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do you mean Hibernate?

http://www.hibernate.org/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try a vb.net forum. This has absolutely nothing to do with Java, abd most people here will look on this question with scorn.

And taken in connection with you post, I must ask, what makes you think that you will get answers concerning vb.net on a Java forum. Boggles the mind.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try a vb.net forum. This has absolutely nothing to do with Java, abd most people here will look on this question with scorn.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It is because you are using Generics (which first came out in JDK 1.5.0) and are compiling with a JDK 1.4.2 compiler. You need to upgrade your JDK to a 1.5 version.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

On the same time i need the program and coding!

So what was the meaning of this line?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Except for the fact that he said he wants to keep the original case, which that regex would not allow. I am assuming he is doing some sort of alphabet shift to quasi encode or scramble a string (at least that is what it sounds like to me since he wishes to keep the same capitalisation pattern).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What about simply running the entire string through two tr statements. The first one transforming either the the upper or lower case letters, and the second one transforming the other.

That would be my first suggestion, but it would definately help to see the related snippet of code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, you want us to not only give you an idea for a project, and then do it for you, too? Well, why didn't you say so? Can I get you your shoes and coat, too? I mean, that is the sort of thing a personal servant does, isn't it?

Well, I will be so kind as to give you an idea: do a chat server, just like just about every other student out there. That aught to give you few originality points.

Better yet, be honest and do nothing. Call it the art of silence or something.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I don't have a clue what you just said.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Runtime.exec()
capturing the output and err streams and feeding the inputstream

or opening a socket connection and attempting the protocol yourself.

Read the API and tutorials for those, and search javaworld.com for a good document on the pitfalls of Runtime.exec

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Glad to hear it. Good luck, and have fun.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And like I said, it is a CLASSPATH (not PATH) problem.
Use "java -cp .:<path to jarfile> Classname"

On windows you may need to replace ".:" with ".;"

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then use korn shell arrays and a single while loop as follows:

#!/bin/ksh

set -A INSTID inst1 inst2 inst3
set -A FANCID fac1 fac2 fac3

count=0

while [ $count -lt ${#INSTID[*]} ]
do
  echo "Instance on ${fancid[$count]} ${instid[$count]} instance"
  count=$(( $count + 1 ));
done
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, then what should an interviewer do? Take your word for it? Like I said, that is what an interviewer is suppossed to do. He must do it. It is not a question of right or wrong, it is his job.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is a pure personal choice design question. If it is going to be local intranet anyway, you could do simple multicast and let each "client" receive and broadcast the messages themselves, without any kind of a server.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi Richard,

What if that guy, in turn, asks you one or more questions and you don't know the answer(s)? Would you resign?

You cannot judge people by a few questions. They may know what you don't and don't know what you do.

Was this person you? Are you bitter? You must be to have dug up an extinct thread and try to revivie it with a retorical question. And yes, an interviewer can judge someone with a few questions. In fact, that is exactly what they are suppossed to do, and you would hope that those few questions are geared toward determining applicant compatibility with project requirements, but this is not always the case.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

use

system("command");

on a uniy system, do man perlfunc and search for system. I don't know where the docu is on windows, but since you are using it, you should, so if you are using windows look up the system call in the docu.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Ach, completely missed that first done before the second for.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Here is the fix:

INSTID="inst1 inst2 inst3"
FANCID="fac1 fac2 fac3"

for instid in $INSTID 
do 
echo ""
done
   for  fancid in  $FANCID 
   do
     echo "Instance on ${fancid} ${instid} instance"
   done
done
exit 0

You forgot to close one of the for loops.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you are defining the variable inside the loop. Change the following:

for(int i = 0; rst2.next(); i++){ 
  String ca1 = request.getParameter("ca1_"+i);
  String sa1 = request.getParameter("sa1_"+i);
  String ca2 = request.getParameter("ca2_"+i);
  String sa2 = request.getParameter("sa2_"+i);
}

to

String ca1 = "";
String sa1 = "";
String ca2 = "";
String sa2 = "";

for(int i = 0; rst2.next(); i++){ 
  ca1 += request.getParameter("ca1_"+i) + " ";
  sa1 += request.getParameter("sa1_"+i) + " ";
  ca2 += request.getParameter("ca2_"+i) + " ";
  sa2 += request.getParameter("sa2_"+i) + " ";
}

ca1 = ca1.trim();
sa1 = sa1.trim();
ca2 = ca2.trim();
sa2 = sa2.trim();
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I think you can extropolate my answer from your other thread to fit this one. It seems to be the same thing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If what you mean, is that you want to concatenate all values into one string and then insert that then change

for(int i = 0; rst2.next(); i++){ 
  if(request.getParameter("ca1_"+i) !=null){
    Childic = rst2.getString("Childic") ;
    String query2 = "INSERT into results(ca1) values ('"+Childic+"')";
    stm2.executeUpdate(query2);
  } else {
    // whatever it is you want here
  }
}

to

for(int i = 0; rst2.next(); i++){ 
  if(request.getParameter("ca1_"+i) !=null){
    Childic = Childic + rst2.getString("Childic") ;
  } else {
    // whatever it is you want here
  }
}
String query2 = "INSERT into results(ca1) values ('"+Childic+"')";
stm2.executeUpdate(query2);
masijade 1,351 Industrious Poster Team Colleague Featured Poster

DYOH - Do Your Own Homework

masijade 1,351 Industrious Poster Team Colleague Featured Poster
String ca1 = request.getParameter("ca1_<%=i%>");

should this not be

String ca1 = request.getParameter("ca1_" + i);

Assuming the parameter names are ca1_0, ca1_1, ca1_2, etc.

At this point in the code you are already inside a scriptlet tag (at least I assume you are), so additional scriptlet tags are nothing but syntax errors.