Boolean of dynaimc data

Using LV7.1:
I am trying to have a boolean response to 2 "Greater?" blocks. In other words I need to know if  "A is greater than B AND C is greater than D". However A, B, C, and D are the output from 4 formula blocks. The problem is that the output is "Dynamic Data" and not numeric. This is crewing up the final "And" block. How can I fix this?
I've attached a sample of the problem.
thanks,
jason
Attachments:
test_script.vi ‏375 KB

I've opened up your attached vi.  The output of the two Pass Value Through functions is not dynamic data.  It is a numeric.  The output of the greater thans is boolean.  I don't know why you would see it differently.
- tbob
Inventor of the WORM Global

Similar Messages

  • How to calculate a boolean based on data from a table fed by a BI Query

    Hi Gurus,
    I am currently struggling with the following issue:
    - I have a query in my VC model wich returns 4 ratios
    - I put the result of the query in a table in the VC model
    - then, I added a column in the table. this column is a boolean which should be true if the value of one of my 4 ratios is not 0, otherwise, it is false
    - I want that boolean to be "updatable" by the users.
    I tried to define the default value of the boolean based on the value from the signficant ratio... no luck
    I tried to change the value from the configuration tab of the column, but then I can not update afterwards....
    Has anyone ever seen that issue and found a solution ?
    Thansk for your help
    PY

    Hi Deep!
    Thanks for your feedback! I felt a bit alone in my world before you answered
    Your idea is great and it would work if I hadn't to display the data with a hierarchy.
    Actually, the only thing I did not mention is that we are posting data against fiscal period, and we are budgeting for the next 10 years (no comment on that, and the precision we could reach ). So, to display the information we are using a cusomized hierarchy on 0FISCPER using 0FISCYEAR.
    So when I used your option, the hierarchy has been deactivated on the table. But to be sure I correctly implemented your proposition, here are the steps we used :
    1) connect the query output port "data" to the share
    2) add the boolean in the share
    3) map the boolean with the rule based on the data coming from the query
    4) connect the share to the table.
    Note that we the current version we use of VC I am not able to edit the field mapping between the share and the table...
    Did I miss something ?
    If yes, could you drive me to the correct procedure ?
    If no, would you have any idea ? I already tried to change the default value of the field in the "define Data" maintenance popup of the table. I also tried to assign a value to the boolean based on the Action option of the column used in my condition...
    Thanks for your help
    PY

  • Boolean Authorization No Data Found

    Hello, I am trying to create a PL/SQL function returning Boolean to allow new contacts to sign up with a blank form and nothing in session state using a list entry on page 1 targeting page 2, or to edit existing contact information by clicking a link in an email sent to them with their ID in the link. They are required to enter their email address so that noone can "steal" their ID. Everything works except the authorization scheme.
    I get ORA-01403: no data found Error ERR-1082 Error in executing authorization scheme code. OK. I suppose it is because the select statement returns no rows. I know this is basic stuff. Can someone please help me with the syntax? I really appreciate it.
    declare
    v_id number;
    begin
    select id into v_id from contacts
    where id=:P2_ID and e_mail_address=:P2_SECURITY_CHECK;
    if :P2_ID is null then
    return true;
    elsif :P2_ID is not null
    and :P2_ID=v_id then
    return true;
    else return false;
    end if;
    end;
    Peter

    So add an exception just before your end statement:
    exception
    when no_data_found the return true; -- or false whatever you want

  • How to return a message in a boolean method?

    I am looking to return a message other than true or false using a boolean method. Is that possible to do without displaying the true, or false?
    private boolean search(Node node, int id){
              if (node == null)
                   return false;
              else if (id == node.id){
                   return true;
              else if (id < node.id){
                   return search(node.left, id);
              else
                   return search(node.right, id);
         }In this snippet I would like to return a message rather than true or false.
    My idea was to put the println statement just before the return, but that leaves me with a true or false being displayed.
    I also thought i could use an if statement in my main:
    public class studentTest {
         public static void main(String[] args) {
              StudentDatabase data = new StudentDatabase();
              System.out.println(data.insert(7066, "Pianczk", 25, 4.0));
              System.out.println(data.insert(7067, "Pianczk", 25, 4.0));
              data.insert(756, "Pia", 78, 3.5);
              boolean result;
              result = data.search(7066);
              if (result){
                   System.out.print("")
    }the problem with this is I can't reach the info I would like to print out.(or at least I don't know how)

    I figured it out.
    I thought I tried this once already, but must not have done it correctly.
    private boolean search(Node node, int id){
              if (node == null){
                   return false;
              else if (id == node.id){
                   System.out.print("Student info: " + node.id + " " + node.lastName + " " + node.age + " " + node.gpa);
                   return true;
              else if (id < node.id){
                   return search(node.left, id);
              else
                   return search(node.right, id);
    public static void main(String[] args) {
              StudentDatabase data = new StudentDatabase();
              System.out.println(data.insert(7066, "Pianczk", 25, 4.0));
              System.out.println(data.insert(7067, "Pianczk", 25, 4.0));
              data.insert(756, "Pianc", 78, 3.5);
              int id = 7065;
              boolean result;
              result = data.search(id);
              if (result)
                   System.out.println("");
              else
                   System.out.print("Your ID " + id + " was not found");
    }this works, although I am not sure if this is the optimal way of doing it.

  • Data type mismatch in criteria expression

    When i execute a sql i get the following message:
    java.sql.QDLExeption.......Data type mismatch in criteria expression...
    I use MS access.
    I use java.sql.Date to this format 04-09-2003
    I use boolean
    Is the date format correct?
    Is the boolean format correct?
    I try to debug for 3 hours and i didn't succeed..
    Thanks for any responses

    Try a couple of things:
    (1) Make sure that your Access database column type is Date for the columns you think it should be. Should the boolean column be type yes/no in Access? I'm not 100% sure, but that's my guess.
    (2) Use PreparedStatement, not Statement, if you aren't already. Set the variable values in your SQL using the setXXX() methods in PreparedStatement. That will make sure that all conversions are done properly.
    MOD

  • I wnat the date formate. year with 4 digigt, month and date two digit. I do

    This is my code.
    TimeZone timeZones = null;
    DateFormat dateFormating = null;
    boolean dateCheck = true;
    Date newDate = new Date);
    if(dateCheck)
         dateFormating = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT, Locale.GERMAN); // Locale.FRANCE
         timeZones = TimeZone.getTimeZone("America/Los_Angeles"); // "Europe/Berlin"
    }else{
    timeZones = TimeZone.getDefault();
    dateFormating = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.US);
    dateFormating.setTimeZone(timeZones);
    String formatedDate = dateFormating.format(newDate);
    // System.out.println(" DateFormatManager ================ formatedDate "+dateFormating.format(newDate));
    I got the this date 5/29/08. But I want the date for this formate 5/29/2008. I don't want to set the date formate. It's automaticaly change based on the timezone and locales.
    Anybody help me correct result. Which part i want to change the above code.
    Thanks
    palani

    this is a reusable component which i developed try it
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.text.DecimalFormat;
    import java.util.Calendar;
    import java.util.Date;
    public class DateTime// implements Runnable
    protected DecimalFormat tflz, tf;
    private boolean stopped=false;
    javax.swing.JTextField text_field;
    public DateTime(javax.swing.JTextField text)
    text_field=text;
    new Thread(new Runnable() {
    public void run() {
    while (stopped==false) {
    // run1();
    paint1();
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) { /* do nothing */
    }).start();
    // java.util.concurrent.ExecutorService es=java.util.concurrent.Executors.newFixedThreadPool(0);
    //     es.execute(this);
    public void paint1() {
    tf = new DecimalFormat("#0");
    tflz = new DecimalFormat("00");
    Calendar myCal = Calendar.getInstance();
    StringBuffer sb = new StringBuffer();
    sb.append(tflz.format(myCal.get(Calendar.MONTH)+1));
    sb.append("/");
    sb.append(tflz.format(myCal.get(Calendar.DATE)));
    sb.append("/");
    sb.append(tflz.format(myCal.get(Calendar.YEAR)));
    sb.append(" ");
    sb.append(tf.format(myCal.get(Calendar.HOUR)));
    sb.append(':');
    sb.append(tflz.format(myCal.get(Calendar.MINUTE)));
    sb.append(':');
    sb.append(tflz.format(myCal.get(Calendar.SECOND)));
    String sss = sb.toString();
    text_field.setText(sss);
    public void stop()
    stopped=true;
    public void start()
    stopped=false;
    }

  • Flex mobile app - which data grid control to use?

    Hi,
    Trying to build my first Flex mobile app in FlashBuilder 4.6 and I need a grid control to display a 2 dimmensional array of 6 columns x 50 rows.
    The user doesn't don't need to have any interraction with the grid except for scrolling the rows.
    I was looking at using dataGrid component but adobe doesn't recommend it for mobile apps.
    Is there a grid component that is recommended for mobile apps?
    Thanks

    Here it is.
    // Show empty grid to start
    private function initGrid():void
        const dataArray:Array = new Array(1);
        var values:Array = new Array(1);
        values[0] = "";
        dataArray[0] = values;
        grid.dataProvider = new ArrayCollection(dataArray);
    // Build array and feed it to the grid - 50 rows x 9 columns dataGrid (grid)
    protected function FillGrid():void
    var rows:int = 50;
    var columns:int = 9;
    // rows array
    const dataArray:Array = new Array(rows);
    // Get rows
    for(var row:int=0; row<rows; row++)
      const arrLine:Array = [columns+1];
      arrLine[0] = row+1;
      for(var col:int=1; col<columns+1; col++)
       // columns array
       arrLine[col] = Math.floor(Math.random()*10);
      dataArray[row] = arrLine;
    // At this point the multi dimensional array is assembled, now we connect it to the dataGrid
    grid.dataProvider = new ArrayCollection(dataArray);
    <!-- The DataGrid's dataProvider and typicalItem are set at initialize time by the initializeDataProvider method. -->
    <s:Panel id="tablePanel" x="519" top="91" width="470" height="400" color="#827259" fontSize="18" title=".">
    <s:DataGrid id="grid" left="5" right="5" top="5" bottom="5" selectionMode="singleRow" initialize="initGrid()" fontSize="17" >
      <!-- The default item renderer is used by the first 6 columns to display
      the dataProvider item's array element value at col. -->
      <s:itemRenderer>
       <fx:Component>
        <s:DefaultGridItemRenderer>
         <fx:Script>
          <![CDATA[
           override public function prepare(hasBeenRecycled:Boolean):void
            label = data[columnIndex];
          ]]>
         </fx:Script>
        </s:DefaultGridItemRenderer>
       </fx:Component>
      </s:itemRenderer>
      <s:columns>
       <s:ArrayList>
        <!-- Columns inherit the DataGrid's itemRenderer. -->
        <s:GridColumn id="zero"    headerText="N0" width="65" resizable="false"/>
        <s:GridColumn id="one"     headerText="N1" width="45" resizable="false"/>
        <s:GridColumn id="two"     headerText="N2" width="45" resizable="false"/>   
        <s:GridColumn id="three"   headerText="N3" width="45" resizable="false"/>   
        <s:GridColumn id="four"    headerText="N4" width="45" resizable="false"/>
        <s:GridColumn id="five"    headerText="N5" width="45" resizable="false"/>
        <s:GridColumn id="six"     headerText="N6" width="45" resizable="false"/>
        <s:GridColumn id="seven"   headerText="N7" width="45" resizable="false"/>
        <s:GridColumn id="eight"   headerText="N8" width="65" resizable="false"/>
       </s:ArrayList>
      </s:columns>
    </s:DataGrid>
    </s:Panel>       
    Tomexxus

  • Use of boolean returning functions in a project

    Hello all gurus,
    in my project, we have a fairly important packaged functions that return boolean values. Working with these ones in pl/sql is very fine. But sometimes we need to reuse these functions in SQL, but no luck because bools are usable under pl/sql only and can't interact in any way in SQL statements. So the workaround should be to use these functions to return us some Y/N or 1/0 to emulate boolean behavior in SQL statements.
    Here what i tested with not luck:
    -- not work
    select r.role, sys.diutil.bool_to_int(dbms_session.is_role_enabled(r.role)) as is_role_enabled
    from   dba_roles r;
    -- not work
    select r.role
    from   dba_roles r
    where  sys.diutil.bool_to_int(dbms_session.is_role_enabled(r.role)) = 1;
    -- not work
    select t1.id,
           bool_to_char(my_bool_func(t1.x, t1.y, ...)) as is_something
    from   t1;
    -- not work
    select t1.id,
           sys.diutil.bool_to_int(my_bool_func(t1.x, t1.y, ...)) as is_something
    from   t1;The odd wrapping trick as a last resort solution is working....
    -- Works! Seems the only way, but a lot of wrapping work...
    create or replace function my_bool_func_wrap(p_x number, p_y number, ...) return varchar2 as
    begin
       return bool_to_char(my_bool_func(p_x, p_y, ...));
    end;
    select t1.id,
           my_bool_func_wrap((t1.x, t1.y, ...)) as is_something
    from   t1;I read a lot, but no elegant and working way.
    Is there a more standard, elegant universal way to call bool functions from SQL?
    Is creating a custom type visible and usable from both pl/sql and sql, if possible, a way to go?
    Any other pointers?
    For new development, is it good to make my boolean type returning functions using SQL compatible type like CHAR (Y/N) or NUMBER (1/0) ? It will make us less wrapping job, but more and less elegant bool handling code on the pl/sql side.
    What is the goal to have bool only in pl/sql and not usable in SQL? It's kind of a feature incompatibility in the same product. Strange...
    Thanks a lot
    Bruno

    brlav wrote:
    Finally, I'll have to dump the BOOLEAN return type to all our boolean functions and return char instead. With this I will be able to call then from SQL.... From this perspective, BOOLEAN is useless.I would not say that. Let's assume that you implement boolean in SQL as a single byte character string containing either Y or N, enforce that with a constraint and also add a not-null constraint to it.
    You simply define two PL functions (not usable from SQL) that deals with the conversion. You use the one function to change boolean to char before hitting the SQL engine, and the other to convert char to boolean when getting data from the SQL engine.
    As I/O routines are modularised, it means that you need to deal with these conversions once only when writing and once only when reading (per module).
    Simple example:
    SQL> create or replace function to_bool( c varchar2 ) return boolean is
      2  begin                                                            
      3          return( c = 'Y' );                                       
      4  end;                                                             
      5  /                                                                
    Function created.
    SQL>
    SQL> create or replace function bool_to_char( b boolean ) return varchar2 is
      2  begin
      3          if b then
      4                  return( 'Y' );
      5          else
      6                  return( 'N' );
      7          end if;
      8  end;
      9  /
    Function created.
    SQL>
    SQL> declare
      2          i       integer;
      3          b       boolean;
      4          flag    all_tables.temporary%type;
      5          tab     all_tables%rowtype;
      6  begin
      7          flag := bool_to_char(true);  
      8          select count(*) into i from all_tables where temporary = flag;
      9
    10          select t.* into tab from all_tables t where rownum = 1;
    11          b := to_bool( tab.temporary );
    12  end;
    13  /
    PL/SQL procedure successfully completed.
    SQL>

  • How to compare dates between two items

    Hello all,
    I am trying to compare dates in two items.
    The first item is a computation P45_PAGE_LOADED_TIME
    select sysdate from dual;
    This essentially keeps track of when the user opened the form. They are accessing data that may become obsolete while they are in the form.
    So we have a dynamic action that finds the last_update date from a table. This field is of type date. It is placed in a text field called P45_STATUS.
    We then have a notification which we want to fire when P45_PAGE_LOADED_TIME is before P45_STATUS. We tried the following condition
    declare
    least_date date;
    begin
    SELECT LEAST(TO_DATE(:P45_STATUS),TO_DATE(:P45_PAGE_LOADED_TIME)) into least_date
    from dual;
    if least_date = to_date(:P45_STATUS) then
    return false;
    else
    return true;
    end if;
    end;
    Any guidance would be most appreciated.
    Thanks

    Maybe your better off putting your anonymous block into a plsql function.
    A function that you can test. If it works in plsql then you must call it in APEX.
    I kinda get a headache when I see that least, to_date, to_date query (although I've seen worse :p)
    Make it like:
    create or replace function fun_least_date(in_status in varchar2,
                                                               in_page_loaded_time varchar2) return boolean
    is
      l_status date;
      l_page_loaded_time date;
      least_date date;
      l_return boolean;
    begin
      l_status := to_date(in_status, 'FORMAT MASK!!!');
      l_page_loaded_time := to_date(in_page_loaded_time, 'FORMAT MASK!!!!');
      least_date := least(l_status, l_page_loaded_time);
      if least_date = l_status then
        l_return := false;
      else
        l_return := true;
      end if;
      return l_return
    end fun_least_date;If your sure that your function is correct then use it as a condition for your dynamic action.
    Regards
    Nico
    ps: I haven't tested that function. Be aware that you most correctly enter the format mask you use in APEX. Also before APEX may know about these variables you should set a dynamic action on your items to always submit their value to the server when they change!!!

  • How to know whether data is being AES crypted or not?

    Hi Forum,
    I used AES crypting with an initial vector and a SecretKey.
    The problem is , for backward compatibility I need to check if the data had been crypted or not?
    if not crypted I need to show them in plain readable format instead of decrypting them.
    below is my Encryption/Decryption class
    public class AesEncryption
        private  final String CRYPTO_ALGO_= "AES";
        Cipher aesCipher_;
    // Create an 16-byte initialization vector
        private final byte[] initialVector_ = new byte[]{
                                                        (byte)0x8E, 0x12, 0x39, (byte)0x9C,
                                                              0x07, 0x72, 0x6F, 0x5A,
                                                        (byte)0x8E, 0x12, 0x39,(byte)0x9C,
                                                              0x07, 0x72, 0x6F, 0x5A
        private final SecretKey key_ = new SecretKeySpec(initialVector_, CRYPTO_ALGO_);
        public AesEncryption()
             *  Create a Cipher by specifying the following parameters
             *     Algorithm name - here it is AES
            try
                 aesCipher_ = Cipher.getInstance(CRYPTO_ALGO_);
            catch (NoSuchAlgorithmException e)
                e.printStackTrace();
            catch (NoSuchPaddingException e)
                e.printStackTrace();
        public  String encryptPassword(String password)
            String strEncryptedText ="";
            try{
             *  Initialize the Cipher for Encryption with secret key
            aesCipher_.init(Cipher.ENCRYPT_MODE,key_);
             *   Encrypt the password
            byte[] byteDataToEncrypt = password.getBytes();
            byte[] byteCipherText = aesCipher_.doFinal(byteDataToEncrypt);
                   strEncryptedText = new BASE64Encoder().encode(byteCipherText);
            catch (InvalidKeyException e)
                 e.printStackTrace();
            catch (BadPaddingException e)
                 e.printStackTrace();
            catch (IllegalBlockSizeException e)
                 e.printStackTrace();
            return strEncryptedText;
        public String decryptPassword(String encryptedPassword)
            String strDecryptedText = "";
            try
                 * Decrypt the Data
                byte[] byteCipherText = new BASE64Decoder().decodeBuffer(encryptedPassword.trim());
                aesCipher_.init(Cipher.DECRYPT_MODE,key_,aesCipher_.getParameters());
                byte[] byteDecryptedText = aesCipher_.doFinal(byteCipherText);
                strDecryptedText = new String(byteDecryptedText);
            catch (InvalidKeyException invalidKey)
                 invalidKey.printStackTrace();
            catch (BadPaddingException badPadding)
                 badPadding.printStackTrace();
            catch (IllegalBlockSizeException illegalBlockSize)
                 illegalBlockSize.printStackTrace();
            catch (InvalidAlgorithmParameterException invalidParam)
                 invalidParam.printStackTrace();
            catch (IOException e)
                e.printStackTrace();
            return strDecryptedText;
    } I just want to have a method like boolean isAESEncrypted(String data){ ????  } in my class.
    Could anybody give a helping hand for the same?
    Many thanks in advance
    Edited by: jagabandhu on Sep 16, 2010 10:54 AM

    jagabandhu wrote:
    I do have a choice to store the encrypted data only in 'varchar' format so I have to encrypt and store the password without changing the column data type in the database!
    Again many thanks for 'Notes:' these are definitely helpful.
    sabre150 wrote:
    If you have a choice, then you should add a digest of the cleartext to the ciphertext. ...I fear if I use any MessageDigest , my password will be byte[] instead present String format.Not relevant since you Base64 encode the ciphertext you can also Base64 encode the digest!
    for e.g.
    [http://gmailassistant.sourceforge.net/src/org/freeshell/zs/common/Encryptor.java.html]
    Could you please further guide me if I am in the right track?I thought I had guided you! I have pointed out what I see as the flaws in your code and I think you should use the more normal approach of just using a randomly seeded Message Digest.
    >
    FYI : I do not need a serious encryption format as per the present requirement. :)That is not serious encryption since it has at least 3 major security flaws.
    >
    Edited by: jagabandhu on Sep 16, 2010 1:17 PM

  • How to validate date formate YYYY-MM-DDThh:mm:ss ?

    i have implemented validation for YYYY-MM-DD <br>
    but how to validate for time <br>
    here is the code for date validation
    could you please anyone help me on this issue
    <br><br><br> public static boolean validateDateFormate(String date) <br><br>
    {   <br>
    <br>      try {   <br>          
    <br>     String dateFormat="yyyy-MM-ddYYYY-MM-DDThh:mm:ss";
    <br>     String temp = date.substring(0,date.indexOf("-"));
    <br>     if(temp.length()!= 4)
    <br>          return false;           
    <br>     SimpleDateFormat df=new SimpleDateFormat(dateFormat);      
    <br>     Date date1=df.parse(date);
         <br>String resultDateString=df.format(date1);
         <br>System.out.println("date1"+resultDateString);
         <br> if ( !date.equals(resultDateString)) { return false;  }
    <br>     } catch (Exception de) {
         <br>     System.out.println(de);
    <br>          return false;
         <br>     
         <br>}
    <br>     return true;
    <br> }

    A useful Data util class
    import java.text.DateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.StringTokenizer;
    public final class SlacDate implements Comparable
         public final static int FormatDDMMCCYY               = 0;
         public final static int FormatMMDDCCYY               = 1;
         public final static int FormatDATETIME               = 2;
         public final static int FormatMMMDDTIME               = 3;
         public final static int FormatTIMESTAMP               = 4;
         public final static int FormatCCYYMMDD               = 5;
         public final static int FormatCCYYMMDDHHMM          = 6;
         public final static int FormatCCYYMMDDHHMMSS     = 7;
         public final static int FormatDDMMCCYYTIME          = 8;
         public final static int FormatDATEVERBOSE          = 9;
         public final static int FormatDATETIMEVERBOSE     = 10;
         public final static int FormatHHMMSS               = 11;
         public final static int FormatHHMMSSMIL               = 12;
         public final static int FormatDB2TIMESTAMP          = 13;
         public final static int FormatUDBTIMESTAMP          = 14;
         public final static int JANUARY          = 1;
         public final static int FEBRUARY     = 2;
         public final static int MARCH          = 3;
         public final static int APRIL          = 4;
         public final static int MAY               = 5;
         public final static int JUNE          = 6;
         public final static int JULY          = 7;
         public final static int AUGUST          = 8;
         public final static int SEPTEMBER     = 9;
         public final static int OCTOBER          = 10;
         public final static int NOVEMBER     = 11;
         public final static int DECEMBER     = 12;
         public final static int MONTHS_IN_YEAR = 12;
         public final static int SUNDAY          = 1;
         public final static int MONDAY          = 2;
         public final static int TUESDAY          = 3;
         public final static int WEDNESDAY     = 4;
         public final static int THURSDAY     = 5;
         public final static int FRIDAY          = 6;
         public final static int SATURDAY     = 7;
         public final static int DAYS_IN_WEEK = 7;
         private final static int DefaultHours   = 12;
         private final static int DefaultMinutes = 0;
         private final static int DefaultSeconds = 0;
         private final static int DefaultMillis     = 0;
         private final static int DaysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
         private final static String MonthAbbrev[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
         private final static String MonthVerbose[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
         private final static String DaysOfWeekAbbrev[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
         private final static String DaysOfWeek[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
         private final static String DayExtension[] = { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
         private final static String EMPTY = "";
         private final static String COLON = ":";
         private final static String PERIOD = ".";
         private final static String HYPHEN = "-";
         private final static String SPACE = " ";
         private final static String ZERO  = "0";
         private static String s_dateSep = HYPHEN;
         private int m_dd, m_mm, m_yyyy, m_hh, m_min, m_ss, m_mil;
         private static long MillisInSecond     = 1000;
         private static long MillisInMinute     = MillisInSecond * 60;
         private static long MillisInHour     = MillisInMinute * 60;
         private static long MillisInDay          = MillisInHour * 24;
          * JDK_BST_FIX
          * Static initialisation block - check JDK vendor/version in order to determine whether
          * an adjustment to correctly report British summertime needs to be made. This is required
          * in order to fix a bug in some Sun & IBM JDKs. If an untested version of the Sun or IBM JDK
          * is used, we log an error message warning that this block of code should be examained and
          * changed as appropriate. This is ugly, but will prevent a new JDK being used and this bug
          * creeping back in.
          * Note the following JDKs have been tested under both NT & AIX
          *    JDK Version           NT          AIX
          *          1.1.7 (IBM)          x          x
          *          1.1.7A (IBM)               ?
          *          1.1.7B (IBM)     ?          ?
          *          1.1.8 (IBM)          x          x
          *          1.2.2 (IBM)          ok          ok
          *          1.1.7 (SUN)          x          x
          *          1.1.8 (SUN)          x          x
          *          1.2 (SUN)          x          x
         private final static String SunVendorString = "Sun Microsystems Inc.";
         private final static String IBMVendorString = "IBM"; // Can also be 'IBM Corporation'
         private final static String SunProblemJDKs[] = { "1.1.4", "1.1.5", "1.1.6", "1.1.7", "1.1.7A", "1.1.7B", "1.1.8", "1.2", "1.2.2" };
         private final static String     SunOKJDKs[] = { "1.0.2", "1.1.2", "1.1.3", "1.4.0", "1.4.2"};
         private final static String IBMProblemJDKs[] = { "1.1.4", "1.1.5", "1.1.6", "1.1.7", "1.1.7A", "1.1.8" };
         private final static String     IBMOKJDKs[] = { "1.0.2", "1.1.2", "1.1.3", "1.1.7B", "1.2.2", "1.3.0", "1.3.1" };
         private static boolean s_adjustForBST = false;
         static
              String vendor = System.getProperty("java.vendor");
              String jdk = System.getProperty("java.version");
              // Check applies to Sun only.
              if (vendor.equals(SunVendorString) || vendor.startsWith(IBMVendorString))
                   String problemJDKs[] = null;
                   String OKJDKs[] = null;
                   if (vendor.equals(SunVendorString))
                        problemJDKs = SunProblemJDKs;
                        OKJDKs = SunOKJDKs;
                   else
                        problemJDKs = IBMProblemJDKs;
                        OKJDKs = IBMOKJDKs;
                   // Determine whether we need to make adjustment
                   for (int i = 0; i < problemJDKs.length; i++)
                        if (problemJDKs.equals(jdk))
                             s_adjustForBST = true;
                             break;
                   // If we do not need to make the adjustment then check that the
                   // JDK reported is one of the versions that we know to be good.
                   // If it is not log an error message.
                   if (!s_adjustForBST)
                        boolean goodJDK = false;
                        for (int i = 0; i < OKJDKs.length; i++)
                             if (OKJDKs[i].equals(jdk))
                                  goodJDK = true;
                                  break;
    /* CR176 - we now anticipate that all JDKs post 1.3.x are "good" ones
                        if (!goodJDK)
                             // We do not use the SingletonLogger mechanism since we
                             // cannot be sure that these singleton objects have been instantiated
                             // at this point, and in any case it is not desirable to introduce
                             // this dependancy into SlacDate.
                             System.err.println("JDK VERSION ERROR : Unsupported JDK - '" + jdk + "' provided by '" + vendor + "'. SlacDate class requires examination.");
         * Construct the date with todays date.
         * <p>This should be the only place where a Date object is explicitly instantiated. All
         * other code should use SlacDate. If the s_adjustForBST flag is set and the date falls
         * between the last sunday of March and the last Sunday of October (inclusive) then we need
         * to make an adjustment of +1 hour so that British Summertime is correctly reported.
         private SlacDate()
              init(Calendar.getInstance());
         * Construct the date with the specified day, month and year.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date) throws InvalidDateException
              init(year, month, date, DefaultHours, DefaultMinutes, DefaultSeconds, DefaultMillis);
         * Construct the date with the specified day, month, year, hour and minute.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @param hr The hour to set the date to
         * @param min The minute to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date, int hr, int min) throws InvalidDateException
              init(year, month, date, hr, min, DefaultSeconds, DefaultMillis);
         * Construct the date with the specified day, month, year, hour, minute and second.
         * Will default to 0 milliseconds.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @param hr The hour to set the date to
         * @param min The minute to set the date to
         * @param sec The second to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date, int hr, int min, int sec) throws InvalidDateException
              init(year, month, date, hr, min, sec, DefaultMillis);
         * Construct the date with the specified day, month, year, hour, minute, second and milliseconds.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @param hr The hour to set the date to
         * @param min The minute to set the date to
         * @param sec The second to set the date to
         * @param millis The milliseconds to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date, int hr, int min, int sec, int millis) throws InvalidDateException
              init(year, month, date, hr, min, sec, millis);
         * Construct the date from a timestamp.
         public SlacDate(long timestamp) throws InvalidDateException
              Calendar cal = Calendar.getInstance();
              cal.setTime(new Date(timestamp));
              init(cal);
         * Construct the date from the specified string. Note that the date must
         * be in day/month/year format.
         * @param date The date string.
         * @exception InvalidDateException The date passed in is invalid.
         public SlacDate(String date) throws InvalidDateException
              init(date);
         * Construct the date from the specified string. The format passed in will
         * identify the format of the date.
         * @param date The date string.
         * @param format The format of the date.
         * @exception InvalidDateException The date passed in is invalid.
         public SlacDate(String date, int format) throws InvalidDateException
              if (format == FormatCCYYMMDD || format == FormatCCYYMMDDHHMM || format == FormatCCYYMMDDHHMMSS)
                   boolean valid = false;
                   date = date.trim();
                   if (date.length() >= 8)
                        try
                             int year = Integer.parseInt(date.substring(0,4));
                             int month = Integer.parseInt(date.substring(4,6));
                             int day = Integer.parseInt(date.substring(6,8));
                             int hour;
                             int min;
                             int sec;
                             if (date.length() > 8)
                                  hour = Integer.parseInt(date.substring(8,10));
                                  min = Integer.parseInt(date.substring(10,12));
                                  if (date.length() >= 14)
                                       sec = Integer.parseInt(date.substring(12,14));
                                  else
                                       sec = DefaultSeconds;
                             else
                                  hour = DefaultHours;
                                  min = DefaultMinutes;
                                  sec = DefaultSeconds;
                             init(year, month, day, hour, min, sec, DefaultMillis);
                             valid = true;
                        catch (Exception e)
                   if (!valid)
                        throw new InvalidDateException("Invalid date: " + date + " for the specified format");
              else if (format == FormatDB2TIMESTAMP || format == FormatUDBTIMESTAMP)
                   // 2002-02-04 10:49:30.999000 (UDB)
                   // 2002-02-04-10.49.30.999000 (DB2)
                   int year = Integer.parseInt(date.substring(0,4));
                   int month = Integer.parseInt(date.substring(5,7));
                   int day = Integer.parseInt(date.substring(8,10));
                   int hour = Integer.parseInt(date.substring(11,13));
                   int min = Integer.parseInt(date.substring(14,16));
                   int sec = Integer.parseInt(date.substring(17,19));
                   int millis = Integer.parseInt(date.substring(20,23));
                   init(year, month, day, hour, min, sec, millis);
              else
                   init(date);
         * Construct the date with the java.util.Date passed in.
         public SlacDate(Date date)
              init(date);
         * Init the date with the java.util.Date passed in.
         private void init(Date date)
              Calendar cal = Calendar.getInstance();
              cal.setTime(date);
              init(cal);
         * Return whether this date is after the date passed in.
         * @d2 The date to compare against.
         * @return Whether this date is after the date passed in.
         public boolean after(SlacDate d2)
              int xx = d2.getYear();
              if (m_yyyy > xx)
                   return true;
              else if (m_yyyy < xx)
                   return false;
              else
                   xx = d2.getMonth();
                   if (m_mm > xx)
                        return true;
                   else if (m_mm < xx)
                        return false;
                   else
                        xx = d2.getDate();
                        if (m_dd > xx)
                             return true;
                        else if (m_dd < xx)
                             return false;
                        else
                             xx = d2.getHour();
                             if (m_hh > xx)
                                  return true;
                             else if (m_hh < xx)
                                  return false;
                             else
                                  xx = d2.getMinute();
                                  if (m_min > xx)
                                       return true;
                                  else if (m_min < xx)
                                       return false;
                                  else
                                       xx = d2.getSecond();
                                       if (m_ss > xx)
                                            return true;
                                       else if (m_ss < xx)
                                            return false;
                                       else
                                            return (m_mil > d2.getMillisecond());
         private void appendHoursMinutes(StringBuffer str, String separator)
              if (m_hh < 10)
                   str.append(ZERO);
              str.append(Integer.toString(m_hh));
              if (!separator.equals(EMPTY))
                   str.append(separator);
              if (m_min < 10)
                   str.append(ZERO);
              str.append(Integer.toString(m_min));
         private void appendTime(StringBuffer str, String separator, boolean addMillis)
              appendHoursMinutes(str, separator);
              if (!separator.equals(EMPTY))
                   str.append(separator);
              if (m_ss < 10)
                   str.append(ZERO);
              str.append(Integer.toString(m_ss));
              if (addMillis)
                   if (!separator.equals(EMPTY))
                        str.append(separator);
                   if (m_mil < 100)
                        str.append(ZERO);
                        if (m_mil < 10)
                             str.append(ZERO);
                   str.append(m_mil);
         * Version of the asString() method which defaults to FormatDDMMCCYY.
         * <p>An example date in this format is:
         * <pre>
         * 25-02-1999
         * </pre>
         * @return The Date as a string in DDMMCCYY format.
         public String asString()
              return asString(FormatDDMMCCYY);
         * Convert the date to a String. This will format the Date as defined by the format
         * passed in. The default parameter is FormatDDMMCCYY.
         * The valid formats are:
         * <ul>
         * <li>FormatDDMMCCYY</li>
         * <li>FormatMMDDCCYY</li>
         * <li>FormatDATETIME</li>
         * <li>FormatDDMMTIME</li>
         * <li>FormatTIMESTAMP</li>
         * <li>FormatCCYYMMDD</li>
         * <li>FormatCCYYMMDDHHMM</li>
         * <li>FormatCCYYMMDDHHMMSS</li>
         * <li>FormatDDMMCCYYTIME</li>
         * <li>FormatDATEVERBOSE</li>
         * <li>FormatDATETIMEVERBOSE</li>
         * <li>FormatHHMMSS</li>
         * <li>FormatHHMMSSMIL</li>
         * <li>FormatDB2TIMESTAMP</li>
         * <li>FormatUDBTIMESTAMP</li>
         * </ul>
         * @param format The format to return the string in.
         * @return The date in string format (as specified by the format parameter).
         public String asString(int format)
              StringBuffer str = new StringBuffer(20);
              if (format == FormatDB2TIMESTAMP || format == FormatUDBTIMESTAMP)
                   str.append(Integer.toString(getYear()));
                   str.append(HYPHEN);
                   int month = getMonth();
                   if (month < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(month));
                   str.append(HYPHEN);
                   int day = getDate();
                   if (day < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(day));
                   String dateTimeSeparator = new String();
                   if (format == FormatDB2TIMESTAMP)
                        dateTimeSeparator = HYPHEN;
                   else if (format == FormatUDBTIMESTAMP)
                        dateTimeSeparator = SPACE;
                   str.append(dateTimeSeparator);
                   String timeSeparator = new String();
                   if (format == FormatDB2TIMESTAMP)
                        timeSeparator = PERIOD;
                   else if (format == FormatUDBTIMESTAMP)
                        timeSeparator = COLON;
                   appendTime(str, timeSeparator, true);
                   str.append("000");
              else if (format == FormatDATETIME || format == FormatMMMDDTIME || format == FormatTIMESTAMP)
                   str.append(getMonthNameAbbrev());
                   str.append(SPACE);
                   if (m_dd < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(m_dd));
                   str.append(SPACE);
                   appendTime(str, COLON, false);
                   if (format == FormatDATETIME)
                        str.append(SPACE);
                        str.append(Integer.toString(m_yyyy));
                   else if (format == FormatTIMESTAMP)
                        str.append(COLON);
                        str.append(formattedMillis(m_mil));
              else if (format == FormatHHMMSS)
                   appendTime(str, COLON, false);
              else if (format == FormatHHMMSSMIL)
                   appendTime(str, COLON, true);
              else if (format == FormatCCYYMMDD || format == FormatCCYYMMDDHHMM || format == FormatCCYYMMDDHHMMSS)
                   str.append(Integer.toString(m_yyyy));
                   if (m_mm < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(m_mm));
                   if (m_dd < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(m_dd));
                   if (format == FormatCCYYMMDDHHMMSS)
                        appendTime(str, EMPTY, false);
                   else if (format == FormatCCYYMMDDHHMM)
                        appendHoursMinutes(str, EMPTY);
              else if (format == FormatDATEVERBOSE || format == FormatDATETIMEVERBOSE)
                   str.append(Integer.toString(m_dd));
                   if (m_dd > 10 && m_dd < 14)
                        str.append(DayExtension[0]);
                   else
                        str.append(DayExtension[m_dd%10]);
                   str.append(SPACE);
                   str.append(getMonthName());
                   str.append(SPACE);
                   str.append(Integer.toString(m_yyyy));
                   if (format == FormatDATETIMEVERBOSE)
                        str.append(",");
                        str.append(SPACE);
                        appendTime(str, COLON, false);
              else
                   // DDMMCCYY, MMDDCCYY, DDMMCCYYTIME
                   int first;
                   int second;
                   if (format != FormatMMDDCCYY)
                        first = getDate();
                        second = getMonth();
                   else
                        second = getDate();
                        first = getMonth();
                   if (first < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(first));
                   str.append(s_dateSep);
                   if (second < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(second));
                   str.append(s_dateSep);
                   str.append(Integer.toString(getYear()));
                   if (format == FormatDDMMCCYYTIME)
                        str.append(SPACE);
                        appendTime(str, COLON, false);
              return str.toString();
         * Return whether this date is before the date passed in
         * @d2 The date to compare against.
         * @return Whether this date is before the date passed in.
         public boolean before(SlacDate d2)
              return (!after(d2) && !equals(d2));
         * Clone the current date.
         * @return The cloned SlacDate object
         public Object clone()
              SlacDate d = new SlacDate();
              d.m_dd          = m_dd;
              d.m_mm          = m_mm;
              d.m_yyyy     = m_yyyy;
              d.m_hh          = m_hh;
              d.m_min          = m_min;
              d.m_ss          = m_ss;
              d.m_mil          = m_mil;
              return d;
         * Compare this date with the supplied date.
         * Hours, minutes, seconds and milliseconds are taken into consideration.
         * Returns:
         *      -1 this date is before the supplied date.
         *      0 this date is equal to the supplied date.
         *      1 this date is after the supplied date.
         public int compareTo(Object o2)
              SlacDate d2 = (SlacDate)o2;
              if (equals(d2))
                   return 0;
              if (after(d2))
                   return 1;
              return -1;
         * Compare this date with the supplied date.
         * Hours, minutes, seconds and milliseconds are NOT taken into consideration.
         * Returns:
         *      -1 this date is before the supplied date.
         *      0 this date is equal to the supplied date.
         *      1 this date is after the supplied date.
         public int compareDate(Object o2)
              SlacDate baseDate = (SlacDate)o2;
              SlacDate startBaseDate = new SlacDate(baseDate.getCalendar().getTime());
              startBaseDate.setHour(0);
              startBaseDate.setMinute(0);
              startBaseDate.setSecond(0);
              startBaseDate.setMillisecond(0);
              SlacDate endBaseDate = new SlacDate(baseDate.getCalendar().getTime());
              endBaseDate.setHour(23);
              endBaseDate.setMinute(59);
              endBaseDate.setSecond(59);
              endBaseDate.setMillisecond(999);
              int compare = 0;
              if (before(startBaseDate))
                   compare = -1;
              else if (after(endBaseDate))
                   compare = 1;
              return compare;
         * Compare this date with today's date.
         * Hours, minutes, seconds and milliseconds are NOT taken into consideration.
         * Returns:
         *      -1 this date is before today.
         *      0 this date is equal to today.
         *      1 this date is after today.
         public int compareToToday()
              return compareDate(today());
         * Calculate the difference (in days) between the two dates.
         * Note the difference may be negative.
         * @param from The <i>start</i> date
         * @param to The <i>to</i> date
         * @return The difference between the dates in days.
         public static int daysBetween(SlacDate from, SlacDate to)
              int dayFrom;
              int     monthFrom;
              int yrFrom;
              int dayTo;
              int     monthTo;
              int yrTo;
              int mult = 1;
              if (from.after(to))
                   mult=-1;
                   dayFrom          = to.getDate();
                   monthFrom     = to.getMonth();
                   yrFrom          = to.getYear();
                   dayTo          = from.getDate();
                   monthTo          = from.getMonth();
                   yrTo          = from.getYear();
              else
                   dayFrom          = from.getDate();
                   monthFrom     = from.getMonth();
                   yrFrom          = from.getYear();
                   dayTo          = to.getDate();
                   monthTo          = to.getMonth();
                   yrTo          = to.getYear();
              int cnt=0;
              try
                   if (yrFrom != yrTo)
                        // Different Years.
                        for (int i=yrFrom+1; i<yrTo; i++)
                             cnt += SlacDate.daysInYear(i);
                        for (int i=monthFrom+1; i<13; i++)
                             cnt+=daysInMonth(i, yrFrom);
                        for (int i=1; i<monthTo; i++)
                             cnt+=daysInMonth(i, yrTo);
                        cnt += (daysInMonth(monthFrom, yrFrom)-dayFrom);
                        cnt += dayTo;
                   else
                        if (monthFrom != monthTo)
                             // Same Year but different months.
                             for (int i=monthFrom+1; i<monthTo; i++)
                                  cnt+=daysInMonth(i, yrFrom);
                             cnt += (daysInMonth(monthFrom, yrFrom)-dayFrom);
                             cnt += dayTo;
                        else
                             // Same Year and month.
                             cnt += (dayTo-dayFrom);
              catch (InvalidDateException ide)
                   // This should never happen
              return cnt * mult;
         * Calculate the number of days from the specified date.
         * Note the difference may be negative.
         * @param date The date to calculate from
         * @return The diference between the two dates in days (may be negative).
         public int daysFrom(SlacDate date)
              return daysBetween(date, this);
         * Calculates the number of days in a given month in a given year
         * copes with century dates!
         * @param month The month to determine the day count
         * @param year The year the month is in (only relevant for February).
         * @exception InvalidDateException Invalid parameters passed in. Ie the month was >= 12
         *                    or the month was < 0.
         public static int daysInMonth(int month, int year) throws InvalidDateException
              if (month > 12 || month <= 0)
                   throw new InvalidDateException("Invalid month specified to SlacDate.daysInMonth(): " + month);
              // month-1, because DaysInMonth array is 0-based.
              return (month == FEBRUARY && isLeapYear(year)) ? 29 : DaysInMonth[month-1];
         * Calculates the number of days in a given year.
         * @param year The year the month is in (only relevant for February).
         public static int daysInYear(int year)
              return (isLeapYear(year)) ? 365 : 364;
         * Calculate the number of days to the specified date.
         * Note the difference may be negative.
         * @param date The date to calculate to
         * @return The diference between the two dates in days (may be negative).
         public int daysTo(SlacDate date)
              return daysBetween(this, date);
         * Decrement the date by the specified number of years, months and days.
         * @param years The number of years to increment by
         * @param months The number of months to increment by
         * @param days The number of days to increment by
         public void decrement(int years, int months, int days)
              decrementYears(years);
              decrementMonths(months);
              decrementDays(days);
         * Decrement the date by the specified number of days.
         * @param days The number of days to decrement by
         public void decrementDays(int days)
              incrementDays(days * -1);
         * Decrement the date by the specified number of hours.
         * @param hours The number of hours to decrement by
         public void decrementHours(int hours)
              incrementHours(hours * -1);
         * Decrement the date by the specified number of milliseconds.
         * @param seconds The number of seconds to decrement by
         public void decrementMilliseconds(int milliseconds)
              incrementMilliseconds(milliseconds * -1);
         * Decrement the date by the specified number of minutes.
         * @param minutes The number of minutes to decrement by
         public void decrementMinutes(int minutes)
              incrementMinutes(minutes * -1);
         * Decrement the date by the specified number of months.
         * @param years The number of months to decrement by
         public void decrementMonths(int months)
              incrementMonths(months * -1);
         * Decrement the date by the specified number of seconds.
         * @param seconds The number of seconds to decrement by
         public void decrementSeconds(int seconds)
              incrementSeconds(seconds * -1);
         * Decrement the date by the specified number of years.
         * @param years The number of years to decrement by
         public void decrementYears(int years)
              incrementYears(years * -1);
         * Calculate the difference between two dates to the nearest second as a String.
         * @param from The start date
         * @param to The end date
         public static String differenceBetween(SlacDate from, SlacDate to)
              SlacDate f, t;
              if (from.after(to))
                   t = from;
                   f = to;
              else
                   t = to;
                   f = from;
              int secs = 0;
              int mins = 0;
              int hours = 0;
              int days = 0;
              int months = 0;
              int years = 0;
              secs     = t.getSecond() - f.getSecond();
              mins     = t.getMinute() - f.getMinute();
              hours     = t.getHour() - f.getHour();
              days     = t.getDate() - f.getDate();
              months     = t.getMonth() - f.getMonth();
              years     = t.getYear() - f.getYear();
              if (secs < 0)
                   secs += 60;
                   mins--;
              if (mins < 0)
                   mins += 60;
                   hours--;
              if (hours < 0)
                   hours += 24;
                   days--;
              if (days < 0)
                   try
                        days += daysInMonth(f.getMonth(), f.getYear());
                   catch (InvalidDateException ide)
                        days += 30;
                   months--;
              if (months < 0)
                   months += 12;
                   years--;
              StringBuffer sb = new StringBuffer();
              sb.append(years).append(s_dateSep);
              sb.append(months).append(s_dateSep);
              sb.append(days).append(SPACE);
              sb.append(hours).append(COLON);
              sb.append(mins).append(COLON);
              sb.append(secs);
              return sb.toString();
         * Calculate the difference between the date passed in and this date.
         * Note that if the date passed in is in the future the difference will be
         * negative.
         * @param from The date from which to return the difference
         * @return The difference from the date passed in in String format
         public String differenceFrom(SlacDate from)
              return differenceBetween(from, this);
         * Calculate the difference between this date and the one passed in.
         * Note that if the date passed in is in the past the difference will be
         * negative.
         * @param to The date to which to return the difference
         * @return The difference to the date passed in in String format
         public String differenceTo(SlacDate to)
              return differenceBetween(this, to);
         * Return whether the two dates are the same. This will check right down to the second.
         * @param d2 The date to compare against
         * @return Whether the dates are the same.
         public boolean equals(SlacDate d2)
              return ((m_yyyy == d2.m_yyyy) &&
                        (m_mm == d2.m_mm) &&
                        (m_dd == d2.m_dd) &&
                        (m_hh == d2.m_hh) &&
                        (m_min == d2.m_min) &&
                        (m_ss == d2.m_ss) &&
                        (m_mil == d2.m_mil));
         public String format(DateFormat df)
              Calendar cal = getCalendar();
              return df.format(cal.getTime());
         private final String formattedMillis(int millis)
              String rString = null;
              if (millis < 10)
                   rString = "00" + millis;
              else if (millis < 100)
                   rString = ZERO + millis;
              else
                   rString = EMPTY + millis;
              return rString;
         public Calendar getCalendar()
              Calendar cal = Calendar.getInstance();
              cal.set(m_yyyy, m_mm-1, m_dd, m_hh, m_min, m_ss);
              cal.set(Calendar.MILLISECOND, m_mil);
              return cal;
         * Return the Date/Time in CCYYMMDD format.
         * <p>An example date in this format is:
         * <pre>
         * 19990225
         * </pre>
         * @return The Date as a string in CCYYMMDD format.
         public String getCCYYMMDD()
              return asString(FormatCCYYMMDD);
         * Return the Date/Time in CCYYMMDDHHMM format.
         * <p>An example date in this format is:
         * <pre>
         * 199902251423
         * </pre>
         * @return The Date as a string in CCYYMMDDHHMM format.
         public String getCCYYMMDDHHMM()
              return asString(FormatCCYYMMDDHHMM);
         * Return the Date/Time in CCYYMMDDHHMMSS format.
         * <p>An example date in this format is:
         * <pre>
         * 19990225142356
         * </pre>
         * @return The Date as a string in CCYYMMDDHHMMSS format.
         public String getCCYYMMDDHHMMSS()
              return asString(FormatCCYYMMDDHHMMSS);
         public int getDate()     { return m_dd; }
         * Return the date in DATETIME format.
         * <p>An example date in this format is:
         * <pre>
         * Feb 25 14:21:09 1999
         * </pre>
         * @return The Date as a string in DATETIME format.
         public String getDATETIME()
              return asString(FormatDATETIME);
         * Return the Date/Time in DATETIMEVERBOSE format.
         * <p>An example date in this format is:
         * <pre>
         * 25th February 1999, 14:21:09
         * </pre>
         * @return The Date as a string in DATETIMEVERBOSE format.
         public String getDATETIMEVERBOSE()
              return asString(FormatDATETIMEVERBOSE);
         * Return the Date/Time in DATEVERBOSE format.
         * <p>An example date in this format is:
         * <pre>
         * 25th February 1999
         * </pre>
         * @return The Date as a string in DATEVERBOSE format.
         public String getDATEVERBOSE()
              return asString(FormatDATEVERBOSE);
         * Return the day o

  • [Solved] ADFBC validation when your data isn't normalized

    Hello -
    I'm working on a ADFBC/JSF app (using JDev 10.1.3.3) where I am developing a JSF page to edit data for a table whose data is denormalized. I'll explain using the EMPLOYEES table in the HR sample schema.
    Change EMPLOYEES to...
    a. Add a column (EMPLOYEES.DEPARTMENT_NAME) that holds the data in DEPARTMENTS.DEPARTMENT_NAME
    b. Remove the foreign key EMP_DEPT_FK which links EMPLOYEES.DEPARTMENT_ID to DEPARTMENTS.DEPARTMENT_ID
    The UI presents a field for EMPLOYEES.DEPARTMENT_ID. It also shows EMPLOYEES.DEPARTMENT_NAME as a read-only field.
    When the user gives a value for EMPLOYEES.DEPARTMENT_ID, the app needs to
    1. Validate the DEPARTMENT_ID using a function in a PL/SQL package
    2. Populate the EMPLOYEES.DEPARTMENT_NAME field. Department name is retrieved using a function in a PL/SQL package that takes the department_id as a parameter.
    3. Assign a NULL value to EMPLOYEES.DEPARTMENT_NAME if the provided DEPARTMENT_ID is NULL.
    I don't have the option of changing the table structure.
    I have an entity object for the EMPLOYEES records. To accomplish #1 I added a method validator on the DEPARTMENT_ID attribute to call the appropriate PL/SQL function using JDBC. My question is - where should #2 and #3 happen?
    - In the same method validator on the attribute for DEPARTMENT_ID?
    - In the setter for the DEPARTMENT_ID after the call to setAttributeInternal?
    - Somewhere else?
    Thanks for reading my question
    -- Scott
    Message was edited by:
    scott.turnquist

    Thanks Frank.
    Here is what I came up with (in case anyone else has a similar question) - it works well so far.
    In EmployeeEntityImpl:
        public boolean validateDepartmentId(Number data) {
            boolean valid = true;
            if (data != null ) {
                try {
                    MyAppModuleImpl mod =
                        (MyAppModuleImpl )getDBTransaction().getRootApplicationModule();
                    valid = mod.validateDepartmentId(data);  //method uses JDBC to call PL/SQL package function, could throw SQLException
                } catch (SQLException se) {
                    log.error("Error while checking Department Id: " + data, se);
                    valid = false;
            return valid;
        public void setDepartmentId(Number value) {
            setAttributeInternal(DEPARTMENTID, value);
            //Propogate changes to redundant DepartmentName field.
            //If we get this far, we will have passed the validation
            //called by setAttributeInternal()
            if (value == null) {
                if (getDepartmentName() != null) {
                    setDepartmentName(null);
            } else {
                MyAppModuleImpl mod =
                    (MyAppModuleImpl) getDBTransaction().getRootApplicationModule();
                try {
                    String deptName = mod.lookupDepartmentNameFromDepartmentId(value);   //method uses JDBC to call PL/SQL package function, could throw SQLExeption
                    if (deptName == null) {
                        log.error("Could not find department name for department id: " +
                                  value);
                        throw new JboException("Invalid department id: " +
                                               value);
                    } else {
                        setDepartmentName(deptName);
                } catch (SQLException se) {
                    log.error("Could not validate department id: " + value, se);
                    throw new JboException("Invalid department id: " + value);
        }

  • Date Fprmat Validation.. (yyyy-MM-dd-hh-mm-ss)

    Hi All,
    In a application i am trying to validate a dateTime string in this particular format.
    yyyy-MM-dd-hh-mm-ss
    The code which i am using for this validation is
    public boolean validateDate(String date)
    DateFormat date_formatter = new SimpleDateFormat(
    "yyyy-MM-dd-hh-mm-ss");
    date_formatter.setLenient(false);
    ParsePosition position = new ParsePosition(0);
    if (null == date_formatter.parse(date, position))
    return false;
    else
    return true;
    If the input is 2007-12-12-12-12-12|1211 the method is returning true where as the method should return false.
    Can any one suggest correction to the above code so that it work correctly for the above and its kind of input?
    And also this method returns false for the date time input in 24 Hr format
    eg. 2007-12-12-22-10-55 but the expectation is to get true as the return value from the method.

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5221672

  • System.Data.SqlClient.SqlException: The locale identifier (LCID) 16393 is not supported by SQL Server

    I have SQL Server 2005 Developer Edition. And my operating system is Windows Vista.
    I have written a procedure in C# and deployed it on SQL Server. However when i try to run it i get the following error.
    System.Data.SqlClient.SqlException: The locale identifier (LCID) 16393 is not supported by SQL Server
    Also I tried using same procedure in Windows XP machine and it workd fine. Can anyone help me what could be the problem?

    Hi Jonathan
    I tried posting the error box here but it is not allowing me.
    Here is the error coming up:
    A .NET framework error occured during execution of user-defined routine or aggregate.
    System.Data.SqlClient.Sqlexception:The locale identifier (LCID)1153 is not supported by SQL Server.
    System.Data.SqlClient.Sqlexception:atSystem.Data.SqlClient.SqlConnection.OnError(SqlExceptionexception, Boolean breakConnection)                            atSystem.Data.SqlClient.SqlInternalConnection.OnError(SqlExceptionexception, BoleanbreakConnection)                     atSystem.data.SqlCleitn.SqlInternalConnectionSmi.EventSink.ProcessMessagesandThrow(Boolean ignoreNonFatalMessages)             atMicrosoft.SqlServer.Server.SmiEventSink_Default.ProcessMessagesandThrow(Boolean ignoreNonFatalMessages) atSystem.Data.SqlClient.SqlCommand.RunExecuteNonQuerySmi.(BooleansendTo Pipe)                                           atSystem.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResultresult,StringmethodName,BooleansendToPipe)
                                                       atSystem.Data.SqlClient.SqlCommand.ExecuteNonQuery()
    I hope this will shed some light.
    Cheers

  • Bug with date parsing

    import java.util.*;
    import java.text.SimpleDateFormat;
    public class DateUtils3 {
    public static void main(String arg[]) {
         try{
         SimpleDateFormat sdf = null;
                             Date date = null;
                                  sdf = new SimpleDateFormat("yyyyMMddHHmmss");
                                  sdf.setLenient(Boolean.FALSE.booleanValue());
                                  date = sdf.parse("20100314021602");
                             System.out.println(date);
    }catch(Exception e){
         System.out.println(e);
    I get this error java.text.ParseException: Unparseable date: "20100314021602"
    But if you change the date to be 2009 or change it to march 13 or 15 or anything else , it works!!!

    sabre150 wrote:
    DrClap wrote:
    Yes, that's right. I didn't have a 2:16 in the morning on March 14 where I live either. The clock went straight from 2 AM to 3 AM and skipped all the times in between.Interesting. We (in the UK) usually change the clocks on the last weekend of March so the 14th would be far too early for us.Yeah, the Americans made us change a couple of years ago so they could save a ton of energy. Or so they said, I haven't seen the review which determines how much energy was actually saved. I prefer the theory that the change was made so that people would have 3 extra weeks per year to go golfing after work.

Maybe you are looking for

  • Convert to a date error

    i have a the code below which i am passing a form value to <CFLOCATION url="CalendarCurrent.cfm?DATE=<cfoutput>#form.Diary_Date#</cfoutput>"> but i am getting cannot convert to a date error, i cannot change the code below as other pages use it, so ho

  • How to activate the deleted Process chain

    Hello Experts, Unfortuantely we have deleted few process chain by in RSPC .But we are in need of this Process chain . Could you please let us know whether there is any possibilties to get back the deleted process chain . Please let us know where the

  • Current version of 2014

    What is the current of cc 2014, and when is the next update scheduled?

  • Portal Dispatcher

    We have a several production portal app servers, load balanced by a hardware load balancer. Each app server has a dispatcher and two server nodes. We have two new physical machines, however, they are only capable of handling one server node each, due

  • Change budget billing plan

    Hi, I want to change BBP. Can anyone tell me name of BAPI or FM to change BBP. There is one FM ISU_S_BUDBILPLAN_CHANGE but I am not able to give proper inputs to it. Regards, Pranaya