store an entire class in persistent store?

I need to store a set of many parameters in the persistent store. I wonder if it is possible to create a class that contains all the settings and get an instance of the class into the store, instead of putting every parameter in the store separately. The questions are:

1 is it possible?

2. If so, are there performance issues with the storage of an instance of the class, or any other concers?

Thank you

1 Yes its possible, you must make sure that your class extends the persistable interface

2. Yes, there are performance concerns and limitations in number of handles object that you could use on some operating systems... see these articles for a more detailed explanation:

http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/7979/1181821/832210/Memory_b...

http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800431/What_Is...

Tags: BlackBerry Developers

Similar Questions

  • Store the object in a persistent storage

    Hello

    I want to store the cusom object in the persistent store.here is my custom class:

    public class {UserData

    OrgName string;
    Time to string;
    String authTocken;
    Public UserData (orgName, String authTocken, String time, String)
    {
    this.orgName = orgName;
    This.Time = time;
    this.authTocken = authTocken;

    }
    public String getOrgName() {}
    return orgName;
    }
    {} public void setOrgName (String orgName)
    this.orgName = orgName;
    }
    public String getTime() {}
    back in time;
    }
    {} public void setTime (string time)
    This.Time = time;
    }
    public String getAuthTocken() {}
    Return authTocken;
    }
    {} public void setAuthTocken (String authTocken)
    this.authTocken = authTocken;
    }

    }

    and I use the following class of persistent storage to store the data.

    / public final class PersistentStoreContents implements {Persistable
    private CAMailMinderHashTable mElements = null;
    static private instance of PersistentStoreContents = null;
    Private static final long KEY = 0x67c5b66a2bcd1dfcL;
    private PersistentObject persistentObject = null;

    /**
    * Gets the single instance of the database.
    *
    * only @return of the database instance
    */
    public static getInstance() {} PersistentStoreContents
    try {}
    If (instance == null) {}
    Logger.out ("PersistentStoreInfo", "creation of the storage object");
    instance = new PersistentStoreContents();
    }
    } catch (Exception e) {}
    instance = null;
    }
    return instance;
    }

    private PersistentStoreContents() {}
    persistentObject = PersistentStore.getPersistentObject (KEY);
    synchronized (persistentObject) {}
    If (persistentObject.getContents () == null) {}
    persistentObject.setContents (new CAMailMinderHashTable());
    persistentObject.commit ();
    }
    }

    mElements = persistentObject.getContents ((CAMailMinderHashTable));
    If (mElements == null) {}
    Logger.out ("PersistentStoreInfo", "*" + (mElements is nothing));
    mElements = new CAMailMinderHashTable();
    }

    }

    public String getElement (String key) {}
    Logger.out ("PersistentStoreInfo", "getElement:" + key);
    Return (String) mElements.get (key);
    }

    ' Public Sub setElement (String key, String value) {}
    Logger.out ("PersistentStoreInfo", "setElement:" + key + value);
    mElements.put (key, value);
    persistentObject.setContents (mElements);
    persistentObject.commit ();
    }

    UserData public getElement2 (String key) {}
    Logger.out ("PersistentStoreInfo", "getElement:" + key);
    Return mElements.get (key) (UserData);
    }

    public void setElement2 (String key, UserData userData) {}
    Logger.out ("PersistentStoreInfo", "setElement:" + key);
    mElements.put (key, userData);
    Logger.out ("PersistentStoreInfo", "added");
    persistentObject.setContents (mElements);
    Logger.out ("PersistentStoreInfo", "game content");
    persistentObject.commit ();
    Logger.out ("PersistentStoreInfo", "Validate");
    }

    Public list getAllKeys() {}
    Logger.out ("PersistentStoreInfo", "getElement:" + key);
    Return mElements.keys ();
    }
    }

    I use the follwinng code to insert data :

    PersistentStoreContents ch = PersistentStoreContents.getInstance ();
    UserData = us new UserData("gmail.com","1111","aaaa");
    ps.setElement2 ("[email protected]", US);

    But it is not inserting data in the persistent store. App is struck to the persistent store setContent method... any idea on this?

    the object you put in the store has implemented persistable, not your utility class.

  • Persistent storage problem

    Hi all

    I use a persistent storage to store my data.

    Question: Persistent data are automatically get updated while recovery of persistence data and store it in a variable local object and then modify this local variable, observe that the persistent data are also changed without saving my new changes.

    I'm storage array of user defined class in persistent for example myclass [];

    I used to store vector which has been also get updated so I have changes to my class, I'm storage table because I store the list of objects of 'MyClass '. By changing the vector in [myclass] problem has been solved, but now I'm getting same result once again.

    I create a listener in the background that will read persistent data and send only data used to my application in the foreground, but when I do some changes in my local object again once it finds that the data gets reflected in persistent.

    Please let me know what I am doing wrong. I created a library of my persistent classes so that the foreground and background the two application could access.

    Looks like my storage

    Class Myclass implements persistable

    {

    certain types of data from premitive

    MyClass2 [] arrayOfSecondClass;

    }

    class Myclass2 implements persistable

    {

    certain types of data from premitive

    Myclass3 [] arrayOfThirdClass;

    }

    class Myclass3 implements {persistable

    Some data from premitive

    }

    //////////////////////////////////////////////////////////////

    call persistent to save and retrieve data:

    Thank you Peter and James,.

    It's corrected now. Your example simple singleton helped to understand the major concept.

    Kind regards

    Aparna Bloe

  • Eception exception: java.lang.Error when persisting the data...

    Hi all

    I am facing this error persisting my data.

    I followed the example provided to

    http://NA.BlackBerry.com/developers/resources/A13_Storing_Persistent_Data_V2.PDF

    First, I copy paste the code in a project. It was working fine. Later I managed for my use following code re

    SerializableAttribute public class HelloWorld extends UiApplication
    {
    Public Shared Sub main (String [] args)
    {
      
    Hello HelloWorld = new HelloWorld();
    hello.parseOnlineData ();
    hello.enterEventDispatcher ();
    }
    public HelloWorld()
    {
    a new screen
    Try
    {
    pushScreen (new HelloWorldScreen()); MusicStores
    pushScreen (new Settings());
    }
    catch (System.Exception e)
    {
    System.out.println ("# error" + e.getMessage ());
    }
    }
     
    / * class final HelloWorldScreen extends screen
    {
    LabelField settings private;
    public HelloWorldScreen()
    {
    Super();
    LabelField title = new LabelField ("HelloWorld example",
    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    setTitle (title);
    Add (new LabelField "(Bonjour World!",LabelField.FOCUSABLE) ");
    }
    public boolean onClose()
    {
    Dialog.Alert ("Goodbye!");
    System.Exit (0);
    Returns true;
    }
      
    }*/
     
    }

    # second class that is inherited from the screen...

    Settings/public class extends screen
    {
    most popular public static string = "most popular."
    public static String newlyadded = "newlyadded;
    public static string Bulletin = 'News ';
    public static string columns = "columns";
    public static string = "jobs" jobs
    public static string = "events" events
    public static interview of string = "interview"
    public static String indepth = 'thorough ';
     
    CheckboxField chkMostPopular;
    CheckboxField chkNewlyAdded;
    CheckboxField chkNews;
    CheckboxField chkColumns;
    CheckboxField chkJobs;
    CheckboxField chkEvents;
    CheckboxField chkInterview;
    CheckboxField chkIndepth;
    ButtonField saveFields;

    public Settings()
    {
    Try
    {
    Configuration config = StoreConfiguration.getConfiguration ();
    If (config! = null &! config.isEmpty ())
    {
    chkMostPopular = new CheckboxField ("Most popular", ((Boolean) config.getElement (mostPopular)) .booleanValue ());
    chkNewlyAdded = new CheckboxField ("Newly added", ((Boolean) config.getElement (newlyadded)) .booleanValue ());
    chkNews = new CheckboxField ('News', ((Boolean) config.getElement (news)) .booleanValue ());
    chkColumns = new CheckboxField ("Columns", ((Boolean) config.getElement (columns)) .booleanValue ());
    chkJobs = new CheckboxField ("Jobs", ((Boolean) config.getElement (jobs)) .booleanValue ());
    chkEvents = new CheckboxField ('Events', ((Boolean) config.getElement (events)) .booleanValue ());
    chkInterview = new CheckboxField ("Interview", ((Boolean) config.getElement (interview)) .booleanValue ());
    chkIndepth = new CheckboxField ("in depth", ((Boolean) config.getElement (indepth)) .booleanValue ());
    }
    on the other
    {
    chkMostPopular = new CheckboxField ("Most popular", false);
    chkNewlyAdded = new CheckboxField ("Newly added", false);
    chkNews = new CheckboxField ("News", false);
    chkColumns = new CheckboxField ("Columns", false);
    chkJobs = new CheckboxField ("Jobs", false);
    chkEvents = new CheckboxField ("Events", false);
    chkInterview = new CheckboxField ("Interview", false);
    chkIndepth = new CheckboxField ("in depth", false);
    }
       
       
    saveFields = new ButtonField ("Save")
    {
    protected boolean navigationClick (int status, int time)
    {
    persistConfigurationData();
    Dialog.Alert ("data");
    onClose();
    Return super.navigationClick (status, time);
    }
    };
    Add (chkMostPopular);
    Add (chkNewlyAdded);
    Add (chkNews);
    Add (chkColumns);
    Add (chkJobs);
    Add (chkEvents);
    Add (chkInterview);
    Add (chkIndepth);
    Add (saveFields);
    }
    catch (System.Exception e)
    {
    System.out.println ("# error Settings()" + e.getMessage ());
    }
    }
     
    Private Sub persistConfigurationData()
    {
    Configuration config = new Configuration();
    config.setElement (most popular, new Boolean (chkMostPopular.getChecked ()));
    config.setElement (newlyadded, new Boolean (chkNewlyAdded.getChecked ()));
    config.setElement (news, new Boolean (chkNews.getChecked ()));
    config.setElement (columns, new Boolean (chkColumns.getChecked ()));
    config.setElement (jobs, new Boolean (chkJobs.getChecked ()));
    config.setElement (events, new Boolean (chkEvents.getChecked ()));
    config.setElement (interview, new Boolean (chkInterview.getChecked ()));
    config.setElement (indepth network, new Boolean (chkIndepth.getChecked ()));
    System.out.println ("will persist object");
    StoreConfiguration.setConfiguration (config);
    }
    }

    # third class which is a persistence class

    Configuration/public class implements Persistable
    {
    private static Hashtable _config;
    Configuration() public
    {
    _config = new Hashtable();
    }
     
    public Object getElement (String key)
    {
    Return _config.get (key);
    }
    ' Public Sub setElement (key of type string, Boolean)
    {
    _config.put (key, new Boolean (value));
    }
     
    ' Public Sub setElement (key of type string, Boolean)
    {
    _config.put (Key, value);
    }
     
    public Hashtable getConfiguration()
    {
    return _config;
    }
     
    public boolean isEmpty()
    {
    Return _config.isEmpty ();
    }
    }

    I use the BB 8300 Simulator.  Once this error is thrown in this program, the example program that was carried out with success, also stopped running. I tried changing the 'key' to store the data in the following line of code.

    PersistentStore.getPersistentObject (0xdec6a67096f833cL);

    Using bb 8300 with eclipse Simulator.

    Please help me solve this problem.

    Thank you

    Kind regards

    Amber

    Not sure where your problem is, but there are some things that I am not comfortbable with your current code.  This is a replacement code.  You can give it a try?

    The major changes are:

    (a) in the settings, we do not create a new object of Configuration, we update the existing object.  Also note that StoreConfiguration.getConfiguration (); should never return null.

    (b) in StoreConfiguration, I tidied up to account for what was happening in fact of suite and there is never a single _data object (Configuration)

    (c) in the Configuration, the hash table is more static.

    Apart from a bit of as, these changes reflect the fact that static may not be a singleton.  If you are referring to the Configuration of two different processes (a background app started at the beginning of time and a leading user interface component started with an alternative entry), you won't see the same object simply by using a static.

    Sorry, none of the code has been compiled, but I hope you understand intentions.

    Parameters

    package com.persistence;
    
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.CheckboxField;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.container.MainScreen;
    
    public class Settings extends MainScreen
    {
    
        public static String mostPopular = "mostpopular";
        public static String newlyadded = "newlyadded";
        public static String news = "news";
    
        CheckboxField chkMostPopular;
        CheckboxField chkNewlyAdded;
        CheckboxField chkNews;
    
        Configuration config
    
        ButtonField saveFields;
    
        public Settings()
        {
            try
            {
                config = StoreConfiguration.getConfiguration();
                chkMostPopular = new CheckboxField("Most Popular", ((Boolean)config.getElement(mostPopular)).booleanValue());
                chkNewlyAdded = new CheckboxField("Newly Added", ((Boolean)config.getElement(newlyadded)).booleanValue());
                chkNews = new CheckboxField("News", ((Boolean)config.getElement(news)).booleanValue());
    
                saveFields = new ButtonField("Save")
                {
                    protected boolean navigationClick(int status, int time)
                    {
                        persistConfigurationData();
                        Dialog.alert("Data saved");
                        //onClose();
                        return super.navigationClick(status, time);
                    }
                };
                add(chkMostPopular);
                add(chkNewlyAdded);
                add(chkNews);
                add(saveFields);
            }
            catch (Exception e)
            {
                System.out.println("##### Error occurred Settings() "+e.getMessage());
            }
        }
    
        private void persistConfigurationData()
        {
            config.setElement(mostPopular,new Boolean(chkMostPopular.getChecked()));
            config.setElement(newlyadded,new Boolean(chkNewlyAdded.getChecked()));
            config.setElement(news,new Boolean(chkNews.getChecked()));
            System.out.println("Going to persist object");
            StoreConfiguration.storeConfiguration();
        }
    }
    

    StoreConfiguration

    package com.persistence;
    
    import net.rim.device.api.system.PersistentObject;
    import net.rim.device.api.system.PersistentStore;
    
    public class StoreConfiguration
    {
        private static PersistentObject store;
        private static Configuration _data;
    
        private StoreConfiguration()
        {
    
        }
    
        static
        {
            store = PersistentStore.getPersistentObject(0xe63e08aacd575338L);
    
            Object storedObject  = store.getContents();
            if ( storedObject instanceof Configuration ) {
                // we have what we want - cast it
                _data = (Configuration) storedObject ;
            } else {
                _data = new Configuration();
                StoreConfiguration.setConfiguration(_data);
            }
    
        }
    
        public static Configuration getConfiguration()
        {
            return _data;
    
        }
    
        public static void storeConfiguration()
        {
            System.out.println("setConfiguration  ## Going to persist object");
            synchronized (store)
            {
                System.out.println("setConfiguration  ## _data "+((Boolean)_data.getElement("mostpopular")).booleanValue());
                store.setContents(_data);
                store.commit();
            }
        }
    }
    

    Configuration:

    package com.persistence;
    
    import java.util.Hashtable;
    
    import net.rim.device.api.util.Persistable;
    
    public class Configuration implements Persistable
    {
        private Hashtable _config;
        public Configuration()
        {
            _config = new Hashtable();
        }
    
        public Object getElement(String key)
        {
            return _config.get(key);
        }
        public void setElement(String key, boolean value)
        {
            _config.put(key, new Boolean(value));
        }
    
        public void setElement(String key, Boolean value)
        {
            _config.put(key,value);
        }
    
        public Hashtable getConfiguration()
        {
            return _config;
        }
    
        public boolean isEmpty()
        {
            return _config.isEmpty();
        }
    }
    
  • Use of class PersistentProxy for super class part 3


    Hello



    I use the PersistentProxy class for 3 ^ rd ^ class super party. Please see code below for the proxy class.



    @Persistent(proxyFor=AIAMessageHeader.*class*)


    public class AIAMessageHeaderProxy implements PersistentProxy & lt; AIAMessageHeader & gt; {






    public AIAMessageHeader convertProxy() {}


    AIAMessageHeader h = null;


    Some code here


    return h;


    }



    public void initializeProxy (AIAMessageHeader h) {}


    Some code here


    }



    }



    I don't know how to save this proxy class using EntityModel:registerClass method before opening EntityStore. Before the store opened, entity model object is null. I tried to create an object of class AnnotationModel and register, indented by using the StoreConfig setModel method. But no help!



    Can someone put this snippet? Without registration, it throws following exception.



    Exception in thread "main" java.lang.IllegalArgumentException: persistent class superclasse a non-persistent:

    Hi tibo,.

    One of my colleagues told me that it is not possible to use the 3rd party as a base class for a class of @Persistent/@Entity. I can't stand not that, even if the base class has a proxy (as is the case with your code). Proxy classes can only members of @Persistent/@Entity, not their great class classes. Persistent proxies have been designed to instances of any power of Attorney, not only a part of the class of an instance hierarchy.

    We'll fix the javadoc in the next version to reflect this.

    So I think that the answer is to have TestData have a field that refers to your class library.

    Charles Lamb

  • How to operate system class loader in blackberry?

    How the system class loader in blackberry?

    I have a few questions

    * can I load a class with the name of spesific file. for example, I have a file "myclass.txt" at cod. and it's a class file. I can load it?

    ("can I load class as follows: Class.forName("/myclass.txt ");

    * I can load only of class which is the name ends. class. This is a must for file names ends with ".class"?

    * I use Class.forName to load classes. is there another way to load?

    * If a class has a function that is not in the device OS, I can not load. But in the BlackBerry OS does not run applications. However, the OS should throw exception when I try to load this class. is it not?

    The way that J2SE load classes/functions is "properly" so if you tried something like that or used ClassLoader it would be just 'see' setNonSpellCheckable if she was called.

    On BlackBerry, that it is responsible when loading of the entire class, so when loading SpellCheck the native (no developer access) ClassLoader reads everything and said ' wait, I have not this call here, even if it might not get called I don't want to take the risk. "

    Who is?

    A workaround would be something like making a separate file of COD with the device's specific function calls, and then to call, that way if it is not supported on this version of the API that it doesn't get coded into the device specific COD file.

  • Best name for the class that does something...

    Hello!

    I have a doubt as to the naming of the Java classes that are doing something...

    Example: I have a class that are used to calculate a range of available year to generate a report. This class returns a list with the last 5 years from 2011... ex: the list will return in 2013 2012, 2011 etc...

    How can I name this class? His consufing as in the naming conventions, it should be a noun and not a verb.


    Thank you!

    Peey wrote:
    Example: I have a class that are used to calculate a range of available year to generate a report. This class returns a list with the last 5 years from 2011... ex: the list will return in 2013 2012, 2011 etc...

    Is that all that the class has? She has just one method? And the method does nothing to create a list of integers corresponding to the last 5 years? If so, then I have no doubt not would create an entire class just for that. And if it's not everything it does, then it is difficult to propose a name without knowing more about what it really does.

    However, its name must be from a word or phrase that it summarizes responsibilities. The name of ReportHelper which was already proposed may be appropriate, or perhaps ReportUtil. However, if the class is not just for reports, a handful of common tasks dealing with time, but dates and calendars that could be used elsewhere in your application, then maybe TimeUtil or CalendarHelper would be appropriate. Alternatively, if it's just one of the methods, then perhaps this method must be moved to a class ReportGenerator, calculate the list of years where is a step in the task or generating a report.

  • Security class

    Our tree structure, Coroorate is the highest level and has the same security class name. It has 30 child entities and each has a safety class. In our team of consolidation of enterprise accouting, brahim team member need access to all entities to consolidate. Is there an easier way to assign the class of security that the assignment of the entire class of security, including businesses and children?

    in other words, is there a safety class that the member assigned to can see all entities?

    Thank you very much.

    Here's what I do...

    For entities, each entity has its own individual security settings class and a group of correspondent. This is done to ensure that I have control of security level very low. (that is, I want to ensure that people only get access to specific entities they need)

    There are a few cases where entities have the same class, and it's usually because it's really the same company, but they have different lines of business or the places that have been created as.

    Allows you to use the following as an example of hierarchy of entities

    CharlesCorp, SecurityClass=CharlesCorp
         NorthAmerica, SecurityClass=NorthAmerica
              EngineCompanies, SecurityClass=EngineCompany
                     Inline4, SecurityClass=Inline4
                     VEngines, SecurityClass=VEngines
                           8Cylinder, SecurityClass=VEngines
                           6Cylinder, SecurityClass=VEngines
    

    Now, the first thing I do is I create a group for each class and assign access to class/group so that each group has access "All". (assuming that we want here to read/write,...)

    The next thing I do is I work from the deepest point in the hierarchy, and I do the parent group directly above him a member of the lower group. In other words, just as you can add people to groups, you can add other groups.

    Using the example above, the EngineCompany group would be an associate of Inline4 and VEngines.
    The Group North America would be associated with EngineCompany
    The Group CharlesCorp would be partner in North America

    Now if I have a user who needs to access Inline4, I add him to the Group Inline4.
    If I have a group leader who needs access to all of the engines, I have him add to the EngineCompany group. Given that this group is also related to all groups directly below, the user linked to EngineCompany also has access to these entities as well.
    If I have someone at the top level of society, I just add it to CharlesCorp.

    This also gives the now super easy maintenance. If I add a new entity, all I have to do is ensure that the group directly above has access to the entity. I have to make changes to the user number unless they are directly linked to the new group.

    Published by: beyerch2 on January 24, 2012 14:53

  • import a class: how many ways are there? CFC, import, extend the base class

    How many ways is there to import a class and am I confused

    1 screen/public class extends MovieClip

    This inherits all the properties and methods of the MovieClip class so WHY again do we use: import flash.display.MovieClip;

    Import something else or just made the job twice

    2 import flash.display.MovieClip - so no need to extend (repeat me once again - see 1)

    3 CFCS: connect to a CFC

    4. stir in a SWF with a meta tag

    5. in the properties panel menu - add a class as a base class

    OMG - a bit confusing

    You can only "extend" another class if the compiler knows where he is.

    The import statement is only by the compiler to find the class on your hard drive.

    It is not "import" of the entire class in the sense that you import a BMP in Photoshop.

  • How to access the mc of IN the class file

    Hello, I wrote a custom, class and I need to change the attributes of the clip for me, don't know what the syntax, that's what I thought, it was the law, but om a newbie:

    MovieClip (test_mc) .visible = false;

    also tried:

    test_mc. Visible = false;

    This.test_mc. Visible = false;

    This.parent.parent.test_mc. Visible = false;

    This.parent.test_mc. Visible = false;

    This. MovieClip (test_mc) .visible = false;

    Here is the entire class incase you need, thank you in advance;

    package {}
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.display.Sprite;
    import flash.events. *;

    public class mouseScroller extends Sprite {}

    public void mouseScroller() {}


    function runF(e:Event):void {}
    var mX:Number = mouseX;
    var my: number = mouseY;

    If (my < 200 & & my > 100) {}
    trace ("Y" + my);
    FOR X
    If (mX < 100) {}
    trace ("minus" + mX);

    } ElseIf (x > 100) {}
    trace ("greatest" + mX);
    } else {}
    trace ("100" + mX);
    } / / END
    This.parent.test_mc. Visible = false;
    } / / End if statement

    } //end of function F
    addEventListener (Event.ENTER_FRAME, runF);
    } / / end of function main mouseScroller
    }
    }

    I took the liberty of making a few changes:

    Script code:

    var myMouseScroller:mouseScroller = new mouseScroller();
    unless the option access the objects of the ancestor

    you no longer need to add to the display list

    addChild (myMouseScroller);

    myMouseScroller.target = my_mc;

    Your mouseScroller.as:

    package {}
    import flash.display.DisplayObject;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events. *;

    public class mouseScroller extends Sprite {}

    public void mouseScroller() {}
      
    addEventListener (Event.ENTER_FRAME, runFunc);
    }

    public var target: DisplayObject = null;
    function runFunc(e:Event):void {}
      
    If (target == null) {return ;}
    Contains the coordinates of the mouse
    var mX:Number = mouseX;
    var my: number = mouseY;

    If (my<200&&mY>100) {}
    Maintains the speed of Horiz. Movement
    var hRateD:Number = target.x - 2;
    var hRateI:Number = target.x + 2;
    var hRateDF:Number = target.x - 4;
    var hRateIF:Number = target.x + 4;

    If (mX<250 &&test3_mc.x="">300 * /) {}
    If (mX > 150) {}
    Target.x = hRateD;
    test2_mc.x = test2_mc.x - 2;
    test3_mc.x = test3_mc.x - 2;
    } else {}
    Target.x = hRateDF;
    test2_mc.x = test2_mc.x - 4;
    test3_mc.x = test3_mc.x - 4;
    }
    } ElseIf (mX > 350 / * & test_mc.x)<300*>
    If (mX<450)>
    Target.x = hRateI;
    test2_mc.x = test2_mc.x + 2;
    test3_mc.x = test3_mc.x + 2;
    } else {}
    Target.x = hRateIF;
    test2_mc.x = test2_mc.x + 4;
    test3_mc.x = test3_mc.x + 4;
    }

    }
    } / / End if statement

    } //end of function F
    }
    }

  • How instantiate a Singleton persistent

    I have a data access component for access to non-relational databases, and in order to make it useful, I need to allow grouping. What would work better would be if I could instantiate a class singleton when coldfusion starts, but I have no idea how to do that. Is it possible to instantiate a class that persists through the life of the server, or even through the life of a session? The latter would be more than a work around, but I could probably live with it.

    Any help would be appreciated.

    OK if you use Application.cfm the following: -.

    If (NOT structKeyExists (application, "myObj")) {}
    application.myObj = createObject ("component", "path.to.cfc");
    {

    If you are using based onApplicationStart() then Application.cfc then what follows: -.

    application.myObj = createObject ("component", "path.to.cfc");

    If you do not use or then you should be!

  • Without end error App 606 torch reset problem

    Hello

    I am developing an app for the devices RIM supporting the OS version 4.5 and 4.6 +.  In my 4.6 + branch, I ran into a huge problem with this binary file on the torch on the last two official versions of the OS (6.0.0.246 and 6.0.0.449; Versions of Rogers).  Code is built using JDE 4.6, signed using the private key of my company and the RIM SDK buttons.

    If my request is properly installed (loading cable using javaloader - no previous version installed) and as long as it normally stops before the reset, I encounter problems.  If I installed a previous version using javaloader, or I pull the battery when the application is running, the machine can finish is no longer the boot process.  The torch passes through the full operating system loading process, and everything as network connections begin to come to the top and before the coming carrier screen, I get an alert saying "Eception exception: NullPointerException", another alert saying "Eception exception: java.lang.Error" and then a white screen saying "App Error 606" and a line below to say "Reset".  After reset of the device this ever again, no matter how many times I reset.  The device is actually brick until you force remove my application using javaloader, after which, the unit returns to the normal operating state.

    This problem does not occur if the application has not been used (I can install over it as much as I like, as long its persistent store has not been created).  This leads me to believe that there is a bug in the implementation of permanent storage in these OS versions.

    Attach the debugger through the startup process gives a large number of unknown uncaught exceptions during the final stage of startup (several hundreds).  The most interesting part of the log, contains the following debug messages, probably from the implementation of the Application Manager.  This is repeated several times, indicating that the AM cannot go beyond initialization after several attempts to start and dies by timeout in an unrecoverable state:

    AM: Started net_rim_bb_browser_daemon(300)
    AM: Exit net_rim_bb_browser_daemon(300)
    AM: NullPointerException
    AM: No detail message
    AM: net_rim_bb_browser_lib-3(4D389E92)
    AM:  BrowserDaemonRegistry
    AM:  
    AM:  0x226F
    AM: net_rim_bb_browser_lib-3(4D389E92)
    AM:  BrowserDaemonRegistry
    AM:  setInstance
    AM:  0x2453
    AM: net_rim_bb_browser_lib-3(4D389E92)
    AM:  BrowserImpl
    AM:  
    AM:  0x4650
    AM: net_rim_bb_browser_daemon(4D389EA8)
    AM:  BrowserLoader
    AM:  main
    AM:  0x81
    ApplicationManagerImpl.processExited : process process switching to background:  pid=300
    

    I'd be more than happy to send a replication mechanism binary and full of a person on BOARD to help solve this problem.

    I solved the problem and I thought that others here could benefit from my experience with this.

    In the code of my Persistent Store app, I was stretching from ContentProtectedVector and ContentProtectedHashtable and marking these as Persistable classes so that they could make in the persistent store.  For example:

    public class Attributes extends ContentProtectedHashtable implements Persistable
    

    Neither the compiler nor the JVM complained when these classes have been committed in the persistent database, and they behaved properly on simulators and devices with OS versions 4.5 - 5.0, without any problem.  Versions 6.x BBOS will accept this code as well, but on a cold (battery pull) start, I got the following error in the log (id and package name changed to anonymize my organization signatory):

    CMM: net_rim_cldc-11(5967) no sig from 0xFFFFFFFF
    module 5967 cannot reference com.xxxxxxx.client.model.Attributes
    

    While the API seems to confirm this, something in the cldc seeks to inspect the store persistent on cold start, and it seems to fail when it encounters an object that is a subclass of a Persistable class pre-existing and Persistable.  If this behavior is that it should be in the documentation Persistable and all classes of the RIM that implement Persistable.

    Since the current Persistable JavaDocs:

    A class must explicitly implement this interface for the system store instances of the persistent class. Subclasses inherit any implementation of this interface. In the following example, Bar instances may persist, because the class does not explicitly implement the Persistable interface (if you try to store an object of bar in the persistent store, the camera fires a JVM error):

    This seems to imply that extend a Persistable class and Persistable implementation is the path provided (for example, if you do not want to stock the bar from the example of the JavaDoc).

  • When Parent, the child is not getting saved.

    Hello
    I have 2 entities

    Public parent()
    {
    int A;
    int B;
    Child of the child;

    @ManyToOne (waterfall = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn (name = "child_id", nullable = false)
    public child getChild() {}
    Return this.child;
    }
    }

    public Child()
    {
    int child_Id;
    int Y;
    The value < Parent > parents;

    @OneToMany (fetch = FetchType.LAZY, mappedBy = "child")
    public Set < Parent > getParents() {}
    Return this.parents;
    }

    }

    Then
    Parent P = new Parent();
    Class c Child = new Child();
    ....
    I put values for classes of the mother and the child
    p.setChild (c);

    So, when I save the parent class

    entityManager.persist (parent);

    Ideally, it should save the child. But she got the following error. My mapping entity were not manually written. They were generated by eclipse. So I guess that as long as the database mapping is correct by the entity mapping will be also correct.

    +
    Caused by: openjpa - 1.1.1 - SNAPSHOT-error no fatal store r422266:807362 > org.apache.openjpa.util.StoreException: ORA-02291: integrity (PARENT_R03) violated constraint - found parent key
    {prepstmnt 4234 INSERT INTO PARENT (A, B, CHILD_ID) VALUES (?,?,?,?,?,?,?)} {[(null), (null) null, null, (BigDecimal) 58608]} [code = 2291, State = 23000]
    FailedObject: com.ejb.entity.Parent@337261
    at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4207)
    at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4171)
    at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
    at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:72)
    at kodo.jdbc.kernel.BatchingPreparedStatementManager.flushInternal(BatchingPreparedStatementManager.java:214)
    at kodo.jdbc.kernel.BatchingPreparedStatementManager.flushInternal(BatchingPreparedStatementManager.java:112)
    at kodo.jdbc.kernel.BatchingPreparedStatementManager.flush(BatchingPreparedStatementManager.java:72)
    at kodo.jdbc.kernel.AutoOrderUpdateManager.flush(AutoOrderUpdateManager.java:84)
    at kodo.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:68)
    at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:89)
    at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:549)
    at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
    at org.apache.openjpa.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:554)
    at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
    ... more than 49
    +
    As you can see the CHILD_ID was generated. But I think that the order in which it gets commited is different. Please let me know if I need to change the configuration of my entity to make it work.

    Jebus, a column of ID of BigDecimal. You must have the intention to store the whole universe in there. I never managed to go on a primary key to precision 10 sequence generated to myself...

    Same difference: sound in rear. You have a card with a RfuiRfDef child and a child of RfuiRfDef belonging to many cards. Huh?

    In this scenario, I see only one true way to persistence it.

    -persist RfuiRfDef child object to a managed JPA entity
    -assign the child entity MANAGED RfuiRfDef to RfuiRfLgcMap object
    -persist RfuiRfLgcMap object to a managed JPA entity
    -to be complete, paste the RfuiRfLgcMap parent entity at the address now managed in the game of rfuiRfLgcMaps of the child object

    That translates into SQL statements; You cannot persist the Map object when there is firstly a RfuiRfDef record so you can store a foreign key relationship itself.

    I see a waterfall ALL slapped on everything (this is not recommended, don't use generated code as is the case, you must understand what it all does and adjust according to what is safe and necessary) - maybe it will work if you persist in fact the object of RfuiRfDef as follows:

    -create the child object RfuiRfDef
    -create the RfuiRfLgcMap object (with the game in the RfuiRfDef object)
    -stick RfuiRfLgcMap object in the game of RfuiRfDef.rfuiRfLgcMaps
    -persisted child object RfuiRfDef

  • Please help me: problem hard charting to Apex 4

    Hi guys, it's me again!

    I'm having a hard time creating a chart in the apex oracle 4.0. I wish it were a graphic flash with a trendline.

    The trend line is not very important right now, my problem is in the construction of the SQL query to generate this table. I'm wondeing if you could help.

    A quick overview of what it is supposed to do: children in a school to pass the exams for different academic courses. A student could write multiple reviews for the same course. Each of these reviews may contain one or several "Sections" (think of the Section A, Section B, etc.). Each section has its own amount of 'points' that contributes to the maximum overall score of the review. Pretty simple. Now the total scores of these reviews are all added to make a maximum score in a whole topic. Performance of the student in each course must be represented on the Board in a series, while the average score for an entire class is represented in another series. This bar graph to compare the overall performance of the student with the average performance of her entire class.

    Simply put, I ask the creating a chart bars flash that compares the maximum scores for each course with another. Once I know how to do this, it is pretty easy to figure out the rest. Now to explain my structure of database in detail:

    The course called "mathematics degree" for example, are stored in a table named COURSE. Its title is stored in a field called "COURSETITLE. The primary key of the table RACE is called "COURSEID".

    Each course can be delivered to several groups of class at a time. To manage this relationship, I have a table called COURSEOFFERING that allows to record multiple instances of the same class, each instance being delivered to another group of students. The primary key of the table COURSEOFFERING is called 'COLD '.

    A review takes place in what concerns a COURSEOFFERING (and not a course, as a group of classes do not have to write the same examinations as the other class includes will). Exams are stored in a table called REVIEW. The primary key of the table is 'EXID. Of course, there is a foreign key called 'COLD' that references the primary key of the table COURSEOFFERING.

    Now each review contains sections. These sections have their maximum point scores. The primary key of the table of SECTIONS is called 'SECID '. The field that stores the value of point of each section is called 'POINTS '.

    So if we have for example a review on "Mathematics in Cambridge" which is given to the class of Grade a pretty good mention, and it contains the Section has a value of 20 points and Section b which is worth 30 points, you have a review that is worth 50 points. If another review as it is worth 100 points when you add up the value of its sections, the maximum possible in mathematics from Cambridge to the honours class rank is 150. Similarly, the Grade One Special Ed class can have a different maximum possible score, according to reviews that they write to you.

    I created a function compiled successfully, and it DOES not work with the data (I tried to do a region of PL/SQL out of it and the display of some of the results). It returns the maximum value that is possible on a subject that takes in the ID of the COURSEOFFERING table as an argument which is titled v_coid. I don't know how to make a chart that shows the result of this function from the TITLE of the COURSE offered.

    create or replace function "MAXCOMARKS"
    (v_coid in NUMBER)
    return NUMBER
    is
    l_sum number;
    l_exid number;
    l_cotitle varchar2(50);
    exam_rec exam%rowtype;
    sections_rec sections%rowtype;
    cursor c1 IS SELECT * FROM EXAM WHERE COID = v_coid;
    cursor c2 IS SELECT * FROM SECTIONS WHERE EXID = l_exid;
    
    BEGIN
    
    l_sum :=0;
    SELECT coursetitle INTO l_cotitle FROM COURSE WHERE courseid= (SELECT courseid from COURSEOFFERING where coid = v_coid);
    FOR exam_rec in c1
    LOOP
        l_exid := exam_rec.exid;
        FOR sections_rec in c2
           LOOP
              l_sum := l_sum + sections_rec.points;
           END LOOP;
    END LOOP;
    
    return l_sum; 
    
    END;
    Note that the l_cotitle stores the title of the course, these marks are for. It is not returned, or printed or anything in this function, but I need that she either label X for each result in the series.

    Please help me, he had me conduit nut to do such a simple little thing.

    Sorry if this is long... :(
    -C

    Yes, the 'function of PL/SQL returning a SQL command' can be used to produce this type of query (or practically any other type, as long as the PL/SQL function returns valid SQL). I tend to limit the use of the "functions of PL/SQL that return requests" to the reports and charts that really need, which usually means a situation where the query must be built dynamically.

    In any case, I'm glad I could help.

    Tobias

  • Elegantly #2044 Error handling

    Hello, I'm working on a simple script that tried to join my server to check the validity of a combination of username/password MD5 encrypted to a login page for the school. The server returns the name of the school as a sign of success, and Flash stores the credentials in a SharedObject to facilitate future connections. It all works well jolly in ideal conditions.

    However, when the conditions are not ideal, as when my server is down or the user loses the connection to the internet, we are facing a screen infinite "connection to the server. Flash then throws a nice:

    Error opening URL " http://www.example.com/checkLogin.php ".
    Error #2044: Unmanaged by ioError:. Text = Error #2032: error flow. URL: http://www.example.com/checkLogin.php

    to Login$ / () login

    My question is: what is the best way to catch this error, so that I can present the user with a graceful explanation of why the connection is not successful? My first instinct was to put a try-catch inside the connection function, as you can see in the code below, but that doesn't seem to do the trick.

    Any suggestions are appreciated. The code for the entire class is as follows:

    Try/catch will not work because it is an asynchronous event. Instead, you must add an ioError event listener.

    I think you want to add something like this:

    loginURLLoader.addEventListener (IOErrorEvent.IO_ERROR, ioErrorHandler);

Maybe you are looking for

  • Has it helped you? Where can I buy memory cards

    Where can I buy memory cards.  After you download El Capito, I got nothing else problems. The photos are mixed. He runs slowly. The beachball is there more steps.

  • What is the key of information system?

    Greetings, I pressed accidentally some keys, what caused this next dialog box: Does anyone know the shortcut key to get that back? My laptop does not have a Pause/break key. Thank you Shane.

  • Parental control blocks Family Feud 2

    I'm at my wits end... I have vista, a user (Administrator) account, parental, controls are not on that I know and I have no other software with parental controls on my computer. I have tried uninstalling and reinstalling family rivalry 2 and get a po

  • HP Envy 4500th: abnormal termination: black does not print

    4500th HP Envy printer gave "abnormal termination, possible damage" message only once , when I recently turned printer (I think that I had previously disabled the front strip of the printer had completed the stop).  Since then, (almost brand new XL c

  • Flashing monitor

    The power button on my Dell monitor started blinking on and outside, with no visible image, except a brief flash of light. I am running Windows XP and I use service pack 2. (I had a bad experience, installation of other service packs, so I am wary of