stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This once again is not related to Java script, just set the default page in your webserver as "file.html" for that specific folder and voila when anyone types "http://cbuy.webs.com/file.html" he will see the file in his browser but "http://cbuy.webs.com/" in the address bar,
But why would you want to hide that is a mystery to me ??

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

can anyone please give me the code (or point me in the right direction) to be able to password protect a web page with javascript that gets the usernames and passwords from a database and displays a message if the entered password or username is wrong and points the user to a page if it is correct. and i also want it to create a cookie so that the user doesn't have to put in his/her password all the time.
can anyone help me out please!

You can't do that with pure Javascript, you need some server side script to work with you for that

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Nope by default the Java Plugin for Eclipse only includes Core Java, Servlets are not a part of that.
A short cut to resolve that error would be, in case you have tomcat / some other java enabled server installed, just check in their "lib" folder if you find any jar called "servlet.jar" or "j2ee.jar" or something similar in name and add it to your project's build path in Eclipse, this should solve the compile error.

However you will not be able to test your servlets directly via Eclipse in this case

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I remember during my college days when I was a lazy programmer I used to use the BigDecimal and BigInteger classes for checking whether a particular string is numeric or float.

To check if a given number is an integer or not I used to just write the code

try{
  new java.math.BigInteger(<string to check>);
  System.out.println("String is numeric");
}catch(NumberFormatException ex) {
  System.out.println("String has invalid characters.");
}

same way to check for floating point numbers with the java.math.BigDecimal class.

But in recent times since I have learnt of regexes I no longer find the above approach attractive I prefer using the matches(String regex) function of the String class which is a much much better option.
Also if you are unaware of regexes in Java you can start here

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

For running the program mentioned, you need an echo server running on your system, which is provided by most UNIX machines and runs on port no 7.
To check if your Vista box has one running just hit telnet localhost 7 , if it shows connection refused or could not connect, then it means you box does not have an echo server, and hence your program will not work and thats the reason I feel for your ConnectException exception.

I know that your tutorial probably says to connect to port 7 for an echo, but try connecting to a port > 1024. Chances are your errors are due to trying to connect to a port that is in use.

Now this prob would have occurred if we were trying to create a ServerSocket on the given port, But as we are creating a client socket here to connect on the given port we apparently want the opposite, that is the port should be in use by the "echo server" so that we can connect to it.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I wouldn't recommend upgrading via this method . . cause I have awful experiences of it.
I had tried to upgrade by home PC which was running Ubuntu 7.10 Gutsy to Ubuntu 8.04 Hardy, the system downloaded all the required packages but during the installation, everything just stalled, I had to power off my system, and on restarting I couldn't boot into anything, This had happened before too while going from 6.10 to 7.04 also :'( !!!

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

.rpm works only on Red Hat Based systems, Ubuntu is based on Debian so it uses to .deb versions.

For you currently it is no longer possible to upgrade to a newer version of Ubuntu by directly invoking

apt-get upgrade

cause your version is too old.
In case you need to use MySQL also, I suggest you download the latest version from the Ubunu site

Cause otherwise u would need to manually compile and install all the software you need.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Thats cause your Ubuntu version is too old and the repositories are no longer supported, U will need to upgrade to a more recent version (@least 6.04) use for installing software via apt,

or do a manual install by downloading jdk from here

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Note the semicolon next to the while loop,

while(getc(pFile)!=' ');

Thanks to that, your while continues to run and skip all the characters on the line until it finds a ' ' <space>.

Just remove that semincolon and try.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Since you are running Ubuntu you can install the Sun JRE directly by issuing:

apt-get install sun-java6-jre

in your terminal.

But if you plan on doing some Java developement you should install the java SDK instead,
to do so just issue the following command in your terminal

apt-get install sun-java6-jdk

But first I suggest you check whether all the required Jars/classes are included in your classpath as jwenting mentioned

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I just checked " Var " and " Var2 " are both "char" types, I think you can use " == " directly for checking for equality.

Following is the signature for strcmp ->

int strcmp( const char *str1, const char *str2 );

so I don't think strcmp (Var1, Var2) will work

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Have u added #included<cstring> in the file which contains your class definition(ppoly.h).
you will need it for the strcmp() function which is on Line 51

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This is happening cause you are using GCJ which does not support all classes mentioned in the official J2SE specifications.
Most probably on Windows you are using the JRE from Sun, I suggest you install the same on your Linux machine.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You need to compile C++ programs in GCC using g++ and not gcc.

g++ filename
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hi Yuichi,
My suggestion is almost similar to Alex's, only looking at your prigram I think you should not only declare your array which which is holding the queue as global, but also a variable which holds your actual queue size (i.e no of elements currently in the queue and not the size of the array).
Something like

using namespace std;

int queue[10];
int lastElementIdx=-1;

So when you want to add just one element to the queue you have to :

queue[++lastElementIdx]=...

instead of the for loop.
and to delete the last element from the queue just decrement the variable "lastElementIdx" and of course check to ensure you do not delete an element from empty queue etc.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hi Alex,
I see the problem you are facing, and have been there..
In Java when you are typing in a regex you need to understand that a simple "\" stands for indicating escape characters inside your string (Hence the error when you mention "\+" as there no such escape character in Java).
But you need to indicate an escape character in your regex so you need to mention it as "\\+", the first back slash tells the compiler to treat the next backslash as a normal backslash which in tells your regex evaluator that the next "+" is just a normal character and not a quantifier.

So in case you wish to search for a "\" in your regex you would have to type in "\\\\"

The back slashes in red are used by the compiler as an indication for an escape sequence
The back slash in green is used by your regex evaluator as the start of an escape sequence.
The final back slash is what is taken by the regex evaluator as a normal character.

Similarly if you wanted your regex to search for a "+" it would become : "\\+"