Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Ste Graham

Greenhorn
+ Follow
since Sep 15, 2003
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 Ste Graham

Thanks! I have now:



, and this works. For some reason I didn't know you could reference the names and values like this! ops:

Stephen
11 years ago
JSP
On my workstation which is running Tomcat 5.5 (Java 1.5 JVM) the following code works and prints out the HTTP headers:



However, when I copy it over to our server which is running Tomcat 6 (1.6 JVM) I get the following output:



Why is this? Any help/advice much appreciated!

Stephen
11 years ago
JSP
Hi - I'm following the example in chpt17 of the Manning SCWCD exam guide, but I just cannot get it to work. I have two files:

1. example.tag


2. example.jsp


When I access example.jsp from the web browser I get the following output:


I just cannot understand why the fibnum variable is not interpolating correctly - am i missing something?
Sorry for hi-jacking the thread, but I have a question about passing etc.

When do you receive the detailed report about the exam? Since the 23rd Jan, the details at http://www.certmanager.net/sun for me have been updated (I took the exam in Dec last year), and there are several new entries in the "History" section which look like:

Testing Center Id: gb95
Exam Series #: 310-027
Exam Name: (310-027) Sun Certified Developer for the Java 2 Platform (310-027)
Exam Date: 12/12/06
Grade: Passed

Event Date/Time: Jan 23, 2007 8:04:32 PM
Event History:
Certified in Sun Certified Developer for the Java 2 Platform on Dec 12, 2006


etc etc.

The last entry says:


Posted Date/Time: Jan 24, 2007 11:05:08 AM
Description: Fulfillment request #1234567 for Developer for the Java 2 Platform Kit; status: Mailed



Does this means that the actual report is mailed to you? I can't spot anyting online. I *think* I have passed, but without a grade etc I'm a bit wary about celebrating etc, just in case!!

Ste
[ February 06, 2007: Message edited by: Ste Graham ]
Well, I sat the Essay exam - quite straight forward really - but I'm annoyed with myself for submitting the application with the read only file. I just wanted to make sure that the db file was the original one. I had several "untouched" copies on my PC, but couldn't be 100% sure, so I copied it from the CD! I suppose I should really put a check in my code to see what the properties of the file are and print a nice error out if it read-only. I suppose just because it wasn't an issue in the development I should have thought of it! Got to wait 4-6 weeks now before I can re-submit! Boo!!!
[ December 12, 2006: Message edited by: Ste Graham ]
I've kicking myself at the moment. When i first received my assignment I copied the db file over to a CD. I did this because the instructions said that I needed to include the db as i received it (unchanged) when I finally submitted the application. Over the last few weeks I've been testing and testing and been really careful. On Monday i uploaded the assignment (exam questions this afternoon), BUT I copied the db file over to my jar file from the CD before I sent. I forgot that the file comes off a CD as read-only ......... I was in such a rush (relieved) to be sending it, I just didn't test again. I've just tried the application and the gui doesn't load because the file is read only. I'm guttted. I can guess that I'll get automatic failure for this. I checked in my code to make sure that the suncertify.properties files could be read/written, but not the db file - WHY?!! I'm still going to sit the exam this afternoon, but I'm totally deflated and do not feel like doing it at all.
[ December 12, 2006: Message edited by: Ste Graham ]
I'm just in the process of re-coding some classes for java 1.5. They all compiled and worked fine under 1.4, but Im getting compile warnings under 1.5 (even though they still all run correctly). I'm new to Jave 1.5, and it appears that the issue I am having is with generics. I have a class which holds the following ArrayList:

ArrayList records = new ArrayList();

Obviosuly, I get an "unchecked" warning when compiling this, so I do:

ArrayList<Integer> records = new ArrayList<Integer>();

Further on in the code I want to add this ArrayList to another ArrayList, so I try:

ArrayList keepRecords = new ArrayList(records);

Again I get an unchecked warning, so I do:

ArrayList<ArrayList> keepRecords = new ArrayList<ArrayList>(records);

I htink this is correct, because keepRecords is an ArrayList that contains other ArrayLists. However, when i compile I get:



As far as I can see this should be correct. In 1.4 I could create an ArrayList with a another Collection (e.g. An ArrayList),and it worked fine. No matter what I try I can't get this to work. Any help would be much appreciated!

Stephen :-)
13 years ago
Thanks Mike.

