Best method to pass a resource between classes

Hi all

Relatively new to OOP again and worked on a project of OBJECT-oriented programming.  My basic architecture is a machine to States OOP, each class represents a different test.  I have a test that will go through all the tests, so I thought I could spend just a new class in one for a loop and pass all the tests.  Problem with this is of course I connect to a device and the resource is lost with each new object.  A solution imagined ive because this problem is to have a class that the class test and the resource and I could a new class of group whenever I passed the test and carry the same resource on the wire.

Any comments welcome, if my overall plan for this program is disabled please tell.

Thank you

Matt

Use a shift register to store your device and have each of your methods to run the Test have an entry for the device object.  You will probably need a couple of tests to initialize device and device close.  These should be the only two cases that open or close your device.  So no dialing is required.

Tags: NI Software

Similar Questions

  • Best way to pass an array between TestStand, CVI

    Hello

    I was not able to judge or to find the best practice to pass arrays between TestStand and CVI. I'd preferably done in pass pointer to array. For example, if I have a function written in CVI DLLs:

    int GetAverage (double* aBuffer, double aSize, double* aAverage)
    

    TS I have an aBuffer double array [100]:

    -I can't simply pass

    GetAverage (aBuffer, 100, &aAverage)
    

    - or, I can go:

    GetAverage (&aBuffer[0], 100, &aAverage)
    

    -The only thing that is TestStand accepts:

    GetAverage (aBuffer[100], 100, &aAverage)
    

    I don't think not good because the size is just repeated.

    I had no problem if I could write

    GetAverage (aBuffer[100], &aAverage)
    

    but the problem is in this case there is no possibility fo CVI to determine the size of the table, like sizeof (aBuffer) just return, sizeof (double).

    Can you provide me with advice for best programming practices in this case?

    Concerning

    RB

    Hello

    Just in addition:

    Is there another way to access the tables.

    Often, I use for this task, the TS-API. The only parameter you need is in this context of the sequence.

    Maybe you should also visit this example:

    TestStand 2010\Examples\AccessingArraysUsingAPI\UsingCVI\AccessingArrays.seq

    Concerning

    Jürgen

  • How to pass a variable between classes?

    Hello

    I created a class .as MovieClip to a MovieClip that contains 7 buttons. I use a table of these buttons and an array of labels of image on the timeline of the MovieClip parent to navigate in the labels.

    ...
    
    private function clickHandler(event:MouseEvent):void 
            {
    //Sets the current button listed in the button array    
     currentButton = MovieClip(event.currentTarget);
                index = buttonArray.indexOf(currentButton);
            
    //Uses the index variable to find the corresponding frame label from the label array            
    MovieClip(root).gotoAndStop(labelArray[index]);
            }
    
    ...
    

    This works perfectly.

    Now I have another .as MovieClip class, I created a simple MP3 player MovieClip. I'm pulling in a XML data of each mp3, including the URL, etc... All works perfectly.

    I'm trying to use the variable "index" of the class Nav.as in the class AudioPlayer.as to play the corresponding number of the song. By calling "playSong (index);

    "playSong (index);" works in a test file, when I tested the navigation tables and the corresponding number xml concept. I need to shoot the variable 'index' from Nav.as to AudioPlayer.as.

    ...
    
    private function playSong(mySong:Number):void 
            {            
                var myURL = my_songs[mySong].@URL;        
            
                if (my_channel) {
                    my_channel.stop();
                }
            
                my_sound = new Sound();
                my_sound.load(new URLRequest(myURL));
                my_channel = my_sound.play();
            }
    
    private function onPlay(e:MouseEvent):void {            
         playSong(index);
            }
    

    It works perfectly when tested. For example: "playSong (2)" or "playSong (5)" plays the song number correct.

    Thank you in advance!

    You should not have a currentIndex in each class, simply on the mother of the other 2 classes. When you say 'this.parent' you access the parent display object. This is where you want currentIndex to exist. If both classes are on the same display list then 'this.parent' will be the same parent and therefore the same variable.

    I didn't know what kind of display object container parent was (MovieClip, Sprite, etc.), so I've referenced it let go like: 'object (this.parent) .currentIndex '.

    Should be in NAV. As:

    Object (this.parent) .currentIndex = buttonArray.indexOf (currentButton);

    AudioPlayer.as should be read through:

    playSong (Object (this.parent) .currentIndex);

  • The best way to pass data when browsing

    By taking the case where an action method is called and he chooses navigate to another page.

    What is the best way to pass data from bean of old media to the new (probably in the execution of the action method)? I am currently using beans of spring session scope as the support of beans.

    Take a look at:

    It goes between your commandLink or commandButton control:



  • CRIO best method of logging

    I have an app cRIO to keep track of a timer in hours reboots. The application will almost never stop gracefully (which means that the power of the cRIO will be just unplugged). What is the best method of logging that can be used to keep the last value in a file on the cRIO without corrupting him or lose value.

    I could simply write this value in an INI file every 30 seconds or so, but I don't want to take the risk of someone unplug the cRIO at the precise moment when the file was written to (I know that the chances are slim, but I've seen it happen).

    Any help is appreciated,

    Thank you

    -ACC

    I see two options:

    1 (easy) open a new file every hour. Time stamp of the file name so that you know same between reboots when go to the next file. At least, this limits the damage caused if the system reboots during a file operation. You may even consider to always start a new file after a reboot, even if the last file has been open just a few minutes ago. This would further limit the amount of data lost or corrupted if a file is incorrect. Also, if you use the LabVIEW file IO primtives, consider using the flush after every write to ensure that all data is written to the disk.

    2 (hard) have you heard of SQLite? It is a cross-platform compatible SQL embedded database. It is quite light enough to operate comfortably on your cRIO. The main reason that I bring it to the top is that their transactions are secure and won't corrupt the database (which is really just a file) even in the case of a loss of power in the middle of the transaction.

  • Best method of automation by adding a value in the comments advanced options

    I need to add a value in the advanced options in all my virtual machines, which means I have to turn them off, change the configuration and turn on again them.

    I was wondering what is the best method if automate this since I did not intend to do it manually (if this is a bit special virtual machine).

    The environment is vSphere with vCenter 4.1 4.1 and VMs are Windows Server and Linux SLES.

    Somebody had to do something similar?

    Hello, caddo-

    A way to add a setting to a virtual machine is to use a VirtualMachineConfigSpec and the ReconfigVM() of a VirtualMachine object method.  So, for the advanced option that you mentioned, you can use something like:

    ## the name of the VM to reconfig$strMyVMName = "someVM0"$vmMyVM = Get-VM $strMyVMName
    
    ## create a new ConfigSpec to configure the VM$spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{    extraConfig = New-Object VMware.Vim.OptionValue -Property @{        Key = "monitor_control.disable_mmu_largepages"        Value = "TRUE"    } ## end new-object OptionValue} ## end new-object ConfigSpec
    
    ## reconfig the VM with the given ConfigSpec$vmMyVM.ExtensionData.ReconfigVM($spec)
    
    ## update the VM's View data$vmMyVM.ExtensionData.UpdateViewData("Config.ExtraConfig")
    
    ## check the advanced option setting (ExtraConfig item)$vmMyVM.ExtensionData.Config.ExtraConfig | ?{$_.Key -eq "monitor_control.disable_mmu_largepages"}
    

    This establishes the additional configuration for a virtual machine.  You can adjust easily to many/all virtual machines (date you probably pass by using the ReconfigVM_Task() method, which runs asynchronously).  Enjoy.

  • Passing of objects between workflow items created

    Hello

    is it possible to pass oneself objects between workflow items created? And when it is possible, how is that possible?

    In the example:

    var myVlans = [];

    myVlans.push ({vlanid: 100, found: false, type = "local" network: PortGroup_100})

    myVlans.push ({vlanid: 101, found: false, type = "distributed" network: dvpg_100})

    I tried to set myVlans as a table of all (workflow attribute) to gain access to another element of worfklow.

    Failed: Workflow: initializeWorkflowVariables / find (item13) host: ch.dunes.model.type.ConvertorException: impossible to serialize the object of class: org.mozilla.javascript.NativeObject

    Thanks in advance,

    Stephan

    vCO stores all the outputs in its database between each boxes to ensure that the workflow can be resumed. It is done just with objects he knows (not custom ones you create in javascript). For example, you can use the properties object to pass your vlan properties from one box to the other.

    Christophe.

  • What is the best method to move from an iPhoto from one Mac to another library?

    What is the I best method for export/transfer my iPhoto on MBP to the iPhoto library library on my iMac? I prefer to keep my metadata intact; I guess that to do a package contents 'show' of my iPhoto and AirDropping the 'masters' library, I won't lose it? I'm under El Capitan 10.11.4 on Mac.

    I just want to explain my situation because maybe I'm missing something. I have SUMMER will use the photo library iCloud for synchronization on all my Apple devices and as a backup off-site. Fortunately, I realized soon as enough it would become a management NIGHTMARE. I downloaded everything from iCloud to my MBP and want to get it all on my iMac, so I can clean up the mess of duplicates and others.

    I couldn't synchronize with realism of the iCloud photo library to my iMac because I would have had to download about 150 + GB of data, so that I can download the 30 or GBs who were on my families iOS devices iCloud and the MBP. ICloud photo library interface is NOT well designed or easy to use - download directly from the cloud is heavy at best.

    All tips are appreciated, thanks.

    Simply connect the two Macs together and drag the library in the pictures of the new mac folder - or use an external hard drive to the Mac OS extended (journaled) format and drag through - then launch iPhoto on the new system

    Move the masters moves original photos and metadata exactly as they were imported without organization

    And iCloud library isn't an option for iPhoto - it requires OS X 10.10.1 and photos 1 or later version

    LN

  • What is the best method to do a clean install of El Capitan (currently using Mavericks).

    I want to do a clean install of El Capitan. I am currently using Mavs 10.9.5 and my time machine goes back to 2010. I don't want to migrate everything. I want to start cleaning up. I read a few methods, but I'm curious to know if there is some consensus as to the best method.

    Make sure that you have a Time Machine backup.

    Download El Capitan and do an install from USB.

    Start the installer from USB and install it.

    (Ref - this :)

    http://osxdaily.com/2015/10/01/clean-install-OS-x-El-Capitan-Mac/

  • First HP: Best method to solve equations very slightly advanced...

    I always seem to struggle with trying to find a correct and reliable way to do different things with this calculator.  I've stuck with him since they were released at the beginning and I intend to continue to wear for everyday use when I finished my degree.  The problem I encounter is that there are two fairly detailed instructions published or find methods that I do not work for slightly more advanced problems than those in the manuals, etc. of the user.

    Then, I manipulated an equation until the following and I need to solve for alpha without random speculation and 40 different attempts, which is the best method to achieve this?  I tried to plug in this whole equation in the 'Solve' application in different formats, but the number it solves for is always about 0.5 to low or high, in this case I probably have a bad setting somewhere.  I also tried to solve, csolve and orders fsolve in AR but I always get some [[]] as a result.  I guess it's either a mistake or is it which indicates that there are several answers, but where do I go from here?  I was not able to find that [[]] actually means.

    Here's my equation: (sin(2*a)/(2*pi))-(a/pi)+0.75=0, where a = letter Greek alpha.)  The correct answer is 1,986 rad = 113.8 degrees.

    Please help, thanks!

    Sorry Tim, after little sleep and fees starting this morning, I realized that 1) I did not use the appropriate syntax to solve/csolve/fsolve, i.e.: I was not finishing the statement of education and that's why I was getting the [[]].  (2) I realized that when I received a response that was in degrees because I had not turned on my way to radians.  I am all set now and can find the right answer through a number of ways.  Thanks for the reply and my apologies for taking your time.

  • Tecra M4 - best method of printing of documents

    that would you suggest the best method of printing of documents etc. would be, when you use the TECRA M4, because there is no printer port.

    Hello

    Many printers or the most recent printer supports only USB port interface.
    But if your printer supports only the parallel port, so you can use cable adapters.
    Check this box:
    http://www.ramelectronics.NET/HTML/usb_printer_cable.htm

  • What is the best method/app to remove the old files on a late 2009 iMac?

    Want to clean and remove some old files, on which some I don't even know.  What is the best method, and or the app? I have airport time capsule as back up.

    Look at and think are the best, there is no app that comes already to know your preferences.

  • Satellite L655 - what is the best method to reisntall ati display driver?

    What is the best method to reisntall ati display drivers as the ati Control Center no longer works.
    It won't work anymore.

    I think that something is going wrong.
    So how to uninstall the entire package and install again.

    Thanks in advance

    Satellite L655 (PSK1JE)

    Go to the page of the Toshiba UE driver.
    Choose the display updated L655 driver
    Download the package, unpack it and run the setup.exe :)

  • No hdmi on my p6320y port. Best method to connect to sony hdtv or home theater?

    I have a sony kdl46ex400 1080 p hdtv.  It is not an hdmi port on my desktop HP p6320y.  What is the best method to connect to my TV or home theater system, so that I can enjoy tv online and movie services and look into hidefinition and having the best sound?

    Hi gilbo225,

    There are a few options you have, according to which ports are available on your TV.

    What is your TV? http://www.TigerDirect.com/applications/SearchTools/item-details.asp?EdpNo=5687623

    If it is your TV, so you can connect your PC using the "PC in ports", which are the VGA and audio port to connect to the back of your TV. He just use a standard VGA cable for the video, and then run the audio cable from the green line to the port of exit at the back of your PC in PC in audio port on the TV.

    Then simply select PC as the video source on your TV.

    You should still be able to get high-definition video via the VGA input as long as you set your display settings on the PC up to 1920 x 1080.

    I have my PC set in place at home in this same configuration, but with a different brand TV. It works very well.

  • Best method to track usage of the file by the user?

    Hello world

    I currently need to look at a method for monitoring of the activities of the file in my organization and I need a little help to get started on the right track. I had some references point me to app Xcode Instrument via the business model of the file, but I currently have issues seeing any activity from users of the real network. to start, I simply set the target to "All processes" with the hope that it would bring together all activities and newspaper, in which he did for everything except users on the network. On mine, I also found some people who use scripts to dtrace or opensnoop, but I was hoping someone could point to what they think, it's the "best" method to track when a file/folder is accessed and/or modified.

    Also, as a note, we are in a mixed environment and so we only via SMB as our file sharing protocol in the case where it makes a difference. I know that in newspapers of the server application, it does clearly as AFP titles widely as I can only find small amounts of data for SMB in the newspapers (disconnects / reconnects, permissions, etc.). If I need to flesh out the details as well, this isn't a problem, and thank you to you all in advance.

    As with everything, there are a number of ways to accomplish.  Manager of the 'better' is one that works in your environment and that you feel comfortable.

    You can watch the common criteria framework that is built into OS X.  Try checking the man and man audit_control to get an idea of what is possible.  If you enable the service, you will record only login, logout, and authentication.  However, adding to the indicators you can save the file reads, writes, creates and deletes (most other things).  Are you trying to follow everything on local machines or just the server?

    Now, if you do this, you'll generate a lot of logging data.  The most logical way to handle this is to aggregate the log data into a centralized syslog server.  But it of more infrastructure and will pose challenges if you breadwinner and because portable computers that let the environment.

    Reid

    Apple Consultants Network

    'El Capitan Server - Foundation Services.

    «El Capitan Server - Collaboration & control»

    'El Capitan Server - Advanced Services '.

    : IBooks exclusively available in Apple store

Maybe you are looking for