Rowan Chattaway

Ranch Hand
+ Follow
since Jan 18, 2002
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 Rowan Chattaway

I�ve installed openldap-2.3.7.tgz on a separate Unix box and I�m attempting to interrogate it from my windows development machine.


Although I can successfully bind objects to the tree, I cannot read them back. Using an ldapsearch command I can see that my objects had been successfully bound.



However, when attempting to read them out using:



Object obj = jndiTest.lookup("cn=myRandomInt");



I got the following error:



javax.naming.NamingException [Root exception is java.io.EOFException]; remaining name 'cn=myRandomInt'

at com.sun.jndi.ldap.Obj.deserializeObject(Obj.java:520)

at com.sun.jndi.ldap.Obj.decodeObject(Obj.java:217)

at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:1016)

at com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(ComponentContext.java:526)

at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:155)

at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:144)

at imagenet.scratchPads.Rowan.testLDAP(Rowan.java:573)

at imagenet.scratchPads.Rowan.main(Rowan.java:467)

Caused by: java.io.EOFException

at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2165)

at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2631)

at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:734)

at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)

at com.sun.jndi.ldap.Obj$LoaderInputStream.<init>(Obj.java:592)

at com.sun.jndi.ldap.Obj.deserializeObject(Obj.java:506)

... 7 more

Disconnected from the target VM at '127.0.0.1:4478' using socket transport.


Anyone got any ideas about this?

It seems that it finds the object, but when attempting to de-serialise it, it goes nuts.

Any help would be much appreciated,

Many thanks,

Rowan.
Can someone quickly explain to me the behavior of bitwise shift operations.
For example:

13 >> 1 = 6
13 >> 2 = 3
13 >> 3 = 1

I understand the logic in how these bits are shifted and the end result in these cases.
I also understand why if you shift over 3 then you should get 0 back.

However, my question is this: when you bitwise shift 13 to the right by 32, why do you get 13?

13 >> 32 = 13.
16 years ago
looks like it's down again.....
Hello,

I'm implementing the StrutsTestCase into my current project to provide a suite of JUnit tests for the core Struts actions.

However, the ProcessLoginAction implements ipaddress checking for screening of dubious users. This uses HttpServletrequest.getRemoteAddr().

For my JUnit test - because it's run within my IDE and therefore outside the servlet container, this isn't set and returns null. Because of this the struts action forwards to failure.

Obvioulsy I don't want to change to project code to suit the test.
Can I set remoteAddr someway? or get around this?

Any help would be much appreciated.
Thanks.
16 years ago
Hello,
I'm using Oracles OC4J for a web app. Unfortunately HTTP_USER_AGENT is only storing the first 75 characters which means it is not possible to determine the browser of some users. I'd like to set this to between 150 and 250 chars. Does anyone know of a way to do this?
Many thanks, and apologies if this is the wrong forum for such questions (I'm not sure whether this is an OC4J issue, or something else)
Rowan.
17 years ago
yeh! I passed with a measily 77%, but it's still a pass!
tips/advice:
*Really really learn about custom tags and esp custom tag librarys, I had loads of questions on this. I can't stress enough the importance of doing work in these areas.
*I had quite a few 'look at the following code' questions, with options like 'won't compile because.......' etc. So try and do as much practical hand on work as you can. JWebPlus really doesn't cover this as much as it cleary deserves( as there are quite a few question on this)
*really really learn the deployment descriptor elements, I had a few of those as well.
I got more questions on custom tags/tag librarys than any other topic, so really learn them!
Overall I didn't deserve to pass this exam, as I did very little preparation other than actual project work that I've had to do over the last year in my current job. So I believe that if you've got at least a years j2ee experience, do all the jwebplus tests and read Alx Dark's exam prep - you will pass!
Many thanks to:
*Alx Dark - for his brilliant exam prep
*and Javaranch - for usefull links, forums and mock test.
Good luck for anyone who are getting ready for the cert!
Many thanks,
Rowan.
[ July 15, 2002: Message edited by: Rowan Chattaway ]
Got exam in 4 hours!!
I sense failure looming in the horizon.....
any last minute tips?
Peter, could you give me an idea of how you were scoring on the mocks before you took your exam?
in fact, I would appreciate knowing what kind of results you should be getting in the different mocks before taking the exam.
Many thanks,
Rowan.
I've done all the jweb+ mocks now, and I'm averaging 80% on the random tests. However I can't help but feel that part of the reason I'm passing is due to the fact that I may have just memorized the questions. I've had a look at the first 10 q's from Eduardo Cobain's mock, and I could only answer 1!! this clearly is worrying!
I've just done the javaranch mock, having never done it before and got 88%.
Are these good enough mock results for me to take the real thing!? My exam is booked for the 15th, and I have the fear.....
I think your right. I agree with all those, except the last one:
"if var is private member then it is thead safe."
Question ID :996245849311
Consider the code for two servlets of the same web application.
//In file LoginServlet.java
public class LoginServlet extends HttpServlet
{
public void doPost(HttpServletRequest req, HttpServletResponse res)
{
String userid = loginUser(req);
req.getSession().setAttribute("userid", userid);
}
}

//In file ReportServlet.java
public class ReportServlet extends HttpServlet
{
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException
{
String userid = (String) req.getSession().getAttribute("userid");
if(userid != null) generateReport(req, res);
}
}
Assuming that loginUser() and generateReport() are valid methods, which of the following statements about these servlets are true?
1)ReportServlet.java won't compile
2)Method generateReport() will never be executed
3)Method generateReport() will be executed only if a post request is sent to LoginServlet before ReportServlet
4)Share-session property should be difined to true in web.xml for ReportServlet to get 'userid'
5)None of the above
it says the correct answer is 3)
However, I was under the impression that doPost() throws IOException, ServletException - so they should both fail to compile!?
but I could be getting horrifically confused...
Any help would be much appreciated!
Rowan
After a horrific install on solaris due to disk space/hass units/wierd cdrom error I have finally got it setup. However I can't even seem to run it. Its set to run on port 7777, but how do I start the server?
as per usual, the oracle documentation is evil......
any help would be much appreciated! This is probably a very simple problem, so forgive my lack of knowlegde!
Rowan.
18 years ago
Could someone give me some advice on the best book for me:
-3/4 years java experience(j2se, j2ee)
-can only afford one book(poor student)!
-planning on implementing a j2me based dissertation for my final year uni project.
-have no experience with j2me!
i.e. something that starts from scratch, but written for someone that is already familiar with java, but goes into enough detail to help with a final year project.
any ideas?
and help would be very much appreciated!
Rowan.
18 years ago
Hi,
I'm trying to execute the unix command 'uptime' on a remote production server. This is for an intranet I'm developing. I know I can use:
Runtime runtime = Runtime.getRuntime();
Process process = null;
try
{
process = runtime.exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
while((line = in.readLine()) != null)
{
System.out.println(line);
}
}
catch(Exception e)
{
......
this works fine on the local machine, but how would I get a connection to the production server(hosted on a different machine) and run a system specific command from my WebLogic server thorugh an ejb or servlet?
Is the above method I'm suggesting suitable?
can someone give me some advice on how to do this?
[ May 17, 2002: Message edited by: Rowan Chattaway ]