If i don't re-code to deal with the generics issue, do you think I need to document this in my choices.txt file? I mean the reason i don't want to do it is because as far as I was aware I'd finished and don't want to be bothered to have go though the code changing stuff everywhere!!! Lazy, I know!!
With one thing and another (e.g. getting married) I took a break from the developer exam. I've just recently restarted and I'm ready to submit BUT when I originally started I was using Java 1.4. Obviously, I have to test and compile the code with 1.5 now. It's first time I've tried this and I'm getting errors when compiling about the use of generics in collections i.e:

"Sime Input files use unchecked or unsafe opertaions"

If I run the compile with -xlinit:unchecked argument i see the problematic lines. Up until now I haven't really used Java 1.5, and so generics is new to me. At the moment, even though I get the message when compiling, every things works fine without - do I need to alter my code to accomodate generics? Or can I leave as is?

Ste :-)
Hi - is there a presumption that if you are running the application in "alone" mode, then you are the only person interacting with the database? i.e that the server is not running and there are no client connections? When in "alone" mode, if the above is true, then you do not need to be concerned with locking etc, because there is only one GUI open and one person interacting with the database?

cheer, Stephen
[ August 05, 2005: Message edited by: Ste Graham ]
Well thanks for the help!! D'oh! I was catching the selected row (Jtable.getSelectedRow()) within the keyPressed() method. Of course when you press the key you start at the row you at, even though if you are pressing down you end up somehwere else. I did indeed use the keyReleased() method and this returned the value I was looking for. Once again thank you!
14 years ago
I'm having problems getting the same value for JTable.getSelectedRow() when using KeyEvents and MouseEvents. If I click on the very first table row, the value 0 is reported. However, if I then use the down key to get to row 1 (the second row in reality) getSelectedRow() reports 0 again (if I use the mouse to get to this row getSelectedRow reports 1 - which is correct). It gets even stranger when I then use the up key to get back to the first row in the table, getSelectedRow reports 1!! I'm unsure what is going on here - has anyone experienced this before? The MouseEvent reports back correctly, bu the KeyEvent isn't.
14 years ago
Yeah, I kinda knew/guessed that. Trying to set the domain in that fashion was the act of desperate man!! So, does anyone know if what I am trying to do is possible? I'm sure it is without having to turn my servlet into some sort of re-writing proxy!!

I suppose on option would be be to return to the client some HTML with a form that contains the login details as hidden values. The page could contain some javscript which reacts to the "onLoad" event and autosubmits the form.

hmmhh...?
15 years ago
Hi - I think this is the correct forum to post this query on, and not the "Sockets and Internet Protocols" one. I did do a quick search, but couldn't find any info on how to achieve this.

We have a service which has a form based login, once you have logged in it sets a cookie and then repeatedly, through out a session, checks to see if the cookie is set. If no cookie is found then it prints the login form. I want to be able to automate the login, so the user does not need to enter any details, and then hand off to the client(browser) to get on with the "session".

I can perform the automated POST successfully (using the org.apache.commons.httpclient package), but I'm having problems with handling the cookies that come back from the website. The cookies need to be set on the clients browser for the service to work. I have tried to grab the cookies that come back to my servlet, something like:



I can get the cookies no worries, printing them out shows they are there. How do I then forward them on to the browser? - obviously they need to be seen as coming from the domain of the external website, not the domain that my servlet runs on. I tried setting the domain with



, but this doesn't work. Is this possible at all or, because of security issues, is it not going to work? Any help/advice would be much appreciated.
15 years ago
Hi - in my GUI I have a JTable which lists the records in a database. Below the JTable there is a group of JTextFields which act as a "form" for individual database records. So, for example, you click on a row within the JTable and the individual record is displayed within the JTextFields.

The problem I am having is getting the record in the JTextField format and the (same) record in the JTable row to update when one of the ways is used for updating. I think I have two ways to handle this:

1. The users decided which way they want to update the record (either using the JTable or the JTextFields), and when they hit the "Update Record" button the databses is updated, the TableModel is updated to reflect the change and the new TableModel is now used to show the data in the JTable and the JTextFields.

2. I share the underlying document between the JTextFields and the Cells in the JTable, so when I type in the JTextField the data is automatically typed in the cell and vice-versa.

I've tried both ways, but without much success. The problem I have with the first one is, if the "Update" button is the same for both JTextFields and JTable (which it is) how do I know which value I should use to update the databases with - the JTable value or the JTextField one?

For the second way, I'm unsure the best way to go about it. Do I need to create new DefaultCellEditor objects with JTextField objects, so I then can use the getDocument/setDocument methods? I tried something like:



This doesn't see to work as expected and only works one way when it does work.

As anybody expereinced this before? Any soultions, tips etc.

Cheers, Stephen
15 years ago