Parsing a string to formula and executing to int value

Hi ,
I have a String from the database which will hold symbols + - etc.
Eg: String a =((((2+5)/(80*76)) -65)*)The above shows a string with operators and numeric values. I need to execute this String and obtain a integer value.
How i can accomplish this. From database ill be getting may different string with different formula values.
Any help is highly appreciated.
Thanks in advance.
Regards,
Satheesh Kannan.A.B

We already have [this post|http://forums.sun.com/thread.jspa?threadID=5144807],
may also try [this link|http://sourceforge.net/projects/expression-tree/].

Similar Messages

  • How to parse a String help

    I'm trying to find an easy way to parse a string like this
    String, brand,model, number;
    String toParse=(Sony)(VZ-12324)(1);Is there a simple way of parsing the string to the "(" and ")" are omitted and brand=Sony;
    model=VZ-12324);
    number="1";
    ???

    String toParse = "(Sony)(VZ-12324)(1)";
    String[] parts = toParse.split("[()]");
    String brand = parts[1];
    String model = parts[3];
    int number = Integer.parseInt(parts[5]);
    System.out.println(brand);
    System.out.println(model);
    System.out.println(number);

  • How to execute a string formula and assign the result to a number field

    How to execute a string formula and assign the result to a number field
    Hi,
    we have a function that returns a string like this:
    '(45+22)*78/23'
    After we should calculate this string and assign the value to a numeric block field
    Example:
    k number(16,3);
    k:=fun1('(45+22)*78/23'); where fun1 execute and translate to number the string.
    Does exist a function like fun1 ??
    How can we do ?
    Regards

    Hello,
    this is the code that does the job:
    SQL> set serveroutput on
    SQL> DECLARE
    2 ch VARCHAR2(20) :='22+10' ;
    3 i NUMBER ;
    4 BEGIN
    5 EXECUTE IMMEDIATE 'select ' || ch || ' from dual' INTO i;
    6 dbms_output.put_line ('i = ' || TO_CHAR(i));
    7 END ;
    8 /
    i = 32
    Procédure PL/SQL terminée avec succès.
    SQL>
    just you have to do is to create a small stored function that take the string to calculate and return the number result
    Francois

  • Question on parsing a string and storing it, help!

    im doing a assignment and a part of it requires getting a string from the user and storing it.
    for example:
    string given was "a / b , c / d"
    the only data i would store into my array would be the chars but the length is not always given which means it can be a / b or longer. is there any way i can parse it while ignoring the whitespaces. so the array after being parsed is
    arrayOfChars[0] = a
    arrayOfChars[1] = b
    arrayOfChars[2] = c
    arrayOfChars[3] = d
    any sugguestions on how i would parse a string that will be separated by symbols such as / , ! * ? i was told there was a split() that would do the job or the string tokenizer which was what i woulve used.
    THANKS IN ADVANCE!

    only letters would be found. just run the following code (fixed some typos as well...):
    String myString = "a , 1";
    StringBuffer sb = new StringBuffer ();
    for (int i=0; i<myString.length(); i++) {
         if (Character.isLetter(myString.charAt(i))) sb.append(myString.charAt(i));
    System.out.println(sb.toString());the result will be "a". if you want digits to be found too, you must check for Character.isDigit() as well...

  • Firefox not loading webpages from yesterday. I am getting a string of error and warning messages. I tried reloading but getting same messages. Like Parsing Value, Unknown property zoom. Lots of different errors. Cannot re-load pluggins. Help!

    Used Firefox for some time no problem until yesterday. Now it wont load web pages. Getting a string of warnings and errors. Tried reloading but getting same errors. Can't download pluggins. Error in Parsing, Unknown Property, Unknown Zoom, loads of messages like this for no apparent reason. Help please!
    == 10 July 2010

    Same thing started after updating to 3.6.6 on Window XP. Some pages load after doing "shift - Reload page", but not always. Error Console is showing a lot of "Errors" and lots of "Warnings" from pages that do not load. But before 3.6.6 update the pages loaded OK.

  • Record Selection Formula and Parameters

    We've currently upgraded from Crystal Reports 9 to Crystal Reports 2008 (SP3).  In our legacy reports, we use the "record selection formula editor" to filter the results of our report.  This is an example of one of our formulas:
    {DOVREP_TIME_AND_EXPENSE.ITEM_DATE} >= {?FROMDATE} and {DOVREP_TIME_AND_EXPENSE.ITEM_DATE} <= {?TODATE}
    In this formula, we pass in the FROMDATE and TODATE from our .NET applicaiton to filter on dates.  After upgrading to Crystal Reports 2008 (SP3) this no longer works.  I get an error "Error in formula Record_Selection".  It looks as if it was having issues parsing the formula.  If I replace my parameters (?FROMDATE/?TODATE) with hard coded dates it works fine (It also worked fine in Crystal Reports 9) so from what I can tell adding the parameters causes parsing errors. Also in the error it shows the formula and it's defintily messed up:
    ((( NOT {DOVREP_TIME_AND_EXPENSE.ITEM_DATE} >= {?FROMDATE}) AND ( NOT {DOVREP_TIME_AND_EXPENSE.ITEM_DATE} <= {?TODATE})))
    I'm not sure why it is adding the NOT to the formula or the extra brackets...
    Any suggestions?
    Regards,
    Mike

    David,
    First off, the way I determined it was the beta dlls was that I installed CR 2008 SP3 runtimes fresh and ran my report.  I didn't experience any issues.  I then took the beta dlls and replaced the originals, rebooted and ran my report again.  The report failed to execute as I described above.  I then took my backup of the SP3 dlls and replaced the beta dlls, rebooted and tested again.  I worked fine with the original dlls. 
    The formula that I was passing into that report was a bit more complex than I first described.  I had a few other conditions in the formula that checked for a project ID.  I tested it with just the dates and there wasn't any issues (as in your example), as soon as I added additional parameters that's when the "NOT"'s were included.  Could you try your test again with a few additional parameters?  Here is an example of what I was passing into the report:
    ((({DOVREP_TIME_AND_EXPENSE.ITEM_DATE} >= {?FROMDATE}  )   AND   ( {DOVREP_TIME_AND_EXPENSE.ITEM_DATE} <= {?TODATE})))  AND (({%PROJECT_ID}=99 OR {%PROJECT_ID}=113 OR {%PROJECT_ID}=112 OR {%PROJECT_ID}=103 OR {%PROJECT_ID}=107 OR {%PROJECT_ID}=111)))
    Mike

  • RMAN-06466: error parsing configuration string (CONFIGURE DEVICE TYPE DISK

    Hi All
    Windows 2003 and 10.2.0.4
    I get the following message when executing show all; connected to rman
    (I have used grid control 11g for the first configuration of rman. Not sure if it has an impact.)
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
    CONFIGURE BACKUP OPTIMIZATION OFF; # default
    CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    CONFIGURE CONTROLFILE AUTOBACKUP OFF;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of show command at 09/22/2011 16:04:11
    RMAN-12010: automatic channel allocation initialization failed
    RMAN-06466: error parsing configuration string (CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET PARALLELISM 1;)
    RMAN-01005: syntax error: found "backup": expecting one of: "clear, parallelism"
    RMAN-01007: at line 1 column 28 file: Configuration Row
    RMAN>
    Reading the manual Database Backup and Recovery Basics
    I should be able to configure it like this
    RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01005: syntax error: found "backup": expecting one of: ";"
    RMAN-01007: at line 1 column 42 file: standard input
    Anyone that can help me with this ?
    Appreciate your feedback.
    Thanks
    Magnus

    What happens if you type "CONFIGURE DEVICE TYPE DISK CLEAR;" ?

  • Help regarding parsing the string

    I wanted to display diffrent colored strings in the Textarea which is not possible. But from somewhere I came to know that it is possible by parsing the strings comming frm various sources and then display them with diffrent colors. can anyone help me out regarding this. The format is something like:
    &x100100100This is a colored string!&n
    the &x100100100 means that the text after it should use RGB value of 100,100,100. &n meant that the colors should stop and return to default.
    Well... this makes the client need to parse strings and set colors etc
    Can anyone explain me with some small code without using the swing class. thanks in advance.

    Here is my code I am trying to do...Pls see to it and tell me the mistake....
    import java.net.*;
    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    import java.awt.event.*;
    import java.util.*;
    import java.lang.*;
    public class client extends Applet
         //implements KeyListener
              TextArea display;
              //TextField send;
              TextArea send;
              Label status;
              Color color;
              mypanel p1;
              boolean connected=false;
              private Socket sock;
               protected BufferedReader instream;
              private DataOutputStream out;
              private String IP;
              private int port;
              Thread reader;
              private String fontName;
              private int fontSize;
              private String company;
              private String userName;
              private String userID;
              private String compName;
         public void start()
                   String param;
                   String mStr ;
                   IP=getParameter("IP");
                   userID=getParameter("userID");
                   userName=getParameter("userName");
                   fontName=getParameter("fontName");
                   company=getParameter("company");
                   mStr=userID+"#"+userName+"#US#"+company+"#1#A";
                   param=getParameter("fontSize");
                   try{
                        if (param!=null)
                             fontSize=Integer.parseInt(param);
                        else
                             fontSize=0;
                        } catch (NumberFormatException e){
                             fontSize=-1;                    
                   param=getParameter("port");
                   try{
                        if (param!=null)
                             port=Integer.parseInt(param);
                        else
                             port=2;
                        } catch (NumberFormatException e){
                             port=-1;     
                        //display.append(sock.getURL());
                        connect(IP,port,mStr);
         public void init()
                   setBackground(Color.white);
                   //color = new Color(221,240,255);
                   setForeground(Color.black);
                   p1=new mypanel();
                   add(p1);
                   reader = new readMessage(this);
                reader.setPriority(1);
                   //send.addKeyListener(this);
         public void paint(Graphics g){
              String s;
              double p;
              int i;
              //status.setBackground(Color.blue);
              g.setColor(color);
              display.setEditable(false);
              status.setForeground(Color.black);
              display.setBackground(Color.white);
              p1.cmdSend.setBackground(Color.white);
              p1.cmdSend.setForeground(Color.black);
              display.setFont(new Font("Arial", Font.PLAIN, 11));
              //status.setBackground(Color.blue);
              display.setForeground(Color.blue);
         public void connect(String host,int p,String mStr)
               try{
                   sock=new Socket(host,p);
                   instream = new BufferedReader( new InputStreamReader(sock.getInputStream()));
                   out = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
                   out.writeBytes(mStr);
                   connected=true;
                   out.flush();
                   reader.start();
                   setStatus("You are Connected Successfully. ");
                   display.append("Welcome to "+company+" chat . A Customer Support Executive will assist you shortly.\n");
                   catch (UnknownHostException a) {
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append(company+" live support service fails due to some technical reason.");
                            //status.setText("Intelecorp Live Suport service fails due to some technical reasions.");
                   catch (IOException b) {
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append(company+" live support service fails due to some technical reason.");
                            //status.setText("Intelecorp Live Suport service fails due to some technical reasions.");
                   catch (SecurityException c ) {
                        connected = false;
                        display.append("Error");
              public void setStatus(String mstr)
                   status.setText(mstr);
              public boolean action (Event e, Object arg)
                   if(e.target instanceof Button)
                        if (e.target==p1.cmdSend)
                             sendMessage(send.getText());
                             send.setText("");
                             return true;
                   return false;
    public boolean keyUp(Event e, int key)
            if(key==Event.ENTER)
                   sendMessage(send.getText());
                  send.setText("");
                   return true;
            return false;
         public void keyPressed(KeyEvent e)
              switch (e.getKeyCode()) {
                   case KeyEvent.VK_ENTER:
                        sendMessage(send.getText());
                        send.setText("");
                        break;
                   default:
                        break;
              return ;
         public void keyReleased(KeyEvent e) {} ;
         public void keyTyped(KeyEvent e) {} ;
         public void sendMessage(String mStr)
                   int mflag;
                   try{
                        mflag=mStr.lastIndexOf('\n');
                        mStr.trim();
                        if ((connected==true) && (mStr.length()>0))
                             if (mflag<0)
                                  mStr=mStr+"\n";
                             display.append(userName+" : "+"&x100100100"+mStr+"!&n");
                             out.writeBytes(mStr);
                             out.flush();
                             send.setText("");
                   }catch (IOException e){
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append("Unable to send the message, you may be disconnected from the server.");
                             //status.setText("Unable to send the message, you may disconnected from the server.");
    public void destroy(){
              try{
                   sock.close();
                   }catch (IOException e){
                             status.setText(e.toString());
    class readMessage extends Thread{
              client mClient;
              private String mStr;
             public readMessage(client c){
                        super("Client Reader");
                        this.mClient = c;
    public void run()
              mStr=null;
         try{
                        if (connected==true)
                             while(true)
                               mStr = instream.readLine();
                               display.append("&x200200200"+mStr+"!&n"+"\n");
                               //display.setText(display.getText()+"\n"+mStr);
                                    if (mStr==null)
                                  break;
              }catch (IOException e){
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append("Unable to read the messages, you may be disconnected from the server.");
                             //status.setText("Unable to read the messages, you may disconnected from the server.");
    class mypanel extends Panel 
                   Label l1,l2,l3;
                   Button cmdSend;
                   mypanel()
                        setLayout(new BorderLayout());
                        add("North",display=new TextArea("",12,50,TextArea.SCROLLBARS_VERTICAL_ONLY));
                        add("West",send=new TextArea("",2,50,TextArea.SCROLLBARS_VERTICAL_ONLY));
                        //add("West",send=new TextField());
                        add("East",cmdSend=new Button("  Send  "));
                        add("South",status=new Label(""));
    }

  • Is there such thing as a "compile and execute statement" in Java?

    I wanted to know if there's any way to compile and execute a program "within" another program.

    Yes, but the classes to do so aren't officially supported by Sun as far as I know.
    And you must be able to assume a thing or two about the stuff you compile, such as existing constructors or factory methods etc, otherwise it gets hairy.
    Here's some example code (haven't tried it, so excuse any spelling errors etc) to compile the source code in a file called MyClass.java:
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    new sun.tools.javac.Main(baos,null).compile("MyClass.java");
    String theMsg = baos.toString();
    if (theMsg.length() > 0)
        // NiftyErrorHandlingHere
    }After that, you can load it with a simple ClassLoader.loadClass() call and create instances of it.
    It must be compiled with the tools.jar file in the classpath, to find the sun.tools.javac.Main class.
    However, for any such dynamically compiled class to be of any use to you, you must be able to assume something about it, such as implementing interfaces or whatever, otherwise it's a kind of pointless exercise.
    HTH,
    F

  • Find out varchar2 string NULL columns and Empty columns

    Hi dev's ,
    my requiremnt is to find out the string columns Names of whose storing NULL values and EMPTY strings. for that i had written below code. it's getting some error.
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SET SERVEROUTPUT ON;
    SET VERIFY OFF;
    SET PAGES 0;
    SET HEAD OFF;
    spool D:\stringnull.csv
    DECLARE
      v_tab_indent NUMBER(5);
      v_col_indent NUMBER(5);
      v_val1       VARCHAR2(20);
      v_val2       VARCHAR2(20);
      v_query1     VARCHAR(500);
      v_query2     VARCHAR(500);
    BEGIN
      --DBMS_OUTPUT.ENABLE(100000);
      SELECT MAX(LENGTH(table_name))+1,MAX(LENGTH(column_name))    +1
      INTO v_tab_indent,v_col_indent
      FROM user_tab_columns
      WHERE data_type='VARCHAR2';
    FOR i IN
      (SELECT table_name,
        column_name
      FROM user_tab_columns
      WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
      ORDER BY table_name,
        column_name
      LOOP
        v_query1:='SELECT NVL('||i.column_name||',0) AS VAL    
                  FROM '||i.table_name||' where '||i.column_name||' IS NULL';
        v_query2:='SELECT '||i.column_name||' AS VAL    
                  FROM '||i.table_name||' where '||i.column_name||'=''''';
        --dbms_output.put_line(v_query1);
       -- dbms_output.put_line(v_query2);
        EXECUTE immediate v_query1 INTO v_val1;
        EXECUTE immediate v_query2 INTO v_val2;
        dbms_output.put_line (rpad(i.table_name,v_tab_indent,' ')||','||rpad(i.column_name,v_col_indent,' ')||' ,'||v_val1||','||v_val2);
      END LOOP;
    END;
    Spool OFF
    Set echo on
    Set feedback onERROR:
    Error report:
    ORA-01403: no data found
    ORA-06512: at line 31
    01403. 00000 -  "no data found"
    *Cause:   
    *Action:
    set feedback onpls help me on this issue..
    Thanks,

    Example:
    SQL> DECLARE
      2    v_val       VARCHAR2(20);
      3    v_query1     VARCHAR(32767);
      4  BEGIN
      5   FOR i IN (SELECT table_name, column_name FROM user_tab_columns
      6             WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
      7             ORDER BY table_name, column_name
      8            )
      9   LOOP
    10     v_query1 := 'SELECT count(*) FROM '||i.table_name||' where '||i.column_name||' IS NULL';
    11     EXECUTE immediate v_query1 INTO v_val;
    12     dbms_output.put_line(rpad(i.table_name,30,' ')||' : '||rpad(i.column_name,30,' ')||' : '||v_val);
    13   END LOOP;
    14  END;
    15  /
    CHILD_TAB                      : DESCRIPTION                    : 0
    DEPT                           : DNAME                          : 0
    DEPT                           : LOC                            : 0
    EMP                            : ENAME                          : 0
    EMP                            : JOB                            : 0
    MYEMP_OLD                      : ENAME                          : 0
    MYEMP_OLD                      : JOB                            : 0
    MYNULLS                        : ENAME                          : 0
    MYNULLS                        : JOB                            : 4
    PARENT_TAB                     : DESCRIPTION                    : 0
    T                              : CHAR_VALUE                     : 0
    TABLE1                         : COL1_DESC                      : 0
    PL/SQL procedure successfully completed.

  • Parsing a string using StringTokenizer

    Hi,
    I want to parse a string such as
    String input = ab{cd}:"abc""de"{
    and the extracted tokens should be as follows
    ab
    cd
    "abc""de"
    As a result, I used the StringTokenizer class with deilmeter {,},:
    StringTokenizer tokenizer = new StringTokenizer(input,"{}:", true);
    In this was, I can separate the tokens and also can get the delimeters. The problem is I don't know how to parse the string that has double quote on it. If a single quote " is taken as a delimeter then
    ", abc, ",", de," all of them will be taken as a separate token. My intention is to get the whole string inside the double quote as a token including the quotes on it. Moreover, if there is any escape character "", it should be also included in the token. Help please.
    Thanks

    A bit of a "sticky tape"-solution...
    import java.util.StringTokenizer;
    public class Test {
        public static void main(String[] args) {
            String input = "ab{cd}:\"abc\"\"de\"";
            StringTokenizer st = new StringTokenizer(input, "{}:", true);
            while(st.hasMoreTokens()) {
            String token = st.nextToken();
            if(token.startsWith("\"") && token.endsWith("\"")) {
            token = token.substring(1,token.length()-1);
                System.out.println(token);
    }

  • How to Parse this XML File and require below mentioned value as output using powershell script

    Need values for below as an output for below xml file so help me with the script:
    Under Criteria Tag-
    TimeStamp Display Value
    OID corresponding to display value for nodes "Criterion"
    Under Report Body Tag--
    name in Report Section and OID value
    <?xml version="1.0" encoding="UTF-8"?>
    <ReportOutput>
        <ReportHead>
            <Report name="Execution Action" type="detailedchanges_rpt">
                <Description></Description>
            </Report>
            <Criteria>
                <TimestampCriterion name="date" displayvalue="08/10/14 23:08">
                    <Timestamp displayvalue="08/10/14 23:08">1412780929000</Timestamp>
                </TimestampCriterion>
                <MatchCriterion name="approvalId" displayvalue="Not applied" operator="contains" />
                <MatchCriterion name="promotionComment" displayvalue="Not applied" operator="contains" />
                <SelectCriterion name="changeWindow" displayvalue="Not applied" />
                <SelectCriterion name="auditEvents" displayvalue="(Any)">
                    <String>auditEventAny</String>
                </SelectCriterion>
                <SelectCriterion name="attributeDisplay" displayvalue="Changed attributes">
                    <String>changed</String>
                </SelectCriterion>
                <SelectCriterion name="versionCompare" displayvalue="Version with current baseline">
                    <String>disabled</String>
                </SelectCriterion>
                <BooleanCriterion name="showContentDiff" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayUsers" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayPackages" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayCustomProperties" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="strictPackageMatch" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayCriteriaAtEnd" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <SelectCriterion name="elementExists" displayvalue="Not applied" />
                <IntegerCriterion name="maxLinesPerBlock" displayvalue="10">
                    <Integer>10</Integer>
                </IntegerCriterion>
                <NodesCriterion name="nodes" displayvalue="TripwireENT.demo.net">
                    <OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
                </NodesCriterion>
                <MatchCriterion name="nodeName" displayvalue="Not applied" operator="contains" />
                <CustomPropertiesCriterion name="nodeProps" displayvalue="Not applied" />
                <RulesCriterion name="rules" displayvalue="Critical System Files">
                    <OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
                </RulesCriterion>
                <MatchCriterion name="ruleName" displayvalue="Not applied" operator="contains" />
                <MatchCriterion name="elementName" displayvalue="Not applied" operator="contains" />
                <CustomPropertiesCriterion name="elementProps" displayvalue="Not applied" />
                <CustomPropertiesCriterion name="versionProps" displayvalue="Not applied" />
                <AttributesCriterion name="attributes" displayvalue="Not applied">
                    <Integer name=".missingImpliesFailure">1</Integer>
                </AttributesCriterion>
                <ContentCriterion name="content" displayvalue="Not applied" />
                <MatchCriterion name="auditEventUserName" displayvalue="Not applied" operator="contains" />
                <IntegerCriterion name="changeType" displayvalue="Added, Modified, Removed">
                    <Integer>7</Integer>
                </IntegerCriterion>
                <SeverityRangeCriterion name="severity" displayvalue="1 - 10000">
                    <Integer name="min">1</Integer>
                    <Integer name="max">10000</Integer>
                </SeverityRangeCriterion>
                <BooleanCriterion name="currentVersionsOnly" displayvalue="Yes">
                    <Boolean value="true" />
                </BooleanCriterion>
                <TimeRangeCriterion name="timeRange" displayvalue="All time" />
                <PackagesCriterion name="packages" displayvalue="Not applied" />
                <SortCriterion name="sortNodes" displayvalue="Name, ascending" isascending="true">
                    <String>name</String>
                </SortCriterion>
                <SortCriterion name="sortRules" displayvalue="Name, ascending" isascending="true">
                    <String>name</String>
                </SortCriterion>
                <SortCriterion name="sortElements" displayvalue="Name, ascending" isascending="true">
                    <String>name</String>
                </SortCriterion>
                <SortCriterion name="sortVersions" displayvalue="Date, descending" isascending="false">
                    <String>date</String>
                </SortCriterion>
            </Criteria>
        </ReportHead>
        <ReportBody>
            <ReportSection name="TripwireENT.demo.net" category="node">
                <OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
                <String name="typeName">Windows Server</String>
                <ReportSection name="Critical System Files" category="rule">
                    <OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
                    <String name="typeName">Windows File System Rule</String>
                    <ReportSection name="C:\Temp" category="element">
                        <OID>-1y2p0ij32e8dr:-1y2p0ij32e586</OID>
                        <ReportSection name="08/10/14 22:48" category="version">
                            <OID>-1y2p0ij32e8du:-1y2p0ij32e3ho</OID>
                            <Integer name="changeType">1</Integer>
                            <String name="changeTypeName">Added</String>
                            <Integer name="severity">10000</Integer>
                            <String name="severityName">High</String>
                            <Timestamp name="changeTime" displayvalue="08/10/14 22:48">1412779682000</Timestamp>
                            <String name="approvalId"></String>
                            <ReportSection name="attributes" category="attributes">
                                <ReportSection name="DACL" category="added">
                                    <String name="observed">Inherits Entries: true
    NT AUTHORITY\SYSTEM, Access Allowed:
     Standard rights:
      Full Control
      Modify
      Read &amp; Execute
      List Folder Contents
      Read
      Write
      Delete
      Read Control
      Write DAC
      Write Owner
      Synchronize
     Specific rights:
      Full Control
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Create Files / Write Data
      Create Folders / Append Data
      Write Attributes
      Write Extended Attributes
      Directory Delete Child
      Read Permissions
      Change Permissions
      Take Ownership
     Header flags:
      Object Inherit
      Container Inherit
      Inherited
    BUILTIN\Administrators, Access Allowed:
     Standard rights:
      Full Control
      Modify
      Read &amp; Execute
      List Folder Contents
      Read
      Write
      Delete
      Read Control
      Write DAC
      Write Owner
      Synchronize
     Specific rights:
      Full Control
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Create Files / Write Data
      Create Folders / Append Data
      Write Attributes
      Write Extended Attributes
      Directory Delete Child
      Read Permissions
      Change Permissions
      Take Ownership
     Header flags:
      Object Inherit
      Container Inherit
      Inherited
    BUILTIN\Users, Access Allowed:
     Standard rights:
      Read &amp; Execute
      List Folder Contents
      Read
      Read Control
      Synchronize
     Specific rights:
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Read Permissions
     Header flags:
      Object Inherit
      Container Inherit
      Inherited
    BUILTIN\Users, Access Allowed:
     Specific rights:
      Create Folders / Append Data
     Header flags:
      Container Inherit
      Inherited
    BUILTIN\Users, Access Allowed:
     Specific rights:
      Create Files / Write Data
     Header flags:
      Container Inherit
      Inherited
    CREATOR OWNER, Access Allowed:
     Generic rights:
      Generic All
     Specific rights:
      Full Control
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Create Files / Write Data
      Create Folders / Append Data
      Write Attributes
      Write Extended Attributes
      Directory Delete Child
      Read Permissions
      Change Permissions
      Take Ownership
     Header flags:
      Object Inherit
      Container Inherit
      Inherit Only
      Inherited
    </String>
                                </ReportSection>
                                <ReportSection name="Group" category="added">
                                    <String name="observed">TRIPWIREENT\None</String>
                                </ReportSection>
                                <ReportSection name="Owner" category="added">
                                    <String name="observed">BUILTIN\Administrators</String>
                                </ReportSection>
                                <ReportSection name="Read-Only" category="added">
                                    <String name="observed">false</String>
                                </ReportSection>
                                <ReportSection name="SACL" category="added">
                                    <String name="observed">(null)</String>
                                </ReportSection>
                                <ReportSection name="Type" category="added">
                                    <String name="observed">Directory</String>
                                </ReportSection>
                            </ReportSection>
                        </ReportSection>
                    </ReportSection>
                    <ReportSection name="C:\Windows\System32\drivers\etc\hosts" category="element">
                        <OID>-1y2p0ij32e8dr:-1y2p0ij32e4kp</OID>
                        <ReportSection name="08/10/14 23:08" category="version">
                            <OID>-1y2p0ij32e8du:-1y2p0ij32e3hk</OID>
                            <Integer name="changeType">2</Integer>
                            <String name="changeTypeName">Modified</String>
                            <Integer name="severity">10000</Integer>
                            <String name="severityName">High</String>
                            <Timestamp name="changeTime" displayvalue="08/10/14 23:08">1412780929000</Timestamp>
                            <String name="approvalId"></String>
                            <ReportSection name="attributes" category="attributes">
                                <ReportSection name="SHA-1" category="modified">
                                    <String name="expected">de375d8a456a7345323babee88975ca567a2d5c4</String>
                                    <String name="observed">3c5520382f91cb1cd898fee2da4eba3fa338d982</String>
                                </ReportSection>
                                <ReportSection name="Size" category="modified">
                                    <String name="expected">829</String>
                                    <String name="observed">854</String>
                                </ReportSection>
                            </ReportSection>
                        </ReportSection>
                    </ReportSection>
                </ReportSection>
            </ReportSection>
            <ReportSection name="reportTotals" category="reportTotals">
                <Integer name="summary.nodeCount">1</Integer>
                <Integer name="summary.ruleCount">1</Integer>
                <Integer name="summary.elementCount">2</Integer>
            </ReportSection>
        </ReportBody>
    </ReportOutput>

    Hi Ritehere,
    I know this is simple but am beginner in Powershell Script so I was looking for logic to go through however the output you provided is not what i am looking for and your script is too complicated, as under timestamp i wanted display value and correspoding
    to display value the OID name and then name value correspoding to that OID. May be u got it wrong.
    Thanks anyways.

  • How to invoke BASH shell and execute a command in that shell in Windows 98

    Hello, I have a problem and if somebody will help me, I will be very glad. Thank you.
    I am using BASH shell on Windows 98 OS by means of CYGWIN. And I want to invoke this BASH shell and execute a preprogrammed command in the shell (./scan fileName.txt) from a JAVA program. But so far, I am not sucessful. I can not read or write anything from / to BASH shell. It either blocks and freezes (When I use waitFor( ) ) or appears and disappears without executing scan command (When I do not use waitFor( ) ). My code is like this:
    // This method is used for compiling a file.
    // It invokes BASH shell and executes "./scan fileName.txt" command
    public void compileFileMethod () {
    try {
    Process proc = ( Runtime.getRuntime() ).exec ("C:\\MyDocuments\\CYGWIN.BAT); //I also tried to add -c ./scan fileName.txt after .BAT );
    // I also tried to write "C:\\MyDocuments\\BASH.EXE" but it did not help
    OutputStream ostr = proc.getOutputStream();
    BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter (ostr) );
    InputStream istr = proc.getInputStream();
    BufferedReader br = new BufferedReader ( new InputStreamReader (istr) );
    InputStream errorStr = proc.getErrorStream();
    BufferedReader errorBr = new BufferedReader ( new InputStreamReader (errorStr) );
    bw.write("scan case40.10.txt"); /* I am trying to input the scan command to the shell,but it is not working*/
    bw.flush();
    Vector list = new Vector (1) ;
    String str;
    while ( (str = br.readLine() ) != null) {
    list.addElement(str);
    } // End of while
    Enumeration enumForList = list.elements();
    while ( enumForList.hasMoreElements() ) {
    String tempString;
    tempString = ( String ) enumForList.nextElement();
    System.out.println(tempString); // I am trying to read the outputs of the scan command but it is not reading (I can not see any output)
    I tried with and without waitFor( ), it did not work
    // wait for command to terminate
    proc.waitFor();
    // close streams
    br.close();
    bw.close();
    errorBr.close();
    } // End of try
    catch ( IOException ioe ) {
    JOptionPane.showMessageDialog (null, "Input / output error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of catch
    catch ( SecurityException se ) {
    JOptionPane.showMessageDialog (null, "Security error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    catch ( InterruptedException ie ) {
    JOptionPane.showMessageDialog (null, "Interruption error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of method compileFileMethod
    // Thank you for your helps and time.

    You cannot invoke BAT files directly, you have to invoke the program that run those files which is your Windows 98 shell. For example (under windows 2000), i would invoke "cmd.exe sricpt.bat some args", rather than "script.bar some args".
    Hope this will help you out.

  • Combining package configuration and Execute SQL task at run time

    Hi everyone,
    I have an issue regarding setting values at run time
    I use package configuration to manage different enviroments scenarios (DEV, PROD):
    XML file to store the connections string of SSISConfigDB
    and the actual values of parameters in that SSISConfig DB tables Filtered by ConfigurationFilter column
    Now, one of my packages needs in addition setting at run time value of a flat file name
    i used an Execute SQL task - within the task i read into a variable the file name using command line
    then, the full path of Flat File Connection is set by expression concatenating the root folder and the variable
    the problem is that the variable stays empy! as if the Execute SQL task was never executed!
     Am i doing something incorrect? in the package configuration wizard the configured value are only XML file and the connection string of the DB.
    to summerize - how can i combine package configuration, default value, Execute SQL task and expression at runtime?

    1.EvaluateasExpression=TRUE (Full Path variable)
    2. Do you mean to invlole a ISNULL() function in the expression? if so, no
    3. Of course i recieve a valid value
    4. The Full path expression is evaluated to the root folder - without the portion of the file name
    here is the syntax in Execute SQL Task:
      truncate table OnErrorFlagTable
      Declare @Path varchar(128)
      Declare @FileName varchar(128) 
      Declare @SenderID varchar(5)
      Declare @INST_COD varchar(5)
      Declare @Flag int = 0
     Declare @FileType varchar(2)='01'
      Truncate table TraumaRecords
    Select @Path = 'C:\RootFolder\'
     --***Insert into Temp table the file so we can take his name***--
    Create Table #Tmp(Txt Varchar(Max))
    Insert Into #Tmp(Txt)
    Exec master..xp_cmdshell 'Dir *.txt C:\RootFolder\/b'
    select top 1 @Filename = Txt From #Tmp
    Where ISNUMERIC(substring(Txt,1,1))=1
    order by Txt desc
    Insert into OnErrorFlagTable
    Select 2,@FileName
    Select @FileName as TraumaFileName,@FileType as FileType
    Then, in ResultSet TraumaFileName and FileType are mapped
    Expression of @TraumaFlatfileFullPath is
    @[User::TraumaFlatfilePath]+ @[User::TraumaFlatFileName]
    where the variable @[User::TraumaFlatfilePath] is evaluated in variable window (default value)
    and it's value is C:\RootFolder\
    and @[User::TraumaFlatFileName] is the ResultSet of the ExecuteSQLTask
    and for some reason when executed in SSIS return null while in SSMS return the expected value
    Can you try making this into a procedure with required parameters and call it from SQL task to see if you get return value correctly? Use OUTPUT parameters for getting back required values
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Parsing formatted String to Int

    How can I parse formatted string to Integer ?
    I have a formated string like this $900,000 and I need to convert it to 900000 so I could do calculations with it.
    I tried something like this
    NumberFormat nf = NumberFormat.getIntegerInstance(request.getLocale());
    ttlMargin=nf.parse(screenVal);I got this exception
    "java.lang.NumberFormatException: For input string: "$1,050,000""

    I am working on the JSP file that provides
    margins,sales etc. I am reading this data off the
    screen where it is beeing displayed according to the
    accounting practices.
    That's why I get it as a formatted string and why I
    am trying covert that string to the numberScreen-scraping is a problematic, bad design. It sounds like what you really want is to call a web service which returns its results as data that a program can understand (XML, for example), not HTML (which is meant more for humans to read). I know, you probably can't change the design at this point... just food for thought. In the meantime, you'll probably have to manually parse those strings yourself by stripping out the '$' and ',' characters and then use parseInt on the result.

Maybe you are looking for