Mark Beattie

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

Recent posts by Mark Beattie

Hi Marilyn,

I cannot recall if I used:

db.password=

I probably left off the '=' sign and used:

db.password

I do recall removing db.password from the properties file and the the db.password codes from the build.xml file. That did not work.

I tried again just now with 'db.password='. I reconfigured the MySQL instance - this did not work. Then I removed and created a new MySQL instance - still did not work. For some reason the security password is still needed to access MySQL. I don't know why the application is so stubborn with me now.
11 years ago
The MySQL version, I think, is: 5.0.24a-community-nt

Regarding the build properties files. I am not sure that I tried out all the possible passwords properties in my userName.properties file:

...
db.userid=root
db.password=password

The above properties work for my current setup.

In the previous set up I tried 'null' but can't recall what else I tried.
11 years ago
I finally got ant to drop and create new tables using 'ant db' on the command line.

The main problem I had was that MySQL keeps older files hanging around, making it difficult to get new configurations to work. Solution - remove MySQL then reinstall.

The build.xml problem: The first time I got MySQL to work I did not set up a user with a password. I was able to start MySQL from the command line using 'mysql -u root'. This did not work with the 'ant db' because the response I kept getting said something about using a password.

After a lot of experimenting and online research I came across a useful command: mysql -u root -p
-p means login with a password.
So, I configured MySql with a security password. Tested mysql -u root -p on the command line. Success! Then set the property files for the ant with the security password. Ran ant with the command 'ant db' Success! phew
11 years ago
My VideoServlet application uses a JDBC Connection object. It is very naughty of me to use this Connection as a global variable.

One solution:
Should I change the argument lists of all methods that use a connection object. For example, in the AddActionHandler there is a method called doSecureAction(ServletData servletData). Should I overload this method to take a Connection object?

Or is there a more elegant solution that I should consider?

Any hints would be greatly appreciated.

Thanks,

Mark
11 years ago
Hello Carol, Matt, and Marilyn,

[Carol, I got your name right this time. Having the names Carol and Marilyn on the same site impels me to use Carolyn, a friend of mine.]

I got a new version of the build.xml working, and my JBDC-2a assignment continues to work. That is not to say that I implemented things correctly. I did not see any evidence that the createVideos.sql actually ran.
11 years ago
Carolyn,

I have no idea what most of the things mean. I just want to make it work.
:roll:

Mark
11 years ago
Well, I am certainly tuckered out.

I've been attempting to get the new version of JDBC-2a to work. I think I am half way there.

My first comment is that the assignment should tell the student to first read Paul Wheaton's Evil Ant Build Properties article. I suspect most coders are like me in that they try to get something to work by ignoring the instruction manual. Yes, that is how I assemble furniture and children's Christmas gifts.

My second comment relates to where I am stuck. The build.xml very nicely tells me that I need to set my db.driver.jar. I found the answer in the reply to Carolyn's email above. Then it tells me to set the db.driver. Now it wants the url, userid, and password. I have not the foggiest idea what the db.url would be. What are they?

I should explain that I set up MySQL differently from what is described in the first section of the JDBC assignment. MySQL site has been updated since and I was only able to get it to work by setting it up in the Program Files folder as recommended by MySQL. Doing it this way, all I have to do is open the command prompt window and type 'mysql -u root' and MySQL starts up no problem. So I never had to worry about where the MySQL program is located.

11 years ago
Thanks for your kind congrats

And Pauline for the research


[ November 27, 2006: Message edited by: Mark Beattie ]
11 years ago
Hi Carol,

I tried to make my cookie code 'elegant' by trying to change a cookie directly. No luck. The solution I came up with is to loop through all the cookies until I find the right one and then change the value.

Mark
12 years ago
Hi Carol,

I like your message subject heading.

I have not got a nitpick back yet so I am not sure if I am on the right track.

I did have the same problem as you about the log in process. The showVideoList method did not handle cookies very well because the newly created cookie could not be 'read' yet. My solution reads the showVideoList message and 'if', 'else if' and 'else' statements. One of the messages passed is 'Logging in'; in this case, the cookie is not evaluated and the listvideos.jsp is forwarded.

Hope this was not gibberish.
12 years ago
Hi all,

Re: Clearing cookies. Disregard my comments about clearing cookies. I was using IE and still have not figured our what is going on with this browser. Let's just blame Microsoft.

Use Firefox. I can see the cookies I created by going to Tools > Options > Privacy > View Cookies. Much to my delight my cookies show up.

Firefox is such a nice browser

Mark
12 years ago
Hi Adrienne,

I'm afraid I can't remember all the set up details. I do recall that I thought I had java on my system, and in a sense I did. I had the Java Runtime Environment, JRE, but this does not include the applciation 'javac.exe'.

javac means compile java code. This javac is an application that comes from the Java Development Kit, JDK.

Do a search for 'javac.exe' on your computer. If it is not found then you need to go to Sun to download a JDK. Be sure to download the 1.4 version if you plan to participate in the CattleDrive.

Hope this helps.
12 years ago
Hi all, especially Carol,

Have not bothered to find where the cookies are being stored.

I have managed to get a working 'secured' application.

A user, or a hacker, is prevented from accessing the following URLs:

http://localhost/videos/servlet/VideoServlet?action=addvideo
http://localhost/videos/servlet/VideoServlet/addvideos.jsp
http://localhost/videos/servlet/VideoServlet/listvideos.jsp

In all cases these urls return to:

http://localhost/videos/servlet/VideoServlet/

The above urls are accessible when cookie "favorite_cheese' has the value "extra stinky bloo cheese". The VideoServlet.java code checks the cookie each time a page is accessed.

When the Log out button is clicked, the 'cheese' cookie is set to a different value, thus preventing the other pages from being displayed. This required a lot of experimentation before I got it to work.

Much to my puzzlement is that the cheese cookie disappears when I close and restart the browser. Mind you, this is convenient for this assignment.

There is a relationship between cookies and sessions. So far, however, my code does not make any use of Session IDs except that I see them listed as one of the cookies.
12 years ago
Hi Matt,

I lucked into a useful method that was created in the JavaRanch common package. Look at the methods in the Str class in the Code Barn:

http://www.javaranch.com/common.jsp Click on Java Docs link

This method checks to see if a variable is not null and has characters.

Let me know if you need a better hint.
12 years ago
Thanks Carol,

I went back to my VideoServlet code. After several experiments I was able to get a list of cookies to display in the Command screen. That was exciting. However, I cannot not figure out where these cookies are stored.

I even cleared the cookies from the IE browser then attempted to go back to http://localhost/videos/servlet/VideoServlet. The Command screen displayed a nullpointer exception, which is a good thing. It means the cookies were deleted. Usually I can locate a folder on my system that lists all the cookies. This does not occur when using orion.

Do you know where tha cookies are stored?

Thanks,

Mark
12 years ago