Action engine/array question

Im sure there is an easily corrected mistake I'm making. I am going to be making an action engine where I need elements added to an array, and after the array is full, toss away old data and add the new data. If someone can tell me why this array is continuing to be all zeros i'd appreciate it. Probably misuse or misunderstanding of one of the array functions. If someone could put a photo of the corrected VI rather than attach the actual VI it I'd appreciate it as I wont be on a computer with Labview until Monday. Thanks.
CLA, LabVIEW Versions 2010-2013
Solved!
Go to Solution.
Attachments:
actionengine.vi ‏22 KB

If you could just take a last look at this and make any more comments I'd appreciate it. I'm trying to learn how to do this stuff as efficiently as possible the first time so I don't have to backtrack/relearn. I'll take advice on anything, except tunnel and wiring as I think I can fix that myself. I'm more worried about the actual coding. And yes, I am aware my front panels aren't organized
Message Edited by for(imstuck) on 01-22-2009 02:59 PM
CLA, LabVIEW Versions 2010-2013
Attachments:
actionengine.vi ‏67 KB
test_action_engine.vi ‏144 KB

Similar Messages

  • Array of variable-length lists in Action Engine

    I'm starting work on a application that consists of multiple sub-panels which each present a specific subset of the hardware functionality.  The hardware appears to the host mostly as memory-mapped registers.  I'm considering implementing the hardware interface in an Action Engine (AE) so that LV will automatically arbitrate among the hardware access requests from the sub-panels and because it (seems to me) to make the data flow more clear than the current implementation that uses a veritable plethora of queues, notifiers, and rendezvous to send requests and results between the sub-panels and the hardware interface at the top-level.
    The challenge is this, though:  Certain hardware addresses need to be modeled in multiple sub-panels -- maybe data at a certain address changes the functionality of some other addresses, or maybe different bit-fields within an address are part of different functional groups.   
    So any of sub-panel can request a read or write to the hardware, but often several of them need to see the resulting data.
    In order to keep the design modular and expandable I don't want to hard-code anything in the hardware AE that is specific to the sub-panels.   Instead, I intend to have the sub-panels "register" with the hardware AE indicating for which addresses they need to receive updates when some hardware address is read or written to.  This means the AE will have to keep the "registration" data in an un-initialized shift-register (USR).  But I want the hardware accesses to run as fast as possible, so I would like to ask for some suggestions how to implement this as efficiently as possible (avoiding, for example, clusters of arrays...)
    I imagine the sub-panel registration info might consist of a user-defined event reference (created inside the sub-panel VI) and a list of hardware addresses that the sub-panel is modeling.   Then when the hardware AE gets a request to read or write at some address it will also generate events to broadcast the data to the sub-panels that have registered for that address.   This will probably include 20-25 subpanels registering for a collective total of about 700 hardware addresses.  
    I'm less concerned about memory than speed.
    So, a few possibilities come to mind for how to implement the registration data in the AE USR:
    A) Have one 2-D array where the array contains one row per hardware address (~320), and columns contain the event refs for all the sub-panels registered for that address.   The width of the array would depend on whichever address has the greatest number of sub-panels registered for it (maybe 4-5?), but that still means the array would be pretty large (about 6.5 kbytes if a reference is a 32-bit value?)
    On the other hand, indexing into this array to look up the sub-panel references for the current address would be relatively quick and easy since the hardware address is the row number.
    B) Have two arrays where the array size is the number of sub-panels:  One 1D array for the registered event refs and one 2-D array for the addresses.  But different sub-panels will have different quantity of addresses registered, so that means the "width" of the address array would be as big as the largest number of addresses registered by one sub-panel (maybe 20?).   This would use a total of only about 1.5 kbytes, but I would have to search through all 25 address arrays to see if the current address is registered.
    C) or, some other way that I have not though of.   
    Once the "registration" data is received from the sub-panels during program initialization it is never changed, only read.   So at first glance it would seem (A) would be the faster implementation.  But I don't know what, if any, performance hit there would be from having such a large array in a USR, which is why I'm asking here.
    Any thoughts or suggestions would be greatly appreciated.
    Thank you and Best Regards,
    -- J.

    JeffBuckles wrote:
    Any thoughts or suggestions would be greatly appreciated.
    Thank you and Best Regards,
    -- J.
    Quick thought (hardly!)...
    I have used a "Self-Addressed Stamped Envelope" architectrure for those type os apps.
    DAQ device has a queue it monitors for subscription requests (Think of a in-box for Marketing deparetment).
    When client is created it submits a request via the queue for the subscription request that included a ref to its update queue and a list of teh channels it wants to watch. The clients then wait for updates.
    The Marketing department pass the request for updates (in-box of marketing department) to the production department (I used an AE to pass the mailing list) who picks through the acquired data and passes updates as requested to all of teh subscribing clients.
    Just sharing ideas,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Community Nugget 4/08/2007 Action Engines

    Action Engines, What are They?
    “An action engine is Ben's term for a functional global which includes extra actions other than just holding the data.”
     (tst , 03-13-2007 01:18 PM)
    In a nut shell tst has nailed it except for the “Ben’s term” part. I was originally exposed to the term "Action Engine"
    by reading the book ""LabVIEW Applications Development A Course on Advanced LabVIEW Programming Techniques*”.  But
    before I get into details of the Action Engine (AE), I will attempt to clarify some terminology.
    Functional Globals
    Functional Globals (FG) are VIs that are functionally equivalent to LabVIEW globals. Functional Globals store
    information. You can read them or write them and that is it. No fancy stuff. Functional Globals are also referred to as
    LV2 globals because LV2 did not have globals but it did support Un-initialized Shift Registers (USRs). The USR is the
    entity that stores the information.
    USR.jpg
    USR’s
    Shift Registers (SR) come in two varieties “Initialized” and “un-initialized”. The presence or absence of a wire
    feeding the SR from outside the loop distinguishes how LabVIEW will implement the SR. If there is NO wire feeding a
    shift register (A), then the SR is not initialized. This is called an “Un-Initialized Shift Register”. The USR variety
    is implemented as static buffer that is re-used from call to call. The values written to the USR in and earlier call
    persist for access (B) in latter calls**. A Functional Global exploits this behavior by implementing two methods of
    interacting with the contents of the USR.
    Functional Global.JPG
    In the “Write” action (not shown) the value of “Numeric in” is placed in the USR. In the “Read” action the contents of
    the USR are returned via Numeric out.
    Action Engines
    An Action Engine (AE) can be thought of as a machine (Engine) that performs some useful task (action) often on
    something (typically but not limited to data in a USR). Functional Globals are very specific type of Action Engine.
    They have two actions “Write” and “Read”. They operate on the data stored in the USR either by replacing or using the
    contents of the USR. So AE’s are a superset of Functional Globals. In many documents the terms AE and FG are
    interchangeable. A recent poll on LAVA has indicated that Functional Global is the most popular term. Since this Nugget
    was prompted by answering the question “what is an AE?” in the remainder of this document you will find that I will
    generally use the term AE.
    Do What to What?
    AE design revolves around the ways the shared resource must be accessed manipulated or monitored. In a Functional
    Global, the actions “Write” and “Read” are appropriate. That is not necessarily the case for AEs. AEs can have entirely
    different set of actions depending on the interaction requirements for the information stored in the USR. A short list
    follows.
     A Configuration AE could allow for multiple processes to share a single copy of the system configuration (in a USR) by
    providing actions like “Set Device ID”, Set Device ON-Line…
    A hardware device can be realized as an AE that presents actions appropriate to the physical phenomenon being measured
    or controlled.
    A DO Port Controller AE could store a reference to the physical device in one SR and the port status in another SR and
    have action like: Set Main Motor On”, “E-Stop”, …
    An Instrument can be implemented to store the device name and settings with actions like “Set Input ON” “Auto-Scale Y”
    and “Get Trace”,…
    Screen Stacks can be implemented by using control references in one USR and maintain a screen view stack in another
    then implementing actions like “Set Config Screen”, “Set Login Screen”, “Back”…
    Users can be managed using an AE with action such as “Add New User” “Set Password”, “Disable User”…
    The list goes on and is limited only by our imagination. Here is an example that shows how a running average can be
    maintained.
    Running_Average_Example.jpg
    Running Average Example
    The Running Average Example shown above shows how a running average can be maintained using an AE. The AE is
    initialized before the While Loop executes. On each iteration of the loop the simulated measurement value (random
    number) is used to update the history of all measurements (Add Number(s)) and the mean is calculated (Calc Mean).
    Please note that although the buffer of all measurements is affected in every step of this example, the buffer (USR in
    the sub-VI) contents are never part of this VI’s diagram. Since the history is stored in the sub-VI, the history can be
    acted on from more than one thread as shown below.
    Parallel_Loops.jpg
    In the parallel Loops Example the history is initialized and then two loops run in parallel with one updating the
    history and the other plotting the average. Since the History resides inside the USR of the sub-VI the two while loops
    are effectively sharing the same block of memory, the block used to store the USR. The Sub-VI was implemented as shown
    in the following sequence of images.
    Init.jpg
    As was the case with Functional Globals, the actions are implemented as a type def’d enum***** driven case structure.
    Appropriate code is present in each case to realize the intended actions. In the “Init” case, contents of “Array in”
    are used to initialize the history. In our example above we did not pass an initial array value. Therefore the “Init”
    resets the history (cleared the array).
    Add Num.JPG
    The operation of the AE when the “Add Number(s)” action is called varies depending on its usage. If the caller passes a
    non-empty array, it is appended to the array. Alternatively, passing a value via the Numeric in” control, and leaving
    the “Array in” un-wired adds a single element to the history. We used the Numeric In input so we were continually
    building our history one value at a time.
    Calc_Mean.JPG
    When the “Calc Mean” action is invoked, the average is calculated and returned.
    This Nugget is continued in the next post
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Solved!
    Go to Solution.

    Nugget continued
    The Traffic Cop Behind the Scenes
    A detail I have not mentioned up until now is that AEs should be implemented as VIs that are not reentrant***. VIs that are not reentrant can only be executing in one context at a time. LabVIEW will ensure that if there is ever a situation were two contexts are attempting to act on the same AE at the same time, LabVIEW will schedule the first and the subsequent will wait until the first call completes. This is similar to a traffic cop preventing more than one vehicle from entering an intersection at the same time. The Traffic Cop is illustrated in the following timing diagram were we look at how the processing of two threads is affected by using a single AE.
    Execution_Timeline.JPG
    In the figure above the processing time of two processes “P1” and “P2” are illustrated by a red or blue solid arrow respectively. In the parallel loops example shown earlier, P1 could be the “Calc Mean” loop and P2 could be the “Add Number(s)” loop.
     t0 - t1
    Both processes are executable and run their assigned tasks. Neither process is accessing the AE.
    t1 – t2
    P2 continues to run while P1 calls the AE. Since the AE is idle it is available to run so P1 continues execution running inside the AE until all work inside the AE completes. The dotted arrow shows that the thread for P1 is executing in the data space allocated for the AE.
    t2 –t3
    At t2 the AE terminates and both process run as in t0 – t1.
    t3 – t4
    This time segment is similar to t1 – t2 with P2 running in the AE.
    t4 – t5
    Similar to t2 – t3 the AE terminates and both process run.
    t5 – t6
    Similar to t1 – t2. P1 take control of the AE.
    t6 - t7
    At t6 P2 attempts to call the AE. Since the AE is not idle it is not available to run. P2 is placed in a resource wait state (it is NOT running) waiting for the resource to become available. The dotted horizontal arrow indicates the process is not executing.
    t7 –t8
    At t7 the call of the AE by P1 that started at t5 completes and P1 continues to execute outside of the AE. When the call by P1 completes the AE becomes available. The process P2 is marked as executable. The scheduler includes P2 in its executable threads and the AE is available. P2 then executes inside the AE until the call completes.
    The Beauty of the AE
    This behavior of a non-reentrant VI is a wonderful feature we can exploit to eliminate race conditions. Race conditions are the nemesis of many a developer. In hardware this was solved with clocked enabled logic. In LV we solve race conditions with Queues, Semaphores, Rendezvous, Occurrences, and Action Engines!AEs can eliminate race conditions when all operations involving updates of the data stored in the USR are done INSIDE the AE. A very simple illustration of how the encapsulation of USR manipulation is shown in the following set of examples.
    Port_With_Global.jpg
    This VI is intended to demonstrate how two bits of an eight-bit port can be used to control the running state of two pumps. To illustrate the control process, one pump will be set running at start-up and then every half second the state of both pumps will be toggled to simulate switching of the supply. This example uses globals and fails miserably.
    Port_With_Global.jpg
    In this example we start out by initializing a global variable so that bit “1” (zero based) is the only bit set in an array of eight bits. This turns on Pump 2 to start. Then the “Port Update” and a “State Change” loops run in parallel. In the “Port Update” loop the state of the port is read from the global and used to update the GUI.
    In the “State Change” loop, the port status is read and the first Boolean is inverted before being written back to the global. Similarly for the second Boolean. Since the read of the globals both occur before the subsequent data processing, one of the threads will be processing old data.
    Port_With_Action_Engine.jpg
    The Action Engine version codes up the same way as the global version but now all of the data manipulation of the port states are encapsulated in the Action Engine  “Port Controller”. This encapsulation ensures all operations involving the data in the USR are forced to happen sequentially even though we did not have to implement any code to achieve this affect.
    The key point to take away from this example is a shared resource (the port status in the case) when implemented as AEs come with resource contention resolution built in provided that all manipulation of the shared resource takes place inside the AE.
    Action Engines to the rescue!
    Action Engines are not a replacement for Queues, Rendezvous and the other synchronization techniques. They are typically called for when your design dictates that a single resource must be shared by more than one parallel process and none of the LabVIEW provided techniques are sufficient. They require a design of their own to ensure they work correctly. They also have to be developed and supported.
    This Nugget is continued in the next post
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Action Engine indicators do not update?

    This action engine is part of a larger test. I call it every 15 minutes to test for temperature stabilization (four consecutive readings at 15 minute intervals within three degrees)
    It seems to work as far as detecting stabilization but I don't understand why it's numerical array indicators do not update.
    If you run this by it's self and fill numbers in the Temperatures array control all the indicators work.
    But when it is a sub-vi all the indicators remain grayed out or in their initialized state when I open it while it is running.
    I even have brought the Stab Array out with a terminal thinking it would be updated every time the sub-vi ran, but it is not.
    What is going on here?
    Solved!
    Go to Solution.
    Attachments:
    Check Stab.png ‏50 KB

    It seems to work OK for me.
    Here's what I did:
    Put snippet on block diagram
    Disconnected Function control from Type Def
    Wired controls and indicators to connector pane
    Then I placed the AE in a main program. Being lazy, the main uses a breakpoint to stop each execution of the loop so you can vary the Temperature inputs.
    steve
    Weinberg's Second Law: If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    main.vi ‏10 KB
    AE.vi ‏18 KB

  • First foray in LVOOP mixed with Action Engine functionality, would appreciate comments

    Hello (LVOOP) experts!
    I am a big fan of Action Engines (AEs), and use them very regularly.
    Now, say I wanted to have a Logging module that writes text to a log file, I can create an Action Engine for this and all is well, i.e. I can drop this VI anywhere in my hierachy and it basically just works. I like to encapsulate AE in a lvlib.
    So, what if I wanted a second Logging module, doing exactly the same thing, but operating on a different file. Well, I could create a new copy of the Action Engine in the project, duplicating the code and giving the second AE a different name. This is of course a bit clumsy, as what if I wanted 100 of these!
    I suppose I could make the AE re-entrant (cloned) use VI server to obtain a second copy of the AE, but I have not tried this.
    So what I decided to do is make a LV Class, and just instantiate a second class as needed. I really really really like the ability of AEs to drop them anywhere without wiring all the way through the hierachy, so that was a design goal with my LVOOP implementation. As far as I can tell, one way to do this is using single element named queues (sort of a singleton design pattern).
    The attached code is my attempt, I would really appreciate comments, both positive and negative.
    nrp
    CLA
    Attachments:
    Logger LVOOP.zip ‏54 KB

    tst wrote:
    What you've basically built is a SEQ-based, by-ref class (although you pass a name, not a reference), which is certainly a valid construct. dqGOOP has been doing that for years and the singleton example also uses this, as you mentioned.
    Some comments:
    You really don't need the object as an input. It can be a constant on the diagram.
    You could make this a by-ref system and pass the object which holds the queue reference, similar to the singleton example. This has less chance of braking, IMO.
    Instead of acquiring the queue in each member VI, create an LV2 manager VI - when it gets a name it looks up its reference in an array. If it doesn't find it, it creates a new ref and returns it. If it does find it, it returns it. That simplifies some of the code you have to replicate for every member VI.
    The fact that you have to replicate code at all for member VIs is annoying. It would be great if LVOOP had by-ref support built-in or could at least create data access VIs from a template.
    1. Fixed. I copied this technique from Dr D's Xylophone project. I thought if you drop the class constant on the BD it actually creates a new object each time?
    2. Not sure I get you on this one, could you provide some more enlightenment please.
    3. Done. Probably not the most efficient implementation though...
    4. Agree it sure is annoying!
    New version with basic queue manager attached!
    nrp
    CLA
    Attachments:
    Logger LVOOP v2.zip ‏75 KB

  • Action Engine Data Space associated with an executable

    I am thinking of using an AE (Action Engine) for my project. I have basically 3 top level VI which I use to display and control the machine behavior (they are essentially duplicates of each other). If I invoke the AE (same name), will the AE will be sharing the data with the 3 top level VI in a single executable?

    I have not tried that in LV 8.+ yet so I will speculate.
    Since NI is pretty good about making sure old stuff still works, I suspect you should be OK.
    If not, you will have to explicitly specify the applicaiton instance they run in.
    For all of these types a questions, I stongly urge you "Build early, build often" just to make sure you do not get blind-sided when the dead-line approaches.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How can I establish an enum typedef for use with state machines and action engines?

    Hey all--
    I have an action engine with several instances.  Any time that I add a method to the engine, I have to modify all of the calling code to update the constant that determines the method being called.  There must be a smarter way to address this problem but my LV experience is insufficient to identify it.  Can any of you wiz-bangs tell me if it is possible to make a type def (I can do this) and use it with each instance of the action engine call so that changing any instance also updates the typedef?
    Thanks.

    Take your enumerator.  If it is not a control (ie constant), change it to a control.
    Under File Menu, select New > Custom Control.
    Move (or copy) your Enum Control to the Custom Control.  Change the Control to Strict Type Def (the selection to the right of the wrench).  Save it.
    (EDIT: ** OOps, the picture shows the wrong one.. sorry**)
    Copy that new Strict Type Def control to your code.
    See images below.
    OR.. If you're using LV8.x, and using a project, I would recomment that you do it from within your project explorer.  Simply insert a new "Control".  The rest of the steps are similar, except that you can insert it from your project. 
    R
    Message Edited by JoeLabView on 07-08-2008 06:47 PM
    Attachments:
    TypeDef.PNG ‏33 KB

  • Blackberry Desktop Software freezes at message "Action Engine Loading Configurat​ion"

    I have Windows 7 Professional. My Outlook profile is saved on an Exchange server and my Blackberry had previously beeng syncing with Outlook in this setup for nearly a year without issue. 
    Recently, the desktop software freezes at "Action engine loading configuration" message and is unrecoverable. I have tried the following things to rectify the situation:
    1) Adjust the organizer settings not to sync anything except the date & time. Still happens
    2) Delete all data from the device using Desktop Software and try to resync. Same problem
    3) Uninstall and reinstall Blackberry Desktop Software and try to sync with both the original set of data and the empty, deleted data Blackberry. Same problem.
    4) Tried wiping the blackberry completely using JL Cmdr, reinstalling the OS. In this scenario I can sync Addresses but once I sync Calendar the problems happens again and I am unable to ever sync it again (Including thereafter when de-selecting the Calendar option. 
    At this point I have spent hours scouring Google for help and trying the above items. This has been disastrous for me as I rely on the sync'd data for work and have already starting missing things. 
    I don't believe there is anything wrong with the Blackberry, as it works fine and works perfectly well after re-loading a fresh, OS, etc. 
    I have tried playing with the support logs but because the software freezes before calendar can sync, nothing is in the log that states if there is a corrupt record in calender causing this. Nothing dramatically changes in my calendar between the day that syncing worked and the day it didnt.
    I've tried searching the Blackberry forums and have found some info but nothing helpful. RIM does not provide support telephone numbers and AT&T support has continuously demonstrated itself as worthless over my time with them. 
    Is there any resources left at all that I could try to get past this issue, not waste any more time, and be able to resolve the issue?
    Thank you for reading and for any input you are willing to offer.
    Solved!
    Go to Solution.

    I had a Dell PalmPilot type device in 2003 that sync'd contnously with my computer using ActiveSync. I didn't ever have to click Sync, I would make a change on either device and they would sync. 
    The fact that it is 2011 and we still work with Desktop Manager, the biggest piece of **bleep** software I still have to use, is simply pathetic. 

  • FPGA in Action Engine

    I'm trying to control an FPGA vi from inside an action engine by holding the reference in an USR.  This is not working at all.  Everyting works fine when it is controlled directly on the main vi.  In fact, it appears to have corrupted the main vi, which now crashes LV when run with a "MechFactoryCWrap.cpp" error whenever it is run, even after the FPGA action engine code is deleted.  I'm using FPGA V8 and LV 8.0.1.
    TIA,
    Bill F

    Hi Bill,
    I just want to make sure that I am understanding this correctly. You have an FPGA VI that you are trying to control inside an Action Engine. If you don't control it inside the Action Engine, then the main VI works fine. However, if you do try to control it inside the Action Engine, then it causes LabVIEW to crash, producing the cpp error. Is this correct? Also, once that happens, the main VI does not seem to work correctly, right? Does this cpp error occur when you hit the run arrow or when you are editing the VI? Is there a possibility that you could post the VI on the forum or at least a screenshot of it? That might make things a bit clearer.
    National Instruments
    Applications Engineer

  • Action engine loading configuration...Unknown error reported

    When I try to synchronize with my computer, I get "Unknown error reported" after it attempts the "Action engine loading configuration..."
    I uninstalled and reinstalled the Desktop Manager software, and I was able to synchronize once, but the error reappeared on subsequent attempts. I really don't want to uninstall and reinstall the software every time I want to synchronize.
    I deleted the Intellisync folder and restarted the software and the computer, but this did not solve the problem.
    Please help!

    Try deleting the Intellisync folder and then synching again to see if you still get the error
    http://www.blackberry.com/btsc/KB11703
    You can also try performing a clean uninstall of the Desktop Manager. Then installing it again.
    http://www.blackberry.com/btsc/KB02206
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • Array Question: Action Script

    All I am trying to do is start 4 movie clips one after
    another using an array to store the clips instance names and then a
    loop to trigger each clip to play.
    The code below isn't working. Check it out:

    You setting the instance names as strings, take the quotes
    off.

  • Rules Engine Design Questions

    Rules Engine Questions:
    1. Rules are processed in the order they are created in dictionary file if the priorities are the same. Is it true?
    for eg: if the order you see on the screen in rules dictionary window is:
         rule1 --> set var1 = 10
         rule2 --> set var1 = 20
         rule3 --> set var1 = 30
         rule4 --> set var1 = 40
         rule5 --> set var1 = 50
         result would be 50
    2. I want to use the rules engine for validations.
    Eg: Can we check for the requiredness of xsd validations using rules engine? or this should be done else where?
    eg:
    If my xml is below, then can I use rules engine to check
    <Firstname>
    <LastName> and
    <Address1>
    for emptyness and pass back saying that the validation failed because <LastName> and <Address1> are empty.
    <Customer>
         <Firstname>aaa<Firstname>
         <LastName> <LastName>
         <Email>ccc<Email>
         <Address>
              <Address1> </Address>
         </Address>
    I have a response xml:
         <ValidationResult>
              <Result>Failed<Result>
              <Message>all required fields are not present<Message>
         <ValidationResult>
    So my rules should be
         check for <Firstname>
              Assert new ValidationResult ('success', ..)
         check for <LastName>
              Assert new ValidationResult ('failed', ..)
         check for <Email>
              Assert new ValidationResult ('success', ..)
         check for <Address1>
              Assert new ValidationResult ('failed', ..)     
    and since last rule is failed, will rules engine send back failed? or what is the strategy for order of rules that get fired?
    For the above scenario what would be the best design solution?

    This is a complicated question but I will try my best to give you the best solution:
    #In answer to your question regarding the order that rules fire unless you use priority you cannot garantee the order that the rules fire. The Oracle rules engine uses the Rete algorithm to establish the order in which to fire the rules and this is generally based upon the data passed into the rules. Therefore if the result of rule 4 may effect rule 1 then the rules engine will run rule 4 before rule 1.
    The scenario you have provided is slightly different however and I woudl suggest the following.
    Instead of passing out a single result from your ruleset pass our an array of results meaning you could effectively run all your rules and pass out all rules that failed. Be wary of checking for nulls however because if nothing is passed into a field then the rules engine will not create that element in the rules fact and the rule will never fire.
    To create a array of results you will need to create a function which creates the result fact for you and then addes each result in turn.
    If you woudl like more information let me know and I will help out as much as I can.

  • Trying to send multiple types in a byte array -- questions?

    Hi,
    I have a question which I would really appreciate any help on.
    I am trying to send a byte array, that contains multiple types using a UDP app. and then receive it on the other end.
    So far I have been able to do this using the following code. Please note that I create a new String, Float or Double object to be able to correctly send and receive. Here is the code:
    //this is on the client side...
    String mymessage ="Here is your stuff from your client" ;
    int nbr = 22; Double nbr2 = new Double(1232.11223);
    Float nbr3 = new Float(8098098.809808);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(mymessage);
    oos.writeInt(nbr);
    oos.writeObject(nbr2);
    oos.writeObject(nbr3);
    oos.close();
    byte[] buffer = baos.toByteArray();
    socket.send(packet);
    //this is on the server side...
    byte [] buffer = new byte [5000];
    String mymessage = null; int nbr = 0; Double nbr2 = null;
    Float nbr3 = null;
    mymessage = (String)ois.readObject();
    nbr = ois.readInt();
    nbr2 = (Double) ois.readObject();
    nbr3 = (Float) ois.readObject();
    My main question here is that I have to create a new Float and Double object to be able to send and receive this byte array correctly. However, I would like to be able to have to only create 1object, stuff it with the String, int, Float and Double, send it and then correctly receive it on the other end.
    So I tried creating another class, and then creating an obj of this class and stuffing it with the 4 types:
    public class O_struct{
    //the indiv. objects to be sent...
    public String mymessage; public int nbr; public Double nbr2;
    public Float nbr3;
    //construct...
    public O_struct(String mymessage_c, int nbr_c, double nbr2_c, float nbr3_c){
    my_message = my_message_c;
    nbr = nbr_c;
    nbr2 = new Double(nbr2_c);
    nbr3 = new Float(nbr3_c);
    Then in main, using this new class:
    in main():
    O_struct some_obj_client = new O_struct("Here is your stuff from your client", 22, 1232.1234, 890980980.798);
    oos.writeObject(some_obj_client);
    oos.close();
    send code....according to UDP
    However on the receiving side, I am not sure how to be able to correctly retrieve the 4 types. Before I was explicitely creating those objects for sending, then I was casting them again on the receiving side to retrieve then and it does work.
    But if I create a O_struct object and cast it as I did before with the indiv objects on the receiving end, I can't get the correct retrievals.
    My code, on the server side:
    O_struct some_obj_server = new O_struct(null, null, null. null);
    some_obj_server = (O_struct)ois.readObject();
    My main goal is to be able to send 4 types in a byte array, but the way I have written this code, I have to create a Float and Double obj to be able to send and receive correctly. I would rather not have to directly create these objects, but instead be able to stuff all 4 types into a byte array and then send it and correctly be able to retrieve all the info on the receiver's side.
    I might be making this more complicated than needed, but this was the only way I could figure out how to do this and any help will be greatly appreciated.
    If there an easier way to do I certainly will appreciate that advise as well.
    Thanks.

    public class O_struct implements Serializable {
    // writing
    ObjectOutputStream oos = ...;
    O_struct struct = ...;
    oos.writeObject(struct);
    // reading
    ObjectInputStream ois = ...;
    O_struct struct = (O_struct)ois.readObject();
    I will be sending 1000s of these byte arrays, and I'm sure having to create a new Double or Float on both ends will hinder this.
    I am worried that having to create new objs every time it is sending a byte array will affect my application.
    That's the wrong way to approach this. You're talking about adding complexity to your code and fuglifying it because you think it might improve performance. But you don't know if it will, or by how much, or even if it needs to be improved.
    Personally, I'd guess that the I/O will have a much bigger affect on performance than object creation (which, contrary to popular belief, is generally quite fast now: http://www-128.ibm.com/developerworks/java/library/j-jtp01274.html)
    If you think object creation is going to be a problem, then before you go and cock up your real code to work around it, create some tests that measure how fast it is one way vs. the other. Then only use the cock-up if the normal, easier to write and maintain way is too slow AND the cock-up is significantly faster.

  • Database array questions

    Disclaimer: I am new to DB's.
    I'm looking at creating a MySQL database to hold tests done on DUTs (each with a specific serial). In theory, each DUT undergoes 3 tests. Each test produces a 401x9 2D array of DBLs. I am not concerned with the write speed to the DB, but I do want to optimize the read of the DB (potentially may need to retrieve 1000+ of these 2D arrays as fast as possible). I have the DB Toolkit; using LV 8.5. Questions:
    1. I have seen two different ways to save a 2D array in a DB mentioned: first, writing one row at a time with the DB Insert vi, resulting in a 2D array in a table (which is slow writing) or second, changing the 2D array to a variant and using the DB Insert vi, resulting in a single cell in a table. I know I can use other methods (parameterized vi, sql commands, user defined functions on the DB server, please do comment if you have found drastic performance increase with these methods), but of the two ways of storing a 2D array, can I read a 2D array from a table faster than reading a 2D array from a single cell? Whenever I need this data, I will read it all (i.e. I will never have to search for certain data within these individual 2D arrays)
    2. I may have installed the 8.2.1 DB toolkit, because the Database Variant to Data vi/function does not drop onto the Block Diagram when I drag it from the palette, and the Help has ???. I assume this is because it just points to the normal Variant to Data, which in 8.5 is in a subpalette as compared to 8.2.1. Any quick way to fix this?
    3. Any other general suggestions for a DB newbie? I've been trying to derive best practices from KB aritcles, this forum, and the web, but there is so much information and so many varying opinions I find it hard to narrow down best practices.
    Michael

    Hi Miguel,
    It looks like you are embarking on a very interesting project. Although you probably have seen many of the following documents, I've linked a few to get you started.
    Discussion forum using LabVIEW to read from tables
    Developer Zone article about developing a test system
    Knowledgebase article about imitations of speed with database toolset
    As far as your first question, I would suggest trying out both methods with simple code and testing with a small amount of values to determine  which one will be the fastest.
    Good luck with your project!
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • Array questions

    Hi, everyone.
    I'm writing a lab program which counts the number of occurances of English letters in a line of English text.
    The program has the following requirements
    Assume that we input only lowercase English text
    The program should be able to count the number of occurances of English letters in a text and print out both the number of occurances and the letters. Don't print out letters that don't exist in the text.
    I write my code as following:
    import java.util.*;
    public class Translator
    public static void main(String[]args)
         Scanner sc = new Scanner(System.in);
         System.out.println("Please enter text:");
         String text = sc.nextLine();
         char[] input = text.toCharArray();
        public static void countLetters(char [] input)
            System.out.println("Letter           Number of occurances");
            int[] alphabet = new int[26];
            for (int i=0; i<input.length; i++)
                if (input=='a')
    alphabet[0] += 1;
    else if(input[i]=='b')
    alphabet[1] += 1;
    else if (input[i]=='c')
    alphabet[2] += 1;
    else if (input[i]=='d')
    alphabet[3] += 1;
    else if (input[i]=='e')
    alphabet[4] += 1;
    else if (input[i]=='f')
    alphabet[5] += 1;
    else if (input[i]=='g')
    alphabet[6] += 1;
    else if (input[i]=='h')
    alphabet[7] += 1;
    else if (input[i]=='i')
    alphabet[8] += 1;
    else if (input[i]=='j')
    alphabet[9] += 1;
    else if (input[i]=='k')
    alphabet[10] += 1;
    else if (input[i]=='l')
    alphabet[11] += 1;
    else if (input[i]=='m')
    alphabet[12] += 1;
    else if (input[i]=='n')
    alphabet[13] += 1;
    else if (input[i]=='o')
    alphabet[14] += 1;
    else if (input[i]=='p')
    alphabet[15] += 1;
    else if (input[i]=='q')
    alphabet[16] += 1;
    else if (input[i]=='r')
    alphabet[17] += 1;
    else if (input[i]=='s')
    alphabet[18] += 1;
    else if (input[i]=='t')
    alphabet[19] += 1;
    else if (input[i]=='u')
    alphabet[20] += 1;
    else if (input[i]=='v')
    alphabet[21] += 1;
    else if (input[i]=='w')
    alphabet[22] += 1;
    else if (input[i]=='x')
    alphabet[23] += 1;
    else if (input[i]=='y')
    alphabet[24] += 1;
    else alphabet[25] +=1;
    System.out.println("a");
    for(int i=0; i<input.length; i++)
    if (alphabet[i] > 0)
    System.out.println(input[i] +" "+alphabet[i]);
    Though having gotten no syntext error complain from the compiler, no matter what I input, the program returns nothing. At first I assumed that it's the first for loop's problem, so that I typed in some System.out.println() methods at the end of some elseif statements. But I still got nothing after this trial. So that I guess it's the char[] input = text.toCharArray();'s problem.
    Have the input[i] elements really stored any character (I tried to convert the input string into char array) after I typed char[] input = text.toCharArray();'s problem. ?
    My another question is: since the input[i] stores character, when I am trying to print out the letters that exist in the text through the last System.out.println() method in my code, I can use input[i] to represent the letter which I want to print. Is it right?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I figure out now that the problem is caused by the last for loop. I modify it as following:
    for(i=0; i<26; i++)
                if (alphabet[i] > 0)
                System.out.println('a'+i +"          "+alphabet);
    }After the modification, now I can get the right answer. The only problem I have now is trying to convert the interger number produced by 'a'+i back into character. I tried to replace 'a'+i with toChar('a'+i), but it doesn't work. Can you give me some explanation? Thank you very much!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Filling in forms and clicking continue no longer works since the last Firefox update. Please help!

    Since downloading the latest update for firefox, I can no longer complete forms or orders online. I click continue and it keeps me where I am only the form is once again blank. Is there A filter setting I can change or what can be done so I can opera

  • [SOLVED] Changed an option in /etc/updatedb.conf

    Hello all, I started using locate to search my files. However, it never showed files in my /home directory which is, obviously, the directory I search most. Running updatedb --debug-pruning I found out that it didn't add /home to the database because

  • How to make a transparent background for logo

    I've tried creating a transparent backgound for a logo in Photoshop CS4 in numerous ways such as saving the file as a png and using the magic wand (text resolution was very poor) but neither worked. My logo has text and an image. Any ideas? Thanks.

  • Travel Mgt. Max.amoutn for Expe Type...

    Hi All, I have maitained the maximumn amount for the expenses type in  V_T706B2 with necessary details....meanwhile the same group is also assigned to that employee in IT 0017...made the chages in PTRV_TRVCT_XX still when I exceed the amount (from th

  • Lightroom Needs Convert Feature!

    Lightroom needs a feature that lets you replace a filetype with another. For example convert a set of tiff files to jpeg, and after the conversion the tiffs would be gone (optional of course) and the jpegs would be there in thier place with filename,