Weak references for variables

Hello,
UseWeakReference exists for addEventListener and for dictionaries. Is there any way to set a variable to be a weak reference? Kind of like WkPtr<> in boost for C++? I'd like to use this for function callbacks, amongst other things. Would hate to have to wrap everything in a dictionary as a hack.
Thanks!

Alex,
Not quite what I was hoping for as an answer, but it's an answer nonetheless.
Thanks!
Mark

Similar Messages

  • Weak reference for MapListeners?

    I create objects which implement MapListener and then I register those objects with a CQC. If at some later time the only reference to that object is from the CQC, I would like that object to be garbage collected and the MapListener obviously unregistered. My understanding is that if I create objects and register them as MapListeners, they'll never be GC'd unless I unregister them. Is that right? For my application I'd like the CQC's reference to my MapListener to be a weak reference. Am I correct about all this? Can anyone suggest a work-around for me?
    Thanks,
    Andrew

    Hi Andrew,
    CQC (or any of the named cache implementations for that matter) isn't designed to treat listeners weakly, so there really is no clean way of doing what you are asking that I know of. The only thing I can think of is to wrap the other references to your listener object to incorporate a finalizer that will then turn around and unregister the "weak" listener, upon finalization.
    For example:
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.MapEvent;
    import com.tangosol.util.MapListener;
    import java.util.Iterator;
    import java.util.HashSet;
    import java.util.Set;
    public class MyListener
            implements MapListener
        * The map listener object to wrap.
        * @param listener  the map listener
        public MyListener(MapListener listener)
            m_listenerInternal = listener;
        * Register this listener with the specified cache.
        * @param cache  the named cache to register this listener with
        public void registerWeakListener(NamedCache cache)
            cache.addMapListener(getListenerInternal());
            m_setCache.add(cache);
        // ----- MapListener interface ----------------------------------------
        * {@inheritDoc}
        public void entryInserted(MapEvent evt)
            getListenerInternal().entryInserted(evt);
        * {@inheritDoc}
        public void entryUpdated(MapEvent evt)
            getListenerInternal().entryUpdated(evt);       
        * {@inheritDoc}
        public void entryDeleted(MapEvent evt)
            getListenerInternal().entryDeleted(evt);
        // ----- internal -----------------------------------------------------
        protected MapListener getListenerInternal()
            return m_listenerInternal;
        private MapListener m_listenerInternal;
        private Object      m_finalizer        = new Object()
            public void finalize()
                MapListener listener = m_listenerInternal;
                for (Iterator iter = m_setCache.iterator(); iter.hasNext(); )
                    ((NamedCache) iter.next()).removeMapListener(listener);
        private Set         m_setCache         = new HashSet();
        }

  • Currency Translation not working with "Time Reference from Variable"

    We have created several Currency Translations using RSCUR with a fixed "Key Date".  All have been working fine until we got the request to allow a variable date for the exchange rate date.  I have built a variable on 0DATE which I am putting a default date value into using user exit.  This default date is the SAME date as the fixed "Key Date" which we have been using.  Unfortunately when we use the "Time Reference from Variable" option and use this new variable, no currency conversion is taking place, instead it only shows the original currency values.  I am 100% sure that my variable is getting a value and it is the same date we are using for the fixed "Key Date" value so both methods should be using the exact same exchange rates.  The documentation that I can find states:
    ●      Time reference: The time reference for the currency translation can be either fixed or variable.
    If the time reference is fixed, the time at which the exchange rate is determined is independent of the data. You have the following options:
    ○       You can establish that the time reference be determined upon translation.
    ○       You can select the current date.
    ○       You can specify a fixed date as the key date.
    ○       You can specify any variable that exists for InfoObject 0DATE.
    ○       You can establish that the query key date be used. This is determined in the query settings.
    In my case I am only switching from option "You can specify a fixed date as the key date"=(Key Date) to "You can specify any variable that exists for InfoObject 0DATE"=(Time Reference from Variable).
    What am I missing?  Any help is appreciated.

    I neglected to mention that we are calling this currency translation through a WAD button using the SET_CURRENCY_TRANSLATION command.  I did do a test by applying the currency conversion within query key figure.  This seems to work.  So it appears the issue is with how the WAD is processing the variable, not the query.  When I display the variable in a drop down item within the WAD it does have the default value that I have assigned in user exit.

  • Getting Menu Reference for a VI other than the current one

    Is there any way to get a Menu reference for a VI that isn't the current VI? There's Current VI's Menubar, but that only works on the current VI. I'd like something that does the same thing, but accepts a VI reference to a higher-level VI. I would expect to find a Property Node entry for it, but there doesn't seem to be one. This is for 8.2.

    eaolson wrote:
    A functional global is what I wound up using. It just seems odd to me that there's no other way to get access to that reference.
    It also seems counter-intuitive to me that a Shortcut Menu reference is only valid inside that particular frame of the Event Structure that caught it. If you're using a producer-consumer architecture, you can not send that refnum off to the consumer loop for handling; it can only used within that frame of the Event Structure.
    I am not sure what you mean. The refnum seems to be accessible from everywhere .
    As i wrote above:
    You can store the Menu Reference to a global variable for example, and you can read it, in any vi you want, just like all variables.
    Note: Do not try to use a property note. Use the menu functions

  • Are weak references cleared with soft ones?

    Suppose a program holds both weak and soft references to an object X. Suppose the virtual machine clears all the soft references at once, making X weakly reachable. Is the virtual machine guaranteed to clear all the weak references next before normal execution resumes?
    I ask because I am setting up an automatic interning system for immutable objects of a certain class that will guarantee that at most one object of a given value is reachable by the rest of the program at one time but will allow objects to be garbage collected if necessary. I need to decide what reference object(s) to keep to each interned object. If I keep only a weak reference, objects will be discarded at the whim of the virtual machine; I would prefer to keep them around longer so they don't have to be recreated so many times. If I keep only a soft reference, I am concerned that another part of the program might keep a weak reference. If the answer to my question above is "no", the soft reference could be cleared and the interning system could create a second object with the same value while the first is still accessible via the weak reference. It seems safest to keep both a soft reference and a weak reference and only recreate the object if the weak reference has been cleared.

    Softs hang around until memory needs dictate theygo.
    In my experience (Apple's 1.4 VM) this appears to be
    as soon as GC is run, making them effectively
    useless. Maybe VMs have improved.Not in my experience (Sun 1.4 VM). Soft references hang around forever. I had to stuff my class with bloat to make the instance larger, then change the VM heap size to get it to start collecting my soft references. Whereas the weak references are dumped ASAP. Inside scoop has it that finalizers will delay object collection a bit so be careful of that.
    Also the only guarantee is that soft is cleared before weak when they refer to the same object. in my experience weak references go quickly. Like at the first GC when they are weak. You can not depend on any timing with respect to when the weak will be cleared. I don't think the spec even guarantees that soft will be enqueued before weak. Im not sure on that point.

  • Soft/Weak References: rule of thumbs?

    After reading <a target="extern" href="http://java.sun.com/developer/technicalArticles/ALT/RefObj/index.html">Reference Objects and Garbage Collection</a> i browsed my code and replaced my listener containers with versions that store WeakReference objects. The main idea is to avoid memory leaks by storing references to objects that are not needed anymore (the listener container is the only strong reference left).
    Another rule is to use SoftReferences for caches. But I haven't figured out a good way of implementing it (for caches that fill itself with one single SQL statement).
    Are there any other examples where it's good advice to use Soft/Weak References?

    For listeners, you have to make sure that the listener object is hard referenced - which is usually the case. After you release the listener object from the main application/object/thread, because it's finished or you don't need it anymore, the listener holder should not hold on to such references to avoid OutOfMemoryExceptions. Of course, the best way is always to unregister a listener, but unfortunately, we're not living in a perfect world. No listener is forced to unregister, they can simple forget to unregister. For this reason, it's better to tell the listener: if you register yourself, you should know that you are just referenced via WeakReferences. If the listener suddenly doesn't get listener events, this is a coding error which can be traced and fixed. But if a listener forgets to unregister itself, the resulting memory bloat is much harder to trace.
    SQL table caches are difficult. On one hand you want to cache the data, on the other, you want to free this cache memory (temporarily) for more important memory usage. It's always a trade off between 2 advantages. If performance is not the big issue, but you get OutOfMemoryExceptions, then this is critical for the application to continue working. Better a little slower than not at all ... ;-)

  • PLS-00487: Invalid reference to variable 'RC_PARAMSGET'

    Oracle 9.2 client ORA 8.1.7 Server:
    Trying to run an SP in SQL navigator ( or PL/SQL)
    I get the following error(s)
    ORA-06550: line 6, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 6, column 3:
    ++++++++++++++++++++++++++++++++++++++++++++
    Here's the Package and Proc Code with the errors at the end.
    It seems not to like a Ref Cursor, but I'm not experienced enough to know the reason.
    ANy Help would be very appreciated: AJACODE
    ++++++++++++++++++++++++++++++++++++++++++++
    --Package Spec
    Package RPT_NB_GUI_Param_Get_PKG
    IS
    TYPE rc_Params_gettbl IS RECORD (
         o_QueryID          Number,
         o_ParameterID          Number,
         o_Param               VARCHAR2 (20),
         o_Param_Type          VARCHAR2 (50),
         o_Param_QueryID          Number
    TYPE rc_params IS REF CURSOR RETURN rc_Params_gettbl;
    END; -- Package Specification RPT_NB_GUI_Param_Get_PKG
    --+++++++++++++++++++++++++++++++++++++++++
    -- Proc
    Procedure RPT_NB_GUI_Param_Get_PROC
    p_QueryID in Number ,
    rc_ParamsGet IN OUT RPT_NB_GUI_Param_Get_PKG.rc_Params)
    IS
    -- Purpose: To generate Parameters for GUI
    -- MODIFICATION HISTORY
    -- Person           Date      Comments
    -- AJ Grasso           04/11/2003      Created
    BEGIN
    OPEN rc_ParamsGet For
    SELECT
    QP.QueryID
    ,P.ParameterID
    ,P.Parameter
    ,PT.Parameter_Type
    ,PQ.Parameter_QueryID
    FROM
    rpt_Query_Parameter QP, rpt_Parameter P, rpt_Parameter_Type PT, rpt_parameter_query PQ
    WHERE --inner join rpt_Parameter P ON
    (QP.ParameterID = P.ParameterID)
    AND --inner join rpt_Parameter_Type PT  ON
    (QP.Parameter_TypeID = PT.Parameter_TypeID)
    AND --left outer join rpt_parameter_query PQ  ON
    (QP.Parameter_queryID = PQ.parameter_queryID)
    AND (QP.QueryID = p_QueryID) ;
    END; -- RPT_NB_GUI_Param_Get_PROC
    -- ERRORS
    -- +++++++++++++++++
    ORA-06550: line 6, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 6, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 7, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 7, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 8, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 8, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 9, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 9, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 10, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 10, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 16, column 74:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 16, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 17, column 78:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 17, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 18, column 71:

    Oracle 9.2 client ORA 8.1.7 Server:
    Trying to run an SP in SQL navigator ( or PL/SQL)
    I get the following error(s)
    ORA-06550: line 6, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 6, column 3:
    ++++++++++++++++++++++++++++++++++++++++++++
    Here's the Package and Proc Code with the errors at the end.
    It seems not to like a Ref Cursor, but I'm not experienced enough to know the reason.
    ANy Help would be very appreciated: AJACODE
    ++++++++++++++++++++++++++++++++++++++++++++
    --Package Spec
    Package RPT_NB_GUI_Param_Get_PKG
    IS
    TYPE rc_Params_gettbl IS RECORD (
         o_QueryID          Number,
         o_ParameterID          Number,
         o_Param               VARCHAR2 (20),
         o_Param_Type          VARCHAR2 (50),
         o_Param_QueryID          Number
    TYPE rc_params IS REF CURSOR RETURN rc_Params_gettbl;
    END; -- Package Specification RPT_NB_GUI_Param_Get_PKG
    --+++++++++++++++++++++++++++++++++++++++++
    -- Proc
    Procedure RPT_NB_GUI_Param_Get_PROC
    p_QueryID in Number ,
    rc_ParamsGet IN OUT RPT_NB_GUI_Param_Get_PKG.rc_Params)
    IS
    -- Purpose: To generate Parameters for GUI
    -- MODIFICATION HISTORY
    -- Person           Date      Comments
    -- AJ Grasso           04/11/2003      Created
    BEGIN
    OPEN rc_ParamsGet For
    SELECT
    QP.QueryID
    ,P.ParameterID
    ,P.Parameter
    ,PT.Parameter_Type
    ,PQ.Parameter_QueryID
    FROM
    rpt_Query_Parameter QP, rpt_Parameter P, rpt_Parameter_Type PT, rpt_parameter_query PQ
    WHERE --inner join rpt_Parameter P ON
    (QP.ParameterID = P.ParameterID)
    AND --inner join rpt_Parameter_Type PT  ON
    (QP.Parameter_TypeID = PT.Parameter_TypeID)
    AND --left outer join rpt_parameter_query PQ  ON
    (QP.Parameter_queryID = PQ.parameter_queryID)
    AND (QP.QueryID = p_QueryID) ;
    END; -- RPT_NB_GUI_Param_Get_PROC
    -- ERRORS
    -- +++++++++++++++++
    ORA-06550: line 6, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 6, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 7, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 7, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 8, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 8, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 9, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 9, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 10, column 16:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 10, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 16, column 74:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 16, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 17, column 78:
    PLS-00487: Invalid reference to variable 'RC_PARAMSGET'
    ORA-06550: line 17, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 18, column 71:

  • Cannot create weak reference to 'classobj' object

    I am trying to run the python Script in a C# program using Iron Python I am getting this type of Error
    cannot create weak reference to 'classobj' object
    I am using this code for running the python code
    var ironPythonRuntime = Python.CreateRuntime();
    try
    dynamic loadPython = ironPythonRuntime.UseFile("Program.py");
    catch (Exception ex)
    Console.WriteLine(ex.Message);

    Hi Mahesh,
    About IronPython issue, It's third-party product.  Please redirect to IronPython forum.  The link as below.
    https://ironpython.codeplex.com/workitem/list/basic
    After search this error,
    this thread tells me.
    Try to use virtualenv. It is used to separate many instances of python and it's libraries - you can have as many virtual environments as possible: python 2.5 , 2.6 , 2.7, whatever - with any combinations of libraries - so you can have for example five
    python 2.6 instances with different sets of libraries configured.
    By the way, here is also a blog talking about
    Running IronPython Scripts from a C# 4.0 Program
    Now I will move your thread to "off-topic" forum. Thanks for your understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • PLS-00487: Invalid reference to variable ' expression '

    oracle database 10G
    OS unix
    One of procedure is giving error PLS-00487: Invalid reference to variable '<expression>' while compilation in above database while it is compiling
    successfully in other database.
    Is there any database error?

    PLS-00487: Invalid reference to variable "string"
    Cause: A variable was referenced in a way that is inconsistent with its datatype. For example, a scalar variable might have been mistakenly referenced as a record, as follows: DECLARE CURSOR emp_cur IS SELECT empno, ename, sal FROM emp; emp_rec emp_cur%ROWTYPE; my_sal NUMBER(7,2); BEGIN ... total_sal := total_sal + my_sal.sal; -- invalid ...
    Action: Check the spelling of the variable name. Make sure the variable was declared properly and that the declaration and reference are consistent regarding datatype.
    Most probably the compiler "sees" some other type variable with the same name first which in the other database doesn't exist or is out of scope.
    Regards
    Etbin

  • Error:Invalid reference to variable 'PARTS1.PNUM%TYPE' - how to resolve

    error:
    ERROR at line 29:
    ORA-06550: line 29, column 39:
    PLS-00487: Invalid reference to variable 'PARTS1.PNUM%TYPE'
    ORA-06550: line 29, column 4:
    PL/SQL: SQL Statement ignored
    DECLARE
    cursor c1 is select pnum from parts1;
    TYPE NumTab IS TABLE OF parts1.pnum%TYPE INDEX BY PLS_INTEGER;
    TYPE NumTab1 IS TABLE OF parts1.pnum%TYPE INDEX BY PLS_INTEGER;
    --TYPE NameTab IS TABLE OF parts1.pname%TYPE INDEX BY PLS_INTEGER;
    pnums NumTab;
    pnums1 NumTab1;
    -- pnames NameTab;
    --iterations CONSTANT PLS_INTEGER := 500;
    t1 INTEGER;
    t2 INTEGER;
    t3 INTEGER;
    l_num_index integer := 0;
    BEGIN
    FOR j IN 1..50000 LOOP -- load index-by tables
    insert into parts1 values(j);
    END LOOP;
    commit;
    t1 := DBMS_UTILITY.get_time;
    /* FOR i IN 1..iterations LOOP -- use FOR loop
    INSERT INTO parts1 VALUES (pnums(i));
    END LOOP;
    select pnum bulk collect into pnums from parts1;
    t2 := DBMS_UTILITY.get_time;
    open c1;
    loop
    l_num_index := l_num_index + 1;
    fetch c1 into pnums1(l_num_index).pnum;
    EXIT WHEN c1%notfound;
    end loop;
    close c1;
    t3 := DBMS_UTILITY.get_time;
    DBMS_OUTPUT.PUT_LINE('Execution Time (secs)');
    DBMS_OUTPUT.PUT_LINE('---------------------');
    DBMS_OUTPUT.PUT_LINE('FOR loop: ' || TO_CHAR((t2 - t1)/100));
    DBMS_OUTPUT.PUT_LINE('FORALL: ' || TO_CHAR((t3 - t2)/100));
    COMMIT;
    END;
    thanks,
    vinodh

    The line number in the error message is nearly always a good clue.
    fetch c1 into pnums1(l_num_index).pnum;should be
    fetch c1 into pnums1(l_num_index);

  • Weak References in Listener Lists

    I've found a common source of memory leaks is when objects that add themselves to listener lists forget to remove themselves when they are done.
    It would be nice to generalize and say that listener lists should contain weak references, but there are probably valid cases where a listener's only valid reference is through the listener list.
    It would be nice to extend the listener pattern so that the listener could specify if they should be referenced weakly, for examplemodel.addChangeListener(this, true)where true indicates the reference to the listener should be weak.
    In some cases like the Model View Controller pattern, it probably makes sense that whenever a view listens to a model it should be weakly referenced. For example, when you construct a JTable and pass the model as a parameter to the constructor, the JTable should always specify a weak reference when it listens to the model.
    I think supporting a feature like this in the listener APIs could help reduce the potential for memory leaks and make code a little more maintainable.

    There was another time that I dabbled in this idea.
    But it always comes back to objects cleaning up
    after themselves. Now if its not your code and you
    cant ensure good behavior, then perhaps there is
    cause. But I'd keep an assert and report the issue
    if I saw it trigger.What would fire the assert? The Listener will never be garbage collected while it is listening to something. I assume that you are talking about when the listener is a Swing Object like a JFrame. I don't really like to use gui components as listeners.
    If you have to write a clean up method, it kind of defeats the value of having automatic garbage collection to a degree. I like to be able to let my Objects just fall out of scope or just become unreachable when they are no longer needed without having to actively manage their deallocation.

  • Time reference from variable in crcy transl. type

    Hi guys,
    does anybody know, where to create the variables displayed in RSCUR, when I want to create a crcy. transl. type with time reference from variable?
    Thanks in advance, Clemens

    Hi,
    With  step by step :
    http://www.sapdb.info/wp-content/uploads/2008/11/bw-howtousevariablestimereferencesincurrencyconversion.pdf
    with  steps and Definitions :
    http://www.scribd.com/doc/7061035/How-to-Use-Variables-for-Currency-Conversion
    The time reference for the currency translation can be either fixed or variable.
    If the time reference is fixed, the time at which the exchange rate is determined is independent of the data. You have the following options:
    ○       You can establish that the time reference be determined upon translation.
    ○       You can select the current date.
    ○       You can specify a fixed date as the key date.
    ○       You can specify any variable that exists for InfoObject 0DATE.
    ○       You can establish that the query key date be used. This is determined in the query settings.
    If the time reference is variable, the time at which the exchange rate is determined is decided by a time characteristic value.
    ○       A variable time reference can, for example, be determined using the end or start of a fiscal year or calendar year, a period and a month u2013 or even to the exact day. The following standard time characteristics are available: 0FISCYEAR, 0FISCPER, 0CALYEAR, 0CALQUARTER, 0CALMONTH, 0CALWEEK and 0CALDAY.
    ○       The time reference can also be determined using a customer-specific InfoObject of type date (for example, trading day). Note that this InfoObject has to have the same properties as the standard InfoObject selected in the variable time reference or must reference it.
    ○       You can specify an InfoSet: This is only necessary if you are determining the target currency using an InfoObject that exists in the InfoSet more than once. You enter the field alias so that the InfoObject can be specified uniquely.
    In the Business Explorer, you can only set time variable currency translations in query definition, and not for an executed query. See also Setting Variable Target Currency in the Query Designer.
    ○       In the Time Adjustment field of type INT4, you can specify whole numbers with a +/- sign.
    ○       In the Time Adjustment from Variable field, you can specify formula variables (1FORMULA). As these values of the variables may have to be whole numbers, they are rounded to whole numbers (integers) where necessary.
    The time adjustment (regardless of whether it is fixed or variable) is always related to the InfoObject specified under Variable Time Reference.
    Example of a time adjustment of -3:
    The variable time reference is To the exact day and the InfoObject under Variable Time Reference is 0CALDAY. Instead of 07.11.2006, after the time adjustment, 04.11.2006 is used for the translation.
    The variable time reference is End of Week and the InfoObject under Variable Time Reference is 0CALWEEK. Instead of 52.2004, the week 49.2004 is calculated and the end date is calculated from this.
    For more info pls refer this link:
    http://help.sap.com/saphelp_nw2004s/helpdata/EN/80/1a6806e07211d2acb80000e829fbfe/content.htm
    I hope these will helps you.
    Thanks .
    Hema

  • IPhone: Database records that reference a variable

    Hello All,
    Firstly let me say that I am a total newbie to the iPhone and mac programming in general so please be gentle on me.
    An application I am working on pulls a bunch of dialogue text out of a database and I would like to have a person's name (whenever its used in the database records) reference a variable so i can change it easily everywhere its said.
    For instance consider the database record: "Hello there BOB, how are you doing?" (just one of many such statements involving bob). I'd like to easily change this (and all other dialogues) to: "Hello there JAMES, how are you doing?
    is there a way to put some special string in the database records so that they reference a global variable or some such? In keeping with the above; something like "Hello there @testName, how are you doing?
    Thanks.

    Thanks for the speedy reply. I think I understand the basics of string formating:
    for instance NSString *greeting = [[NSString alloc] initWithFormat:@"Hi there, %@!",
    nameString];
    means (if i'm correct) a variable called greeting is of the type NSStrin and is assigned the value of "hello [whatever is in the value of some other string called namestring]".
    My question is can we have code like this right in a database record...or is that problematic?
    Again I am very new to this all so please forgive my ignorance. I don't even know how to setup/access a sql database on the iPhone. I'm reading through the docs...but its quite a lot of stuff to take in. Thanks.

  • Global reference for columns

    Lets say I have three columns, A, B, and C. I want C to always be A-B. I can do this now but I always have to put in the row number, i.e. the formula for row 6 column C would be ( =a6-b6 ) and I have to put in the row number individually for each of the C column formulas. I would rather just put in a variable which would do it for each row automatically.

    If you enter
    =A2-B2 in cell C2
    you may fill the entire column without changing the row num by hand.
    Select the cell C2 then drag its bottom_right circular handle to the bottom of the column.
    The cells will be filled with an auto-adjusted row number.
    I used the short reference very often but since a few months I'm back to the complete reference for three reasons :=
    (1) if I export a spreadsheet to Numbers '08, the transcoder code will use the complete references. So I assumed that it may be a hidden reason.
    (2) As the User Guide never describe the short reference, I'm afraid that a new application version drop the short reference
    (3) I'm not sure that the short syntax is faster than the 'official' one.
    Yvan KOENIG (VALLAURIS, France) lundi 6 décembre 2010 19:15:22

  • Garbage Collection Weak References

    Can someone please explain to me the point of Weak References.
    here is what i understand
    // we have a strong reference object
    String strong = new String("i am a strong reference");
    // we create a weak reference object
    Reference wr = new WeakReference(strong);
    Now what i have understood from my readings is that now when strong dereferences the object that was initially created the garbage collector deallocates the memory for that item.
    but what is the point of a WeakReference?

    This might be useful for you.
    http://java.sun.com/developer/technicalArticles/ALT/RefObj/

Maybe you are looking for

  • Incoming EDI payment advise - open item not found

    Hello, I introduced the process of incoming EDI payment advise but with manual posting by using transaction F-28. Some positions in the EDI PA could not be assign to an open item. I have a total amount, cash discount and net amount in the position li

  • Problem with check_changed_data

    hello I have added a checkbox and a button to a ALV Grid report. When the checkbox is ckecked and the button is pushed, the record with the checkbox used for further processing. I have been searching thru the SDN and it looks like I need to use the "

  • Date format in Dutch

    Hi, I am using a query to display a date. I am selecting TO_CHAR (c.DAY_DATE, 'DD mon YYYY') where DAY_DATE is of type DATE I am getting the following result: 05 oct 2011 This is in English. Is there a way to get it in Dutch language, such as: 05 okt

  • Strange JTable/JViewport resizing

    Folk'ses, i have a strange problem with a JTable and its viewport when i change the data and column model. * autoResizeMode is set to AUTO_RESIZE_ALL_COLUMNS. * all my columns have a minimum size * when i change my data and column model i do not get

  • Problem:statement cannot be reached

    this program should compute the factorial numbers with recursion and iteration. But now,this error occurs:Fak.java [37:1] Statement not reached. return fak; ^ 1 error This is my program: import java.io.*; * @author *** * @version public class Fak ext