Expression parsing and execution

Hi All,
I need ideas/code/suggestions from you all. I am working on a Formula Builder UI. In this a user can create their own expressions choosing some variable values also.
This will contain IF, AND , OR and NOT also from expression creation. For example it may look like this
IF my_variable > 25 THEN my_variable *20 ELSE my_varibale/2 END
So these kind of lines should be parsed first for completeness and then should be executed for thier values.
Hope to get a supportive help from all of you.
Regards,
Sandeep

Hi,
I am trying to evaluate an expression like this =IF(A1<0.125,0.0005,(IF(A1<0.25,0.00066667,(IF(A1<0.5,0.00075,(IF(A1<0.75,0.000916667,0.0010833))))))) in java. In excel it is easy but i cannot use that. I cannot use any free downloads. Is there any code sample which I can use to start off? I need to parse and evaluate the above expression.

Similar Messages

  • Query parse and execution order

    Hi,
    In the below SQL, I could understand that it would parse from Right to Left, first filter condition fieldname, Syntax is verified and then join column names.
    From the below execution plan, I believe it executes from right to left, first filters the data and then joins the two tables, is this correct.
    Is this in the fixed order or keep changing based on the statistics or any other parameter.
    I would like to know how this SQL Select statement is executed in the run-time, whether data is joined first and then the filter condition is applied or
    the other way round. Please give me more details on this, thank you.
    SELECT * FROM EMP E, DEPT D
    WHERE E.DEPTID = D.DEPTID AND
    D.DEPTNAME = 'DEPT1';
    Below is the execution plan,
    SQL > SELECT * FROM EMP E, DEPT D
    2 WHERE E.DEPTID = D.DEPTID AND
    3 D.DEPTNAME = 'DEPT1';
    Execution Plan
    Plan hash value: 1123238657
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 143 | 5 (20)| 00:00:01 |
    |* 1 | HASH JOIN | | 1 | 143 | 5 (20)| 00:00:01 |
    | 2 | TABLE ACCESS FULL| EMP | 1 | 78 | 2 (0)| 00:00:01 |
    |* 3 | TABLE ACCESS FULL| DEPT | 1 | 65 | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - access("E"."DEPTID"="D"."DEPTID")
    3 - filter("D"."DEPTNAME"='DEPT1')
    Note
    - dynamic sampling used for this statement

    >
    - Oracle does the full table scan of EMP table and makes an in-memory hash table with DEPTID as the hash key
    - DEPT table is being read; as Oracle reads DEPT table, applies the filter predicate ("D"."DEPTNAME"='DEPT1'), applies the hashing function to the join key (DEPTID)
    and uses it to locate the matching row from EMP
    - rows are returned to the client
    >
    I believe that is correct for this particular query and plan only because there is only one row in each table. If the tables had many more records then the smaller of the two tables would be chosen to create the hash table and the following should apply.
    The DEPT table is the smaller of the two tables so Oracle would do a full table scan of DEPT to make the in-memory hash with DEPTID as the hash key.
    Then the EMP table (the larger table) is scanned and the DEPTID value used to probe the hash table to find the matching record and then the other filter predicate ("D"."DEPTNAME"='DEPT1') used to eliminate rows.
    See section 11.6.4 Hash Joins in the Performance Tuning Guide
    >
    Hash joins are used for joining large data sets. The optimizer uses the smaller of two tables or data sources to build a hash table on the join key in memory. It then scans the larger table, probing the hash table to find the joined rows.
    This method is best used when the smaller table fits in available memory. The cost is then limited to a single read pass over the data for the two tables.
    >
    This example uses a copy of emp and dept with no primary key or constraints
    SQL> SELECT * FROM EMP1 E, DEPT1 D
      2  WHERE E.DEPTNO = D.DEPTNO AND
      3  D.DNAME = 'RESEARCH';
    Execution Plan
    Plan hash value: 619452140
    | Id  | Operation          | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |       |     5 |   380 |     7  (15)| 00:00:01 |
    |*  1 |  HASH JOIN         |       |     5 |   380 |     7  (15)| 00:00:01 |
    |*  2 |   TABLE ACCESS FULL| DEPT1 |     1 |    30 |     3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| EMP1  |    14 |   644 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("E"."DEPTNO"="D"."DEPTNO")
       2 - filter("D"."DNAME"='RESEARCH')
    Note
       - dynamic sampling used for this statement (level=2)

  • I have result after execution of OperationBinding. How can i parse and store in list.

    I have result after execution of operation binding. how can i parse and store in list

    Hi,
    I Thought u have custom method in AM which returns List Data type. What is the requirement exactly, bcz commit operation have void return type.
    Ex: create custom method in AMimple class
    public List sampleData(){
    // code here to set the values in List object.
    now expose the above method in client interface. Then add the Method action binding in pageDef file and execute the below code in managed bean
    OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("sampleData");
                List result =(List) operationBinding.execute();
    Thanks
    Nitesh

  • Low Execute to Parse % and high soft parse %

    Hello Folks
    I am working on oracle 10g release2 on HP-UX
    After going through awr reports observed it have low Execute to Parse % but high soft parse % (Instance Efficiency Percentages)
    so cannot say issue with less use of bind variables,then what is cause of Execute to Parse %
    searched sites like ask.tom,burselon counsulting etc as usual they had given generic/diplomatic(escaping) replies on this
    like due to problem in application code,ineffecient sharing ,due to problem in database parameters etc
    without any clear indication for cause and solution like if some database parameters not set properly then should say which database parameters can be checked,cause due to more parsing and less execution
    please share if you had faced such issue and any suggestions to solve this
    examples why this could happen ,like possibilities in application code
    Thanks

      Load Profile
                                              Per Second       Per Transaction
                   Redo size:             11,685.79              3,660.98
                   Logical reads:             71,445.74             22,382.86
                   Block changes:                 70.89                 22.21
                   Physical reads:                 58.63                 18.37
                   Physical writes:                  2.80                  0.88
                   User calls:                652.93                204.55
                   Parses:                 48.39                 15.16
                   Hard parses:                  0.33                  0.10
                   Sorts:                  6.90                  2.16
                   Logons:                  0.23                  0.07
                   Executes:                 52.71                 16.51
                   Transactions:                  3.19
                % Blocks changed per Read:    0.10    Recursive Call %:    30.48
                Rollback per transaction %:    2.57       Rows per Sort:    29.66
        Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 Buffer Nowait %:  100.00       Redo NoWait %:  100.00
                 Buffer  Hit   %:   99.92    In-memory Sort %:  100.00
                 Library Hit   %:   98.47        Soft Parse %:   99.32
                 Execute to Parse %:    8.19         Latch Hit %:   99.63
                 Parse CPU to Parse Elapsd %:   89.90     % Non-Parse CPU:   99.62There rdbms performs approximately 48 soft parse per second ,Soft Parse % and Library Hit very close to 99 it means there main part of sql are shared.Also here user calls similar high per second but executions less,however you should be try minimizing soft parsing.I do not know exactly for which interval you get this report but Execute to Parse % indicate that when executing query oracle can not find early cursor handles(open or closed) but it can find sql text and plan information from shared pool according hash values,in this case oracle perform soft parse again.In your case you also investigate shared pool size/fragmentation.To avoid little Execute to Parse % you can increase SESSION_CACHED_CURSORS or implement CURSOR_SPACE_FOR_TIME.So refer documentation and find how to use these parameters.

  • Sql parse and shared pool

    hi friends i have a procedure
    and its have *(AD IS NULL OR NVAD LIKE AD||'%') AND (SOYAD IS NULL OR NVSOYAD LIKE SOYAD||'%')*
    if i use this query and pass different things for AD ; is it become a brand new query for oracle because of ||'%' or its parse and put in shared pool and for a sometime this query don't parse and take from shared pool
       PROCEDURE P_YENI_TALEP_LISTELE(RC_CURSOR OUT SYS_REFCURSOR,TOPLAM_TALEP OUT NUMBER,SAYFA_INDEX IN NUMBER,SAYFA_BUYUKLUK  IN NUMBER,TC_NO IN NVARCHAR2,AD IN NVARCHAR2,SOYAD IN NVARCHAR2,ONAY IN NUMBER,H_TIP_ID IN NUMBER)
        AS 
        BEGIN
          OPEN RC_CURSOR FOR  SELECT TA.NT_ID,TA.NTC_NO,HI.NVHIZMET_TUR AS NVARM_KONU,TA.NVOPRTR_CVP,TA.NVGRSM_SURE,TA.NVGRSM_DRM,
                       TA.NHIZMET,TA.BONAY,TA.DTLP_TRH,TH.NVAD,TH.NVSOYAD,TH.NVILCE ,TA.DALINAN_TRH,
                       TA.DBRKLAN_TRH,TA.NG_ID,GU.NVAD1||' - '||GU.NVAD2 AS GUZERGAH,HI.NH_TIP_ID,HT.NVHIZMET_TIP,
                FROM H_TALEP TA,TNM_HASTA_BILGI TH,TNM_HIZMET HI,SBT_HIZMET_TIP HT,TNM_GUZERGAH GU
          WHERE TA.NTC_NO=TH.NTC_NO AND TA.NH_ID=HI.NH_ID AND HI.NH_TIP_ID=HT.NH_TIP_ID AND(TC_NO IS NULL OR TA.NTC_NO=TO_NUMBER(TC_NO)) AND TA.NG_ID=GU.NG_ID AND
                          *(AD IS NULL OR NVAD LIKE AD||'%') AND (SOYAD IS NULL OR NVSOYAD LIKE SOYAD||'%')*...............

    The code you have posted has no DYNAMIC SQL in it.... Static SQL inside PL/SQL will bind all the variables for you.
    So what you are saying does not compute.
    What is making you think a 'brand new query' is being parsed for each execution?
    Edited by: Tubby on Nov 8, 2008 4:19 PM

  • Higher parse and execute than I expected

    I am trying to diagnose a problem. But I'm a bit confused on how the following could happen. How could I get 25 parses on the same SQL statement? I'd expect 1 parse, 25 execute (which is what I get when I run that statement 25 times during a separate trace).
    SELECT PROJ_ID 
    FROM TIMEX.TD_PROJECTS 
    WHERE PROJ_TYPE = 'LVE'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       25      0.03       0.02          0          0          0           0
    Execute     25      0.00       0.00          0          0          0           0
    Fetch      265      0.16       0.19         31        935          0         250
    total      315      0.19       0.21         31        935          0         250
    Misses in library cache during parse: 1

    "only slightly more amusing than using DBMS_RANDOM"? Seriously Dan? I've got Cary's book & I've been to several of the Hotsos conferences. Method R doesn't necessarily apply here, or if it does, then please give me your targeted approach to implementing it. In my mind, I have to find out where the problem is before I can implement it. If the latch contention in the library cache is causing every session in the db to slow down, and I know that 4 new applications were introduced, then I need to figure out which of those 4 apps is the biggest contributor to the latching problem. Right?
    Initial Goal:
    Load the system with 1/3 of the upcoming user load, to see if it can handle cutover.
    Implementation:
    30 people entered application A, performing the work I captured which started my questions in this thread.
    12 people in application B, 18 in application C, 5 in application D.
    Result: Due to excessive latches in the library cache, the entire system became virtually unavailable.
    Next step: without involving 65 people for each test, capture an approximation of their work in their respective application, and use a testing harness find out which one is causing the majority of the latch contention. Then focus on fixing that app.
    The concern I have here, is that I want to capture that 1:1 parse-to-execution ratio for that one query, due specifically to the latch contention in the library cache - and it's excessive (and unnecessary) number of executions per user.
    If I can't replicate the problem, how can I find the problem areas and fix them?

  • What is Execute to Parse % and how to tune it when it lower?

    What is Execute to Parse % and how to tune it when it is lower?

    Gjohn wrote:
    What is Execute to Parse % and how to tune it when it is lower?If you don't know what it is, how are you going to decide that you need to tune it.
    Here's a little information on how pointless it can be to get too worried about that particular "Instance Efficiency" percentage in Statspack and the AWR: http://jonathanlewis.wordpress.com/2006/12/27/analysing-statspack-2/
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    "There's no sense in being precise when you don't even know what you're talking about"
    John von Neumann                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • I am trying to integrate simulink model (.mdl) file with SIT of Labview for RCP and HIL purpose. I am using Labview 8.6, Simulink 6.6 with RTW 6.6 and RTW embedded coder 4.6 ,Visual C Express 2008 and Visual C++ Express 2008.

    I am trying to integrate simulink model (.mdl) file with SIT of Labview for RCP and HIL purpose. I am using Labview 8.6, Simulink 6.6 with RTW 6.6 and RTW embedded coder 4.6 ,Visual C Express 2008 and Visual C++ Express 2008. I have selected system target file as nidll.tlc,make command as make_rtw and template nidll_vs.tmf. When I try to generate .dll file I get the following error.
    Attachments:
    SITProblem.JPG ‏101 KB

    Hi,
    No . I could not solve the issue. Presently we are using microautobox (from Dspace)for doing the RCP.
    Himadri 

  • Parse and output XML document while preserving attribute order

    QUESTION: How can I take in an element with attributes from an XML and output the same element and attributes while preserving the order of those attributes?
    The following code will parse and XML document and generate (practically) unchanged output. However, all attributes are ordered a-z
    Example: The following element
    <work_item_type work_item_db_site="0000000000000000" work_item_db_id="0" work_item_type_code="3" user_tag_ident="Step" name="Work Step" gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_site="0000000000000000" last_upd_db_id="0" rstat_type_code="1">
    </work_item_type>is output as:
    <work_item_type gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_id="0" last_upd_db_site="0000000000000000" name="Work Step" rstat_type_code="1" user_tag_ident="Step" work_item_db_id="0" work_item_db_site="0000000000000000" work_item_type_code="3">
    </work_item_type>As you may notice, there is no difference in these besides order of the attributes!
    I am convened that the problem is not in the stylesheet.xslt but if you are not then it is posted bellow.
    Please, someone help me out with this! I have a feeling the solution is simple
    The following take the XML from source.xml and outputs it to DEST_filename with attributes in a-z order
    Code:
    private void OutputFile(String DEST_filename, String style_filename){
         //StreamSource stylesheet = new StreamSource(style_filename);
         try{
              File dest_file = new File(DEST_filename);
              if(!dest_file.exists())
                  dest_file.createNewFile();
              TransformerFactory tranFactory = TransformerFactory.newInstance();
              Transformer aTransformer = tranFactory.newTransformer();
              aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
              Source src = new DOMSource("source.xml");
              Result dest = new StreamResult(dest_file);
              aTransformer.transform(src, dest);
              System.out.println("Finished");
         catch(Exception e){
              System.err.print(e);
              System.exit(-1);
        }

    You can't. The reason is, the XML Recommendation explicitly says the order of attributes is not significant. Therefore conforming XML serializers won't treat it as if it were significant.
    If you have an environment where you think that the order of attributes is significant, your first step should be to reconsider. Possibly it isn't really significant and you are over-reaching in some way. Or possibly someone writing requirements is ignorant of this fact and the requirement can be discarded.
    Or possibly your output is being given to somebody else who has a defective parser which expects the attributes to be in a particular order. You could quote the XML Recommendation to those people but often XML bozos are resistant to change. If you're stuck writing for that parser then you'll have to apply some non-XML processing to your output to fix it up on their behalf.

  • When I open logic express 8 with eyetv open but not active and i close logic express 8 and make eyetv active it won't show closed captioning even though closed captioning is turned on

    when I open logic express 8 with eyetv open but not active and i close logic express 8 and make eyetv active eyetv won't show closed captioning even though closed captioning is turned on.  When I totally close eyetv and reopen eyetv and open a live tv window the closed captioning comes back.  I never noticed this with os leopard, Just after i installed os snow leopard.  All software is up to date only I think, thanks to apple they droped support for logic express.  Thanks for any suggestions.

    Does toggling CC off & back on bring it back?
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    *Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)
    If perchance you can't find your install Disc, at least try it from the Safe Boot part onward.

  • What do you do if someone uses your account to purchase programs? All the YuFanApp programs were purchased on my account. I called apple and they said go online to express support and that was NO help. I changed my passwords but I am concerned.

    Yesterday I started getting these emails that my address and credit card information was changed. I then got one that an order was placed on a device I had never used before. I did not do any of this so I went in to my account and there it was, all programs by YuFanApp had been purchased! (To me this is a red flag that that company may have stolen information from itunes users!) My credit card was not on file, I can't remember if I ever had it on there. The gift card I had on my account had been drained. My shipping adress was still the same. So I changed my password and tried to call customer service. They said they were sorry and just go online to the customer support express page and do things there to report it but there is nothing there to report it. Anyone have an email address or something I can work with?

    Click "Support" at the top of this page, then click the link under "Contact Us"

  • Unable to update, when executed table gets lock and Execution does not stop even for an hour.

    Following is my Query, which unables to update. When Executed, table gets lock and Execution does not stop even for an hour.
    update Employees 
          set Status = 'Close'
          where statusid IN (select statusid 
                                             from MyView 
                                              where DownloadedDate ='2014-07-27 00:00:00.000'
    here Employee contains 3,00,000 of records and Subquery return 1,50,000 Empid 
    i tried in various ways but not able to solve, statusid  column have no index on,  i tried using cursor but it does not work.
    plz let me know how to solve this Issue, Its very Important to get solve as all my further work depends on Updation
    , THANKS IN ADVANCE.

    See also your other thread with the same question:
    http://social.msdn.microsoft.com/Forums/en-US/80243625-fc3b-4ee1-bce1-4adcdbc16c14/unable-to-update-when-executed-table-gets-lock-execution-does-not-stop-execution-even-for-an-hour?forum=sqlserversamples
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Implementing Auto Contract Generation/Negotiation and Execution

    Would love to hear from anyone that has implemented auto contract generation/negotiation and execution.  Were there any lessons learned you could share during implementation?  Were there things you found out - too late? Are you seeing adoption?  How long did the implementation take?  Pain points along the road?  Things you would do differently?  We are getting ready to take this trip ourselves and I have a feeling it will not be smooth sailing.

    Hello Sravan
    Your message isn't clear fo me
    If you used import for new master data you can use automatic key generation ability for inbound port
    The another way:
    You can create special key field in MDM and
    create simple workflow which fire when ADD record.
    That worklflow call assignment which fill key field
    Regards
    Kanstantsin

  • XML Parser and Content-type/encoding problem

    I've write a little and simple XML parser and a simple "trasformer" that recive an XML file and an XSL one and return HTML, here is the code:
    public static String toHTML(Document doc, String xslSource){
            ByteArrayOutputStream testo = new ByteArrayOutputStream();
            try{
                DOMSource source = new DOMSource(doc);
                TransformerFactory tFactory = TransformerFactory.newInstance();
                System.out.println("----> " + xslSource);
                Transformer transformer = tFactory.newTransformer(new StreamSource(xslSource));
                transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
                transformer.setOutputProperty(OutputKeys.METHOD, "html");
             transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
             transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
                transformer.transform(source, new StreamResult(testo));
            }catch(Exception ioe){
                System.out.println("2 XMLTool.toHTML " + new java.util.Date());
                System.out.println(ioe);        
            return testo.toString();
        }the problem is that I would like to put the HTML code its return into a JEditorPane; now I'm trying with this code:
    JEditorPane jep1 = new JEditorPane();
    jep1.setContentType("text/html");
    jep1.setText(v);
    // 'v' is the string returned by the code posted up (the XML/XSL transformer)but I can't see anything in my JEditorPane.
    I think that the problem is this line of code that the transformer add automaticaly ad HTML code:
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">Infact if I try to delete this line from the code I can see what I want but is'n good delete a line of code without understend where is the problem.
    So, can anyone help me?

    good.
    when u set ur output properties to html , transformer
    searches for all entity references and converts accordingly.
    if u r using xalan these files will be used for conversion of
    Character entity references for markup-significant
    output_html.properties
    (this should be in templates package)
    and HTMLEntities.res(should be in serialize package)
    vasanth-ct

  • Issues during reinstallation Oracle 10g express edition and Forms 6i

    I've been racking my head over this issue for the past two three days. Exasperated, I tried searching in the forums but could not find a specific scenario like this.
    I am facing issues while trying to get forms 6i to work with oracle 10g Express edition
    i have windows XP home edition (installed service pack 2) and installed oracle 10g express edition as well as the oracle 10g express client and SQL developer on the same machine. The database started fine and I was able to use Enterprise manager.
    After that I tried installing Forms 6i and whatever i try i am not able to connect to the database from Forms though I was able to connect easily from SQL developer. I used to get the error 12154 "TNS:could not resolve service name"
    I dont know if Forms 6i expects the database connector string in some particular format. I searched on the net and found some people solved the issue by reinstalling the database software.
    My machine name was complex so I changed it as well and reinstalled the software. Again the DB was fine and connections were fine but no way I could get forms to connect to the DB. All the time
    I tried installing Forms to the same folder that Oracle express edition home in the hope that it might fix the problem. That only caused my database to crash. The oracle xe service shows as started but the Enterprise manager link does not work and it seems the database is down. I tried uninstalling and reinstalling client and server to no avail.
    Has anyone gone through such a situation and solved this ? Appreciate your help.

    The statement about XP Home is correct, but in this case I would say the initial problem (Forms and ORA-12154) is independent of that, it also happens in a supported environment. I think it's the old problem, a second Oracle home was installed, but tnsnames.ora containing the connect informations is located in the first home.
    Either tnsnames.ora is copied from to <Second_ORACLE_HOME>\network\admin or the environment variable TNS_ADMIN is set system-wide to <First_ORACLE_HOME>\network\admin.
    I think now it's necessary to create a clean machine (remove all Oracle components as explained in the database installation guide for Windows). Then repeat the installation , but XE and Forms 6i in different ORACLE_HOMEs.
    Werner

Maybe you are looking for