text: Search...
  FAQs
  Subscribe
  Pie
  FAQs
  Recent topics
  Flagged topics
  Hot topics
  Best topics
  Search...
  Search Coderanch
  Advance search
  Google search
  Register / Login
  Richard Agnes
  Greenhorn
  22
  8
  Threads
  0
  Cows
  since Feb 12,  (22/10)
  Number Threads Started (8/10)
  Number Likes Received (0/3)
  Number Likes Granted (0/3)
  Set bumper stickers in profile (0/1)
  Set signature in profile
  Set a watch on a thread
  Save thread as a bookmark
  Create a post with an image (0/1)
  Recent posts by Richard Agnes
  where to put a .properties file
  I just downloaded the trial of Weblogic 5.1. I want to deploy my web-app which has a few .properties files used in conjunciton with ResourceBundle.getBundle("src") calls. Where should these be located in the directory structure if the servlet is mapped to a url pattern? Should they be in the same directory as the servlet classes? I keep getting a resource not found error.
  Help appreciated.
  show more
  21 years ago
  BEA/Weblogic
  Where are U from?
  Just North of Sydney, Australia. Overlooking the hawkesbury river...beautiful!
  later.
  ....
  when do i stop being a greenhorn
  show more
  21 years ago
  Meaningless Drivel
  Quotes
  "This sentence is false."
  - some textbook.
  show more
  21 years ago
  Meaningless Drivel
  quick question on java interface.
  how do we model a java interface in UML class diagram?
  is it a generalization? association? other...
  cheers.
  show more
  21 years ago
  OO, Patterns, UML and Refactoring
  Looking for advice on process for UML?
  I am a university student, we have been studying UML fairly intensely for the past year. We also happen to use Larman as our primary textbook, for analysis at least anyway.
  I am looking for advice on material with a more refined process, such as RUP (which only seems available for a lot of money on the web). What are the thoughts on Larman anyway? Is this book considered 'a process' by industry standard or merely an introduction to the UML notation. Does UML have it's place in XP? I know little of XP but have heard good things of it is it worth pursueing this avenue instead of RUP or the like?
  Secondly Case tools, in particular Rational Rose, does anyone know where I can see some good examples of java based models? I have access to RR2000 at uni and am interested in using this software to develop my own models, I find looking at more experienced developers work extremely beneficial.
  all discussion welcome.
  Rich
  show more
  21 years ago
  OO, Patterns, UML and Refactoring
  sendError method - page not found?
  I am just new to servlets having just set up environment the other day. In my doPost Method of an HttpServlet I have:
  switch (err)
  {
  case DUP_SUBSCRIPTION:
  res.sendError(HttpServletResponse.SC_BAD_REQUEST, "information already on file");
  return;
  case NOT_ON_FILE:
  res.sendError(HttpServletResponse.SC_BAD_REQUEST, "information not on file");
  return;
  }
  however when the code executes I get a page not found error instead of the error message, could someone suggest why, is it something to do with my configuration?
  edit: I just noticed that the error page does have the correct error code. does this mean IE 5.0 only has a generic message?
  thanks in advance.
  [This message has been edited by Richard Agnes (edited July 12, 2001).]
  show more
  21 years ago
  Servlets
  newbie: troubleshooting apache/tomcat win98 environment
  I am trying to set up my environment to do the java tutorial on servlets. I have done the following:
  1. downloaded, unzipped and installed tomcat 3.2 & apache
  2. downloaded the mod_jk.dll and put it in apache module directory
  3. changed my classpath to include the servlets.jar
  4. set environment variables for TOMCAT_HOME & JAVA_HOME in autoexec:
  set TOMCAT_HOME=C:\jakarta\tomcat
  set JAVA_HOME=C:\jdk1.2.2
  5. in httpd.conf - Include \jakarta\tomcat\conf\mod_jk.conf-auto
  then I try to run by:
  1. start tomcat - works.
  2. start apache - says mod_jk running or similar.
  3. enter
  (bookstore.war in webapps dir of tomcat)
  4. I get to the bookstore.html page and trouble begins.
  If apache is running I get a 404 error trying to "start shopping" which I think starts the catalog servlet.
  If apache is not running and tomcat is doing the work, the page comes up but after a long time, and tomcat window logs an IOException ( Socket write error ).
  It might be worth noting also, that tomcat is the homepage even when apache is running, I don't know if that is right or not?
  Has anyone run into similar problem? I searched java.sun but all requests like this receive 0 reply.
  thanks in advance.
  show more
  21 years ago
  Servlets
  conversion q
  hi padmini,
  to add the 126 + 127 just do it normally, they get promoted to int so answer is 253. Do you know how to convert to binary from dec? if not you should review on web somewhere.
  Anyway 253 int value in binary code is:
  00000000 00000000 ... 111111101 in the low byte
  now since it's truncated to a byte again, we only take those last 8 digits and as you know byte is a signed type, so high bit represents sign and the other 7 bits represent the magnitude. Since high bit in this case is 1 the number is negative. Then you just follow procedure to get magnitude, flip bits and add 1.
  11111101 becomes
  00000010 then + 1
  00000011 this is 3 so the number was -3.
  does that make sense? don't bother with adding in binary form if you're unsure how to do it, just work out in decimal and then convert the answer to binary.
  cheers.
  Rich
  show more
  21 years ago
  Programmer Certification (OCPJP)
  Exceptions (Khalid & Rolf 's book)
  code:
  import java.io.*;
  public class jsource
  {
  public static void main (String argv[])
  {
  try{
  new jsource().aMethod();
  }catch(Exception e)
  {
  //statement
  }catch(IOException e)
  {
  //not reachable
  }
  }
  void aMethod () throws IOException
  {
  throw new IOException();
  }
  }
  IOException is a subclass of Exception. The rule is that the exception is caught in the first catch handler, therefore the second catch in this example is unreachable since the exception is caught by the first catch block. The compiler gives this error. Generally, more specific exceptions should be handled first.
  clear?
  cheers.
  Rich.
  show more
  21 years ago
  Programmer Certification (OCPJP)
  Confusion re casting
  I am a little confused still.
  in your code you are casting the array 'element' to a MyClass object, I am presuming this would obey the normal rules for casting between classes.
  I think the book is talking about the casting of an entire array to a single non-final class identifier. I may be corrected here.
  So in the case of your code it would appear:
  SuperClass d[] = new SuperClass[10];
  MyClass e = (MyClass) d ; //I presume the 'a' was a typo
  just to clarify my point, the other row in the table specifies that to cast an array (old-type) to an array (new-type) the elements must be type castable, this suggests the original element is indeed an entire array as this rule makes sense under those conditions.
  here's more code to illustrate my second point about casting of interfaces, which according to the book an interface (Old-type) can never be cast to an array (new-type):
  code:
  void test()
  {
  Object o[]=new Object[10];
  Serializable b=o; //b is an interface reference
  o=(Object[])b; // this line compiles.
  }
  help appreciated.
  show more
  21 years ago
  Programmer Certification (OCPJP)
  float or double
  hi,
  i think you're right, though don't forget the automatic promotion rules when looking at expressions, it seems most smaller than int expressions will promote to size int, so usually answer will be int, long, float, double, unless you're dealing with a single term ( I may be corrected here )
  e.g
  b=25
  I would answer b could be byte, char, short, int, float, double.
  An interesting question would be
  b=32768?
  char, int, float, double.
  just include all types bigger than the smallest type of the result.
  cheers.
  show more
  21 years ago
  Programmer Certification (OCPJP)
  Casting Question
  hi trevor,
  253 as short is a signed binary digit in 2's complement,
  making it:
  00000000 11111101
  then because byte is considered signed also the value of the truncated low order byte here is:
  11111101 note the high position is 1 this means negative.
  easiest way to convert 2's comp is flip the bits and add 1.
  so it becomes
  a. 00000010
  b. 00000011 //this is 3 so value was -3.
  you were on right track, just need to review binary representation.
  cheers.
  show more
  21 years ago
  Programmer Certification (OCPJP)
  casting problem(new) !!!
  I agree you cannot cast a Non-final class to a non-final class unless one extends the other.
  show more
  21 years ago
  Programmer Certification (OCPJP)
  Instance & static Initializers
  hi albert,
  static code is executed first and in the order it appears in the source so the order goes like this:
  1.
  static String m = msg("1"); //executed first at class load time.
  2.
  static
  {
  m = msg("3"); // then it executes this static block
  }
  3. Then when you create instance it goes back and executes the
  non-static block, it's worth noting the ';' in line 1 above:
  {
  m = msg("2");
  }
  hope it clears it up.
  cheers.
  show more
  21 years ago
  Programmer Certification (OCPJP)
  Confusion re casting
  I too am having trouble with casting.
  I have RHE book and refer to table on p121:
  it says to cast an array(Old-type) to a non-final class(New-type), Old-type must be object. Is this backwards? Shouldn't it be new type should be object. Similarly casting a non-final class (old-type) to an array (new-type) it says new-type should be object, this seems backward to.
  Also why can I auto-convert an array to Cloneable or Serializable interface, yet casting an array to an interface is always error? why not:
  Serializable g = (Serializable) someArray;
  or is this table supposed to outline only those situations where cast is necessary and not those situations where cast is redundant?
  cheers.
  show more
  21 years ago
  Programmer Certification (OCPJP)