Dynamic Shared Object - Is This Possible?

What I want in my app is to have 2 tilelists and an array collection of items which will populate the first tilelist and these objects can be dragged between both tilelists. Then the user can click a save button which will save the statuses of both tilelists so the items that are present/not present in each tilelist when the app is closed will still be there when the app is restarted.
The problem is I want my array collection to be populated dynamically from mysql data on a server.
I have no problem getting dynamic data from a mysql database into an array colllection via http request and I have no problem getting the shared object to work IF the array collection is defined within the app the usual way but I'm having trouble getting these 2 things to work together. 
Can anybody tell me if it is indeed possible to have a dynamically populated array collection stored as a shared object on the user's system and would anyone be willing to help me out if I post my code so far? Cheers.

Hi Greg. The way I usually post code is by clicking the small arrows above and then clicking syntax highlighting and then xml. The problem is this seems to remove all of the quotation marks ("") from my code which is what is causing the errors you mentioned. I've posted it below just by simply copying and pasting. I hope that works better. Cheers for your help:-
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication 
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="newsService.send(); initprofile1NewsAndSportSO()">
<mx:Script><![CDATA[
 import mx.rpc.events.ResultEvent; 
import mx.collections.*; 
import flash.net.SharedObject; 
public var profile1NewsAndSportSO:SharedObject; 
Bindable] 
private var profile1NewsAndSportaddLinksFullAC:ArrayCollection; 
Bindable] 
private var profile1NewsAndSportaddLinksAC:ArrayCollection; 
private function newsResultHandler(event:ResultEvent):void{
profile1NewsAndSportaddLinksFullAC=newsService.lastResult.newscategory.news
as ArrayCollection;profile1NewsAndSportaddLinksAC=newsService.lastResult.newscategory.news
as ArrayCollection;}
// private var profile1NewsAndSportaddLinksFullAC:ArrayCollection = new ArrayCollection([
// {label:"BBC News"},
// {label:"ITV"},
// {label:"Sky News"}
// ]); // private var profile1NewsAndSportaddLinksAC:ArrayCollection = new ArrayCollection([
// {label:"BBC News"},
// {label:"ITV"},
// {label:"Sky News"}
 private function profile1NewsAndSportReset():void{resetprofile1NewsAndSportAC();
profile1NewsAndSportAddLinksTilelist.dataProvider = profile1NewsAndSportaddLinksAC;
profile1NewsAndSportLinkChoice.dataProvider =
new ArrayCollection([]);}
private function resetprofile1NewsAndSportAC():void{profile1NewsAndSportaddLinksAC.removeAll();
for each(var obj:Object in profile1NewsAndSportaddLinksFullAC){profile1NewsAndSportaddLinksAC.addItem(obj);
private function initprofile1NewsAndSportSO():void{profile1NewsAndSportSO = SharedObject.getLocal(
"profile1NewsAndSport"); 
if(profile1NewsAndSportSO.size > 0){ 
if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList){ 
if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList != "empty"){ 
var profile1NewsAndSportaddList:Array = profile1NewsAndSportSO.data.profile1NewsAndSportaddList.split(","); 
var profile1NewsAndSporttempAC1:ArrayCollection = new ArrayCollection(); 
for each(var str:String in profile1NewsAndSportaddList){ 
for each(var obj1:Object in profile1NewsAndSportaddLinksAC){ 
if(str == obj1.label){profile1NewsAndSporttempAC1.addItem(obj1);
continue;}
if(profile1NewsAndSporttempAC1.length > 0){profile1NewsAndSportAddLinksTilelist.dataProvider = profile1NewsAndSporttempAC1;
if(profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList){ 
var profile1NewsAndSportchoiceList:Array = profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList.split(","); 
var profile1NewsAndSporttempAC2:ArrayCollection = new ArrayCollection(); 
for each(var str2:String in profile1NewsAndSportchoiceList){ 
for each(var obj2:Object in profile1NewsAndSportaddLinksAC){ 
if(str2 == obj2.label){profile1NewsAndSporttempAC2.addItem(obj2);
continue;}
if(profile1NewsAndSporttempAC2.length > 0){profile1NewsAndSportLinkChoice.dataProvider = profile1NewsAndSporttempAC2;
else{profile1NewsAndSportReset();
private function saveprofile1NewsAndSport(event:MouseEvent):void{ 
var profile1NewsAndSportaddList:String = ""; 
if(profile1NewsAndSportAddLinksTilelist.dataProvider){ 
if(ArrayCollection(profile1NewsAndSportAddLinksTilelist.dataProvider).length > 0){ 
for each(var obj1:Object inprofile1NewsAndSportAddLinksTilelist.dataProvider){
profile1NewsAndSportaddList += obj1.label +
else{profile1NewsAndSportaddList =
"empty";}
profile1NewsAndSportSO.data.profile1NewsAndSportaddList = profile1NewsAndSportaddList;
var profile1NewsAndSportchoiceList:String = ""; 
for each(var obj2:Object inprofile1NewsAndSportLinkChoice.dataProvider){
profile1NewsAndSportchoiceList += obj2.label +
profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList = profile1NewsAndSportchoiceList;
profile1NewsAndSportSO.flush();
]]>
</mx:Script>
 <mx:HTTPService id="newsService" resultFormat="object" result="newsResultHandler(event)" url="http://www.coolvisiontest.com/getnews.php"/> 
<mx:TileList id="profile1NewsAndSportLinkChoice" fontWeight="bold" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="166" width="650" top="5" left="521" columnCount="5" rowHeight="145" columnWidth="125" backgroundColor="#000000" color="#FFFFFF">
 <mx:itemRenderer>
 <mx:Component>
 <mx:Canvas width="125" height="129" backgroundColor="#000000">
 <mx:Image source="{'http://www.coolvisiontest.com/interfaceimages/images/'+ data.icon}" top="5" horizontalCenter="0"/>
 <mx:Label text="{data.label}" bottom="1" horizontalCenter="0"/>
 </mx:Canvas>  
</mx:Component>
 </mx:itemRenderer>  
</mx:TileList>
 <mx:TileList id="profile1NewsAndSportAddLinksTilelist" fontWeight="bold" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="166" width="385" top="5" left="128" columnCount="3" rowHeight="145" columnWidth="125" backgroundColor="#000000" color="#FFFFFF">
 <mx:itemRenderer>
 <mx:Component>
 <mx:Canvas width="125" height="129" backgroundColor="#000000">
 <mx:Image source="{'http://www.coolvisiontest.com/interfaceimages/images/'+ data.icon}" top="5" horizontalCenter="0"/>
 <mx:Label text="{data.label}" bottom="1" horizontalCenter="0"/>
 </mx:Canvas>  
</mx:Component>
 </mx:itemRenderer>  
</mx:TileList>
 <mx:Button click="profile1NewsAndSportReset()" id="reset" label="Reset" y="5" height="25" x="5"/>
 <mx:Button click="saveprofile1NewsAndSport(event)" id="save" label="Save Changes" x="5" y="38" width="113" height="25.5"/>
 </mx:WindowedApplication>

Similar Messages

  • Creating dynamic datasources. Is this possible?

    Can I create a 'subset datasource' from an existing datasource
    and then pass this subset datasource to the <jbo:RowsetIterate>
    Let's assume I have a datasource containing 100 records.
    How is is possible to create a new datasource from the exiting datasource
    which will contain 10 records and then this new data source will be passed
    to <jbo:RowsetIterate>?
    I'd like to write a JSP Tag which reads the datasource and creates a subset datasource
    dynamically
    public class SubsetDS extends TagSupport
         public int doStartTag() throws JspException
            ApplicationModule am  = dataSource.getApplicationModule();
            ViewObject vo = am.findViewObject("V0");  
             while(vo.hasNext()){
            Row r = vo.next();
                   // Iterate based on a certain condition and put the new records
            // in a dynamically created DataSource
    Is this possible?

    I don't know about the custom JSP tag part, there is a <jbo:CreateViewObject> tag and ApplicationModule.createViewObject() methods for defining ViewObjects at runtime. We were not able to locate a mechanism for actually running a query against one VO to select rows for a second VO (whether defined at compile-time or runtime). We created a VO at runtime so we could base it's result set on another VO.
    See "Ways to Add a View Object Instance to the Data Model at Runtime" topic in JDev help (we're using 10.1.2, but there's a <jbo:CreateViewObject> tag going back to at least 9.0.3.3); I located using JDev's Help's text search for createviewobject.
    In our case, because the two queries were related (subset), we obtained the where clause from the VO that we defined at compile-time and whose where clause is being set at run time by values passed in from an HTML query form. We then applied that where clause to the dynamically created VO to get the desired subset.
    Hope that gives you a starting place and helps.

  • Installing the Apache HTTP Server Plug-In as a Dynamic Shared Object

    My environment is: Windows 2000 Server SP3 + Apache 2.0.45 + WebLogic 7.0 SP2
    I followed the install guide.
    1. Locate the shared object file for your platform. >>> No problem
    2. Enable the shared object. >>> No problem
    3. Install the Apache HTTP Server Plug-In in the Apache server with a support
    program called apxs (APache eXtenSion) that builds DSO-based modules outside of
    the Apache source tree, and adds the following line to the httpd.conf file:
    >>> I don't know how to do this. where can I find apxs,
    >>> and should I add "AddModule mod_so.c" in httpd.conf
    >>> I did it, but Apache -t tell me:
    >>> Syntax error on line 173 of D:/Program/Apache/Apache2/conf/httpd.conf:
    Invalid command 'AddModule', perhaps mis-spelled or defined by a module not incl
    uded in the server configuration
    I don't understand the 4th step, where can I find 'perl' and how to use it?
    thanks.

    For Apache 2.x I think you use LoadModule instead of AddModule. That's what
    the docs say anyway.
    "muli" <[email protected]> wrote in message
    news:3ed558aa$[email protected]..
    >
    My environment is: Windows 2000 Server SP3 + Apache 2.0.45 + WebLogic 7.0SP2
    >
    I followed the install guide.
    1. Locate the shared object file for your platform. >>> No problem
    2. Enable the shared object. >>> No problem
    3. Install the Apache HTTP Server Plug-In in the Apache server with asupport
    program called apxs (APache eXtenSion) that builds DSO-based modulesoutside of
    the Apache source tree, and adds the following line to the httpd.conffile:
    I don't know how to do this. where can I find apxs,
    and should I add "AddModule mod_so.c" in httpd.conf
    I did it, but Apache -t tell me:
    Syntax error on line 173 ofD:/Program/Apache/Apache2/conf/httpd.conf:
    Invalid command 'AddModule', perhaps mis-spelled or defined by a modulenot incl
    uded in the server configuration
    I don't understand the 4th step, where can I find 'perl' and how to useit?
    >
    thanks.

  • Shared variables - is this possible?

    Post Author: hafr
    CA Forum: Formula
    I am trying to design a Crystal XI report that has subreports in a group footer section.  I would like to calculate formulas in the main report using subreport group totals.  The report design looks like this:
    Formula1 = Subreport1/5 totals divided by subreport4/8 totals times Value              Subreport1             Subreport5
    Formula2 = Subreport2/6 totals divided by subreport4/8 totals times Value              Subreport2             Subreport6
    Formula3 = Subreport3/7 totals divided by subreport4/8 totals times Value              Subreport3             Subreport7
    Value                                                                                Subreport4             Subreport8
    I have successfully used subreports with shared variables before, but I cannot figure out any way to get the correct results in this case.
    Thanks in advance for any assistance or suggestions.
    hafr

    Post Author: V361
    CA Forum: Formula
    hafr, I have several reports like that.  I take the subreport elements and make them as tiny as possible.   Say font size of 3 or 4 point, make the fields very tiny, and make the subreport as tiny as possible.  I then put it in a section and make the section as small as possible.  This does not eliminate it from showing on the report, but sometime I can hide the subreports behind other objects.

  • Dynamic Form? Is this possible?

    Hello
    I am trying to create a application to store Biblography references so researchers dont forget who they are citing. It will be similar to an address book, but with different form fields depending on the type of reference.
    For the form where users enter the different fields for a reference, rather than making a form for every type of reference I am trying to make a dynamic generic screen which adds fields depending on the type of reference. To do this I have a string array for each type of reference, which contains the names of all the required fields e.g.
    private String[] bookCitation = { "Title", "Author", "Edition", "Series or Volume Number" "Publisher", "Year of Publication", "Place of Publication"};
    private String[] websiteCitation = { "Title", "Author", "Edition", "Series or Volume Number" "Publisher", "Year of Publication", "Place of Publication"};
    private String[] selection;
    Then in the form screen, the system looks at what type of source the user chose (which is stored to string array variable 'selection' ), and then measures the length of that array, then initates a 'for' loop that creates textfields for each of the fields.
    I have declared 10 textfield variables at the start of the java file with the names field_0, field_1, field_2 ... field_9. (More can be added later if required)
    What I want to know if this is a feasible method in java, and also how could i change the number of the textfield variable to field_x, for each instance of the for loop. e.g when x = 0, i want field_0. I could use a catch statement for each field number if necessary, but this method looks more efficient if it works.
    Here is the code for the entry screen;
    private Screen addEntryScreen()
    addEntryScreen = new Form("New Reference");
    addEntryScreen.addCommand(cancelCommand);
    addEntryScreen.createCommand(addCommand);
    addEntryScreen.setCommandListener(this);
    for(x = 0, x < selection.length, x++)
    field_x = new TextField("selection[ x ]", null, 50, TextField.ANY);
    newProjectScreen.append(field_x);
    for(x = 0, x < selection.length, x++)
    field_x.delete(0, field_x.size());
    display.setCurrent(addEntryScreen);
    return addEntryScreen;
    I hope that all made sense
    Many Thanks
    Max

    I have declared 10 textfield variables at the start of the java file with the names field_0, field_1, field_2 ... field_9. (More can be added later if required)
    No! Use an array or Vector of TextFields.
    this method looks more efficient if it works.So you couldn't try it to discover that it doesn't?
    It looks like you need to spend some time in core java before you continue in Java ME apps. here's a link to the tutorial:
    {color:0000ff}http://java.sun.com/docs/books/tutorial/index.html{color}
    Learn to use arrays and Vector.
    There are a few other points I would like to make about your code:field_x.delete(0, field_x.size());is equivalent to but less easy to read thanfield_x.setText("");Your method addEntryScreen () returns a Form object addEntryScreen, which is confusing. It would be better to call the method getEntryScreen () and have it return entryScreen, which would be setCurrent by the calling routine.
    addEntryScreen.createCommand(addCommand);Form does not have a method createCommand.
    In this linefield_x = new TextField("selection[ x ]", null, 50, TextField.ANY);you are setting the String "selection[ x ]" and not the contents of selection [x] as the label for the TextField.
    Try to get a good grounding in the basics, it'll serve you well later.
    luck, db
    To post code, use the code tags -- [code]Your Code[/code]will display asYour CodeOr use the code button above the editing area and paste your code between the tags it generates.

  • ST22 Dumps: Shared Objects

    Hi SDN,
    in our SRM System, SRM Server 5.5, WAS700 ABAP, we get ST22 Short Dumps concerning "shared objects".
    This is the Dump Short Analysis:
    Runtime Errors         SYSTEM_NO_SHM_MEMORY                                    
    Date and Time          19.08.2008 12:20:50                                                                               
    Short text                                                                    
         No more memory for 2516576 bytes in the shared objects memory.                                                                               
    What happened?                                                                
         The shared objects memory is full or an area management specified         
         memory limit has be reached.                                              
    In heard, that "shared objects" is part of the new WAS 620, 640, 2004s, 700 ... releases
    What are exactly these shared objects. And how can we avoid the dumps?
    We have an instance profile parameter set:
    abap/shared_objects_size_MB                 100
    Apparently this is not enough... Are there any recommendations?
    thanx, matthias

    Take a look at [Note 972757 - Occurence of the SYSTEM_NO_SHM_MEMORY runtime error|https://service.sap.com/sap/support/notes/972757] for further information. You should investigate what is using the shared objects memory, it may be an error in a application. The note will help to determine this.
    Regards,
    Nelis

  • Shared Objects, iCloud, and inApp Purchasing

    Here is the scenario:
    All game data is saved in a Local Shared Object. This includes game un-locks and items that the user has purchased using in-app purchaes.
    Will the player be able to down load this shared object from the cloud if they play the game on another device?  Does Apple require in-app purchased 'items' to be stored in  a special way?  I've read some people having issues with Shared Objects in the past, so I'm curious on what the current 'best practices' are.
    Thanks,
    -dis

    Dis, Hi.
    If you want to use non-consumable IN APP PURCHASE - you don't need use any saving for restoring on other devices.
    Non-consumable it's products, that you can buy once. For unlock for example from LITE to FULL version. Than you can save it as Local Shared Object.
    When you will buy it again - APP STORE will not get money again but will return product as Buyed (as new) and you will see it as 'restored'.
    App Store don't provide any downloads. It's return only JSON parameters like 'restored', 'purchased' and etc. All rest you do on your device

  • Shared Object Size Limit

    I know with web apps in flash there is only a certain amount of data you can store in shared objects.Does this also apply to air?

    I think so. For a large amount of data( only strings, numbers ) you can choose SQLite as an alternative.

  • How can I convert client-side Shared Object in server-side Shared Object?

    Hello world....
    I have a problem...
    I have a program that uses client-side shared Object, like the Example "Ball" il the FMS 3.5 guide: I can move a ball around the stage...
    I need to convert this program so I can use server side shared object. This is because I can load the .swf to another .swf and I must to be able to reset, or delete, the properties of my shared object. With client-side sahred object I can't delete or reset the shared object after I loaded my external .swf....
    My script is:
    private var pointer1_so:SharedObject;
    nc=new NetConnection  ;
    nc.connect (rtmpNow);
    nc.addEventListener (NetStatusEvent.NET_STATUS,doSO);
    Cerchio=new cerchio ;
    addChild (Cerchio);
    Cerchio.x=220;
    Cerchio.y=280;
    Cerchio.addEventListener (MouseEvent.MOUSE_DOWN,beginDrag1);
    Cerchio.addEventListener (MouseEvent.MOUSE_UP,endDrag1);
    private function doSO (e:NetStatusEvent):void
                 good=e.info.code == "NetConnection.Connect.Success";
                 if (good)
                       //Shared object
                       pointer1_so=SharedObject.getRemote("point1",nc.uri,false);
                       pointer1_so.connect (nc);
                       pointer1_so.addEventListener (SyncEvent.SYNC,doUpdate1);
    private function doUpdate1 (se:SyncEvent):void
                 for (var cl1:uint; cl1 < se.changeList.length; cl1++)
                       trace(se.changeList[cl1].code);
                       if (se.changeList[cl1].code == "change")
                            switch (se.changeList[cl1].name)
                                 case "xpos" :
                                       Cerchio.x=pointer1_so.data.xpos;
                                       break;
                                 case "ypos" :
                                       Cerchio.y=pointer1_so.data.ypos;
                                       break;
    private function beginDrag1 (e:MouseEvent)
                     Cerchio.addEventListener (MouseEvent.MOUSE_MOVE,moveMc1);
                     Cerchio.startDrag (false,Rect1);
    private function endDrag1 (e:MouseEvent)
                     Cerchio.stopDrag ();
    private function moveMc1 (e:MouseEvent)
                e.updateAfterEvent ();
                   pointer1_so.setProperty ("xpos",Cerchio.x);
                   pointer1_so.setProperty ("ypos",Cerchio.y);
    Can someone helps me?
    I know I need of a server side script but...
    Please...
    Emiliano.

    ResultSet is not serializable. It is an active connection. If you wish to serialize the info, then read it into an ArrayList in your serializable class and pass the Data that way.

  • Are Cross Domain Flash Local Shared Objects (LSO aka Flash Cookie) possible

    Hi,
    I found several solutions for creating Flash LSOs from JavaScript (for example: http://www.nuff-respec.com/technology/cross-browser-cookies-with-flash )
    If Page (www.hostA.com/index.html) and the .swf file are from the same site, everything works fine.
    Now I'm trying to load the page form www.hostA.com/index.html, which includes www.hostB.com/flashcookie.swf (different sites). But then I cannot read or store the LSO.
    I have tried several configurations (crossdomain.xml,  Security.allowDomain("...") ), but nothing works.
    Is this kind of cross domain access to a LSO possible?
    Can a flash based advertisement delivered by a 3rd party save a LSO on my disc?
    Thanks
    -stephan

    I 100% agree!  We have an application that the Government requires information to be stored on the users computer as part of Multi-Factor-Authentication.  We originally wrote it as a browser application and when everyone and their brother started deleting browser cookies because of security concerns, we totally re-wrote it as a Flash application to take advantage of permanent storage.  This new "feature" in Flash Player is causing much concern because thousands of users will need to start answering lots of security questions every single time they use the application (ie: daily) and our staff is having to handle technical support questions that shouldn't exist.  Right now it's only IE that's causing the issue, but I'm sure every browser and Internet Security program will soon be adding this to their products.  There should at least be a way for the USER to white-list a specific Domain so Flash could exempt those sites from ANY external program trying to delete ALL Shared Objects/Local Storage/Flash Cookies.  The USER should be given that choice.  This would satisfy the extra privacy you are putting in there and still allow information to be stored from sites that require it.
    John

  • I have an ipad and iphone sharing icloud.  The ipad is using 268mb, the iphone 2.6.  My plan is 5gb but it keeps saying I don't have enough space to back them up.  How is this possible?

    I have an ipad and iphone sharing icloud.  The ipad is using 268mb, the iphone 2.6.  My plan is 5gb but it keeps saying I don't have enough space to back them up.  How is this possible?

    Hey sameyrs2,
    Thanks for the question. Based on what you stated, it seems like you are getting a message when trying to backup to iCloud. I would recommend that you read these articles, they may be helpful in troubleshooting your issue.
    iCloud: Understanding Backup alert messages
    Manage your iCloud storage
    Thanks for using Apple Support Communities.
    Cheers,
    Mario

  • Shared object and different application servers - how to resolve this issue

    Dear SDN Members,
    We are occuring a big problem. We create a shared object in a program and after we call in an another one. In central system architecture, it is working well. But on a distributed architecture (4 application servers), we have a dump some times. In fact, the read of the shared object can be occured in the AS 4 but the share object has been created in AS1.
    How to manage this problem to avoid this dump ?
    Dupplicate the shared object in the application servers ?
    Encapsulate different calls with RFC link to only one AS ?
    Any parameters on server or share objects ?
    Thanks a lot for your help,
    Points will be given to right or good answers.
    Br,
    Aurélien

    What is the dump you are getting ?
    AFAIK, "Shared Memory"(SHM) is an area defined in the app server. I am not sure if you can access SHM of a different app server (as in your case trying to access SHM of AS1 from AS4). [http://help.sap.com/abapdocu_70/en/ABENSHARED_MEMORY_GLOSRY.htm]
    In this case you can opt for "DataBase Clusters". Relevant ABAP statements: [IMPORT|http://help.sap.com/abapdocu_70/en/ABAPIMPORT_MEDIUM.htm#!ABAP_ALTERNATIVE_4@4@]/[EXPORT|http://help.sap.com/abapdocu_70/en/ABAPEXPORT_DATA_CLUSTER_MEDIUM.htm#!ABAP_ALTERNATIVE_4@4@] FROM/TO DATABASE.
    Hope this helps.
    BR,
    SUhas

  • This[id] doesn't see dynamically created objects????

    Hey all!
    If i have
    <mx:Canvas id="TopCanvas" initialize="Init()">
    <mx:Canvas id="VisibleCanvas" >
    </mx:Canvas>
    </mx:Canvas>
    <fx:Script>
    function Init(){
    var NewO = new Canvas();
    NewO.id="InvisibleCanvas";
    TopCanvas.addChild(NewO);
    if (this["VisibleCanvas"]){
    //We can see non-dynamically created canvas
    if (this["InvisibleCanvas"]){
    //ERROR we cannot see the new one!
    Help please! How to access dynamically created Canvases via their id? I know i can save linkage to them in array, but i need to do it through id.
    Cheers!

    If you set the id property on a dynamically created instance, you can check
    the id of an instance later if it happens to be a target of an event, for
    example.  But it will not be assigned to a variable in the document.
    By default, MXML generates a non-dynamic class so you can't add properties
    to it at runtime.  You can set the name property and search the immediate
    parent by calling getChildByName, but if the parent is not the document, you
    still can't search the document.

  • Imlementing synchronized access to shared objects in LabVIEW OOP

    Many objects in object-oriented programming have an
    identity, such as a file, a front-panel object or a hardware device.
    These objects cannot be modelled using present LabVOOP (LabVIEW Object Oriented Programming) objects as
    LabVOOP objects gets copied as wire is branched; multiple different
    wires cannot all represent a single object. This issue has been
    irritating the community of LabVIEW users since the release of LabVOOP
    a few months ago.
    It seems that there is a huge demand for
    objects with unique identity i.e. by-reference objects in LabVIEW. The
    central problem why LabVOOP propably doen't have these objects is the
    difficulty in implementing synchronized access to these objects from
    multiple parallel threads. The problem of synchronized access can be
    divided into two different separate topics. First how the
    sychronization should be implemented in LabVIEW runtime engine. Second
    how this synchronization mechanism should be visible to the developer.
    I'd like to start this thread to discuss these two issues.
    Synhronization under the hood
    Traditionally
    people talk about locking of an object and about get-modify-set pass
    when accessing the object. Locking is traditionally done by acquiring a
    mutex for an object, modifying the object and releasing the mutex so
    that other threads can access the same object instance. This is how
    inter-thread synchronization is traditionally done. However, besides
    the mutex based locking, the computer science community has innovated
    also different kinds of methods on synchronizing the access to objects.
    One way to get object-level synchronization is modify the
    runtime engine so that it only allows a single method of a synchronized
    object to run at any time. This mechanism of syncrhonization is
    implemented in programming languages like O'Haskell, which is a Haskell
    variant with object orirented features.
    Also different
    transactional mechanisms[1,2] have been successful. In transactional
    mechanisms multiple threads are allowed to access a synchronized object
    simultaneously. As each method accessing an object commits their
    changes, they verify that no other object has modified the object
    simultaneously in a manner than would break the transaction. If such a
    modification has occurred, everything is rolled back. Transactional
    mechanism do not suit to every possible situation as not everything can
    be rolled back. For example it's hard to roll back an action that
    somehow modifies the physical world.
    User experience of synchronization
    How
    the synchronization is generally implemented in LabVIEW shouldn't be
    directly visible to the developer end-user. The developer should
    understand the general concepts of synchronization to take full
    advantage of it, but in general the synhronization mechanism should be
    integrated directly to development environment. There should in general
    be no need to acquire a mutex by calling acquire mutex node but instead
    the end-user should be able to specify which data needs synhronized
    access in more sophisticated way.
    In the following I propose a
    mechanism of integrating the synchronized access of by-ref objects to
    the development environemnt of LabVIEW. The proposal is very
    preliminary but I hope it breaks the ice and the community would start
    innovating in how should NI implement the syncrhonization support in
    the user interface of LabVIEW.
    Wire level synchronization
    Only
    methods can access object private data members. In synchronized access
    to the object, it's the methods accessing the private data members that
    need to be synchronized. The private data members are accessed by
    applying unbundle node to the class wire and data is written back to
    the object using bundle node.
    What I propose is the following.
    An unbundle node could either be normal or "synchronized". A
    synchronized unbundle would guarantee the access to the private data
    members in synchronized manner. All data wires originating from
    synchronized unbundle would be of synchronized type, in a little
    similar manner as a dynamic dispatch wire is of special dynamic
    dispatch type. Such a wire must evetually be connected to a bundle
    node. When the wire is bundled back to the originating object, the
    synchronization requirement is released.
    These synchronized
    wires would look somewhat different from normal wires so that the
    developer instantly knows that the wire is synchronized. The developer
    can branch the wire, but only one wire branch can own the synchronized
    type. The developer could easily select which wire would be
    syncrhonized by Ctrl+clicking the wire. Such a wire can be considered
    as a combination of a data and a mutex, even though mutexes don't need
    to be the underlying synchronization method. The wire just guarantees
    that there is a mechanism in the runtime engine that makes sure the
    access to the wire data is synchronized.
    There is a need to wire
    data originating from a non-synchronized wire to a synchronized wire so
    that it can replace the private data member of the class. This is
    accomplished with a new node similar to bundle node, that would allow
    replacing the data in a syncrhonized wire with some data originating
    from a non-synchronized wire.
    The synchronized wire can be
    connected to a front panel controls of special syncrhonized type. This
    way the synchronized wire can originate from a method and allow passing
    the synchronized data to the calling VI and back to another method.
    This is practical for example in a situation when the developer wants
    to run different analyzes to a data class but don't want to rewrite all
    the existing data analysis tools as class members. So the developers
    writes a syncrhonization acquiring getData method that let's the
    calling VI to access the syncrhonized data. Then the developer passes
    this data to an analysis VI and passes the result back to a setData
    method that writes the result back to the class wire.
    There
    will probably be technical problems in allowing the user to connect
    such a synchronized wire to all existing VIs since these VIs. Therefore
    the programming model for all nodes that do not support such
    synchronized wires will be branching the wire and passing the
    non-synchronized wire branch to the node and then bundling the result
    back to the synchronized wire.
    To increase performance and
    decrease unnecessary buffer copies when a syncrhonized wire is
    branched, if the syncrhonized wire continues directly to the new bundle
    synchronized wire node, no buffer copy is made.
    Discussion
    The
    syncrhonized access to a by-ref LabVOOP objects can be implemented in
    multiple ways by National Instruments. The synchronized access should
    be divided to two different and independent parts: 1) the user
    experience of synchronization and 2) the runtime engine synchronization
    mechanisms. As LabVOOP objects have special properties compared to
    other LabVIEW data types, optimal user experience can be gained by
    designing the user experience specifically for LabVOOP objects. From
    user experience point-of-view this syncrhonization mechanism may not
    work for other data types. Separating object syncrhonization from
    synchronization of other data types is advantageous also for other
    reasons. Due to the fact that object data can only be accessed via
    object methods, more advanced synchronization methods may be used with
    objects than can be used with other data types. O'Haskell
    synchronization implementation is an example of this. Integrating the
    synchronization directly to the user interface allows NI to change the
    mehcanisms under the hood, when computer science comes up with more
    advanced methods. Therefore NI could begin with traditional and quite
    easy mutex-based synchronization and later move to more advanced
    perhaps transaction based syncrhonization methods or even combinations
    of multiple different methods.
    I hope this topic generates
    discussion that would help NI to implement an excellent synchronization
    mechanism in LabVOOP. I hope that all talented individuals in the
    community participate this discussion to help NI to reach this goal. I
    also hope that if you just have time, it would be great if you could
    surf the computer science resources to find out what kinds of new
    techniques there exists for synchronizing access to shared resources. A
    Large community may find much more innovative solutions than a few engineers at NI. Let's give NI the power of open source design
    Tomi Maila

    Hello Tomi,
    First, thank you for taking the time to write such a well
    though-out suggestion.  Are you familiar
    with the “LabVIEW Object-Oriented Programming: The Decisions Behind the Design”
    document?  I think the reason we chose to implement a ‘by
    value’ strategy, is that is more in line with the LabVIEW programming paradigm
    of dataflow, and would make sense to most of our LabVIEW users.
    I think your suggestion is interesting, and it does
    highlight the need to think outside of the conventional LabVIEW box and look to
    some of the innovative things other languages do.  However, I think we all agree that
    synchronization takes careful planning and extra work for the programmer.  Even with an ‘ideal’ solution I see no way
    around this.  For LabVIEW users today,
    one great way to get synchronized ‘by reference’ semantics with your objects is
    to use a single-element queue to pass your object.  The queue itself is passed ‘by reference’ and
    is inherently synchronized!  The does
    have the disadvantage of adding one more small layer of complexity to your
    program, but some complexity would have to be introduced in any situation.  The other disadvantage with this is that it
    is not always an intuitive way to implement your program and requires some
    amount of LabVIEW knowledge before one would generally come across this
    technique.
    In any case, I appreciate the time and effort you put in to
    your suggestion.  Please make sure that
    you submit the suggestion formally through the NI Product Suggestion Center so
    that it can be reviewed by some of the decision makers here.
    Thanks again,
    Travis M
    LabVIEW R&D
    National Instruments

  • Master-detail with dynamic view object

    How can you create a view link with a view object that is dynamic? I have created a master-detail relationship on a UIX page. I change the master view object at runtime using a view definition and SQL and then I bind the view object to an iterator on a UIX page. I need the new dynamic view object to maintain the link between the detail view object. Is this possible?
    The reason why I have to change the view object at runtime is because I am implementing a search module and the tables in the from clause can be modified at runtime so I need to have a dynamic view object.
    Thanks,
    Sanjay

    After playing around with ViewObjectImpl's setQuery() method some more I found out that this solution might not work for me due to the following reason: when the user tries to sort a column in the result table, the original contents of the view object get executed instead of the run time query.
    <p>
    I would like to go back to my original solution that included creating a view definition based on the runtime query and then creating a view object from that which I bind to the RowSetIterator. The missing piece to the master-detail functionality is with the detail Iterator being in sync with the master. I have tried the following but I get a ClassCastException <p>
    DCIteratorBinding detailBinding = ctx.getBindingContainer().findIteratorBinding("DetailIterator");
    detailBinding.getViewObject().<b>setMasterRowSetIterator</b>(masterBinding.getRowSetIterator());
    <p>
    here is the relevant stack trace:
    java.lang.ClassCastException
    at oracle.jbo.client.remote.ViewUsageImpl.getImplObject(ViewUsageImpl.java:1829)
    at oracle.jbo.client.remote.RowSetImpl.setMasterRowSetIterator(RowSetImpl.java:512)
    at oracle.jbo.client.remote.ViewUsageImpl.setMasterRowSetIterator(ViewUsageImpl.java:1147)
    at oracle.jbo.common.ws.WSViewObjectImpl.setMasterRowSetIterator(WSViewObjectImpl.java:1005)

Maybe you are looking for