Persistent var

Hello

I have a variable that I want to access at any time, as it does not change.

I do not use any framework.

One option is to:

FlexGlobals.topLevelApplication.myVar

But I do like it.

What I do now is:

public class Test

{

private static var _myVar:Object;

public void Test (someObj:Object)

{

_mavar = someObj;

}

public static void get myVar (): String

{

Return _mavar;

}

}

Then first set a value:

test: var Test = new Test({test:'hello'});)

Then everywhere else:

Test.myVar to get the value

But I don't like it either.

What is the right way to do this please?

The data changes... It is empty before calling the server and subsequently has the data.  This means that it is possible to write about it, and if you give global access and your project lives long enough and has enough developers, someone will.

Seriously, just create your an object with your returned data once the data is returned, then pass these autour data to components that need it, as you would with any other model variable.

If you feel like you absolutely needs good make a global static variable, I would suggest making it where it is initialized in the constructor and all the properties are read-only.

Tags: Flex

Similar Questions

  • ALT Enter point, maintain the instance unique app!

    Hey all,.

    Unlike most who put up the other entry points in their applications of BB, I would like to keep a single instance in which the user interface and the background code treatment will be contained. In other words, no separate instance for unemployment insurance and background processing. My other entry point is made to run at startup, in order to maintain the running background processes, even after restarting the device.

    My attempts have been unsuccessful so far. I find myself with several instances after restart, I can see in the bb application selector (long press menu key).

    Here is my code. I hope yall can find something in there that I'm doing wrong.  Thank you!

    public class HelloWorldDemo extends UiApplication implements SystemListener
    {
        public static HTTPInterface _httpInterface = new HTTPInterface();
        private static HelloWorldScreen _mainScreen;
            private static HelloWorldDemo theApp;
    
    private HelloWorldDemo() {
            pushScreen(new AppScreen(this));  
    
        }
    
        /**
         * Entry point for application
         * @param args Command line arguments (not used)
         */
        public static void main(String[] args)
        {
            // Create a new instance of the application and make the currently
            // running thread the application's event dispatch thread.
            String deviceVersionString = DeviceInfo.getSoftwareVersion();
            String deviceVersionSubString = deviceVersionString.substring(0, 3);
            BingModel.deviceVersion = Double.parseDouble(deviceVersionSubString);
    
            if (theApp == null)
            {
                theApp = new HelloWorldDemo();
            }
            if (args != null && args.length > 0 && "startupEntry".equals(args[0]))
            {
    
            //checking to see of app was set to run in background, before reboot occured.
                boolean isChecked = BingModel.retrieveState();      
    
          if(isChecked == true) {
                     // If system startup is still in progress when this
                    // application is run.
                    if (ApplicationManager.getApplicationManager().inStartup()) {
                        theApp.addSystemListener(theApp);
                        }
                    else {
                        //theApp = new HelloWorldDemo();
                        theApp.doStartupWorkLater();
                        }
                    //theApp = new HelloWorldDemo();
                    theApp.enterEventDispatcher();
                }
                else
                    System.exit(0);
            }
            else
            {
                BingModel.isRunStartup = false;
                //if (theApp == null)
                //{
                /// theApp = new HelloWorldDemo();
                //}
                theApp.enterEventDispatcher();
            }
    
        }
    
        private void doStartupWorkLater() {
             invokeLater(new Runnable() {
                 public void run() {
                     doStartupWork();
                     }
                 });
         }
    
        private void doStartupWork() {
            BingModel.isRunStartup = true;
            UiApplication.getUiApplication().requestBackground();
        }
    
        public void powerUp() {
            removeSystemListener(this);
            doStartupWork();
        }
    

    This code works perfectly for me now. No other entry and no runtime stores.

    It will work for someone else who needs their application to run at startup, but only stay running in the background if a framework had been put in the application before restarting or powerdown took place.

    This line retrieves a persistent var/setting, which determines whether or not keep the app running in the background at the start or close.

    Boolean isChecked = BingModel.retrieveState ();

    I hope this helps others!

    public class DailyDesktop extends UiApplication implements SystemListener
    {
        public static HTTPInterface _httpInterface = new HTTPInterface();
        private static HelloWorldScreen _mainScreen;
            private static DailyDesktop theApp;  
    
        private DailyDesktop() {
                pushScreen(new AppScreen(this));
            }
    
        /**
         * Entry point for application
         * @param args Command line arguments (not used)
         */
        public static void main(String[] args)
        {
            // Create a new instance of the application and make the currently
            // running thread the application's event dispatch thread.
            String deviceVersionString = DeviceInfo.getSoftwareVersion();
            String deviceVersionSubString = deviceVersionString.substring(0, 3);
            BingModel.deviceVersion = Double.parseDouble(deviceVersionSubString);
    
            theApp = new DailyDesktop();
        theApp.addSystemListener(theApp);
            theApp.enterEventDispatcher();
        }
    
        private void doStartupWork() {
            UiApplication.getUiApplication().requestBackground();
        }
    
        public void powerUp() {        
    
            removeSystemListener(this);
            boolean isChecked = BingModel.retrieveState();
            if(isChecked == true) {
                BingModel.isRunStartup = true;
                doStartupWork();
            }
            else {
                System.exit(0);
            }
    
        }
    
  • When I try to print, the queue varies from 0 document (s) in the printer queue: error

    * Original title: printer: error

    Overview:

    I have a Dell 560 which has Windows 7 64 bit is installed.  My printer is an old HP Officejet v40xi.  Have had two e connected by a USB cable for 3 years.

    Location:

    I ran out of ink.  I had not been printing a lot, so I did not fill the cartridges for several weeks.  I had a bright idea to reinstall the printer software for the printing/tool box I used on another computer.  I wanted to do a scan.

    I deleted the software and tried to download the software again.  The disk could not be downloaded on Windows 7 64 bit.  So I got the software from the HP site.

    When I try to print, the queue varies from 0 document (s) in the printer queue: error.  I reloaded the software twice, I put on a new USB cable and I changed the port.  I still get the same message.  Troubleshhot Windows printer also, indicates that it cannot determine the problem.  I went to HP and did not find any help.

    Does anyone know how to solve the problem?

    Hello

    -What is the full error message?

    I suggest you link and check if that helps.

    For more information, see the link.

    Solve a problem

    If the problem persists, contact HP support for help.

    Let us know the results. We will be happy to help you.

  • User persistent between sessions variables

    I have read in a long thread and instructive to 4 and a half years ago that even if "resume data" or "data to suspend" was sent to the LMS between sessions (to keep my Captivate user variables), if my user variables are either set to an initial value in my Captivate file, they will be reset every time at the entrance to the initial value , and the persisted value will be lost.  My question: is this still true in Captivate 9?

    I ask because if a student leaves a lesson and returned it later, a problem that might be explained by the phenomenon above, we discovered a problem with the behavior of our modules.

    It is best if you use a js file included to do so. You can create the file and put the include in the index.html file

    The "moduleReadyEvent" fires only once, to create an initVariables function to get the localStorage form of vars or initialize the localStaorage if it does not yet exist.

    In the initializeEventListeners function, add you a "CPAPI_SLIDEENTER" listener, set the storage whenever you enter a slide.

    Add a window.onunload function to set it again when the page is unloaded.

    window.addEventListener ("moduleReadyEvent", function (e)

    {

    interfaceObj = e.Data;

    eventEmitterObj = interfaceObj.getEventEmitter ();

    initVariables();

    initializeEventListeners();

    });

    function initVariables()

    {

    implement the localStorage

    }

    function initializeEventListeners()
    {
    If (interfaceObj)
    {
    If (eventEmitterObj)
    {
    eventEmitterObj.addEventListener ("CPAPI_SLIDEENTER", function (e)
    {
    call a function to set the storage here.
    });
    }
    }
    }

    Window.OnUnload = function()
    {
    call a function to set the storage here.
    }

  • NFS ODA persists even after the update applied

    Good morning guys,

    We have improved our ESXi Hypervisor from 5.1 to 5.5 U1 last weekend. I have read on the NFS ODA bug and downloaded the update scheduled to apply last nigth.

    ~ # software esxcli vib install d ' "/ vmfs/volumes/4f27d555-e55efb08-0da4-d4ae52723fbc /ESXi550 - 201407001.zip".

    Result of the installation

    Message: The update completed successfully, but the system must be restarted for the changes to be effective.

    Restart required: true

    VIBs installé : VMware_bootbank_esx-base_5.5.0-1.28.1892794, VMware_bootbank_lsi-mr3_0.255.03.01-2vmw.550.1.16.1746018, VMware_bootbank_lsi-msgpt3_00.255.03.03-1vmw.550.1.15.1623387, VMware_bootbank_misc-drivers_5.5.0-1.28.1892794, VMware_bootbank_mtip32xx-native_3.3.4-1vmw.550.1.15.1623387, VMware_bootbank_net-e1000e_1.1.2-4vmw.550.1.15.1623387, VMware_bootbank_net-igb_5.0.5.1.1-1vmw.550.1.15.1623387, VMware_bootbank_net-tg3_3.123c.v55.5-1vmw.550.1.28.1892794, VMware_bootbank_rste_2.0.2.0088-4vmw.550.1.15.1623387, VMware_bootbank_sata-ahci_3.0-18vmw.550.1.15.1623387, VMware_bootbank_scsi-megaraid-sas_5.34-9vmw.550.1.28.1892794, VMware_bootbank_scsi-mpt2sas_14.00.00.00-3vmw.550.1.15.1623387-VMware_locker_tools-light_5.5.0-1.28.1892794

    VIBs supprimés : VMware_bootbank_esx-base_5.5.0-0.0.1331820, VMware_bootbank_lsi-mr3_0.255.03.01-1vmw.550.0.0.1331820, VMware_bootbank_lsi-msgpt3_00.255.03.03-1vmw.550.0.0.1331820, VMware_bootbank_misc-drivers_5.5.0-0.0.1331820, VMware_bootbank_mtip32xx-native_3.3.4-1vmw.550.0.0.1331820, VMware_bootbank_net-e1000e_1.1.2-4vmw.550.0.0.1331820, VMware_bootbank_net-igb_2.1.11.1-4vmw.550.0.0.1331820, VMware_bootbank_net-tg3_3.123c.v55.5-1vmw.550.0.0.1331820, VMware_bootbank_rste_2.0.2.0088-4vmw.550.0.0.1331820, VMware_bootbank_sata-ahci_3.0-17vmw.550.0.0.1331820, VMware_bootbank_scsi-megaraid-sas_5.34-9vmw.550.0.0.1331820, VMware_bootbank_scsi-mpt2sas_14.00.00.00-3vmw.550.0.0.1331820-VMware_locker_tools-light_5.5.0-0.0.1331820

    After the reboot of the host and reassemble our NFS (used for backup VMs using ghettoVCB.sh), ODA issues are persistent that I checked on the /var/log/vobd.log this morning:

    2014-07 - 10 T 11: 00:58.757Z: [APDCorrelator] 46073957136us: [vob.storage.apd.start] device or file with identifier [a643d5cd-6c9ea269] system has entered the State of all the paths down.

    2014-07-10 T 11: 00:58.757Z: [APDCorrelator] 46073957584us: [esx.problem.storage.apd.start] device or filesystem with identifier [a643d5cd-6c9ea269] has entered the State of all the paths downwards.

    2014-07-10 T 11: 02:45.898Z: no correlator for vob.vmfs.nfs.server.disconnect

    2014-07-10 T 11: 02:45.898Z: [vmfsCorrelator] 46181098984us: [esx.problem.vmfs.nfs.server.disconnect] 192.168.100.83/mnt/HD/HD_a2/VMBACKUP a643d5cd-6c9ea269-0000-000000000000 D-Link

    2014-07-10 T 11: 03:18.758Z: [APDCorrelator] 46213958621us: [vob.storage.apd.timeout] device or filesystem with identifier [a643d5cd-6c9ea269] has entered the State of all the paths down Timeout after being in the State of all the paths downwards for 140 seconds. E/s will now be quickly failed.

    2014-07-10 T 11: 03:18.758Z: [APDCorrelator] 46213959037us: [esx.problem.storage.apd.timeout] device or filesystem with identifier [a643d5cd-6c9ea269] has entered the State of all the paths down Timeout after being in the State of all the paths downwards for 140 seconds. E/s will now be quickly failed.

    2014-07-10 T 11: 07:40.806Z: [APDCorrelator] 46476006085us: [vob.storage.apd.exit] device or filesystem with identifier [a643d5cd-6c9ea269] left the State of all the paths downwards.

    2014-07-10 T 11: 07:40.806Z: no correlator for vob.vmfs.nfs.server.restored

    2014-07-10 T 11: 07:40.806Z: [APDCorrelator] 46476006585us: [esx.clear.storage.apd.exit] device or filesystem with identifier [a643d5cd-6c9ea269] left the State of all the paths downwards.

    2014-07-10 T 11: 07:40.806Z: [vmfsCorrelator] 46476006474us: [esx.problem.vmfs.nfs.server.restored] 192.168.100.83/mnt/HD/HD_a2/VMBACKUP a643d5cd-6c9ea269-0000-000000000000 D-Link

    So, anyone has an idea about this?

    Thanks in advance.

    Hey fabio_brizzolla,

    Well the first thing I found was that the D - Link DNS-320 is not on the hardware compatibility list VMwares, however some other versions are, so unless I missed something I couldn't find it, which means that there could be unexpected behavior of the installation.

    Having said that, your other editing that are the same, they all work well on a 5.0 update x is just installing 5.5 that you are having problems with?

  • Host system logs are stored on non-persistent storage

    After the upgrade of a crowd of ESX4.0 at ESXi5.5, I get 'host system logs are stored on non-persistent storage. I've now changed the location of the log of a shared data store. What happens if this datasore is offline due to a mistake or an interview?

    you will get the error like "" /var/log/.vmssyslogd.err: unable to write the newspaper "that's all." then you will have loss the logs after this time. in order to configure it in drive clean. FYI: this always used to use diagnostic logs, it is important

  • /var/log/boot.gz

    I guess that this file is created at startup and then gzip'd for archival purposes.

    So, question:

    -Is this file crashed every time you start it gets archived/moved/saved for historical reference, or is it just added/joint at each start-up phase?

    THX.

    Guardian1234 wrote:

    -Is this file crashed every time you start it gets archived/moved/saved for historical reference, or is it just added/joint at each start-up phase?

    I did two reboots of a 5.1 ESXi host and the boot.gz was that 30506 bytes in the first case and after the second reboot 30416 bytes. A large amount of new lines has been added, but the size was still a few bytes less. This strongly tells me that the file is overwritten each time you start. (Server on a persistent storage as well).

    You could read the file with zcat /var/log/boot.gz | more.

  • Free ESXi and persistent record

    Hello

    I am aware of the possibility to use a remote syslog server but also to place the log files in a different folder.

    My question is this: If the log files have been redirected to a folder who resided in a VMFS volume, is there any kind of rotation log or process in order to prevent a log file of uncontrolled growth?

    He'll turn based on a configured default value.

    To get the default setting, you will need to connect to the console Busybox unsupported.

    You can use the muti-binary "busybox" utility to access the syslogd:

    /vmfs/volumes/4c0cb98f-9691c526-47ea-005056934adc/syslog # busybox syslogd -h
    syslogd: invalid option -- h
    BusyBox v1.9.1-VMware-visor-654 (2008-12-17 10:01:32 PST) multi-call binary
    
    Usage: syslogd [OPTION]...
    
    System logging utility.
    Note that this version of syslogd ignores /etc/syslog.conf.
    
    Options:
            -n              Run in foreground
            -O FILE         Log to given file (default=/var/log/messages)
            -l n            Set local log level
            -S              Smaller logging output
            -s SIZE         Max size (KB) before rotate (default=200KB, 0=off)
            -b NUM          Number of rotated logs to keep (default=1, max=99, 0=purge)
            -R HOST[:PORT]  Log to IP or hostname on PORT (default PORT=514/UDP)
            -L              Log locally and via network (default is network only if -R)
    

    As you can see, the default value is slowed when his > 200 KB and max number of rotations is 1. You can change these values by default if you must, once again is probably not recommended by VMware and changes may or may not persist through a restart function if the configuration file is saved every hour by the internal processes of ESXi. Note, it says this version of syslogd uses pas/etc/syslog.conf, so you have no need to bother adding the changes in this file.

    You can change the default by using something like:

    busybox syslogd -n -s 10 -b 10
    

    You can also try simply by changing the default settings, reboot the host and see whether or if it takes without modification. To do this, simply remove the "n" flag.

    UPDATE: the changes actually take effect immediately, you do not need of the '-n' flag. Although the question is whether it will hold through a reboot.

    =========================================================================

    William Lam

    VMware vExpert 2009

    VMware scripts and resources at: http://www.virtuallyghetto.com/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • Variables that persist throughout the application

    As usual I show my naivety Flex with my questions.  So what's another...

    Is it possible to have variables that I put in a pop-up window (think connection), persist and be accessible even when popup is closed?

    For example, I have an application that uses a pop-up login window to control access to the application. The user provides the user name, password, and role. When the user is authenticated, the pop-up closes and a viewstack is displayed after the results of the role selected in the pop-up window.

    Everything works very well. Now, I want to display the user ID in the viewstack are the components. For example, I want to display a welcome message based on the user ID.  In ColdFusion, I would just use a session variable.  However, in my view, there is a way to call any variable in the application as long as the film is still running.

    I can't find a way to do it. Any help would be appreciated.

    You can set a variable in the application.

    The code on the shortcut menu:

    private var app:Object = mx.core.Application.application;

    app.myVar = myPopUpVarValue;

    Or you can send a custom event that contains the data as a property that you define in the custom event. This is the best way to do (app coupled lloosely) but in this case you must add the event listener to systemManager, not to the application, as popups are from a list of different display under systemManager.

    Here is my Flex cookbook post on custom events:

    http://www.Adobe.com/cfusion/CommunityEngine/index.cfm?event=ShowDetails&ProductID=2&postI d = 11246

    It's more work, so you can go with option 1 above (mx.core.Application.application), but long term you want to use custom events.

    If this post has answered your question or helped, please mark it as such.

  • 5.2 Server postfix logging is more to /var/log/mail.log

    I would like to know if anyone else has this problem?

    After update macOS Sierra and Server 5.2, I get no message Postfix in /var/log/mail.log (aka SMTP Log).  I've never had a problem to see messages from postfix here before.  I defining all postfix mail log "info".

    I do not process messages greylisting Policy logging /var/log/mail.log.  Thus, the file seems to work in general.  But, no tricks postfix.

    Does anyone else have this problem?

    Same here, tried changing in debugging without result. Tried to change with the Terminal using serveradmin settings messaging or (I know you shouldn't do) editing the main.cf, also changed the com.apple.mail in the directory/etc/asl of notices info or debug nada!

    so, if anyone finds the solution? Please share

  • Disable the persistent question in CSA banner.

    Hot off the presses.

    Transform it.

    In this.

    Go to your preferences page and disable the persistent Question button.

    This link will take you to your preferences page.

    https://discussions.Apple.com/user-preferences! input.jspa

    Starting to stuff...

    Keep up the good work AppleJiveTeam!

  • Persistent problems with the Magic Mouse

    I have persistent problems with my Magic Mouse. He often stops followed (i.e. the cursor on the screen does not move when I move the mouse), or the input button on malfunctions (i.e. I don't click and drag, or cannot right click, or when I click on something and that you hold the button down it doesn't "stick").

    I called Apple and they took me through all the troubleshooting steps (reset the SMC, PRAM, etc.) and I finally get a new mouse. I got a new and have exactly the same problems!

    The ONLY thing that solved the problem by restarting the computer, or logging in and out. But the problem then begins again after anywhere from a few minutes to a few days (the most often within hours).

    Any ideas?

    Here is more information in case it is useful:

    • I plugged a wired Logitech mouse, and to my surprise, it also does not work. I thought that the problem was related to the wireless/Bluetooth connection, but this clearly isn't.
    • I have a Wacom tablet attached to my computer, and it works very well, no matter if it has connected (via USB dongle) wireless or wired (via USB).

    There seems to be something wrong with any particular software/system control the mouse.

  • Some site to load then receive errors like this: (function() {var _UDS_CONST_LOCALE = "en";) Uninstalled and reinstalled firefox. No help.

    Some sites work very well. I have Firefox on my work PC and laptop. I can open incandescence.com on them, but on this desk, it loads a page with what follows, 1000's of lines like the following:
    (function() {}
    var _UDS_CONST_LOCALE = "en";
    var _UDS_CONST_SHORT_DATE_PATTERN = 'MDY ';
    var _UDS_MSG_SEARCHER_IMAGE = ("Image");
    var _UDS_MSG_SEARCHER_WEB = ("Web");
    var _UDS_MSG_SEARCHER_BLOG = ('Blog');
    var _UDS_MSG_SEARCHER_VIDEO = ('Video');
    var _UDS_MSG_SEARCHER_LOCAL = ('Local');

    There are pages of the below. Some sites go up and try to open Notepad. I uninstalled firefox several times and reinstalled. Same results. I noticed that my bookmarks, etc. themselves so maybe uninstall/reinstall cleaning isn't the problem. Chrome, IE, Edge and all work very well on the sites in question.

    He takes me to the following address instead of incandescence.com: http://www.google.com/uds/api/search/1.0/432dd570d1a386253361f581254f9ca1/default+en.I.js? & a = 1

    Thank you...

    Maybe a content filtering went wrong. Could test you mode without failure of Firefox? It is a standard diagnostic tool to disable some advanced features of Firefox and extensions. More info: questions to troubleshoot Firefox in Safe Mode.

    Does not work if Firefox: Hold down the SHIFT key when you start Firefox.

    If Firefox is running: You can restart Firefox in Mode safe mode using either:

    • button "3-bar" menu > "?" button > restart with disabled modules
    • Help menu > restart with disabled modules

    and OK reboot.

    Two scenarios: A small dialog box should appear. Click on 'Start mode safe' (not update).

    Any improvement?

  • Secure connection failed: 'sec_error_ocsp_old_response '. I tried your troubleshooting tips, the problem persists.

    I tried the trick in Firefox help page (delete the file "cert8.db"), but the problem persists. (I couldn't even for Firefox Help pages in Firefox, had to use Chrome to get here!) The error message means there is a problem with secure web sites themselves, but which is not normal, that I can easily open them with several other browsers. Firefox help page gives several examples of the type "sec_error_..." error messages ", but not one specific I get:"sec_error_ocsp_old_response. "

    I'm running Windows 8.1 and tried to uninstall and reinstall Firefox, nothing helps.

    Thanks for the tips!

    Hi bwcrain, please make sure that your system clock is set to the right date, time and time zone: time.is

  • Why tabs are more persistent?

    Since the update, the tabs is no longer persist between sessions. When I closed Firefox and restart, all my tabs disappeared! Where can I say don't forget the tabs that I had until the last session of Firefox?

    Thank you!

    If you go to the history menu, restore previous Session work?

    If so, your start setting may have been changed. You can check that by following the steps in this article:

    Startup, homepage, tabs and download settings

    If this has changed, do you remember using Refresh? This could happen if Firefox reports that it runs slowly and suggest an update to improve performance. In this case, a new "Old data Firefox" folder will appear on your desktop. Do you see something like that?

Maybe you are looking for