Mohamed Manas

+ Follow
since Jun 02, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mohamed Manas

Thanks for taking your time to reply.

The thing is I can draw a road and a car in a picture. But I have no idea how to move a car along a track (to take curves and pass through junctions). Similarly it is impossible to determine the properties and methods of a car as well as to represent the road map as an Object.
12 years ago
It is something like the simulation in this URL :
12 years ago
Im doing HND in Software Engineering and submitted my final project proposal for a Traffic Simulation system.
Though I have a sound knowledge in Java, I don't know where to start and what to do first. I submitted the proposal with an anxious on the topic. Could anyone please show me the right direction.
Thanks in advance.
12 years ago

Ulf Dittmer wrote: points you to Microsoft's own driver. jTDS is also an option.


Ulf Dittmer wrote:Since you're using SQLServer, why are you using the JDBC/ODBC bridge instead of a proper type 4 driver? It's free, not buggy like the bridge, multi-thread-capable etc. etc.

Can you give me more information regarding this. Actually I do not know to connect to the database other than through the JDBC/ODBC bridge.
thanks for all your valuable help here.

Finally found out its a bug in the jdbc_odbc_bridge. So I gave up using prepared statements..

thanks again...

Ulf Dittmer wrote:Where/how are you seeing these space characters? In other words, how did you notice they're there?

this code is about changing a password. so after changing the password I tried to login with the new password, but I couldnt login. so I checked in the database itself (SQL Server Managment Studio) and figured out that space characters are inserted after the password..

sorry for the late reply.

Paul Sturrock wrote:Its definately not the database. VARCHAR is variable character length. If you had chosen char (fixed character length) you might see this behaviour.

Of course, yes.

But, this time I changed the datatype to VARCHAR(25), and got the password ("pass") saved with 21 whitespaces. still confusing...

But I agree with you, VARCHAR is of variable length, strange behavior..

Ulf Dittmer wrote:You could put a few System.out.println statements along the way between the code that reads the password from the GUI, and the code that writes it to the DB. That way you know what gets entered, whether it gets changed along the way, and what is passed to the DB.

Of course I tried that just before writing the new password to the database.

it is printing the password without any blank spaces.

Another interesting point is if i try to add a password with 3 characters (say "new") it is adding 17 whitespaces.
if i try to add a password with 19 characters then it adds just another whitespace.

Since the datatype VARCHAR(20) is defined in the SQL Server and the java coding has no knowledge about the number 20, I think the problem is in the database side. Still confused...

Paul Sturrock wrote:OK, so you know you must be passing twenty characters of data to the database.

I just read the password from the JPasswordField and send it to the changePassword method.

Paul Sturrock wrote:
What's this:

line doing?

reference name of the JPasswordField instance is newPasswordField
since the getPassword() method returns an array of char values, I converted it to String with the above line..

still cant figure out the problem

Paul Sturrock wrote:There is nothing in JDBC or SQL Server that will cause this behaviour. Are you sure of the value you are passing? Are you sure your data type is varchar and not char? How are you testing this?

Im sure data type is VARCHAR

These are the coding that I used to take the value from a JPasswordField.

hi all,
I am developing a small Movie Booking system as an assignment of my degree programe.

I am having a problem with updating a database with a new value.

This is the coding I used to update the database.

My problem is if I give "pass" as my new password, it stores it as "pass________________" ( _ is for a blank space. so "pass" and 16 blank spaces)
Note that my password column's data type is VARCHAR(20).
And the database I am using is Microsoft SQL Server 2003

Originally posted by Maneesh Godbole:
My bad. I should have thought of that.
In that case, I am wondering if dialog.setAlwaysOnTop(true) (called before the setVisible(true)) would be the proper thing to do.

[ July 23, 2008: Message edited by: Maneesh Godbole ]

First of all I didn't understand how to write the codes inside the overridden method (may be I am not matured enough in Java).
Can you give me the code for the overridden method.
14 years ago

Originally posted by Maneesh Godbole:

You can subclass JOptionPane and override the showOptionDialog(). This method is the one in which the actual JDialog is created and displayed. Inside your overridden method you can call a toFront() after the dialog is shown. This should fix your problem.

I tried to do as you have mentioned. But it didn't fix the problem. Because I couldn't find a toFront() method in the documentation for the JDialog. Please explain with a example.
14 years ago
Sorry, it doesn't seem to work.
No improvements yet.

Thanks for the help anyway.
14 years ago