Assigning an array to a ListCollectionView

I have a ListCollectionView that I want to add a listener to
so I can respond to changes, but the problem here is that I have to
assign an array to it. When I do this:
myListCollectionView = new ArrayCollection(myArray);
It removes all listeners. Is there any other way to force an
array into a ListCollectionView? When I do this:
myListCollectionView = myArray as ArrayCollection;
or
myListCollectionView = ArrayCollection(myArray);
I get an error.
Alternately, is there an event I can listen to on a TileList
that will let me know when the dataProvider has changed? I can't
seem to find anything that works.
P.S. Assigning a new ArrayCollection also seems to remove
ChangeWatchers as well.

Ok I ended up having to do this:
myListCollectionView.disableAutoUpdate();
myListCollectionView.removeAll();
for each (var thing:Thing in thingArray) {
myListCollectionView.addItem(thing);
myListCollectionView.enableAutoUpdate();
and then hooking into the onUpdateComplete event (fires after
the TileList redraws itself:
myTileList.addEventListener("onUpdateComplete",
myEventHandler);

Similar Messages

  • Problem in assigning script array to Js variable

    There is a huge list(20,000) of cities that has to be put into a script array for the further use in the jsp page. so this script array is created once for all when the login is made for the application and stored a session variable. The sample of the script array is like-----
    <script>
    strArrCityName[17463]= "Zoar";
    strArrCityID[17463]= "10599";
    strArrCityStateID[17463]= "3";
    strArrCityName[17464]= "Zoarville";
    strArrCityID[17464]= "10600";
    strArrCityStateID[17464]= "3";
    </script>
    the entire stuff from <script>---</script>(uncluding the script tags is stored as a string in the session (strSessionCityArr))
    Now the porblem is i need to store this array into a js variable on jsp page load.
    I order to that i need to declare a js variable in jsp page
    ex::
    <html>
    <body>
    This is a sample jsp page created by <%= strUserName%>
    <script>
    var cityarry = "<%=session.getAttribute('strSessionCityArr')%>";
    </script>
    </body>
    </html>
    when i assign the array to the js variable , the <script> tag inside the string is conflicting with the <script> tag that of the jsp page.
    This throws the js error and the futher loading of the page is stopped.
    The reason i am storing it in the js variable is i will be painting the script array dyanamically on click of a button.
    Also in need both the script tags in the array is in other jsp pages i will painting the array on page load by using the out.println(strCityArray)
    I need a way in which this script array can be stored in js variable or any method by which i can directly get it from the session on button click
    Thanx in advance
    Manu

    i had tired constructing the script array using the JS but JS logic is always slower ...my point was not to do it all with JS code. My point was that unless you know how to properly define it as JS-only code, then it makes it hard to figure out how to break that up to Java generated code. It's clear to me that you don't have a very good grasp of what you're trying to do.
    The second point is, in some JSPs i need the <script> tags to be included in the array. No they don't. You can always put the <script> tags around what your Java variable includes if you are using that content in several places...
    <script><%= session.getAttribute('strSessionCityArr') %></script>

  • Assign global array of structures of structures of std strings in a dll

    I have a dll which consists of three c files. Find bellow the c file of the loader and the three files of the dll. In dll, file 1 and file 2 are almost identical, static arrays names and sizes, structure names, Prepare_1() and Prepare_2() functions. There
    is a small difference in the function Prepare_1 in the way MuxStatusSupl[ u32Idx ].FileInfo.Name is assigned and there I get an exception. Another difference is that the structure StructStatus in file 2 has an extra member compare to file 1. From this point
    I couldn't strip down even more the sample code because small changes make the problem disappear without, I'm afraid, really solving the problem. That's why I have put so much code here, I'm not even sure what is relevant and what not. For example, if I add
    in file 1 in the StructStatus the extra member u32ExitPoint (and, of course, I modify Status_Init accordingly), I don't see the problem anymore.
    ///////////////////////////////////////////////////// loader file begin ////
    #include "stdafx.h"
    int main(int argc, char* argv[])
    {   HINSTANCE hDLL = LoadLibrary( DLL_FQN_FILE_NAME );
        if( void ( * pCreateDllInterface )( void ) =
                (void(*)())GetProcAddress( hDLL, "CreateDllInterface" ) )
            pCreateDllInterface();
        FreeLibrary( hDLL );
    ///////////////////////////////////////////////////// loader file end //////
    ///////////////////////////////////////////////////// dll main file begin //
    extern void Prepare_1( void );
    extern void Prepare_2( void );
    extern "C" _declspec(dllexport) void CreateDllInterface( ) { Prepare_1(); }
    ///////////////////////////////////////////////////// dll main file end ////
    ///////////////////////////////////////////////////// dll file 1 begin /////
    #include <string>
    #include <sys/stat.h>
    #define STORAGE_SIZE  254
    typedef unsigned long  int uint32;
    struct StructFileInfo
    {   std::string Name; 
        struct stat FileStatus; 
    static struct StructStatus
    {   bool bDownloaded;      bool bDownloadedLast;
        bool bCalled;          bool bCalledLast;
        uint32 u32EntryPoint;
        StructFileInfo FileInfo;
    } MuxStatusMain[ STORAGE_SIZE ], MuxStatusSupl[ STORAGE_SIZE ];
    void Prepare_1() 
    {   struct stat Stat_Init;
        memset( &Stat_Init, 0, sizeof(struct stat) );
        StructStatus Status_Init =
                        { false, false, false, false, 0, { "", Stat_Init } };
        std::fill_n( MuxStatusMain, STORAGE_SIZE, Status_Init ); //  this seems
                               // to overwrite MuxStatusSupl[ 3 ].FileInfo.Name
        for( uint32 u32Idx = 0; u32Idx < STORAGE_SIZE; u32Idx++ )
            MuxStatusSupl[ u32Idx ].FileInfo.Name = ""; // crash when u32Idx==3 
    ///////////////////////////////////////////////////// dll file 1 end ///////
    ///////////////////////////////////////////////////// dll file 2 begin /////
    #include <string>
    #include <sys/stat.h>
    #define STORAGE_SIZE  254
    typedef unsigned long  int uint32;
    struct StructFileInfo
    {   std::string Name; 
        struct stat FileStatus; 
    static struct StructStatus
    {   bool bDownloaded;      bool bDownloadedLast;
        bool bCalled;          bool bCalledLast;
        uint32 u32EntryPoint;  uint32 u32ExitPoint;
        StructFileInfo FileInfo;
    } MuxStatusMain[ STORAGE_SIZE ], MuxStatusSupl[ STORAGE_SIZE ];
    void Prepare_2()
    {   struct stat Stat_Init;
        memset( &Stat_Init, 0, sizeof(struct stat) );
        StructStatus Status_Init =
            { false, false, false, false, 0, 0xFFFFFFFF, { "", Stat_Init } };
        std::fill_n( MuxStatusMain, STORAGE_SIZE, Status_Init );
        std::fill_n( MuxStatusSupl, STORAGE_SIZE, Status_Init );
    ///////////////////////////////////////////////////// dll file 2 end ///////
    I get the crash with the message: Unhalted exception at 0x10001f90 in Test.exe: 0xC0000005: Access violation writing location 0x1006d320
    Another strange phenomena is that in watch window, expressions
        sizeof(MuxStatusMain)/sizof(MuxStatusMain[0])
        sizeof(MuxStatusMain)/sizof(MuxStatusMain[0])
    show both a value of 232 instead of 254 (but if I add in file 1 in the struct the missing member they show the correct values). On the other hand, if I printf those values, they are correct, 254.

    "Another difference is that the structure StructStatus in file 2 has an extra member compare to file 1."
    That's not going to work. It is possible to define the same struct in different translation units but the definitions need to be identical. Use different names for StructFileInfo and StructStatus.

  • Assigning javascript array with jsp array

    hi,
    I have a jsp page where I have a array in jsp. I want to assign the values to an javascipt array. how can I do that?
    the reason why I want to do this is for a perticular problem I am facing in javascript. that is....
    I have a text box in my jsp page, I want the value entered in that box to be checked (whether it exists ) against a hidden string which has some value. I want that hidden string not to be shown to the user even on seeing the html source. that is why I want these values to be stored and checked against a array object of javascript.
    any suggestion is appreciated
    Thanks
    Ashutosh

    Hai asutoshdash
    if you dont mind of viewing code u can use this else dont use, its not matters weatehr user will see you code or not if the user is professiona then its a big issue normal users not think of is for this dont send valuable infos like password etc to client u may send usernames
    ok to create a java array to javascript array do this (i took example of db to array ) write this inside <script> <%codes here%> </script>
    var aUsername =new array();
    <%
    int i=0;
    while (rs.next())
    %>
    aUsername[<%= ++i%>] = "<%= rs.getString("User_Name")%>";
    <%
    %>thats it use this array where ever you want in your client side(javascript ) usage
    hope this will help you
    archi

  • PL/SQL assign an array

    All i have the following code which basically i want to take a report like
    EXCHANGE | TIMETRIP
    J 1.44
    KJ 6.77
    TAG 9.99
    And auto send it via email, i am using the HTMLDB_MAIL function, but the problem i have is that the loop will fill out the exch and secs value for each pass. What i need is to be able to send the email report like the above
    declare
    totallines number;
    ret number;
    exch varchar(90);
    secs varchar(50);
    begin
    for c1 in (select distinct exchange from fastfix_customer_perf where clientname = 'CLIENT' and archive = '0') loop
    select count(*) into totallines from fastfix_customer_perf where clientname = 'CLIENT' and archive = '0'
    and exchange = c1.exchange; --count(*) pro value
    ret := ceil(totallines * 0.25);
         select exchange, totalroundtripsecs into exch, secs
    from
    (select exchange,totalroundtripsecs, row_number() over (partition by exchange
    order by totalroundtripsecs) rn from fastfix_customer_perf where exchange = c1.exchange)
    where rn = ret;
    HTMLDB_MAIL.SEND(
    P_TO => '[email protected]',
    P_CC => '[email protected]',
    P_FROM => '[email protected]',
    P_BODY => ' ',
    P_SUBJ => '### ! DESHAW REPORT ! ###',
    P_BODY_HTML => '<tr><td><table cellpadding="0" border="0" cellspacing="0" summary="" class="t12standardalternatingrowcolors"><tr><th class="t12header" id="EXCHANGE">EXCHANGE</th><th class="t12header" id="TOTALROUNDTRIPSECS">Totalroundtripsecs (25th) percentiles</th></tr><tr><td class="t12data">'||exch||'</td><td class="t12data">'||secs||'</td></tr></table></td></tr><br>');
    end loop;
    HTMLDB_MAIL.PUSH_QUEUE( 'mailhost', '25');
    end;
    With the code above i get an email for every exch and secs that comes out.

    declare <br>
      totallines number;<br>
      ret number;<br>
      exch varchar(90);<br>
      secs varchar(50);<br>
    begin<br>
      for c1 in (select distinct exchange from fastfix_customer_perf where clientname = 'CLIENTNAME' and archive = '0') loop<br>
        select count(*) into totallines from fastfix_customer_perf where clientname = 'CLIENTNAME' and archive = '0'<br>
        and exchange = c1.exchange;  --count(*) pro value<br>
        ret := ceil(totallines * 0.25); <br>
         select exchange, totalroundtripsecs into exch, secs
         from<br>
        (select exchange,totalroundtripsecs, row_number() over (partition by exchange
         order by totalroundtripsecs) rn from fastfix_customer_perf where exchange = c1.exchange)<br>
         where rn = ret;<br>
                 HTMLDB_MAIL.SEND(<br>
          P_TO       => '[email protected]',<br>
          P_CC       => '[email protected]',<br>
          P_FROM     => '[email protected],<br>
          P_BODY     => ' ',<br>
          P_SUBJ     => '### ! CLIENTNAME ! ###',<br>
          P_BODY_HTML => '<tr><td><table cellpadding="0" border="0" cellspacing="0" summary="" class="t12standardalternatingrowcolors"><tr><th class="t12header" id="EXCHANGE">EXCHANGE</th><th class="t12header" id="TOTALROUNDTRIPSECS">Totalroundtripsecs (25th) percentiles</th></tr><tr><td class="t12data">'||exch||'</td><td class="t12data">'||secs||'</td></tr></table></td></tr><br>');<br>
    end loop;<br>
    <br>
    HTMLDB_MAIL.PUSH_QUEUE( 'mailhost', '25');<br>
    end;<br>

  • Can we assign "Arrays" as class properties??

    Hi there!
    Is that possible we assign an array as the class properties?
    Code:
    package
              import flash.net.URLLoader;
              import flash.net.URLRequest;
              import flash.events.Event;
              import flash.events.EventDispatcher;
              public class TextToArray
         public var urlLoader:URLLoader = new URLLoader();
         public var dataArray:Array = new Array();
         public var textURL:String = "";
         public var seperator:String = "";
         public function TextToArray(textURL:String,seperator:String)
            this.textURL = textURL;
            this.seperator = seperator;
            urlLoader.load(new URLRequest(textURL));//URL to the text file we need to import to Flash
            urlLoader.addEventListener(Event.COMPLETE, dataArrayLoaded);
         public function dataArrayLoaded(e:Event):void
           this.dataArray = e.target.data.split(seperator);//the seperator such as "\n"
           urlLoader.removeEventListener(Event.COMPLETE, dataArrayLoaded);
           trace(this.dataArray[2]);  // corret Data
         public function getArray():Array{
           trace(this.dataArray[2]);  // undefined
           trace(textURL); // correct Data
           return dataArray;
         public function getArrayLength():int{
            return dataArray.length;
    What am I doing wrong?
    Thanks for your time.

    thanks a lot for your prompt reply! I have called it in another class (Main.as) like this:
    package
              import TextToArray;
              import VerseID;
              import flash.display.MovieClip;
              public class Main extends MovieClip
          var textToArray:TextToArray = new TextToArray("data/connection.txt","\n");
          var quranData:Array = new Array();
                        public function Main()
          this.quranData = textToArray.getArray();
          trace(this.quranData[2]); // undefined

  • How to assigned array index position to database field

    Here is the sample data of my report.
    Run#     Note1     Note2       Note1 ArrayIndex      Note2 ArrayIndex
    101        CR         Work               1                              2
    102        Work      ER                  2                              3
    103        ER         Test                3                               4
    104        ER         CR                  3                              1
    104       Work                             2                           
    Page Footer:    1. CR       2. Work     3.ER       4.Test
    I have to load distinct values of note1 and note2 in to array and assigned the array index of that note1 and note2 values and on the page footer i have to print distinct note1 and note2. would like to see at the page footer like above.  I allready figer out how to load the distinct note1 and note2 values in array but i am not able to print the Not1Arrayindex and Note2Arrayindex value in the report. I am not sure how to print out the arrayindex values based on the array value.
    Thanks for your help.

    Hi Shweta,
    Thanks for your help. I already take a look that thread but still itu2019s not clear.
    I have to assigned the array index value like 1,2,3,4,5 and at the page footer
    I have to load the N1 and N2 database value in to one array and then show then array index value next to it and at the page footer I have to show corresponding array index with index value.
    Run# , N1  ,               N2             ,        Ind          ,          Ind
    101 ,       CR      ,              Wk               ,              1           ,                 2
    102 ,      Wk    ,                ER                ,              2           ,                 3
    103 ,       ER      ,              Tst                 ,            3            ,                4
    104 ,       ER      ,               CR                ,            3            ,                1
    Page Footer: 1. CR       2. Wk   3.ER        4.Tst
    Thanks for help.
    Regards,
    Shirin

  • Memory usage of big Array in sub-VI (was: Allow the creation of "Inplace"-VIs of Idea Exchange)

    Hi,
    this thread is based on my post in the LabVIEW idea exchange.
    I put my VIs in the attached .rar file.
    Regards
    Marc
    CLD
    Solved!
    Go to Solution.
    Attachments:
    Inplace_VI.ZIP ‏21 KB

    That would be a good explanation.  There was a thread on something very similar to this recently.  Can't remember exactly the topic but Daniel's answer certainly triggered some memories of a very similar discussion taking place.
    I think it had to do with LV assigning a Array created as a constant as Read-only so in order to make changes to it it needs to be copied to a new memory location, thus leaving the constant unchanged.
    I wonder how it performs in other LV versions.
    Shane.
    PS: Found the thread.  HERE.
    Message Edited by Intaris on 08-20-2009 03:23 AM
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • How do I make a reference that I can assign data to? Or,how do I mime void*

    OK, I'm trying to do something where a class has 20+ variables, and I want to make a small, quick, and easy programming interface for it. There will be an assignment function that takes an integer indicating one of the variables, and an object, and assigns the object to a variable.
    Problem is; it's about 5-10 lines of code to do what I need to do, and depending on the variable; that would make assigning the variables in the case statment a pain in the butt. So what I wanted to do was something like what this c function would do:
    int set(int id, void *var)
    void *p;
    int var_is_arry = 0;
    switch(id)
      case A:
        p = &(this->a);
        break;
      case B:
        p = &(this->b);
        break;
      case C:
        p = &(this->c);
        break;
    /* some code to verify var is of the rigth types, not possible in C, and
    * irrelevant to this example, var. Sets var_is_arra if var is an array of
    * strings
    if(id & 0x10000000)
      if(var_is_array)
        return -1;
      p = malloc(strlen(var));
      strncpy(p, var); 
    else
      /*same idea, but to put it into an array. Turns var into an array of one if
       *it is a string, otherwise copies the two dimensional array. the C code fo
       *this is truely ugly and being omitted.
    }So, I tried this:
    public class test
         public static void main(java.lang.String [] args)
              /*create some arrays of strings*/
              java.lang.String [] foo;
              java.lang.String [] bar;
              java.lang.String [] target;
              /*create a reference*/
              java.lang.ref.WeakReference r;
              /*Initialize our source string*/
              bar = new java.lang.String [] {"a", "b", "c"};
              /*you can first tell this doesn't do what I want because
               *without this line, it will throw an exception
              foo = new java.lang.String [0];
              /* Point our happy little reference to foo*/
              r = new java.lang.ref.WeakReference(foo);
              /* make target modify foo? Guess not...*/
              target = (java.lang.String [])r.get();
              /*clone bar (our source) and put it into target (should be referring to foo)*/
              target = (java.lang.String []) bar.clone();
              /*foo is not printing 3*/
              System.out.printf(((java.lang.Integer) foo.length).toString() + "\n\n");
              /*target is*/
              System.out.printf(((java.lang.Integer) target.length).toString() + "\n\n");
    }but the output is:
    "0
    3
    Any suggestions?

    I know what a real life example is, and yes, in fact it /does/ have a variable named var in it.
    I didn't want to put this in because it's rather long, but ok. Here's the class I'm working on:
    public class cvsup_config
    public class cvsup_config
          * The following are the "option listings" for the various CVS options
          * Variables:
          * String [] options_servers;
          * String [] options_bases;
          * String [] options_prefixes;
          * String [] options_releases;
          * String [] options_tags;
          * String [] options_actions;
          * String [] options_options;
          * String [] options_collections;
          * Each may be appended with "_info" to get information about
          * the options. The information in options_?_info[n] should be
          * about the option in options_?[n]
          * Finally, for each, there is an all-caps version, which
          * is the integer ID for the value
          * Which servers does the app know as options?
         public java.lang.String [] options_servers;
          * The information about each server
         public java.lang.String [] options_servers_info;
          * What cvsup base directories does the app know as options?
         public java.lang.String [] options_bases;
          * information about each base directory
         public java.lang.String [] options_bases_info;
          * What cvsup prefix directories does the app know as options?
         public java.lang.String [] options_prefixes;
          * information about the possible cvsup prefixes
         public java.lang.String [] options_prefixes_info;
          * What cvsup releases does this application know as options
         public java.lang.String [] options_releases;
          * Information on the various types of releases for cvsup
         public java.lang.String [] options_releases_info;
          * What cvsup tags does the application know of as options?
         public java.lang.String [] options_tags;
          * Information on the possible tags
         public java.lang.String [] options_tags_info;
          * What actions does the application know about, that can be done with the cvsup data?
         public java.lang.String [] options_actions;
          * Information on the possible actions
         public java.lang.String [] options_actions_info;
          * What other options does cvsup know of?
         public java.lang.String [] options_options;
          * Information on the options that cvsup knows about;
         public java.lang.String [] options_options_info;
          * What collections does cvsup know of?
         public java.lang.String [] options_collections;
          * Information on the various collections available.
         public java.lang.String [] options_collections_info;
          * The chosen options
          * Which servers are acceptable?
         public java.lang.String [] server_list;
          * What actions may be taken?
         public java.lang.String [] actions;
          * What options are selected?
         public java.lang.String [] options;
          * Which collections will be downloaded/updated?
         public java.lang.String [] collections;
          * What is the currently selected server?
         public java.lang.String server;
          * What is the db base directory?
         public java.lang.String base;
          * What is the ports directory prefix?
         public java.lang.String prefix;
          * What is the release variant desired?
         public java.lang.String release;
          * What is the desired release tag?
         public java.lang.String tag;
          * What is the 'download date' string? Either in the form:
          * 'today' (case insensitive)
          * "yyyy.mm.dd.hh.mm.ss"
          * "yy.mm.dd.hh.mm.ss"
         public java.lang.String date;
          * The constants
          * 0x10000000 set: array of string
          * 0x10000000 unset: string
          * 0x01000000 set: options
          * 0x01000000 unset: set value
          * Constant var ID
         public static final int OPTIONS_SERVERS = 0x11000000;
          * Constant var ID
         public static final int OPTIONS_SERVERS_INFO = 0x11000001;
          * Constant var ID
         public static final int OPTIONS_BASES = 0x11000002;
          * Constant var ID
         public static final int OPTIONS_BASES_INFO = 0x11000003;
          * Constant var ID
         public static final int OPTIONS_PREFIXES = 0x11000004;
          * Constant var ID
         public static final int OPTIONS_PREFIXES_INFO = 0x11000005;
          * Constant var ID
         public static final int OPTIONS_RELEASES = 0x11000006;
          * Constant var ID
         public static final int OPTIONS_RELEASES_INFO = 0x11000007;
          * Constant var ID
         public static final int OPTIONS_TAGS = 0x11000008;
          * Constant var ID
         public static final int OPTIONS_TAGS_INFO = 0x11000009;
          * Constant var ID
         public static final int OPTIONS_ACTIONS = 0x1100000A;
          * Constant var ID
         public static final int OPTIONS_ACTIONS_INFO = 0x1100000B;
          * Constant var ID
         public static final int OPTIONS_OPTIONS = 0x1100000C;
          * Constant var ID
         public static final int OPTIONS_OPTIONS_INFO = 0x1100000D;
          * Constant var ID
         public static final int OPTIONS_COLLECTIONS = 0x1100000E;
          * Constant var ID
         public static final int OPTIONS_COLLECTIONS_INFO = 0x1100000F;
          * Constant var ID
         public static final int SERVER_LIST = 0x10000000;
          * Constant var ID
         public static final int ACTIONS = 0x10000001;
          * Constant var ID
         public static final int OPTIONS = 0x10000002;
          * Constant var ID
         public static final int COLLECTIONS = 0x10000003;
          * Constant var ID
         public static final int SERVER = 0x00000000;
          * Constant var ID
         public static final int BASE = 0x00000001;
          * Constant var ID
         public static final int PREFIX = 0x00000002;
          * Constant var ID
         public static final int RELEASE = 0x00000003;
          * Constant var ID
         public static final int TAG = 0x00000004;
          * Constant var ID
         public static final int DATE = 0x00000005;
          * potential speed increases, only one function call...
          * though getClass may be <i>as</i> fast, it is not
          * going to be <i>faster</i>
         public static final java.lang.Object STRINGTYPE = "".getClass();
          * potential speed increases, only one function call...
          * though getClass may be <i>as</i> fast, it is not
          * going to be <i>faster</i>
         public static final java.lang.Object STRINGARRTYPE = (new java.lang.String [] {"", ""}).getClass();
          * The default constructor, it will simply create a blank object.
         public cvsup_config()
               * Initialize each of the options pairs to blank
              this.options_servers = new java.lang.String [] {};
              this.options_servers_info = new java.lang.String [] {};
              this.options_bases = new java.lang.String [] {};
              this.options_bases_info = new java.lang.String [] {};
              this.options_prefixes = new java.lang.String [] {};
              this.options_prefixes_info = new java.lang.String [] {};
              this.options_releases = new java.lang.String [] {};
              this.options_releases_info = new java.lang.String [] {};
              this.options_tags = new java.lang.String [] {};
              this.options_tags_info = new java.lang.String [] {};
              this.options_actions = new java.lang.String [] {};
              this.options_actions_info = new java.lang.String [] {};
              this.options_options = new java.lang.String [] {};
              this.options_options_info = new java.lang.String [] {};
              this.options_collections = new java.lang.String [] {};
              this.options_collections_info = new java.lang.String [] {};
               * initialize the selected options to blank
              this.server_list = new java.lang.String [] {};
              this.server = new java.lang.String();
              this.base = new java.lang.String();
              this.prefix = new java.lang.String();
              this.release = new java.lang.String();
              this.tag = new java.lang.String();
              this.actions = new java.lang.String [] {};
              this.options = new java.lang.String [] {};
              this.collections = new java.lang.String [] {};
          * This sets one of the variables values based on a configuration string given
          * @param id
          *           The identifier of the variable, the same as the variable name
          * @param var
          *           The value of the variable
          * @return
          *            0:     Success
          *           -1:     Variable not valid
          *           -2: Value not valid
         public int set(int id, java.lang.Object var)
              /*Is this an array or sting variable? */
              boolean array = false;
              /*this references the config object of interest*/
              java.lang.ref.SoftReference target;
              /*step one: set the target to "recieve" the value*/
              switch(id)
                   case OPTIONS_SERVERS:
                        target = new java.lang.ref.SoftReference(this.options_servers);
                        break;
                   case OPTIONS_SERVERS_INFO:
                        target = new java.lang.ref.SoftReference(this.options_servers_info);
                        break;
                   case OPTIONS_BASES:
                        target = new java.lang.ref.SoftReference(this.options_bases);
                        break;
                   case OPTIONS_BASES_INFO:
                        target = new java.lang.ref.SoftReference(this.options_bases_info);
                        break;
                   case OPTIONS_PREFIXES:
                        target = new java.lang.ref.SoftReference(this.options_prefixes);
                        break;
                   case OPTIONS_PREFIXES_INFO:
                        target = new java.lang.ref.SoftReference(this.options_prefixes_info);
                        break;
                   case OPTIONS_RELEASES:
                        target = new java.lang.ref.SoftReference(this.options_releases);
                        break;
                   case OPTIONS_RELEASES_INFO:
                        target = new java.lang.ref.SoftReference(this.options_releases_info);
                        break;
                   case OPTIONS_TAGS:
                        target = new java.lang.ref.SoftReference(this.options_tags);
                        break;
                   case OPTIONS_TAGS_INFO:
                        target = new java.lang.ref.SoftReference(this.options_tags_info);
                        break;
                   case OPTIONS_ACTIONS:
                        target = new java.lang.ref.SoftReference(this.options_actions);
                        break;
                   case OPTIONS_ACTIONS_INFO:
                        target = new java.lang.ref.SoftReference(this.options_actions_info);
                        break;
                   case OPTIONS_OPTIONS:
                        target = new java.lang.ref.SoftReference(this.options_options);
                        break;
                   case OPTIONS_OPTIONS_INFO:
                        target = new java.lang.ref.SoftReference(this.options_options_info);
                        break;
                   case OPTIONS_COLLECTIONS:
                        target = new java.lang.ref.SoftReference(this.options_collections);
                        break;
                   case OPTIONS_COLLECTIONS_INFO:
                        target = new java.lang.ref.SoftReference(this.options_collections_info);
                        break;
                   case SERVER_LIST:
                        target = new java.lang.ref.SoftReference(this.server_list);
                        break;
                   case ACTIONS:
                        target = new java.lang.ref.SoftReference(this.actions);
                        break;
                   case OPTIONS:
                        target = new java.lang.ref.SoftReference(this.options);
                        break;
                   case COLLECTIONS:
                        target = new java.lang.ref.SoftReference(this.collections);
                        break;
                   case SERVER:
                        target = new java.lang.ref.SoftReference(this.server);
                        break;
                   case BASE:
                        target = new java.lang.ref.SoftReference(this.base);
                        break;
                   case PREFIX:
                        target = new java.lang.ref.SoftReference(this.prefix);
                        break;
                   case RELEASE:
                        target = new java.lang.ref.SoftReference(this.release);
                        break;
                   case TAG:
                        target = new java.lang.ref.SoftReference(this.tag);
                        break;
                   case DATE:
                        target = new java.lang.ref.SoftReference(this.date);
                        break;
                   default:
                        return -1;
              /*now, determine if it is an array or a string, the quick way*/
              if((id & 0x10000000) != 0) /*is it an array?*/
                   array = true;
              /*verify that the types are ok*/
              /*string is always valid*/
              if(!var.getClass().equals(cvsup_config.STRINGTYPE))
                   /*if array is not set, and the value is not an array of strings...*/
                   if(!(array & var.getClass().equals(this.STRINGARRTYPE)))
                                  return -2;
              /*now... assign the value*/
              /*we assign our array slike this*/
              if(array)
                   java.lang.String [] targ;
                   targ = (java.lang.String [])target.get();
                   /*value isn't array, but we want one*/
                   if(var.getClass().equals(cvsup_config.STRINGTYPE))
                        targ = new java.lang.String [] {(java.lang.String)var};
                   else /*it's an array*/
                        targ = ((java.lang.String []) var).clone();
              else
                   java.lang.String targ;
                   targ = (java.lang.String)target.get();
                   targ = (java.lang.String) var;
              return 0;
          * for testing purposes
          * @param args
          * for testing purposes
         public static void main(java.lang.String [] args)
              cvsup_config t = new cvsup_config();
              java.lang.String [] sar;
              sar = new java.lang.String [] {"a", "b", "c"};
              t.set(cvsup_config.OPTIONS_SERVERS, (java.lang.Object)sar);
              int i = 0;
              System.out.printf(((java.lang.Integer)t.options_servers.length).toString() + "\n\n");
              for(i = 0; i < t.options_servers.length; i++)
                   System.out.printf("  " + t.options_servers[i] + "\n");
    }

  • Defining xsd and assiging an array to the output variable in a BPELprocess

    I have created a BPEL application in which a web service has been invoked which returns an array.If the array has a fixed size i am able to define the XSD,but what if the array does not have a fixed size.How should i define the xsd in this case,i mean how should the output node be defined.Also how can i assign the array returned by the webservice to the Output variable using the assign activity.

    Hi,
    What you could do is set the second step to loop.
    Then use as one of the parameters to VI YY the string array using RunState.LoopIndex as the array index.
    eg. Locals.MyStringArray[RunState.LoopIndex]
    Hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to divide a grid (an 2D array) into subgrids? [Suduko]

    Hey guys
    I've been struggling with a problem with my Suduko program for a few days now and thought I could get some help here.
    The problem is that I have no idea how to divide a Suduko grid and stuff them into subgrids.
    My current plan is to go through the Suduko array r * c times (where r and c is the dimensions of a subgrid) and stuff the cells into my quad array (somehow). I've gone through the sourcecode of 4 suduko programs on sourceforge, but still can't find a solution (mainly because I can't read other prog. lannguages yet).
    My code:
    * easyIO is a packadge that enables read/write to files
    * and enables communication between the user and the program via the command-line
    * You can find this packadge here: http://www.universitetsforlaget.no/java/easyIO.zip
    import easyIO.*;
    /** Initialises the board */
    class Oblig2
         public static void main(String[] args)
              /** If there is a argument in the command line (the filename to be used in this case),
               *  then send that argument with a new Board
              if(args.length >= 0)
                   Board suduko = new Board(args[0]);
    class Board
         /** Constant (yeah, no final int) that defines the board dimensisions, if dimension is 6, then the board is 6 x 6 */
         int dimension;
         /** The quad dimensions */
         int quadRow;
         int quadCol;
        Cell[][] cells;
        Row[] row;
        Col[] col;
        Quad[] quad;
         * Board contructor defines the boards properties
         * @param filename comes from Oblig2.main()
        Board(String filename)
              /** In is a class of easyIO, inFile will contain the contents of the file */
              In inFile = new In(filename);
              dimension = inFile.inInt("\n"); System.out.print(dimension + "\n");
              quadRow = inFile.inInt("\n"); System.out.print(quadRow + "\n");
              quadCol = inFile.inInt("\n"); System.out.print(quadCol + "\n");
              inFile.readLine();
              /** Creates all the neccessary cell, row, cols and quad arrays */
              cells = new Cell[dimension][dimension];
              row = new Row[dimension];
              col = new Col[dimension];
              quad = new Quad[quadRow * quadCol];
              /** Initializes all the rows */
              for(int i = 0; i < row.length; i++)
                   row[i] = new Row(dimension);
              /** Initializes all cols */
              for(int i = 0; i < col.length; i++)
                   col[i] = new Col(dimension);
              /** Initializes all quads */
              for(int i = 0; i < quad.length; i++)
                   quad[i] = new Quad(quadRow, quadCol);
              /** Initializes all cells and puts them in rows and cols */
              for(int i = 0; i < cells.length; i++)
                   for(int j = 0; j < cells.length; j++)
                        cells[i][j] = new Cell();
                        row[i].addCell(cells[i][j]);
                        col[j].addCell(cells[i][j]);
                        cells[i][j].addRCpointer(row[i], col[j]);
              for(int i = 0; i < (quadRow * quadCol)
                   for(int j = 0; i < cells.length; j++)
                        for(int k = 0; k < cells[k].length; k++
              /** Reads the file until it reaches the end of the file */
              while(!inFile.endOfFile())
              /** Closes the filecontainer */
              inFile.close();
    class Row
         /** Single col. array to contain cells in row */
         Cell[] row;
         * Assigns an array with length=rowVal
         * @param is the same as dimension in Board-class
         Row(int rowVal)
              row = new Cell[rowVal];
         /** Add cell to row
         * If the cell is null, or empty, then it will set the cell[i] = cell,
         * and return control back to the caller
         void addCell(Cell cell)
              for(int i = 0; i < row.length; i++)
                   if(row[i]==null)
                        row[i] = cell;
                        return;
         * Checks if it's possible to stuff a number into the row,
         * returns true if it's possible and false else
         boolean tryNumeral(int cellVal)
              for(int i = 0; i < row.length; i++)
                   if(row[i].getContains() == cellVal)
                   { return false; }
              return true;
    class Col
         /** Single col. array to contain cells in col.*/
    Cell[] col;
    * Assigns an array with length=colVal
    * @param is the same as dimension in Board-class
    Col(int colVal)
              col = new Cell[colVal];
         /** Add cell to col.
         * If the cell is null, or empty, then it will set the cell[i] = cell,
         * and return control back to the caller
         void addCell(Cell cell)
              for(int i = 0; i < col.length; i++)
                   if(col[i]==null)
                        col[i] = cell;
                        return;
         * Checks if it's possible to stuff a number into the col,
         * returns true if it's possible and false else
         boolean tryNumeral(int cellVal)
              for(int i = 0; i < col.length; i++)
                   if(col[i].getContains() == cellVal)
                   { return false; }
              return true;
    class Quad
         /** Single col. array to contain cells in quad*/
    Cell[] quad;
         /** Assigns an array with length=row*col to quad */
    Quad(int row, int col)
              quad = new Cell[row * col];
         /** Add cell to quad
         * If the cell is null, or empty, then it will set the cell[i] = cell,
         * and return control back to the caller
         void addCell(Cell cell)
              for(int i = 0; i < quad.length; i++)
                   if(quad[i]==null)
                        quad[i] = cell;
                        return;
         * Checks if it'possible to stuff a number into the quad.
         * returns true if it's possible and false else.
         boolean tryNumeral(int cellVal)
              for(int i = 0; i < quad.length; i++)
                   if(quad[i].getContains() == cellVal)
                   { return false; }
              return true;
    /** The lowest unit on a Suduko board */
    class Cell
         /** The number the box contains */
    int contains;
         /** Pointers to the row/col/quad it's located in */
    Row cellRow;
    Col cellCol;
    Quad cellQuad;
         /** Add pointers from Board-contructor R = Row, C = Col. */
         void addRCpointer(Row row, Col col)
              cellRow = row;
              cellCol = col;
         /** Checks if it's okay to place a number there */
    void tryNumeral()
    /** Get-method for the cells value */
    int getContains()
              return this.contains;

    nitinkajay wrote:
    I want to know how to store the output of a analog to digital converter into an 2D labview array.
    How exactly are you performing 'Analog to Digital'???
    Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Will the memory leak for queue when used in producer and consumer mode in DAQ to transfer different sized array.

    In the data acquisition, I use one loop to poll data from hardware, another loop to receive the data from polling loop sent by queue.
    But everytime the size of the transferred data array may not be the same, so the system may assign different array size and recycle very frequently.
    Will it cost memory leak. Or will it slow down the performance, since the array size is not fixed, so every time need to create a new sized array.
    Any suggestion or better method. 
    Solved!
    Go to Solution.

    As i understand your description, your DAQ-loop acquires data with the setting '-1' for samples to read at the DAQmx read function. This results in the different array sizes.
    Passing those arrays directly to a queue is valid and it does not have significant drawback in performance (at least as far as i know) and it definetly does not leak memory.
    So the question is more or less:
    Is it valid that your consumer receives different array sizes for analysis? How does your consumer handle those arrays? 
    hope this helps,
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Passing array to oracle stored procedure in VC++ 2005

    Hi,
    I am try to send an array of integers to a stored procedure via ODBC 10.2.0.3 on VC++2005 enviornment. I get the below error
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'MYPROC1'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored ... Error Code = 6550
    []E R R O R
    The same code works if I use an INSERT statement.
    SQLUSMALLINT* rowsProcessed = new SQLUSMALLINT;
    RETCODE nRetCode;
    const int arraySize = 200;
    long ptrVal[arraySize];
    long ptrInd[arraySize];
    long ptrStatus[arraySize];
    for (int i = 0; i < arraySize; i++)
    ptrVal = i;
    ptrInd = 0;
    nRetCode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAM_BIND_TYPE, SQL_PARAM_BIND_BY_COLUMN, 0);
    // assign the number of sets of parameters that are to be inserted
    nRetCode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER)iSizeOfArray, 0);
    // assign an array to retrieve status info for each row of parameter values
    nRetCode =SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAM_STATUS_PTR, (SQLPOINTER)ptrStatus, 0);
    // assign a buffer to store the number of sets of parameters that have been processed
    nRetCode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAMS_PROCESSED_PTR, (SQLPOINTER)rowsProcessed, 0);
    nRetCode = SQLBindParameter(m_hstmt, nParamIndex, nDirection, SQL_C_LONG, SQL_INTEGER, 0, 0, ptrVal, 0, ptrInd);
    //suceeds
    SQLPrepare(m_hstmt, (SQLCHAR*)"INSERT INTO my_table VALUES (?)", SQL_NTS);
    //fails
    SQLPrepare(m_hstmt, (SQLCHAR*)"{CALL mypackage.myproc1(?)}", SQL_NTS);
    SQLExecute(m_hstmt);
    package is
    create or replace package mypackage
    as
    type mytable is table of binary_integer;
    procedure myproc1( l_tab in mytable);
    end;
    show errors
    create or replace package body mypackage
    as
    procedure myproc1( l_tab in mytable)
    as
    begin
    insert into my_table values (100);
    commit;
    FORALL i IN l_tab.first .. l_tab.last
    INSERT into my_table values( l_tab(i) );
    end;
    end;
    any ideas?

    I believe when you're doing it with an insert, you're saying "execute this insert statement a bunch of times, here's all the values in advance", which is different than passing an array to a stored procedure where you want it to execute once.
    Oracle's ODBC driver doesnt support Associative Arrays (aka index-by tables).
    Hope it helps,
    Greg

  • Creating an array of objects of a class known ONLY at RUNTIME

    I have a method in a class which expects an array of objects of particular type (say A) as its only argument. I 'invoke' this method using reflection. I have the instances of the class A stored in a Vector. When I do 'toArray' on this vector, what I get back is an array of Objects and not an array of objects of A. I assign this array to the zeroth element of another Object array and pass that array as a second argument to the 'invoke' method. Of course, it throws an Exception saying - argument types mismatch. Because I am sending an array of Objects to a method expecting an array of objects of A. My problem is I don't know A until runtime. So I have to handle whatever I am getting back after doing 'toArray' on a vector as a Generic Object. I know there's another version of 'toArray' in the Vector class. But it's API documentation didn't help a lot.
    Can anybody please help me solve this problem? Any sort of hints/code snippet would be of great help.
    Does the above description makes any sense? If not, please let me know. I would try to illustrate it with a code sample.
    Thanks a lot in advance.

    Sorry, for the small typo. It is -
    clazz[] arr = (clazz [])java.lang.reflect.Array.newInstance(clazz, n);
    instead
    Thanks for the reply. I could do this. But I am
    getting a handle to the method to be 'invoke'd by
    looking at the types of the parameters its
    expecting(getParameterTypes). So I can't change it to
    accept an array of Generic Objects.
    I looked at the java.lang.reflect.Array class to do
    this. This is what I am trying to do-
    String variableName is an input coming into my
    program.
    n is the size of the array I'm trying to create.
    Class clazz = Class.forName(variableName);
    clazz[] arr = (clazz
    [])java.lang.reflect.newInstance(clazz, n);
    According to Reflection API, it should work, right?
    But compiler yells at me saying 'class clazz not
    found'.
    Any suggestions/hints/help?
    Thanks, again.

  • Example on how to set an array as a Global Variable (LV2?).

    Hi,
    I am new to Labview and recently I have been given the task to evaluate labview as our new data acquisition software.
    Let me briefly describe what we currently have set-up and what I need to accomplish.
    We have developed several dll's (created in C) to access the shared memory where the data is located and I have imported these dll's in labview and read them in as one big 1-d array. (There are several 1-d array's that I import but I will try to keep things simple by starting out with one)
    Now I want to share this array to several sub-vi�s, which will I am planning to call from the run-time menu. How can I assign this array globally so that I can access it from any sub-vi?
    For example, lets say
    that my array name that I imported is called ARRAY1 (name created using the local variable option). ARRAY1 is a 1-d array with 10000 elements.
    I would like to access only a few elements of this array on another sub-vi by its name and index number i.e. ARRAY1[10], ARRAY1[20].
    Please let me know if you need any more information.
    I would really appreciate it if someone can help me out.
    Thanks
    Nish
    My E-mail: [email protected]

    Attached is the VIs in LV 6i format...The advantage of those VIs is that they allow you to read and write subsets of the array, not just one element at a time.
    MTO
    Attachments:
    Example.vi ‏27 KB
    ArrayGlobal.vi ‏27 KB

Maybe you are looking for

  • Report for material cost estimation

    Dear All,            my report spec is when I give the material no (finished goods) and plant it should show the sub-material that qty and price also...Could u tell me the table name for getting these sub-item and main-item ..<b></b><b></b><b></b><b>

  • Web Dynpro Application Accessing ABAP Functions  Tutorial

    Hi, After Downloading 4TutWD_FlightList_Init and importing it . i can't find the views or applications there is nothing ...Pls can anyone tell me what is the problem and tell me how to import it correctly. Thanks&Regards, Mathivanan.G

  • Billing  a Debit Memo to  a Vendor in CRM

    Hi, I am creating a warranty claim document from a service confirmation document in CRM 7.0 Once the claim is approved i am triggering a debit memo doc which can be billed in crm. Now while creating an invoice i am getting few errors as shown below:

  • BEx: In Query Design I can't EXPAND Dim to select Char (missing + sign)

    Hi, I am in BI 7, but created some queries in RRMX i.e. the 3.x query designer. I went back to create a new query and I see my InfoArea but no means to expand it to select a cube, missing + sign and I can't expand the InfoArea. When I managed to open

  • Inserting Object in PowerPoint 2013

    Hi All, We are unable to add a pdf(Adobe Reader 11.0.09) as an object in the powerpoint document. Insert- Object- Create from file- Browse the file and display as icon. We get the error: " The server application, source file, or item can't be found,