Which Design Pattern and how to design using OOP this scenario

I am having trouble designing a module, can anybody help me?
Because it will be hard to maintain this kind of module, I also think that this can test my skill of design pattern usage.
Requirement
This is basically an agricultural project (web application). I need to design a module where some calculation takes place.
There are different crops involved like maize, tomato, okra etc. Each of these crops has different traits.
Each trait has a measurement scale which lies in integer like 200-1000. Now let's say I have planted the crop and done measurement noted down the traits. Now I want to do some sort of measurement. Some measurements are simple and some are complex.
Example
Lets take an example of crop maize. I have recorded observations for 15 traits. (We'll use trait1-trait15 as examples, the actual name can be like plt_ht, yld, etc.)
I recorded 5 observations for each trait:
trait1 trait2 trait3 trait5 trait6..... trait15
01,02,03,04 01,02,03,04 01,02,03,04
User logs into system and selects his crops and enters data for these observations. I have to calculate either average or sum of the data entered for each trait.
Complexity / centre of the problem
So far it's simple but complexity comes when I have some different formulas for some of the traits.
Example: trait YLD has a formula based on which I have to calculate its value, which may also depend on some other traits. Each different crop can have different traits.
All this I am able to do - whenever user selects crop I will check for those specific traits and do calculations (if it's not a special trait then I either average or sum it, based on db entry), but there is a lot of hard coding.
I would like to have suggestions on a better way of handling this.
My code needs to handle both simple and complex calculations.
Simple calculations are easy, I have take average of value entered for trait.
The problem comes when I have to do complex calculations, since each crop have different traits with their own formulas, so to calculate I have to check for crop and then for complex trait. So I have to hardcode the trait name of complex traits.
Can any tell me how I can design this using Java oops [?!?] so that I can make it generic?
I have about 10 different crops. Some calculations are specific to crops, so there will be lot of code like the if below:
hasZeroValue = (HashMap<String, ArrayList<String>>) dataValues[1];
} else if(cropId.equalsIgnoreCase("MZ") && traitName.equalsIgnoreCase("Shelling")) {
    avg=HybridTestDataUtility.calculateAvg(traitName, dataPoint, dataTraits, traitValues,dataPvalues, dataPoint, type);
    avg=avg*dataPoint;
    traitAvg=getMaizeYeild(traitName, traitAvg, population, avg, hybrid, area);
} else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YLDGM")) {
    avg=HybridTestDataUtility.calculateAvg(traitName, dataPoint, dataTraits, traitValues,dataPvalues, dataPoint, type);
    //avg=avg*dataPoint;
    Object[] dataValues=getOKRAYield(traitName, traitAvg, population, avg, dividend,hasZeroValue,hybrid,repl);
    traitAvg = (HashMap<String, Float>) dataValues[0];
    hasZeroValue = (HashMap<String, ArrayList<String>>) dataValues[1];
} else if(cropId.equalsIgnoreCase("HP") && traitName.equalsIgnoreCase("w1-w10")) {
    avg=HybridTestDataUtility.calculateAvg(traitName, dataPts, dataTraits, traitValues,dataPvalues, dataPoint, type);
    avg=avg*dataPoint;
    Object[] dataValues=getHotPepperYield(traitName, traitAvg, population, avg,dividend,hasZeroValue,hybrid,repl);
    traitAvg = (HashMap<String, Float>) dataValues[0];
    hasZeroValue = (HashMap<String, ArrayList<String>>) dataValues[1];
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("TLSSG_70")) {
    traitAvg=calculateTLCV(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues,50);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("TLSSG_100")) {
    traitAvg=calculateTLCV(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues,50);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("YVMV_60")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("YVMV_90")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("YVMV_120")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("ELCV_60")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("ELCV_90")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("ELCV_120")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YVMV_60")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YVMV_90")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YVMV_120")) {
    traitAvg=tomatoYVMVCalculation(traitName, traitAvg, dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
} else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("ELCV_60")) {Can anybody think of a way to make a generic approach to this?

There are crops and each crop have traits , traits are actually a mesuremet
scale to decide growth of a seed of a particular crop.
This module is to for planters to observe growth of seeds sowed of certain
crops and take down n no of observation for each trait and upload in csv format.Once they enter
data i have to either avg out the values or sum the values or sometimes
there are more complex function that i have to apply it may differe for each
trait .This is the whole module about.Just to give an idea about how they
will enter data
Hyubrid(seed) trait1 trait2 trait3 trait5 trait6..... trait15
Hybrid1 01 02 03 04 01
HYbrid2 04 06 08 04 01
HYbrid2 04 06 08 04 01
HYbrid2 04 06 08 04 01
HYbrid2 04 06 08 04 01
Once they enter data in this format i have to give result something like
this.
Here avg colum does not necessaryly mean avg it can be sum or any formula
based resutl.Hybrid is the seed for which they record the observation.
I have shown avg column only for two tratis it is actually for all the
traits.
Hyubrid(seed) trait1 Avg trait2 avg trait3 trait5 trait6..... trait15
Hybrid1 01 01 02 04 03 04 01
HYbrid2 04 04 06 10 08 04 01
HYbrid2 04 04 06 12 08 04 01
HYbrid2 04 04 06 14 08 04 01
HYbrid2 04 04 06 12 08 04 01
Hope this clarifies atleat a but
The data are not correctly indented but there is no way i can format it.

Similar Messages

  • How EXISTScan be used in this scenario

    Hi All,
    I want to use EXISTS in this query insted of IN.
    Select <Column Name>
    from <User>.<Table Name>@<Database link Name>
    where <Column1 Name> in (1,2,3,4,5,6,7,18,20)
    and <Column2 Name> in (1,2,3,4,5,6)
    and <Column3 Name> <>'0000000000000000'
    and <Column4 Name> >= (select Sysdate - <Column Name> from <Local Table Name>)
    TIA.
    Regards
    Ayaz.

    In this case you don't have a sub query. You can construct a subquery for the purposes of using EXISTS but I wouldn't recommend it. Curiously though, the example I used to check this out works quite well! However, it's the Range Scan versus the Full Scan on the index that's the important bit.
    SQL> set autot on exp stat
    SQL> SELECT empno FROM scott.emp WHERE empno IN(7369, 7499, 7521);
         EMPNO
          7369
          7499
          7521
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=3 Bytes=12)
       1    0   INLIST ITERATOR
       2    1     INDEX (RANGE SCAN) OF 'PK_EMP' (INDEX (UNIQUE)) (Cost=1 Card=3 Bytes=12)
    Statistics
              0  recursive calls
              0  db block gets
              4  consistent gets
              0  physical reads
              0  redo size
            436  bytes sent via SQL*Net to client
            508  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              3  rows processed
    SQL> 
    SQL> SELECT empno FROM scott.emp e
      2  WHERE EXISTS(
      3    SELECT 7369 FROM dual WHERE e.empno = 7369
      4    UNION ALL
      5    SELECT 7499 FROM dual WHERE e.empno = 7499
      6    UNION ALL
      7    SELECT 7521 FROM dual WHERE e.empno = 7521
      8    );
         EMPNO
          7369
          7499
          7521
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=43 Card=1 Bytes=4)
       1    0   INDEX (FULL SCAN) OF 'PK_EMP' (INDEX (UNIQUE)) (Cost=1 Card=14 Bytes=56)
       2    1     UNION-ALL
       3    2       FILTER
       4    3         FAST DUAL (Cost=2 Card=1)
       5    2       FILTER
       6    5         FAST DUAL (Cost=2 Card=1)
       7    2       FILTER
       8    7         FAST DUAL (Cost=2 Card=1)
    Statistics
              0  recursive calls
              0  db block gets
              2  consistent gets
              0  physical reads
              0  redo size
            436  bytes sent via SQL*Net to client
            508  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              3  rows processed

  • How to view and restore sharepoint 2013 designer workflows and how to redeploy with newer version to environments

    how to view and restore sharepoint 2013 designer workflows and how to redeploy with newer version to environments
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Hi,
    In SharePoint Designer 2010, we could not save the workflow as a template directly except the reusable workflow.
    However, in SharePoint Designer 2013, we can just save all the types workflow as a template, then you can import the workflow into the new environment.
    http://blogs.msdn.com/b/workflows_for_product_catalogs/archive/2012/11/02/deploying-a-workflow-on-a-different-server.aspx
    In SharePoint Designer 2013, every time we publish the workflow, we would get a newer version workflow, and the old workflow version would be overwritten.
    So, when you deploy the workflow in the environment, the workflow would the newer version.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • What is a Scorecard Custom Set Formula and how do I use it?

    When creating a Scorecard (in Dashboard Designer) which includes a KPI, in the right "Details" frame, there is a section for "Set Formulas" and under that (along with Time, which I understand) is "Custom" which I can't find
    any documentation for. How can and how do I use this? (I am using tabular data sources, if that matters.)

    Hi,
    Quote:
    “Set formulas represent the ability to add some advanced MDX or TI expressions to the scorecard.
    The Time Set Formula option allows the entry of TI expressions that will be expanded on the scorecard.
    The Custom Set Formula option allows the entry of a MDX set expression that will be used within the scorecard. The usefulness of this feature has diminished somewhat with the new dynamic hierarchy selection capabilities included in PPS 2010. However,
    the Custom Set Formula feature does still have some value.”
    Please refer more information from:
    http://tutorial.programming4.us/windows_server/SharePoint-2010-PerformancePoint-Services---Understanding-and-Working-with-Scorecards-(part-2).aspx
    http://blog.gnetgroup.com/bi/2012/10/08/dynamic-mdx-if-the-last-day-of-data-isnt-always-day-1/
    http://office.microsoft.com/en-in/dashboard-designer-help/creating-scorecards-by-using-performancepoint-dashboard-designer-HA101730034.aspx
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Where do I use These lock object FM's (Enqueue & D? and How do I use them?

    I created lock object for user defined table (zconsist). The system automatically created 2 FM's (Enquiue & Dequeue).
    I created a new TCode and accessing this with mulitple users to do some updates and inserts in that above table.
    I used INSERT ZCONSIST statement in 5 places in my program (4 include programs).
    Where do I use These FM's? and How do I use them?
    I mean before inserting which FM I need to use? after immediately what fm used?.
    every insert statemnt before i need to use the respective fm? so 5 places i need to call the respective FM is it right?
    thank in advance.

    Hi Sekhar,
    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
    SAP Provide three type of Lock objects.
    Read Lock(Shared Locked)
    protects read access to an object. The read lock allows other transactions read access but not write access to
    the locked area of the table
    Write Lock(exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to
    the locked area of the table.
    Enhanced write lock (exclusive lock without cumulating)
    works like a write lock except that the enhanced write lock also protects from further accesses from the
    same transaction.
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    check this link for example.
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    tables:vbak.
    call function 'ENQUEUE_EZLOCK3'
    exporting
    mode_vbak = 'E'
    mandt = sy-mandt
    vbeln = vbak-vbeln
    X_VBELN = ' '
    _SCOPE = '2'
    _WAIT = ' '
    _COLLECT = ' '
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
    Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
    1. enque_lockobject
    1. deque_lockobject
    before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    GO TO SE11
    Select the radio button "Lock object"..
    Give the name starts with EZ or EY..
    Example: EYTEST
    Press Create button..
    Give the short description..
    Example: Lock object for table ZTABLE..
    In the tables tab..Give the table name..
    Example: ZTABLE
    Save and generate..
    Your lock object is now created..You can see the LOCK MODULES..
    In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
    Lock objects:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    Match Code Objects:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
    See this link:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Check these links -
    lock objects
    Lock Objects
    Lock Objects
    kindly reward if found helpful.
    cheers,
    Hema.

  • What is an ISO Image? and how do I use bootcamp?

    What is an ISO Image? and how do I use Bootcamp

    Heya!
    An .ISO image is a well, form of image file. :3
    If you want to change it to a .img/.dmg (Which are, essentially, the same file) you can use this Terminal command:
    hdiutil convert -format UDRW -o /path/to/target.img /path/to/original.iso
    OSX tends to chuck a .dmg on the end after conversion, just get rid of it if you don't want it. Apple's Bootcamp FAQ should help you using bootcamp, but I'm not sure if OSX 10 has bootcamp. You can always try searching for it.
    Tell us what happens!

  • Hi all. I am new to iPad and am trying to buy certain apps thru iTunes. I keep getting messages saying "this app is not yet available in the South African store"! which means i am unable to buy it. Why not and how can i get around this. Thanks

    Hi all. I am new to iPad and am trying to buy / download certain apps thru iTunes and or App Store. I have found the apps i want yet I keep getting messages saying "this app is not yet available in the South African store"! which means i am unable to buy it. Why not and how can i get around this? Thanks

    If you see a dialog telling you the app is not avaiable, then it's not available.
    And keep in mind, your credit or debit card credentials must be associated with the same country where you reside.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article

  • I can't download ikea home planner ? and how i can use it?

    i can't download ikea home planner ? and how i can use it?

    Care to share which OS system you are using?
    Do you meet the planner's system requirements? 

  • What is javadoc for and how can i use it?

    Hello,
    I want to know what for
    */is and how I can use it?

    It works like this:
    You add comments between /** and */ in your source code for all your classes, methods, variables etc. Then you run the javadoc tool, which is included with the JDK. Read the Javadoc Tool Documentation for instructions about how to use it.
    The javadoc tool looks at the comments in your source code and generates a directory containing HTML pages. The HTML pages contain the documentation of all your classes and methods.
    Why would you want this? Because other people who are going to use your source code do not want to browse through all of your source code all the time to find out how your classes work. Having a good manual in the form of HTML pages generated by javadoc is much more convenient.

  • HT1688 How i could find my I phone 4s which is stolen , and how i get copy of my photos that i stored in i phone it'self ?

    Hi
    please ,How i could find my I phone 4s which is stolen , and how i  could get copy of my photos that i have stored in i phone it'self ?

    Your only chance is with the Find My iPhone option with a free Apple iCloud account.
    Were you accessing an iCloud account on your iPhone with Find My iPhone turned on with the account settings?
    iCloud also includes a PhotoStream feature which can stream the photos in the Camera Roll to your computer as well as to other iOS devices.
    If not being used and you didn't import the photos with your computer as with any other digtial camera nor update your iPhone's backup since the photos were captured, the photos are gone unless your iPhone is re-covered as is.

  • WHERE AND HOW  IS DEBUGGING USED ?

    WHERE AND HOW  IS DEBUGGING USED ? PLEASE GUIDE ME WITH EXAMPLES.
    REWARD POITS GUARENTEED !!

    Hi,
    check these...
    ABAP DEBUGGING
    http://help.sap.com/saphelp_webas620/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9cbb7716-0a01-0010-58b1-a2ddd8361ac0
    Debug Program scheduled Background
    Re: Debugging Report which is scheduled in background
    3 types update,normal and system debugging
    check this for update debugging
    If you set "Update Debbugging" you can debug the codes which works in update tusk.
    SAP std often runs the routine (function or form) to update the database in update tusk mode, these routine start as soon as a commit work is done.
    The commit is called at the end of the program, so you can't debug them by "normal debbugging" because it ends as soon as the program ends
    or----
    All the database updates are performed by the update work processes by calling the functions/subroutines in update tasks.
    These tasks are executed after a commit work is reached in the application. By default you cannot debug these functions.
    TO debug these u need to explicitly activate update debugging.
    for system debugging check the below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/5f0640555ae369e10000000a155106/content.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/frameset.htm
    For debugging tutorial:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/5a/4ed93f130f9215e10000000a155106/frameset.htm
    http://www.sapdevelopment.co.uk/tips/debug/debughome.htm
    http://www.sap-basis-abap.com/sapab002.htm
    System Debugging
    If you set this option, the Debugger is also activated for system programs (programs with status S in their program attributes). When you save breakpoints, the System Debugging setting is also saved.
    Update Debugging
    Update function modules do not run in the same user session as the program that is currently running in the ABAP Debugger. These function modules are therefore not included in debugging. Only if you select the Update Debugging option can you display and debug them after the COMMIT WORK.
    Normal Debugging
    Normal debugging is the one we do it by the normal dynamic break points or by /H or by using stattic break points.
    You can switch to diffferent debuggin modes while processing.
    BREAKPOINT
    In the source code we set the Break-point there by clicking the stop button, the system will stop there when you execute the program.
    Watchpoint
    For watchpoints, we need to give some condition and when this condition is satisfied, program will stop
    example : if you want to debug only
    for matnr value 100 than set watch point
    matnr = 100. when value reaches 100 than
    program stops at that point.
    more at
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/617cdce68c11d2b2ab080009b43351/content.htm
    check these documents as well
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-runtime-tools/the%20new%20abap%20debugger%20-%20an%20introduction.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/media/uuid/f720ea47-0801-0010-f7a3-bd37d44fee8d
    here r some links for debugging...
    Go through these threads for more information on debugging,
    1) debugging
    2) debugging
    3) Debugging
    4) Debugging
    some more links .....
    Introduction: http://www.saplinks.net/index.php?option=com_content&task=view&id=24&Itemid=34
    A PDF file to know knowledge about Debugging
    Some more links:
    http://www.sap-basis-abap.com/sapab002.htm
    Debug Background Programs: http://www.sapdevelopment.co.uk/tips/debug/debug_backjob.htm
    Debugger: http://help.sap.com/saphelp_nw2004s/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    Cheers
    VJ

  • What is the meaing of the sysmbolic constant value in the header file for UIR file and how they are used

    In labwindows after creating the uir then header file is create automatically. There it has define some symbolic constant. As examples of colview.h(from the examples of labwindows )
    #define  MAINPNL              1       /* callback function: MainPanelCB */
    #define  MAINPNL_RESULTS      2     /* control type: table, callback function: ResultTableCB */
    #define  MAINPNL_NEWTEST     3       /* control type: command, callback function: NewTestCB */
    My question is how these values 1, 2 and 3  were selected and how they are used in programs ?
    If anyone explains, it will be a great help.

    When creating a UIR file, CVI editor takes care of assigning constants to the panels / controls you create in it.
    The conceptual framework is the following (assuming to treat the file you have reported in your message):
    - Within a single UIR file all panels have a unique ID, which is the one you pass to LoadPanel when loading a panel into memory. LoadPanel (0, "myfile.uir", MAINPNL); is then translated to panelHandle = LoadPanel (0, "myfile.uir", 1); , that is: "load the first panel in the uir file". The panel in memory is then assigned a handle, which is guaranted unique by the OS and saved in panelHandle variable
    - Addressing a control in a panel is done e.g. using SetCtrlVal (panelHandle, MAINPNL_NEWTEST, xxx);  , which again is translated to SetCtrlVal (panelHandle, 1, 3);  that is: "Set control #3 in the panel identified by panelHandle to value xxx".
    You must not modify the include file associated to the UIR as it is fully maintained by the IDE and is rewritten each time you save the UIR file.
    That conceptual framework has some advantages and some caveats:
    - You can load the same panel more then once in your program: each instance is independent from the others as each panel handle is unique; in some occasions it may be helpful, e.g. if you need to handle several identical equipments connected to your PC and you can load the same control panel for each unit connected maintaining each of them independent
    - If the panel handle is wrong, the system does not warn you of this as it does not know of the symbolic names you are using; if you try that SetCtrlVal command with a wrong handle you are trying to manipulate a control on a panel different from the one you intend: supposing actual panel idientified by the handle has control #3 the maximum you can expect is that you receive an error in case you pass e.g. a string to a numeric, but if controls are of the same type you have no errors or warning at all! This is particularly important when addressing controls on pages of a tab control: each page is really a separate panel with its proper handle that you must retrieve with GetPanelhandleFromTabPage command before addressing the controls on it
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Multiple users, devices & Apple IDs in the house. Can we, and how would we, use Home Sharing?

    We have three users in the house, each with their own Apple ID, using multiple mac/PC devices.  Can we and how would we use Home Sharing to share music, apps, etc? 

    Do you have a computer. You can't share music or apps from one mobile device to another. To share photos you need to use photo stream shared albums.

  • Dear sir I have 2 iPhones , I downloaded find my iphone and find out there is another iPhone on my Apple ID and in another location in same city Erbil which I live and I tried to use lost mode but it is still not stopped

    Dear sir I have 2 iPhones , I downloaded find my iphone and find out there is another iPhone on my Apple ID and in another location in same city Erbil which I live and I tried to use lost mode but it is still not stopped

    It could be that someone has accessed your AppleID/iCloud account with out authorization. Or it could be that you forgot to remove find my iPhone form a phone that your previously owned.
    Change your Apple ID password.

  • HT1338 Purchased a used macbook pro with Mountain Lion. My old Mac runs Snow Leopard is backed up to Time machine. How do I register the operating system to me and how do I use Time Machine to move my files to the new used computer?

    Purchased a used macbook pro with Mountain Lion. My old Mac runs Snow Leopard is backed up to Time machine. How do I register the operating system to me and how do I use Time Machine to move my files to the new used computer?

    If you look at the User Tips tab, you will find a write up on just this subject:
    https://discussions.apple.com/docs/DOC-4053
    The subject of buying/selling a Mac is quite complicated.  Here is a guide to the steps involved. It is from the Seller's point of view, but easily read the other way too:
    SELLING A MAC A
    Internet Recovery, and Transferability of OS & iLife Apps
    Selling an Old Mac:
    • When selling an old Mac, the only OS that is legally transferable is the one that came preinstalled when the Mac was new. Selling a Mac with an upgraded OS isn't doing the new owner any favors. Attempting to do so will only result in headaches since the upgraded OS can't be registered by the new owner. If a clean install becomes necessary, they won't be able to do so and will be forced to install the original OS via Internet Recovery. Best to simply erase the drive and revert back to the original OS prior to selling any Mac.
    • Additionally, upgrading the OS on a Mac you intend to sell means that you are leaving personally identifiable information on the Mac since the only way to upgrade the OS involves using your own AppleID to download the upgrade from the App Store. So there will be traces of your info and user account left behind. Again, best to erase the drive and revert to the original OS via Internet Recovery.
    Internet Recovery:
    • In the event that the OS has been upgraded to a newer version (i.e. Lion to Mountain Lion), Internet Recovery will offer the version of the OS that originally came with the Mac. So while booting to the Recovery Disk will show Mountain Lion as available for reinstall since that is the current version running, Internet Recovery, on the other hand, will only show Lion available since that was the OS shipped with that particular Mac.
    • Though the Mac came with a particular version of Mac OS X, it appears that, when Internet Recovery is invoked, the most recent update of that version may be applied. (i.e. if the Mac originally came with 10.7.3, Internet Recovery may install a more recent update like 10.7.5)
    iLife Apps:
    • When the App Store is launched for the first time it will report that the iLife apps are available for the user to Accept under the Purchases section. The user will be required to enter their AppleID during the Acceptance process. From that point on the iLife apps will be tied to the AppleID used to Accept them. The user will be allowed to download the apps to other Macs they own if they wish using the same AppleID used to Accept them.
    • Once Accepted on the new Mac, the iLife apps can not be transferred to any future owner when the Mac is sold. Attempting to use an AppleID after the apps have already been accepted using a different AppleID will result in the App Store reporting "These apps were already assigned to another Apple ID".
    • It appears, however, that the iLife Apps do not automatically go to the first owner of the Mac. It's quite possible that the original owner, either by choice or neglect, never Accepted the iLife apps in the App Store. As a result, a future owner of the Mac may be able to successfully Accept the apps and retain them for themselves using their own AppleID. Bottom Line: Whoever Accepts the iLife apps first gets to keep them.
    SELLING A MAC B
    Follow these instructions step by step to prepare a Mac for sale:
    Step One - Back up your data:
    A. If you have any Virtual PCs shut them down. They cannot be in their "fast saved" state. They must be shut down from inside Windows.
    B. Clone to an external drive using using Carbon Copy Cloner.
    1. Open Carbon Copy Cloner.
    2. Select the Source volume from the Select a source drop down menu on the left side.
    3. Select the Destination volume from the Select a destination drop down menu on the right
    side.
    4. Click on the Clone button. If you are prompted about creating a clone of the Recovery HD be
    sure to opt for that.
    Destination means a freshly erased external backup drive. Source means the internal
    startup drive. 
    Step Two - Prepare the machine for the new buyer:
    1. De-authorize the computer in iTunes! De-authorize both iTunes and Audible accounts.
    2, Remove any Open Firmware passwords or Firmware passwords.
    3. Turn the brightness full up and volume nearly so.
    4. Turn off File Vault, if enabled.
    5. Disable iCloud, if enabled: See.What to do with iCloud before selling your computer
    Step Three - Install a fresh OS:
    A. Snow Leopard and earlier versions of OS X
    1. Insert the original OS X install CD/DVD that came with your computer.
    2. Restart the computer while holding down the C key to boot from the CD/DVD.
    3. Select Disk Utility from the Utilities menu; repartition and reformat the internal hard drive.
    Optionally, click on the Security button and set the Zero Data option to one-pass.
    4. Install OS X.
    5. Upon completion DO NOT restart the computer.
    6. Shutdown the computer.
    B. Lion and Mountain Lion (if pre-installed on the computer at purchase*)
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because
    it is three times faster than wireless.
    1. Restart the computer while holding down the COMMAND and R keys until the Mac OS X
    Utilities window appears.
    2. Select Disk Utility from the Mac OS X Utilities window and click on the Continue button. 
    3. After DU loads select your startup volume (usually Macintosh HD) from the left side list. Click
    on the Erase tab in the DU main window.
    4. Set the format type to Mac OS Extended (Journaled.) Optionally, click on the Security button
    and set the Zero Data option to one-pass.
    5. Click on the Erase button and wait until the process has completed.
    6. Quit DU and return to the Mac OS X Utilities window.
    7. Select Reinstall Lion/Mountain Lion and click on the Install button.
    8. Upon completion shutdown the computer.
    *If your computer came with Lion or Mountain Lion pre-installed then you are entitled to transfer your license once. If you purchased Lion or Mountain Lion from the App Store then you cannot transfer your license to another party. In the case of the latter you should install the original version of OS X that came with your computer. You need to repartition the hard drive as well as reformat it; this will assure that the Recovery HD partition is removed. See Step Three above. You may verify these requirements by reviewing your OS X Software License.

Maybe you are looking for

  • How do I get the original software for my HP Pavilion g7-1329wm Notebook PC

    I recently had a vicious virus that encrypted my pictures and files in my computer; had it removed from the computer and now internet explorer does not operate correctly and I have to use Chrome for browsing.  I was told that I need to get the origin

  • Can i use a goto in Java?

    i want to be able to get a value from a certain function, and based on that value either keep executing the code or exit the function that i am in (the actionPerformed function). is there a way to exit out of that function once you have already enter

  • BEST way to handle background issue?

    I am having a slight issue with the way that I have set up my website's background and would love any suggestions on how to handle it differently. My website (and the way I want the background to look) can be found at http://www.babybumps.net Current

  • Export to excel without assistant?

    Hello, I need your help once more... I built a measurement-system that reads data from RS232 and exports it to an excel-file. That all works with an autosequenz, but I want to automate the export, so that I do not have to click on "Finish"-button. Is

  • Export sequence for import as media source?

    Im shooting hour long HDV tapes and need to work with them in FCP as hour long, uninterrupted media files. Unfortunately, there are timecode breaks and things like that that break the media apart upon import. I've reassembled the hour long footage in