Please help! java.text.ParseException:

Hi everybody
why am i gatting java.text.ParseException: Unparseable date: "Jul 21, 2002"
String s = "yyyy MM dd";
SimpleDateFormat ff = new SimpleDateFormat(s);
java.util.Date mm = ff.parse( DateFormat.getDateInstance().format(new java.util.Date())) ;
System.out.println(mm.toString()); //Exception is thrown
thanks in advence

I didn't take time to look through your code too closely but here is some code that might help. The pullDate method reads a string from a JTextField (textField) and tries to return a Date. If it can't format it then it returns null. It tries to format the text based on the formats listed. If it can't format the text using one then it tries the next until it runs out of them. Change the formats to whatever you like. Good luck.
Jeff
private static DateFormatter[] altFormats = {
     new DateFormatter(new SimpleDateFormat("M/d/yy")),
     new DateFormatter(new SimpleDateFormat("MMddyy")),
     new DateFormatter(new SimpleDateFormat("MMM d, yy")),
     new DateFormatter(new SimpleDateFormat("MMM d yy")),
     new DateFormatter(new SimpleDateFormat("d MMM yy"))};
private Date pullDate() {
     String text = textField.getText();
     Date d = null;
     int i = 0;
     while(d==null && i<altFormats.length) {
          try {
               d = (Date)(altFormats[i++].stringToValue(text));
          } catch (ParseException e) {}                    
     return d;

Similar Messages

  • Java.text.ParseException: Unparseable date: "2008-12-16 00:00:00"

    Dear All WebLogic Guru,
    Need your help about the error in our WebLogic Apps Server. Below is the related logs. Hope to hear from you soon.
    ========
    Log snippet:
    ========
    [15:48:02 ] [INFO] [NumberFormatException in TimesheetAddHandler:] null [delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAddHandler.perform(TimesheetOperatorAddHandler.java:77)]
    java.text.ParseException: Unparseable date: "2008-12-16 00:00:00"
    at java.text.DateFormat.parse(DateFormat.java:337)
    at ejb.sessionBeans.gbms.bulkcrg.timesheet.TimesheetOperatorEJB.getOpsDttm(TimesheetOperatorEJB.java:1647)
    at ejb.sessionBeans.gbms.bulkcrg.timesheet.TimesheetOperator_vn72b_EOImpl.__WL_invoke(Unknown Source)
    at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
    at ejb.sessionBeans.gbms.bulkcrg.timesheet.TimesheetOperator_vn72b_EOImpl.getOpsDttm(Unknown Source)
    at delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAddHandler.perform(TimesheetOperatorAddHandler.java:383)
    at delegate.RequestManager.perform(RequestManager.java:85)
    at delegate.FrontController.processRequest(FrontController.java:241)
    at delegate.FrontController.doPost(FrontController.java:378)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sg.com.jp.framework.sso.SingleSignOnFilter.doFilter(SingleSignOnFilter.java:121)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sg.com.jp.util.xss.XssFilter.doFilter(XssFilter.java:57)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:153)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
    [15:48:02 ] [INFO] [ScreenManager] Screen ID [TimesheetOperatorViewSvlt] mapped to [JSP/gbms/bulkcrg/timesheet/TimesheetOP_details.jsp] [delegate.ScreenManager.nextScreen(ScreenManager.java:60)]
    [15:48:02 ] [INFO] Next Screen is : /JRPA(or ServletContext@27549577[app:47jrpa module:JRPA path:/JRPA spec-version:null],WebLogic Server 10.3.4.0 Fri Dec 17 20:47:33 PST 2010 1384255 Oracle WebLogic Server Module Dependencies 10.3 Thu Oct 28 06:03:12 PDT 2010 Oracle WebLogic Server on JRockit Virtual Edition Module Dependencies 10.3 Thu Sep 23 15:02:15 PDT 2010 )/JSP/gbms/bulkcrg/timesheet/TimesheetOP_details.jsp [delegate.FrontController.processRequest(FrontController.java:322)]
    [15:48:02 ] [DEBUG] 2nd funcName in doFilter = TimesheetOP_details [uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:83)]
    [15:48:02 ] [DEBUG] #########new admin framework ########## Function Code = [uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:92)]
    [15:48:02 ] [DEBUG] Function Code = [uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:108)]
    Status :S
    [15:48:03 ] [DEBUG] Contains Function: true TimesheetOperatorSuperAmend [tags.ACLTag.doAfterBody(ACLTag.java:132)]
    [15:48:03 ] [DEBUG] Contains Function: true TimesheetOperatorSuperDelete [tags.ACLTag.doAfterBody(ACLTag.java:132)]
    [15:48:03 ] [DEBUG] Contains Function: true TimesheetOperatorClose [tags.ACLTag.doAfterBody(ACLTag.java:132)]
    [15:48:31 ] [DEBUG] 2nd funcName in doFilter = TimesheetOperatorSuperAmend [uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:83)]
    [15:48:31 ] [DEBUG] Function Code = F27052 [uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:108)]
    [15:48:31 ] [DEBUG] Logged In?: true [delegate.helper.System.AuthenticationHandler.valid(AuthenticationHandler.java:571)]
    [15:48:31 ] [INFO] [RequestManager] Request ID [TimesheetOperatorSuperAmend] mapped to [delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler] [delegate.RequestManager.perform(RequestManager.java:77)]
    [15:48:31 ] [INFO] [RequestManager] delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler Created [delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler@66d4bf] [delegate.RequestManager.perform(RequestManager.java:82)]
    [15:48:31 ] [INFO] performing request delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler@66d4bf [delegate.RequestManager.perform(RequestManager.java:84)]
    [15:48:31 ] [INFO] [NumberFormatException in TimesheetAddHandler:] null [delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler.perform(TimesheetOperatorAmendHandler.java:96)]
    [15:48:31 ] [ERROR] java.lang.StringIndexOutOfBoundsException: String index out of range: 2
    at java.lang.String.substring(String.java:1934)
    at delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler.perform(TimesheetOperatorAmendHandler.java:110)
    at delegate.RequestManager.perform(RequestManager.java:85)
    at delegate.FrontController.processRequest(FrontController.java:241)
    at delegate.FrontController.doPost(FrontController.java:378)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sg.com.jp.framework.sso.SingleSignOnFilter.doFilter(SingleSignOnFilter.java:121)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sg.com.jp.util.xss.XssFilter.doFilter(XssFilter.java:57)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at uiServlet.jponlinecharge.TxnLogFilter.doFilter(TxnLogFilter.java:153)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
    [delegate.helper.gbms.bulkcrg.timesheet.TimesheetOperatorAmendHandler.perform(TimesheetOperatorAmendHandler.java:526)]
    [15:48:31 ] [INFO] errorMessage ::: There are some error with your request. Please contact administrator if problem persists. [delegate.FrontController.processRequest(FrontController.java:311)]
    =================
    Application Server Specs:
    =================
    OS: Solaris10 x86
    cat /etc/release
    Oracle Solaris 10 9/10 s10x_u9wos_14a X86
    Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    Assembled 11 August 2010
    RAM: 8GB
    HDD: 70GB
    Apps Server: WebLogic Server Version: 10.3.4.0
    Thank you and have a blessed day.
    Best regards,
    Albert

    Hi,
    Try this
    The reason for this error is that the time format entered is not correct. It should be a date and 24-hour format expressed as mm/dd/yy hh:mm:ss. For example: 07/15/10 14:30:00.
    The WebLogic Server 11g documentation gives instructions for Date/Time format. For details, please refer to
    http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13952/pagehelp/Diagnosticsdiagnosticsviewmetricslogtabletitle.html
    Solution
    However, since you cannot open the Domain Log page again because the console hangs or reports a "Redirect Loop" error, you cannot modify this wrong time format on the console. To resolve this issue, please follow these steps:
    Stop WebLogic Server.
    Go to directory <Domain>/servers/<Server_Name>/data/console
    Either open ConsolePreferences.xml and modify the value of startrange (and/or endrange) to a correctly formatted time, e.g. 07/15/10 14:30:00
    OR
    Delete ConsolePreferences.xml entirely.
    Start Weblogic Server again.
    Regards,
    Kal

  • Java.text.ParseException :UnparseableDate

    Hi,
    Iam trying to convert a String into Date and that Date in to a customized Date format...,Here it is what iam doing..
    import java.util.*;
    import java.io.*;
    import java.text.*;
    public class str2date
    public static void main(String[] args)
    try
    String mystr="01-03-2003";
         SimpleDateFormat converttodt=new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
         java.util.Date mydt=converttodt.parse(mystr.trim());
         System.out.println("mydt"+mydt);
         String output=converttodt.format(mydt);
         System.out.println(output);
         catch(ParseException e)
         System.out.println(e.toString());
    Error:"java.text.ParseException :UnparseableDate 01-03-2003"
    Can any one help me out... URGENT...,
    Thanks in Advance
    Rao.

    Well, the problem is right in front of you. You're telling it the format of the date is going to be
    yyyy-MM-dd'T'hh:mm:ss
    and then you're giving it the date in a format of
    MM-dd-yyyy
    and wondering why it's not accepting it? If you want to input a date from one format and output it in another you need to create two SimpleDateFormat objects, one to parse the date from a String to a Date object, and a second (or reuse the first with a different parse string) to format the Date and output it as a String.

  • Parse Exception : java.text.ParseException: Unparseable date

    I have inherited a UDF in some mapping that on the whole, works okay...
    but it throws an error after mapping a few dates:
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
    Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
    the first few map okay...  then i get the exception.
    the UDF is as follows:
    public String convertDateTimeToUTC(String strDate, Container container) throws StreamTransformationException{
    AbstractTrace trace = container.getTrace();
    Date date=null;
    SimpleDateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    try{
    String dt = strDate;
    date = sdfSource.parse(dt);
    trace.addInfo("Local Date:"+date);
    SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    strDate = sdfDestination.format(date);
    catch(ParseException pe){
    trace.addInfo("Parse Exception : " + pe);
    return strDate;
    can anyone see why this fails after successfully mapping a few fields???

    the first mapping works correctly...
    then we reuse the same fields to map to the additional segments.
    the context is correct as it is trying to pull the same fields in...  it just throw the error with the same data in the same UDF/Function Library but for different segments! :o(
    http://img199.imageshack.us/img199/3104/dateconversion.jpg
    as you can see from the screenshot above, the mapping works in the first instance, then fails on subsequent nodes.

  • Please help, java program terminating unexpectedly without reason

    ok, so I have a project I'm working on, here's its description:
    Create a new project named FML_Pig where F is your first initial, M is your middle initial, and L is your last initial. For example, if your name is Alfred Edward Neuman then you would name your project AEN_Pig. If necessary, add a new Java file to this project named FML_Pig.
    Add a java file to the project named FML_Dice.
    Design and implement a Dice class as follows. The Dice class has 2 twenty&#8209;sided dice with numbers on the faces (1 � 20) and 2 twenty-six-sided dice with letters on the faces (a � z).
    import java.util.Random;
    public class FML_Dice
    private static Random gen = new Random();
    private final static int NUM_SIDES = 20;
    private int die1, die2, numSnakeEyes, numVowels, totalPoints;
    private char die3, die4;
    Part 1
    Add a rollDice() method to your FML_Dice class that sets die1 and die2 to a random number between 1 and 20 and it sets die3 and die4 to a random character between �a� and �z�.
    Helpful Hint:
    dice3 = (char)(�a� + gen.nextInt(26)); // sets dice3 to a random char between �a� and �z�.
    Part 2
    Write a constructor that sets die1 and die2 to a random number between 1 and 20 and it sets die3 and die4 to a random character. Your constructor can simply call rollDice() to do this. It should also initialize numSnakeEyes, numVowels, and totalPoints to 0 (after you roll the dice).
    Part 3
    Write methods getDie1(), getDie2(), getDie3(), and getDie4() that returns the value of the respective die. Write a method numSnakes() that returns the number of snake eyes that have been rolled. Write a method numVowels() that returns the number of vowels that have been rolled. Write a method totalPts() that returns the totalPoints.
    Part 4
    Write a toString() method that overwrites the default toString() method. It should return a String representation of the value of all 4 die. For example, 17 2 h w.
    Part 5
    Write a method updateTotals that updates numVowels, numSnakeEyes, and totalPoints based on the current values of die1, die2, die3, and die4. numVowels should be incremented by 1 if either die3 or die4 are a vowel. However, if both die3 and die4 are vowels, the totalPoints should be reset to 0 and numVowels should be reset to 0 also. numSnakeEyes should be incremented by 1 if either die1 or die2 have a face value of 1 (this is not truly a snake eyes, but it gives better odds for the game). totalPoints should be incremented by the sum of die1 and die2 multiplied by (numSnakeEyes + 1).
    Part 6
    Write a main program (use the one in FML_Pig.java) that plays a game of Pig. In this game, two people play against each other. Player1 begins by rolling the dice. The total of die1 and die2 is added to his total score. Player1�s turn continues until he/she rolls a total of 4 vowels then the turn switches to Player2. Whenever a turn switches to the other player, the number of vowels is reset to zero. Also, if at any time both die3 and die4 are vowels, the total score is reset to 0 and the turn switches to the other player. (So the turn switches to the other player whenever the total number of vowels reaches four or there are two vowels rolled at the same time.)
    If a player rolls snakeeyes (for our game, snakeeyes occurs whenever either of the dice have a face value of one � in reality, both die1 and die2 should have a face value of one but then snakeeyes would occur only once every 400 rolls), then his point values are doubled from that point on (all future rolls for the rest of the game, point values for this player are doubled). When a player rolls snake eyes again, point values are tripled for that roll and all future rolls. (Three snake eyes, quadrupled, etc.)
    (continued on the next page)
    Be sure to display the results of the roll for each turn.
    First player to get to 2000 points wins the game and gets to oink like a pig.
    Note: Both players need their own set of Dice since the Dice keeps track of the totalPoints, the number of snake eyes rolled so far, and the number of vowels rolled so far for that particular player. You can do this simply by declaring it that way in the main program:
    Dice player1 = new Dice();
    Dice player2 = new Dice();
    You may add additional methods and instance variables to the class as needed. For example, I would probably write a private helper method isVowel() that is passed a char argument ch and returns true if ch is a vowel.
    Also, you can have the computer play for both player 1 and player 2. Simply loop it until somebody wins. Print out the result for each turn including who rolled the dice (player 1 or player 2), what they rolled, how many snakeeyes do they have, how many points did they get for this turn, and how many total points do they have.
    When you are completely finished, hand in just the java files (FLM_Dice & FLM_Pig). If you happened to write any other classes, make sure they are named with the FML format, and turn these in as well. I do not need EasyReader or p.
    Oink! Oink!
    This pig won the game --------->
    so here's my code:
    this isn't my code but is required to compile my code: // package com.skylit.io;
    import java.io.*;
    *  @author Gary Litvin
    *  @version 1.2, 5/30/02
    *  Written as part of
    *  <i>Java Methods: An Introduction to Object-Oriented Programming</i>
    *  (Skylight Publishing 2001, ISBN 0-9654853-7-4)
    *   and
    *  <i>Java Methods AB: Data Structures</i>
    *  (Skylight Publishing 2003, ISBN 0-9654853-1-5)
    *  EasyReader provides simple methods for reading the console and
    *  for opening and reading text files.  All exceptions are handled
    *  inside the class and are hidden from the user.
    *  <xmp>
    *  Example:
    *  =======
    *  EasyReader console = new EasyReader();
    *  System.out.print("Enter input file name: ");
    *  String fileName = console.readLine();
    *  EasyReader inFile = new EasyReader(fileName);
    *  if (inFile.bad())
    *    System.err.println("Can't open " + fileName);
    *    System.exit(1);
    *  String firstLine = inFile.readLine();
    *  if (!inFile.eof())   // or:  if (firstLine != null)
    *    System.out.println("The first line is : " + firstLine);
    *  System.out.print("Enter the maximum number of integers to read: ");
    *  int maxCount = console.readInt();
    *  int k, count = 0;
    *  while (count < maxCount && !inFile.eof())
    *    k = inFile.readInt();
    *    if (!inFile.eof())
    *      // process or store this number
    *      count++;
    *  inFile.close();    // optional
    *  System.out.println(count + " numbers read");
    *  </xmp>
    public class EasyReader
      protected String myFileName;
      protected BufferedReader myInFile;
      protected int myErrorFlags = 0;
      protected static final int OPENERROR = 0x0001;
      protected static final int CLOSEERROR = 0x0002;
      protected static final int READERROR = 0x0004;
      protected static final int EOF = 0x0100;
       *  Constructor.  Prepares console (System.in) for reading
      public EasyReader()
        myFileName = null;
        myErrorFlags = 0;
        myInFile = new BufferedReader(
                                new InputStreamReader(System.in), 128);
       *  Constructor.  opens a file for reading
       *  @param fileName the name or pathname of the file
      public EasyReader(String fileName)
        myFileName = fileName;
        myErrorFlags = 0;
        try
          myInFile = new BufferedReader(new FileReader(fileName), 1024);
        catch (FileNotFoundException e)
          myErrorFlags |= OPENERROR;
          myFileName = null;
       *  Closes the file
      public void close()
        if (myFileName == null)
          return;
        try
          myInFile.close();
        catch (IOException e)
          System.err.println("Error closing " + myFileName + "\n");
          myErrorFlags |= CLOSEERROR;
       *  Checks the status of the file
       *  @return true if en error occurred opening or reading the file,
       *  false otherwise
      public boolean bad()
        return myErrorFlags != 0;
       *  Checks the EOF status of the file
       *  @return true if EOF was encountered in the previous read
       *  operation, false otherwise
      public boolean eof()
        return (myErrorFlags & EOF) != 0;
      private boolean ready() throws IOException
        return myFileName == null || myInFile.ready();
       *  Reads the next character from a file (any character including
       *  a space or a newline character).
       *  @return character read or <code>null</code> character
       *  (Unicode 0) if trying to read beyond the EOF
      public char readChar()
        char ch = '\u0000';
        try
          if (ready())
             ch = (char)myInFile.read();
        catch (IOException e)
          if (myFileName != null)
            System.err.println("Error reading " + myFileName + "\n");
          myErrorFlags |= READERROR;
        if (ch == '\u0000')
          myErrorFlags |= EOF;
        return ch;
       *  Reads from the current position in the file up to and including
       *  the next newline character.  The newline character is thrown away
       *  @return the read string (excluding the newline character) or
       *  null if trying to read beyond the EOF
      public String readLine()
        String s = null;
        try
          s = myInFile.readLine();
        catch (IOException e)
          if (myFileName != null)
            System.err.println("Error reading " + myFileName + "\n");
          myErrorFlags |= READERROR;
        if (s == null)
          myErrorFlags |= EOF;
        return s;
       *  Skips whitespace and reads the next word (a string of consecutive
       *  non-whitespace characters (up to but excluding the next space,
       *  newline, etc.)
       *  @return the read string or null if trying to read beyond the EOF
      public String readWord()
        StringBuffer buffer = new StringBuffer(128);
        char ch = ' ';
        int count = 0;
        String s = null;
        try
          while (ready() && Character.isWhitespace(ch))
            ch = (char)myInFile.read();
          while (ready() && !Character.isWhitespace(ch))
            count++;
            buffer.append(ch);
            myInFile.mark(1);
            ch = (char)myInFile.read();
          if (count > 0)
            myInFile.reset();
            s = buffer.toString();
          else
            myErrorFlags |= EOF;
        catch (IOException e)
          if (myFileName != null)
            System.err.println("Error reading " + myFileName + "\n");
          myErrorFlags |= READERROR;
        return s;
       *  Reads the next integer (without validating its format)
       *  @return the integer read or 0 if trying to read beyond the EOF
      public int readInt()
        String s = readWord();
        if (s != null)
          return Integer.parseInt(s);
        else
          return 0;
       *  Reads the next double (without validating its format)
       *  @return the number read or 0 if trying to read beyond the EOF
      public double readDouble()
        String s = readWord();
        if (s != null)
          return Double.parseDouble(s);
          // in Java 1, use: return Double.valueOf(s).doubleValue();
        else
          return 0.0;
    }same with this:
    public class p
         public static void l(String S)
          { System.out.println(S);}
         public static void o(String S)
          {System.out.print(S);}
         public static void l(int i)
          { System.out.println(i);}
         public static void o(int i)
          {System.out.print(i);}
         public static void l(boolean b)
          { System.out.println(b);}
         public static void o(boolean b)
          {System.out.print(b);}
        public static void l(char c)
          { System.out.println(c);}
         public static void o(char c)
          {System.out.print(c);}     
         public static void l(double d)
          { System.out.println(d);}
         public static void o(double d)
          {System.out.print(d);} 
        public static void l(Object obj)
          { System.out.println(obj.toString());}
         public static void o(Object obj)
          {System.out.print(obj.toString());}
         public static void l()
          {System.out.println();}
    }       here's my code:
    import java.util.*;
    public class JMM_Pig
         public static void main(String[] args)
              int winner=0;
              int pts=0;
                   JMM_Dice player1=new JMM_Dice();
                   JMM_Dice player2=new JMM_Dice();
                   p.l("Player 1 rolls the dice...");
                   player1.rollDice();
                   player1.updateTotals();
                   boolean loop=true;
                   while(loop)
                   while(player1.numVowels()<=4)
                        p.l("Player 1 continues his turn...");
                        player1.rollDice();
                        player1.updateTotals();
                        p.l("Player 1 rolled a "+player1.getDie1()+" and a "+player1.getDie2()+" and a '"+player1.getDie3()+"' and a '"+player1.getDie4()+"'");
                        p.l("Player 1 rolled "+player1.currvowels()+" vowels.");
                        p.l("Player 1 has "+player1.totalvowels()+" total vowels.");
                        //if(player1.getMagic()==1)
                        //player1.totalPoints=(player1.totalPoints+player1.getDie1()+player1.getDie2())*player1.mult;
                        //pts=(player1.totalPts()+player1.getDie1()+player1.getDie2())*player1.getMult();
                        //player1.setTpts(pts);
                        //if(player1.getMagic()!=1)
                             //player1.totalPoints=player1.totalPoints+player1.getDie1()+player1.getDie2();
                        //pts=player1.totalPts()+player1.getDie1()+player1.getDie2();
                        //player1.setTpts(pts);
                        p.l("Player 1 has "+player1.numSnakes()+" snake eyes.");
                        p.l("Player 1 earned "+player1.ptsreturn()+" points this turn.");
                        p.l("Player 1 has "+player1.totalPts()+" total points.");
                        pts=0;
                        if(player1.totalPts()>=2000)
                             winner=1;
                             player1.setNv(4);loop=false;
                        if((player1.isavowel(player1.getadice()))&&player1.isavowel(player1.getadice2()))
                             player1.setTpts(0);player1.setNv(0);player1.setNv(4);
                   p.l("Player 1's turn has ended...");
                   player1.setNv(0);
                   p.l("Player 2 rolls the dice...");
                   player2.rollDice();
                   player2.setTpts(player2.totalPts()+player2.getDie1()+player2.getDie2());
                   while(player2.numVowels()<=4)
                        p.l("Player 2 continues his turn...");
                        player2.rollDice();
                        player2.updateTotals();
                        p.l("Player 2 rolled a "+player2.getDie1()+" and a "+player2.getDie2()+" and a '"+player2.getDie3()+"' and a '"+player2.getDie4()+"'");
                        p.l("Player 2 rolled "+player2.currvowels()+" vowels.");
                        p.l("Player 2 has "+player2.totalvowels()+" total vowels.");
                        //if(player1.getMagic()==1)
                        //player1.totalPoints=(player1.totalPoints+player1.getDie1()+player1.getDie2())*player1.mult;
                        //pts=(player1.totalPts()+player1.getDie1()+player1.getDie2())*player1.getMult();
                        //player1.setTpts(pts);
                        //if(player1.getMagic()!=1)
                             //player1.totalPoints=player1.totalPoints+player1.getDie1()+player1.getDie2();
                        //pts=player1.totalPts()+player1.getDie1()+player1.getDie2();
                        //player1.setTpts(pts);
                        p.l("Player 2 has "+player2.numSnakes()+" snake eyes.");
                        p.l("Player 2 earned "+player2.ptsreturn()+" points this turn.");
                        p.l("Player 2 has "+player2.totalPts()+" total points.");
                        pts=0;
                        if(player2.totalPts()>=2000)
                             winner=2;
                             player2.setNv(4);loop=false;
                        if((player2.isavowel(player2.getadice()))&&player2.isavowel(player2.getadice2()))
                             player2.setTpts(0);player2.setNv(0);player2.setNv(4);
                   p.l("Player 2's turn has ended...");
                   player2.setNv(0);
                   if(player1.totalPts()>=2000)
                        winner=1;
                        loop=false;
                   if(player2.totalPts()>=2000)
                        winner=2;
                        loop=false;
                   }  //main loop
                   if(winner==1)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 1 wins, oink oink!");
                   if(winner==2)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 2 wins, oink oink!");
    and dice class:
    import java.util.*;
    public class JMM_Dice {
         private static Random gen = new Random();
        private final static int NUM_SIDES = 21;
        private int die1, die2, numSnakeEyes, numVowels, totalPoints;
        private char die3, die4;
        private int dice=0;
           //dice=
           private int dice2=0;
           //dice2=;
           private String adice="";
           //adice=;
           private String adice2="";
           //adice2;
           private int magic=0;
           private int mult=0;
           private int currvowels=0;
           private int totalvowels=0;
      public static EasyReader key = new EasyReader();
      public JMM_Dice()
          dice=0;dice2=0;
           String alpha="abcdefghijklmnopqrstuvwxyz";
          adice="";adice2="";
           rollDice();
           numSnakeEyes=0;numVowels=0;totalPoints=0;
      public void setTpts(int tpts)
           this.totalPoints=tpts;
      public void setNv(int nv)
           this.numVowels=nv;
      public int getDie1()
           return dice;
      public int getDie2()
           return dice2;
      public String getDie3()
           return adice;
      public String getDie4()
           return adice2;
      public int numSnakes()
           return numSnakeEyes;
      public void setSnakes(int s)
           this.numSnakeEyes=s;
      public String getadice()
           return this.adice;
      public String getadice2()
           return this.adice2;
      public int numVowels()
           return numVowels;
      public int getMagic()
           return this.magic;
      public int getNv()
           return this.numVowels;
      public void setMagic(int mag)
           this.magic=mag;
      public int getMult()
           return this.mult;
      public void setMult(int m)
           this.mult=m;
      public int totalPts()
           return totalPoints;
      public String toString()
           return dice+""+dice2+""+adice+""+adice2;
      public boolean isavowel(String str)
           if(str.equals("a")||str.equals("e")||str.equals("i")||str.equals("o")||str.equals("u"))
                return true;
           else
                return false;
      public int ptsreturn()
           return dice+dice2;
      public int currvowels()
           int tmp=currvowels;
           currvowels=0;
           return tmp;
      public int totalvowels()
           return numVowels;
      public void updateTotals()
           if(adice.equalsIgnoreCase("a")||adice.equalsIgnoreCase("e")||adice.equalsIgnoreCase("i")||adice.equalsIgnoreCase("o")||adice.equalsIgnoreCase("u")||adice2.equalsIgnoreCase("a")||adice2.equalsIgnoreCase("e")||adice2.equalsIgnoreCase("i")||adice2.equalsIgnoreCase("o")||adice2.equalsIgnoreCase("u"))
                numVowels++;currvowels++;
           if((isavowel(adice))&&isavowel(adice2))
                totalPoints=0;numVowels=0;
           if(dice==1||dice2==1)
                numSnakeEyes++;
           int fd=dice;
           int sd=dice2;
           int sum=fd+sd;
           totalPoints+=sum*(numSnakeEyes+1);
      public void rollDice()
           dice=gen.nextInt(20)+1;
           dice2=gen.nextInt(20)+1;
           String alpha="abcdefghijklmnopqrstuvwxyz";
           adice=String.valueOf(alpha.charAt(gen.nextInt(26)));
           adice2=String.valueOf(alpha.charAt(gen.nextInt(26)));
      public static void sleep (int wait)
      {     long timeToQuit = System.currentTimeMillis() + wait;
           while (System.currentTimeMillis() < timeToQuit)
                ;   // take no action
    }the program works fine except it's supposed to terminate when one of the two AIs get a score of 2000, right now it terminates no matter what score the AIs get and no matter what I've tried to do it keeps doing that...can someone please tell me why it's terminating so oddly? Thanks! :)

    Here's how my code works in a nutshell, the main program starts with the boolean loop=true;
                   while(loop)
                   {then comes the loops for the two AIs, first the player 1 AI goes with this loop: while(player1.numVowels()<=4)
                   {there the player 1 roles the dice and it keeps going until player 1 gets a total of 2000 points at which time this is supposed to execute: if(player1.totalPts()>=2000)
                             winner=1;
                             player1.setNv(4);loop=false;
                        }, player1.setNv(4); sets numVowels to 4 so that the inner loop exits, loop=false exits the other loop and winner=1; specifies that player 1 won which is used outside of the loops here: if(winner==1)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 1 wins, oink oink!");
                   if(winner==2)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 2 wins, oink oink!");
                   } the same thing happens for player 2 if player 1 didn't already get 2000 points...but the if statement despite everything pointing to the variables containing the right values don't seem to be working, as shown by the example program output I posted it just ends at any random number...hopefully this helps make figuring out what's wrong easier :) ...so can anyone please help me out? thanks! :)

  • Please Help java.policy signedBy can't access file local

    i create keystore and signjar in web applet
    run tomcat access file in local but not acess file denied
    i goto edit file java.policy
    grant {
         permission java.security.AllPermission;
    can access file
    but put SignedBy cannot access file
    grant SignedBy fuangchai{
         permission java.security.AllPermission;
    Please help me example file keystore,applet.jar,java.policy
    to signedby access file local in webapplet
    env JDE 1.5 ,javascript yui 2.8 ,prototype js,tomcat6
    File html
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    codebase="http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=5,0,0,5"
    width="1" height="1" >
    <param name=code value="com.arg.aes.test.FileDirectoryBS.class" >
    <param name=archive value="app.jar">
    <param name=codebase value="." >
    <param name="type" value="application/x-java-applet;version=1.5">
    <param name="scriptable" value="true">
    <param name="mayscript" value="true">
    <param name="debug" value="false">
    <comment>
    <embed name="myApplet" id="myApplet"
    type="application/x-java-applet;version=1.5"
    code="com.arg.aes.test.FileDirectoryBS.class"
    archive="app.jar"
    java_codebase="."
    width="1"
    height="1"
    scriptable="true"
    mayscript="true"
    pluginspage="http://java.sun.com/products/plugin/index.html#download">
    <noembed>
    </noembed>
    </embed>
    </comment>
    </object>
    <applet
    code="com.arg.aes.test.FileDirectoryBS"
    width="1"
    height="1"
    archive="app.jar"
    name="myApplet"
    codebase="."
    MAYSCRIPT="true"
    >
    </applet>
    javascript
    initlistfile : function() {
              try
                   var list = $("myApplet").initlistfileInDir();     
                   var jsondata = list.evalJSON();
                   /*alert(jsondata.dirname);
                   alert(jsondata.dirpath);
                   alert(jsondata.listfile.length);*/
                   initTableLeft(jsondata.listfile);
              catch(e)
                   alert("Exception : access denied.");
                   return;
    import java.applet.Applet;
    import java.io.File;
    import java.security.Permission;
    import java.security.PermissionCollection;
    import java.security.Policy;
    import java.security.ProtectionDomain;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    import java.util.ArrayList;
    import java.util.Enumeration;
    import java.util.List;
    * @author fuangchai
    public class FileDirectoryBS extends Applet{
    public static File[] ROOTS = File.listRoots();
    public static String HOME = System.getProperty("user.home");
    public String listDir()
    return JsonObj.makeTopDir((ROOTS.length > 0)?ROOTS : new Object[]{HOME});
    public String initlistfileInDir()
    return listfileInDir(null);
    public String listfileInDir(String dirName)
    if(null == dirName || dirName.equals(""))
    System.out.println("root = " + ROOTS.length);
    try {
    dirName = (ROOTS.length > 0)?ROOTS[0].getPath():HOME;
    catch (Exception e) {
    e.printStackTrace();
    return "";
    System.out.println("#########################");
    DirectoryDescImp obj = makeObjDir(dirName);
    return (null == obj)?null:JsonObj.makeDir(obj);
    public String listlinkInDir(String dirName)
    if(null == dirName || dirName.equals(""))
    System.out.println("root = " + ROOTS.length);
    try {
    dirName = (ROOTS.length > 0)?ROOTS[0].getPath():HOME;
    catch (Exception e) {
    e.printStackTrace();
    return "";
    System.out.println("#listlinkInDir#");
    try {
    File obj = new File(dirName);
    return (null == obj)?null:JsonObj.makelinkDir(obj.getName(),obj.getPath());
    } catch (Exception e) {
    System.out.println("I can't access a file here! Access Denied!");
    e.printStackTrace();
    return null;
    public boolean isEnc(File f)
    //TODO
    return false;
    public DirectoryDescImp makeObjDir(String dirName)
    System.out.println("dirName = " + dirName);
    try{
    File dir = new File(dirName);
    String[] entries = dir.list();
    if(null == dir || null == entries || entries.length <= 0)
    System.out.println("Data is null or not obj." );
    return null;
    System.out.println("Dir List = " + dir.list().length);
    System.out.println("Dir Name = " + dir.getName());
    System.out.println("Dir Path = " + dir.getPath());
    DirectoryDescImp dirDesc = new DirectoryDescImp();
    dirDesc.setDirName(dir.getName());
    dirDesc.setDirPath(dir.getPath());
    List<FileDescImp> list = new ArrayList<FileDescImp>();
    for(int i=0; i < entries.length; i++) {
    File f = new File(dir, entries);
    FileDescImp fDesc = new FileDescImp();
    fDesc.setFile(f);
    fDesc.setFileEncrept(isEnc(f));
    list.add(fDesc);
    dirDesc.setListfile(list);
    return dirDesc;
    catch(Exception e){
    System.out.println("I can't access a file here! Access Denied!");
    e.printStackTrace();
    return null;
    Thank you
    Fuangchai Jum
    Mail [email protected]
    Edited by: prositron on Jan 13, 2010 7:35 AM

    OK,
    Let's say I have to intialize Environment, and call method initEnvironment() in Applet's init(). Environment class:
    class Environment
         private KeyStore keyStore;
         private Enumeration<String> aliases;
         public void initEnvironment() {
              Security.addProvider(new sun.security.mscapi.SunMSCAPI());
              keyStore = KeyStore.getInstance("Windows-MY");
              keyStore.load(null);
              aliases = keyStore.aliases();
    }Applet is signed, I trust signer.
    Since Applet is signed I'm able to overwrite existing .java.policy under user.home.
    This doesn't work if I don't have .java.policy:
    grant {
      permission java.security.SecurityPermission "insertProvider.SunMSCAPI";
      permission java.security.SecurityPermission "authProvider.SunMSCAPI";
      permission java.util.PropertyPermission "jsr105Provider", "read";
      permission java.util.PropertyPermission "com.sun.xml.internal.ws.api.pipe.Fiber.serialize", "read";
      permission java.lang.RuntimePermission "setContextClassLoader";
      permission java.util.PropertyPermission "com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory.noPool", "read";
      permission java.lang.RuntimePermission "accessDeclaredMembers";
      permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
      permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.ws.fault";
      permission java.util.PropertyPermission "com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory.woodstox", "read";
    };P.S.
    Does it make sense to be able to make changes to file system and not be able to make actions from above policy?!?!

  • Java.text.ParseException:Unparseable date

    Whilst using the DBMS_XMLSave.updateXML procedure I am having problems parsing a date which is the format dd/mm/yy
    I have tried to use the following procedure to set the date format :
    DBMS_XMLSave.setDateFormat(updCtx,'DD/MM/YY');
    Unfortunately it is not working, as the parser still does not recognise the date format, it seems to want the time element.
    please may somebody advise on some possible solutions

    The date formats must match java date formats not Oracle date formats. For a list of valid date formats please check http://java.sun.com/products/jdk/1.1/docs/api/java.text.SimpleDateFormat.html
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Satvir Ghag ([email protected]):
    Whilst using the DBMS_XMLSave.updateXML procedure I am having problems parsing a date which is the format dd/mm/yy
    I have tried to use the following procedure to set the date format :
    DBMS_XMLSave.setDateFormat(updCtx,'DD/MM/YY');
    Unfortunately it is not working, as the parser still does not recognise the date format, it seems to want the time element.
    please may somebody advise on some possible solutions<HR></BLOCKQUOTE>
    null

  • Please Help ~ Java Problems

    Please help me.. I have an error that says in a box that pops up when I start my computer that says this as the Title: "WJViewError" and then this in the middle of the box: "ERROR: java.lang.NoClassDefFoundError" . I don't know how to fix this, maybe I have to re-install something... please help. I can't get into any Yahoo.com free games (Spades) or pogo.com games (Spades). others too, and that's what i want to fix. please post things i should download, i looked around everywhere and can't find anything to help me. my email is [email protected]

    Try reinstall Java or the JRE *Try after reading bottom
    Try install/updateing JRE *Try after reading bottom
    but first try/check the CLASSPATH & PATH variables in autoexec.bat in your c root directory, make sure that (PATH)they point to your jre/bin dir or your javaSDK/bin dir, and make sure CLASSPATH point to class files of java installion. Also, in Control Panel if installed make sure the java console applet handles the java code for your web browser and make sure that the Classpath & path that is in that java console applet points to the correct directories.
    ----- hope that help, Jimdogee

  • Please Help with text parsing problem

    Hello,
    I have the following text in a file (cut and pasted from VI)
    12 15 03 12 15 03 81 5 80053 1 1,2,3 $23.00 1 ^M
    12 15 03 12 15 03 81 5 84550 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 84100 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 83615 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 82977 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 80061 1 1,2,3 $44.00 1 ^M
    12 15 03 12 15 03 81 5 83721 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 84439 1 1,2,3 $44.00 1 ^M
    12 15 03 12 15 03 81 5 84443 1 1,2,3 $40.00 1 ^M
    12 15 03 12 15 03 81 5 85025 1 1,2,3 $26.00 1 ^M
    12 15 03 12 15 03 81 5 85008 1 1,2,3 $5.00 1 ^M
    this method reads the text from a file and stores it in a ArrayList
        public ArrayList readInData(){
            File claimFile = new File(fullClaimPath);
            ArrayList returnDataAL = new ArrayList();
            if(!claimFile.exists()){
                System.out.println("Error: claim data - File Not Found");
                System.exit(1);
            try{
                BufferedReader br = new BufferedReader(new FileReader(claimFile));
                String s;
                while ((s = br.readLine()) != null){
                         System.out.println(s + " HHHH");
                        returnDataAL.add(s);
            }catch(Exception e){ System.out.println(e);}
            return returnDataAL;
        }//close loadFile()if i print the lines from above ... from the arraylist ... here is waht i get ...
    2 15 03 12 15 03 81 5 80053 1 1,2,3 $23.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84550 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84100 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 83615 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 82977 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 80061 1 1,2,3 $44.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 83721 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84439 1 1,2,3 $44.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84443 1 1,2,3 $40.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 85025 1 1,2,3 $26.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 85008 1 1,2,3 $5.00 1 HHHH
    HHHH
    I see the ^M on the end of the lines ... but i dont understand why im getting the blank lines
    in between each entry ... I printed "HHHH" just to help with debugging ... anyone have any ideas why i am getting the extra blank lines?
    thanks,
    jd

    maybe its a FileReader deal.. Im not sure, maybe try using InputStreams. This code works for me (it reads from data.txt), give it a try and see if it works:
    import java.io.*;
    public class Example {
         public Example() throws IOException {
              BufferedReader b = new BufferedReader(new InputStreamReader(new FileInputStream("data.txt")));
              String s = "";
              while ((s = b.readLine()) != null) {
                   System.out.println(s);
              b.close();
         public static void main(String[] args) {
              try {
                   new Example();
              catch (IOException e) {
                   e.printStackTrace();
    }

  • Please Help stop Texts

    Does anyone knoe how to stop texts from 11=801=222=2269 I finally went to a android phone after years of just a simple phone but since have got over 100texts from this number and have not even had the phone 24hours yet ,any help would be great

        Hi, shawnmax!
    Lets take a look into this for you so you can begin enjoying your new Android device! Did you use Mobile Email on your previous device? If you are still receiving these text, please try to reply with the word STOP to disable these messages. If they persists, please send me (AdamE_VZW) a direct message for further assistance.
    Thanks,
    AdamE_VZW
    Follow us on Twitter @VZWSupport

  • Please help with text boxes

    Can somebody help me wit hmy problem. I have a fom with many tables in it, some cells of the table are text boxes or at least they were when I developed it. Now I need to edit some of the cells and for some reason I cannot do it as the cell is not a text box but became (untitled<draw>) I cannot change its type back to text. Can some one advise what to do whitouh retyping text again in the new cell.
    Many thanks in advance

    You are welcome!
    I have a preference for Javascript (just get in the syntax zone) and use it for most things (except dates).
    As you know:
    this = current object
    rawValue = accesses the value of object
    From an Excel point of view FormCalc is similar and has inbuilt function like sum(), Max(), etc. Syntax is $ for current object and you don't need the rawValue. This is very handy when summing a column in a repeating table. Also FormCalc is excellent for working with time and dates. (not that you can't work around in Javascript, but it is heavier).
    Adobe have a very good reference for FormCalc at http://www.adobe.com/go/learn_lc_formCalc_82 and I would recommend that to you. I think it comes from the LC help file, but is easier to use.
    From a performance point of view, you can either have FormCalc in the calculate event of an object, which looks back at other fields (this will fire each time one of these fields changes). Alternatively you can have the FormCalc in the exit event of a field, which pushes a calculation/value forward to another object.
    Functions are handy if you have a script that you are using several times in a form. You write the script in a "script variable" and then call it in the objects events. HOWEVER, script variables are available in Javascript only.
    One last thing is that if you have a constant (like VAT), then rather than including  "* 0.21" in all of your calculations, use a global variable in the Form / Properties / Variables tab. currentVat = 0.21. Then in your calculations would be "* currentVat.value". If the VAT rate changes then you only have to change it in one location.
    In summary FormCalc is more akin to Excel; just watch the syntax.
    Good luck,
    Niall

  • Java.text.ParseException: Unparseable date: "29/11/2007"

    Hello,
    I have a code like below; BUT it gives error!!! dateTime is string like "29/11/2007"
    Date d = null;
    if (dateTime != null && !dateTime.trim().equals("")) {
    try {
         d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(dateTime);
    } catch (Exception e) {
         e.printStackTrace();
    Any help please?
    thanks

    Hi,
    Your date parser expect something like :
    2007-11-29 15:30:25.123
    Hope that help,
    Jack

  • Hi, please help about text and divided/summed cells

    Here's my problem: I need that the text in a cell exceeds the right border of it, and this work ok by default.
    But when you sum or divide even only a pair of cells, in all the cells of that column the text is forced into the borders.
    I need to make a sheet of my guests (I work in a hotel), and the plan is this:
    - every column is a day of the calendar
    - every room has a row, to text in the Name of the guest and some useful info about the room type, a different color for different travel agency etc. Note that for me is very useful to read easily that info, and so the fact that the text goes in the next cells is a must have.
    For the next season I was managing to complete this registry adding a new row for each room, where to put in some numerical info, for doing sums of the people I have in day per day ect.
    So I was plannig to divide every cell of the second row in two cells, one for the adults in the room, one for the kids, in order to have the sum.
    But when I had the second row and divide the cells the text in the upper row is forced into the cell, and also all the text in that column.
    Anyone who can help me?
    Thank you in advance,
    Stefano

    Here's an example, with three different ways to shot the daily total.
    Totals for Jan 1 are shown in the three footer rows. Each is independent of the others, and only one would be used in practice.
    Form A is a simple sum of the column: =SUM(B)
    Form B separates the integer and fractional parts of the total, then recombines them into a text string:
    =INT(SUM(B))&"A "&ROUND(100*(SUM(B)-INT(SUM(B))),0)&"C"
    Form C does a similar separation, but treats the SUM result as a text string:
    =LEFT(SUM(B),LEN(SUM(B))-3)&"A "&RIGHT(SUM(B),2)&"C"
    Note that the daily counts are entered as # of adults, decimal, # of children (using two digits)
    Formulas will accommodate any number of adults, and up to 99 children (total). For a higher total, revisions to the entry method (one more digit after the decimal—2.001 in place of 2.01) and to Form B (replace 100 with 1000) OR Form C formulas (replace SUM(B),2 with SUM(B),3 ).
    Regards,
    Barry

  • Please help--some text not displayed.

    I used to be able to use Reader with no issues but suddenly only the basic text is viewable--Title blocks, big fonts, etc are hidden in solid black rectangles--other computers display these pages fine.  Not sure if this began before or after I updated to version 9--but I cant download version 8 to see if this is the problem.  Support refered me here for answers but II posted a few days ago but  my questions was ignored. Please advise.  Thx.

    Hello Suruchi,
    Please follow the steps below.
    1) First wrap the 3rd element(some static text) in an individual sub form.
    2) Then wrap all these 3 main elements in a parent sub form of type flowed.
    3) Now on sub form of 2nd element, write the Javascript in Initialize event as below.
    if ( this.parent.text.rawvalue == " " )
         this.presence = "hidden";
    4) Finally on sub form of 3rd element, write the Javascript in Initialize event as below
    if ( this.parent.text.rawvalue == " " )
         this.presence = "hidden";
    Note: Here text.rawvalue in Javascript is the value of 1st element which is a text field.

  • URGENT- PLEASE HELP: java.lang.threads and BC4J

    Hi,
    according to my issue "no def found for view" in the same titled thread I'm wondering how you would implement asynchronous calls of methods that use BC4J to update a couple of data.
    To be more precise:
    A requirement of our software is to start an update database job, which can take a couple of minutes/hours, from the web browser. Before it will be executed the logged-in user receives a notification that this batch job has been started.
    I dont't want to use JMS overhead and MD Beans for this simple requirement, therefore I implemented a class that extends java.lang.Thread and put all the update codings within the run method. After having called the start-method of the thread I get a JBO-25022(No XML file found) error when I try to set a new value for an attribute of the row. The row consists of attributes which belong to four entity objects that mus be updated.
    When calling the run method directly, everything works fine.
    My questions:
    * do you know any workaround how to make the xml files
    reachable?
    * how would you implement anschronous calls of long time-
    consuming jobs?
    * is this a bug of BC4J?
    Any help, tip, hint is really appreciated.
    Stefan

    Arno,
    many thanks for your reply:
    Here is an excerpt of the source code of my thread "Aenderungsdienst":
    public class Aenderungsdienst extends java.lang.Thread
    private SviAdministrationModuleImpl mSviModul;
    // Application module that contains view object
    // IKViewImpl
    public Aenderungsdienst(SviAdministrationModuleImpl aSviModul)
    mSviModul = aSviModul;
    public void run()
    ausfuehrenAenderungsdienst(mAenderungsdienstNr); <--error within this methode
    private int ausfuehrenAenderungsdienst(String aAenderungsdienstNr)
    int rAnzahlSaetze = 0;
    try
    IkViewImpl aenderungen = mSviModul.getIkView();
    aenderungen.suchenAenderungssaetze(aAenderungsdienstNr); <-- method within View Object Impl that executes a query with customized where-clauses
    if ((rAnzahlSaetze = aenderungen.getRowCount()) > 0)
    IkViewRowImpl ik = null;
    while (aenderungen.hasNext())
    ik = (IkViewRowImpl) aenderungen.next();
    ik.setBestandsstatus("B"); <-- error occurs here when setting the status of a current row in my rowset to "B"
    mSviModul.getTransaction().postChanges();
    mSviModul.getTransaction().commit();
    catch (Exception e)
    e.printStackTrace();
    mSviModul.getTransaction().rollback();
    //todo: Verarbeitungsprotokoll erstellen
    return rAnzahlSaetze;
    This thread will be called by the application module "sviAdministrationModuleImpl":
    public void ausfuehrenAenderungsdienst(String
    aAenderungsdienstNr)
    Aenderungsdienst aenderungsdienst = new
    Aenderungsdienst(this);
    aenderungsdienst.setAenderungsdienstNr
    (aAenderungsdienstNr);
    aenderungsdienst.start();
    Using the start() method of the thread causes this exception:
    [653] No xml file: /hvbg/svi/model/businessobjects/businessobjects.xml, metaobj = hvbg.svi.model.businessobjects.businessobjects
    [654] Cannot Load parent Package : hvbg.svi.model.businessobjects.businessobjects
    [655] Business Object Browsing may be unavailable
    [656] No xml file: /hvbg/svi/model/businessobjects/IK_Inlandsbankverb.xml, metaobj = hvbg.svi.model.businessobjects.IK_Inlandsbankverb
    09.03.2004 10:27:41 hvbg.common.businessobjects.HvbgEntityImpl setAttributeInternal
    SCHWERWIEGEND: Fehler beim Setzen des Attributs 1 im Entity Objekt: JBO-25002: Definition hvbg.svi.model.businessobjects.IK_Inlandsbankverb vom Typ Entitätszuordnung nicht gefunden.
    09.03.2004 10:27:42 hvbg.svi.model.dienste.Aenderungsdienst ausfuehrenAenderungsdienst
    SCHWERWIEGEND: Beim Ausführen des Aenderungsdienstes 618 trat während der DB-Aktualisierung ein schwerer Fehler auf:
    JBO-25002: Definition hvbg.svi.model.businessobjects.IK_Inlandsbankverb vom Typ Entitätszuordnung nicht gefunden.
    oracle.jbo.NoDefException: JBO-25002: Definition hvbg.svi.model.businessobjects.IK_Inlandsbankverb vom Typ Entitätszuordnung nicht gefunden.
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:328)
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:268)
         at oracle.jbo.server.MetaObjectManager.findMetaObject(MetaObjectManager.java:649)
         at oracle.jbo.server.EntityAssociation.findEntityAssociation(EntityAssociation.java:98)
         at oracle.jbo.server.AssociationDefImpl.resolveEntityAssociation(AssociationDefImpl.java:725)
         at oracle.jbo.server.AssociationDefImpl.getEntityAssociation(AssociationDefImpl.java:135)
         at oracle.jbo.server.AssociationDefImpl.hasContainer(AssociationDefImpl.java:546)
         at oracle.jbo.server.AssociationDefImpl.getContainer(AssociationDefImpl.java:468)
         at oracle.jbo.server.EntityImpl.getContainer(EntityImpl.java:1573)
         at oracle.jbo.server.EntityImpl.setValidated(EntityImpl.java:1649)
         at oracle.jbo.server.EntityImpl.setAttributeValueInternal(EntityImpl.java:2081)
         at oracle.jbo.server.EntityImpl.setAttributeValue(EntityImpl.java:1985)
         at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:1700)
         at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:946)
         at hvbg.common.businessobjects.HvbgEntityImpl.setAttributeInternal(HvbgEntityImpl.java:56)
         at hvbg.svi.model.businessobjects.IKImpl.setBestandsstatus(IKImpl.java:174)
         at hvbg.svi.model.businessobjects.IKImpl.setAttrInvokeAccessor(IKImpl.java:770)
         at oracle.jbo.server.EntityImpl.setAttribute(EntityImpl.java:859)
         at oracle.jbo.server.ViewRowStorage.setAttributeValue(ViewRowStorage.java:1108)
         at oracle.jbo.server.ViewRowStorage.setAttributeInternal(ViewRowStorage.java:1019)
         at oracle.jbo.server.ViewRowImpl.setAttributeInternal(ViewRowImpl.java:1047)
         at hvbg.svi.model.dataviews.IkViewRowImpl.setBestandsstatus(IkViewRowImpl.java:264)
         at hvbg.svi.model.dienste.Aenderungsdienst.ausfuehrenAenderungsdienst(Aenderungsdienst.java:337)
         at hvbg.svi.model.dienste.Aenderungsdienst.run(Aenderungsdienst.java:290)
    Using run(), everything works perfectly.
    The view object IKView consists of four entity objects which are linked by associations. There exists an association between the entity objects ik and inlandbankverb. The xml-file for the association object is named "ik_inlandsbankverb.xml". It seems so that this definition could not be found when calling my thread in asynchronous (via start()-method call) mode.
    Is this a bug of JDeveloper?
    Thanks in advance,
    Stefan

Maybe you are looking for

  • How can I write a script or create a macro for gaming.

    Now I know this may be a petty and or silly question for most apple users but I am going to throw it out there anyway. I play an online game called Battle Pirates. When you make an attack you have up to 5 ships to control. I am looking for a way to c

  • Invoking BPEL from Webservice

    Hello, I'm trying to change BPEL process state from webservice. The code: public void switchProcessOf(String name) throws Exception Hashtable contextProps = new Hashtable(); contextProps.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.evermind

  • Error while inserting into secure store when installing solution manager

    hi all, I have problem when the installation of solution manager try to insert into secure store, the installation completed creating the secure store, but at the inserting the error raised... i need your helps, Thanks in advanced

  • Log4j And Tomcat

    Hi, I'm trying to get log4j to work with tomcat, but for some reason none of the logs get written to the logfile. I have a logfile containing:      <appender name="apachelog" class="org.apache.log4j.FileAppender">           <param name="File" value="

  • Help! - Can't re-install Tiger, Panther etc.. Just won't start up -

    I have erase my hard drive and tried to re-install Tiger. It successfully installed the 1st time, but every time I tried update, software update quit, and then safari quit when i tried to download the updates manually. Shortly afterwards the Powerboo