How to manage Arrays as Object members

I found a realy strange behavior with the instanciation of a
Class which contains an Array member.
Here is the code wich is self explanatory.

Create the array instance in the constructor.
class MyObj {
public var tab:Array;
function MyObj(index) {
this.tab= new Array();
"Chris_007" <[email protected]> wrote in
message
news:[email protected]...
> I found a realy strange behavior with the instanciation
of a Class which
> contains an Array member.
>
> Here is the code wich is self explanatory.
>
>
>
>
>
> class MyObj {
> //
> public var tab:Array = new Array();
> private var objectName:String;
> private var theIndex:Number;
> //
> // Constructeur
> function MyObj(index) {
> this.theIndex = index;
> // Object name
> this.objectName = "name#" + index;
> for (var i = 0; i < 3; i++) {
> this.tab
= index * 3 + i;
> }
> }
> //
> function printObject() {
> trace(" Printing Object name --> " +
this.objectName);
> for (var i = 0; i < 3; i++) {
> trace(" tab[" + i + "] : " + this.tab);
> }
> }
> //
> function getClone() {
> return new MyObj(theIndex);
> }
> }
>
>
> // And the main scenario code
> //
> var index:Number = 0;
> //
> var objArray:Array = new Array();
> //
> var oob:MyObj;
> //
> function printMyArray(arr:Array):Void {
> for (var i = 0; i < arr.length; i++) {
> trace(" tab[" + i + "] : " + arr
> }
> }
> //
> // Filling in the Array
> for (var i = 0; i < 4; i++) {
> oob = new MyObj(index);
> // oobj = oob.getClone();
> trace("-- New object #" + i + " created. MyObj[" + index
+ "]");
> oob.printObject();
> objArray = oob;
> trace("-- Now entered into the array -- printing from
object #" + i );
> objArray
.printObject();
> trace("-- or printing from the scenario -- objArray[" +
i + "] is realy
> stored");
> printMyArray(objArray.tab);
> trace("____________________________________");
> index += 1;
> }
> //
> // Printing the array of pointers to MyObj
> trace("___________________________________________");
> trace("And now, all in one...\nPrinting the array of
pointers to MyObj
> trace("___________________________________________");
> for (var i = 0; i < 4; i++) {
> objArray
.printObject();
> }
> trace("------ Or directly from the scenario -------");
> for (var i = 0; i < 4; i++) {
> trace(" Printing from scenario Object name --> " +
objArray.objectName);
> printMyArray(objArray
.tab);
> }
> trace("___________________________________________");
> trace("They are all the same ?!\nIt seems to have lost
something !!!!");
> trace("___________________________________________");
> //
> //
> trace("\nAmazingly, the array's elements do not refer to
the same
object\n");
> //
> trace("objArray[0] == objArray[0] ? -->" +
(objArray[0] == objArray[0]));
> trace("objArray[0] == objArray[1] ? -->" +
(objArray[0] == objArray[1]));
> trace("objArray[0] instanceof MyObj ? -->" +
(objArray[0] instanceof
MyObj));
> trace("");
> //
> trace("\nThey realy seem to point different objects
!\n");
> //
> // So, why do they have different outputs ?
> //
> //
> //
> // It seems the 'new' constructor creates a new Object
'MyObj'
> // which always resides at the same memory location.
> // 'oob' is in fact a pointer, and objArray[] an array
of pointers,
> // as so an array of memory addresses.
> // The objArray[] elements are pointers which always
refer to the
> // the same memory zone, which in fact contains the last
content of the
> object.
> //
> //
> // And then manualy
> //
>
trace("**********************************************************");
> trace("\nAnd then another way to create each new object
manualy\n");
>
trace("**********************************************************");
> //
> //
> var otherObjArray:Array = new Array();
> //
> var oob0 = new MyObj(100);
> trace("-- New object created #100");
> oob0.printObject();
> otherObjArray[0] = oob0;
> trace("-- Now entered into the array --
otherObjArray[0]");
> otherObjArray[0].printObject();
> //
> var oob1 = new MyObj(200);
> trace("-- New object created #200");
> oob1.printObject();
> otherObjArray[1] = oob1;
> trace("-- Now entered into the array --
otherObjArray[1]");
> otherObjArray[1].printObject();
> //
> var oob2 = new MyObj(300);
> trace("-- New object created #300");
> oob2.printObject();
> otherObjArray[2] = oob2;
> trace("-- Now entered into the array --
otherObjArray[2]");
> otherObjArray[2].printObject();
> //
> trace("___________________________________________");
> trace("And now, all in one...\nEnjoy the show !!!!");
> trace("___________________________________________");
> otherObjArray[0].printObject();
> otherObjArray[1].printObject();
> otherObjArray[2].printObject();
> //
> trace("\nThe problem seems to reside in the way the
Arrays members are
managed
> by the Objects !\n");
> trace("\nHELP me please to find the bug\n");
> //
>

Similar Messages

  • How to return array of object

    public class A{
    public class B{
    publc C[] sample()
    int i=0;
    ResultSet rset = s.executeQuery("select name, id  from emp ");
    while(rs.next()){
    name = rset.getString("nam");
    id = rset.getInt("id");
    c.setName(name )
    c[i].setId(id)
    return c[]
    public class C{
    // here i have getter and setter metod for name & id
    When I try to return the object c[]..i am getting "cannot conver from C to C[]".
    Can u pls help me, how to return array of object and how to get name and id values in other class using this array object
    Thanks for ur help

    public class Starting{
    public long empID;
    Data data = new Data();
    Value[] value;
    int count = 0;
         public static void executeDe(){
              value = new Value[100]
              try{
                     data.getDetails()
                     processDetails(value);
                   }catch(Exception e){e.printStackTrace();}
         public static void processDetails(Value[] value){
         count = data.i;
              int i;
              for(i=0;i<count;i++){
                  empID=value.getempID(); \\ here i am not getting all values..... am getting only last value of the array
    public class Data{
    public long empID;
    public int i=0;
    static Value[] value = new Value[100];
    public static Value[] getDetails(){
    Connection con=null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con=DriverManager.getConnection("jdbc:oracle:thin:@" + hostname + ":1521:" + sid, user, password);
    System.out.println(" conn " + con);
    System.out.println("");
    Statement s=con.createStatement();
    try{
         ResultSet rset = s.executeQuery("select EMPID from Employee ");
         while(rset.next()){
    empID = rset.getLong("EMPID");
    value[i].setCycleID(cy_i);
    i++;
         rset.close();
         con.close();
    }catch (SQLException sqle){sqle.printStackTrace();}
         finally{
              try{
              s.close();
         con.close();
              }catch(SQLException e){e.printStackTrace();}
    catch(Exception e){e.printStackTrace();}
    return value;
         public class Value {
         public static long cycleID;
              public static void setempID(long empID) {
                   Value.empID = empID;
              public static long getempID() {
                   return empID;
    This is my actual code..... I am able to set the values in Value class from Data class using getDetails() method, which is returning array of value object.
    In Starting class, I am trying to get values using value[i].. i am getting last value of the array. This is my actual problem... here i want to get all values.
    Please help me how to resolve this.

  • How to pass array of Object in A Procedure using OCCI.......

    I m also trying for How to pass Object to a procedureb using OCCI...
    Steps....
    1. I created A type.....
    2. Then I created a VARRAY using that Type.
    3.After that I have written An Procedure with object as a parameter..
    now using OCCI how do u bind the parameter with this . plz note that using OTT
    i have already created the class representation of above object type i.e class
    four Files Created 1> demo.h 2>registermapping.h
    3> demo.cpp 2>registermapping.cpp
    After I want to Pass the Values in A Vector...
    vctor<full_name *> vect;
    stmt=con->createStatement("BEGIN Add_Object(:1); END;");
    full_name *name1 = new full_name; //Giving the Error here Given below....
    name1->
    name1->
    Through name1 Which Function I will call in which I will Pass a String....
    like
    name1->readSQL("Sanjay"); Or I have to add a function......
    vect.push_back(name1);
    setVector(stmt,1,vect,"FULL_NAME");
    error C2259: 'FullName' : cannot instantiate abstract class
    can u plz suggest me Why this Error is Giving......?
    How to pass the data?
    setFirst_name() and setLast_name() this two function I will add in Demo.cpp which one created automativcally by Using OTT command.....or other way plz tell me Boss ....
    Can u lz Suggest me ASAP....

    hi Nishant ,
    What u have done Now I mm trying ....
    can u Plz Suggest me......
    How to pass and Array of Object in Procedure using OCCI... Doing....
    90% finished Two Error's Are Coming...
    1> If I create the Class then Data Not Inserting table......
    2> If I will create the Class through OTT command.......
    then U can't Instantiate Object It is DIsplying ,this is Abstract Class(PObject)...
    Beco'z the below Method is Not adding Automatically by OTT command which is Pure Virtual Function.....
    But I added this Function Still SAme Error Giving..
    getSQLTypeName(oracle::occi::Environment env, void *schName,
    unsigned int &schNameLen, void **typeName,
         unsigned int &typeNameLen) const
    Plz Suggest me....
    regard's
    sanjay

  • How to Sort Array of Object

    Hallo. I have an array of objects. Each object has id and name. How can i sort by name or by id??
    Thx for all
    Max

    array.sortOn("name");

  • How to do Array of objects

    Hi,
    I was wondering if XMP is capable of holding an array of multiple objects. We have historical data that is represented with multiple fields. The normal schema would look like:
      <rdf:Description rdf:about="" xmlns:nef="http://ns.phics.com/nefclient/1.0/">
             <nef:Division>BTF</nef:Division>
             <nef:Season>0914</nef:Season>
             <nef:Sku>91346</nef:Sku>
             <nef:Usage>Print</nef:Usage>
             <nef:Status>Approved</nef:Status>
          </rdf:Description>
    How can I add this addionional data some?
              <nef:History>
                   <nef:issue>blah01</nef:issue>
                   <nef:date>12-12-12</nef:date>
                   <nef:color>red</nef:color>
                   <nef:issue>blah02</nef:issue>
                   <nef:date>1-12-10</nef:date>
                   <nef:color>blue</nef:color>
                   <nef:issue>blah03</nef:issue>
                   <nef:date>02-12-08</nef:date>
                   <nef:color>red</nef:color>
                   <nef:issue>blah04</nef:issue>
                   <nef:date>11-09-06</nef:date>
                   <nef:color>white</nef:color>   
               </nef:History>
    Thank you for your time
    Dean Krueger

    Hi Dean,
    what you want to do is perfectly supported in XMP. The History property would be an array (ordered or unordered, as you like) and each array element is a struct with three fields.
    It would look like this:
    <nef:History>
         <rdf:Bag>
              <rdf:li  rdf:parseType="Resource">
                   <nef:issue>issue</nef:issue>
                   <nef:date>date</nef:date>
                   <nef:color>color</nef:color>
              </rdf:li>
              ...etc
         </rdf:Bag>
    </nef:History>
    If you are using the XMP toolkit in your program, you can refer to the Programmer's Guide for reference how to create such an array.
    regards
    Jörg

  • How to manage non-SAP objects types with SAP Netweaver ?

    I would like to know how it is possible to integrate into the SAP software configuration managment tools (NWDI CTS, CTS+...) non-SAP objects like shell scripts or SQL requests ?
    These shell scripts are, for example:
    - external host scheduler jobs
    - general scripts for start/stop application
    - parameters needed by application at the os level
    My goal should to store into a DEV SAP system these objects, in order to take benefit of SE80 version management. So, it should be possible to create transport order in SE10 and to transport these non-SAP objects in test and production system.
    Thank in advance for your answers.
    Daniel Ouin

    the standard functionality for this up until 4.72 is to call RFCs/BAPIs through a RFC binding library for the third party software, e.g. the language of your choice is PHP then you use the PHP RFC library found [here|http://saprfc.sourceforge.net/], if you have to connect from a .NET environment you might try to get the SAP .NET connector.
    anton
    PS: RTFM and/or using the search facilities here on SCN would help you a lot with your task.

  • How to implement array of objects or vector of objects?

    Hello, i am working on a javabean that is connecting to a database and executes an sql string. The javabean returns the records retrieved in a tabular format.
    Currently i can achieve the above requireement, but only through using a simple table-formatted string, this is not dynamic and a 2d array approach would not be dynamic either.
    I have read a little about using a dynamic approach, possiblya vector of objects, or array list of objects to solve the problem, but i don't really know how to start, could anybody help me??
    The code i have so far is:
    package webtech;
    import java.sql.*;
    public class questiona {
    /* Step 1) Initialize Variables*/
    String result = "";
    String query = "select id, name, url, thumb_url, keywords, category, author from mytable;";
    String url = "";
    String driver = "";
    String uname = "";
    String dpass = "";
    /*Step 2) Make a database connection*/
    private Connection dbconn = null;
    public questiona()
    try
    Class.forName(driver);
    dbconn = DriverManager.getConnection(url, uname, dpass);
    /*Create an SQL statement*/
    Statement statement = dbconn.createStatement();
    if (statement.execute(query))
    {/*Step 3) If we have a result lets loop through*/
    ResultSet results = statement.getResultSet();
    ResultSetMetaData metadata = results.getMetaData();
    /*Validate result. Note switch to while loop if we plan on multiple results from query*/
    if(results != null)
    /*Use results setmetadata object to determine the columns*/
    int li_columns = metadata.getColumnCount();
    result += " <tr>\n\r";
    result += " <td>" + metadata.getColumnLabel(1) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(2) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(3) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(4) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(5) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(6) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(7) + "</td>\n\r";
    result += " </tr>\n\r";
    /*loop throught the columns and append data to our table*/
    while(results.next())
    result += " <tr>\n\r";
    result += " <td>" + results.getObject(1).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(2).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(3).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(4).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(5).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(6).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(7).toString() +"</td>\n\r";
    result += " </tr>\n\r";
    catch (ClassNotFoundException e)
    {     result = "<tr><td> Error in database";
    result += " <br/>" + e.toString() + "</td></tr>";
    catch (SQLException e)
    {     result = "<tr><td> Error in SQL";
    result += " <br/>" + e.toString() + "</td></tr>";
    finally
    try {
    if (dbconn !=null)
    { dbconn.close();}
    catch (SQLException e)
    {   result  = " <tr><td> Error in closing connection.";
    result += " <br/>" + e.toString() + "</td></tr>";
    public String getResults() {
    return result;
    }

    Cross-post
    http://forum.java.sun.com/thread.jspa?threadID=604770

  • Array of Object

    How to create array of object dynamically and the class is also having constructor.
    like:
    class Cir{
    private double radius;
    Cir(double r){
    redius=r;
    10 objects are to be created within for loop

    Cir c[]=new Cir[10]
    for(int i=0;i<10;i++)
    c [ i ] =new Cir(radious);
    Message was edited by:
    ramireddi

  • How to make arrays or repeat objects in circle?

    Hello,
    1 - How to make arrays without copying and pasting? Fig-1
    2 - how to create objects repeated in circles? Fig-2
    Regards and Thanks

    1) Patterns
    2) One option is Scripting (or Actions).
    http://forums.adobe.com/message/3472806#3472806
    Edit: That was only for text layers, you could give this a try:
    // xonverts to smart object, copies and rotates a layer;
    // for photoshop cs5 on mac;
    // 2011; use it at your own risk;
    #target photoshop
    ////// filter for checking if entry is numeric and positive, thanks to xbytor //////
    posNumberKeystrokeFilter = function() {
              this.text = this.text.replace(",", ".");
              this.text = this.text.replace("-", "");
              if (this.text.match(/[^\-\.\d]/)) {
                        this.text = this.text.replace(/[^\-\.\d]/g, '');
    posNumberKeystrokeFilter2 = function() {
              this.text = this.text.replace(",", "");
              this.text = this.text.replace("-", "");
              this.text = this.text.replace(".", "");
              if (this.text.match(/[^\-\.\d]/)) {
                        this.text = this.text.replace(/[^\-\.\d]/g, '');
              if (this.text == "") {this.text = "2"}
              if (this.text == "1") {this.text = "2"}
    var theCheck = photoshopCheck();
    if (theCheck == true) {
    // do the operations;
    var myDocument = app.activeDocument;
    var myResolution = myDocument.resolution;
    var originalUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var dlg = new Window('dialog', "set circle-radius for arrangement", [500,300,840,450]);
    // field for radius;
    dlg.radius = dlg.add('panel', [15,17,162,67], 'inner radius');
    dlg.radius.number = dlg.radius.add('edittext', [12,12,60,32], "30", {multiline:false});
    dlg.radius.numberText = dlg.radius.add('statictext', [65,14,320,32], "mm radius ", {multiline:false});
    dlg.radius.number.onChange = posNumberKeystrokeFilter;
    dlg.radius.number.active = true;
    // field for number;
    dlg.number = dlg.add('panel', [172,17,325,67], 'number of copies');
    dlg.number.value = dlg.number.add('edittext', [12,12,60,32], "30", {multiline:false});
    dlg.number.value.onChange = posNumberKeystrokeFilter2;
    dlg.number.value.text = "12";
    // buttons for ok, and cancel;
    dlg.buttons = dlg.add('panel', [15,80,325,130], '');
    dlg.buttons.buildBtn = dlg.buttons.add('button', [13,13,145,35], 'OK', {name:'ok'});
    dlg.buttons.cancelBtn = dlg.buttons.add('button', [155,13,290,35], 'Cancel', {name:'cancel'});
    // show the dialog;
    dlg.center();
    var myReturn = dlg.show ();
    if (myReturn == true) {
    // the layer;
              var theLayer = smartify(myDocument.activeLayer);
              app.togglePalettes();
    // get layer;
              var theName = myDocument.activeLayer.name;
              var theBounds = theLayer.bounds;
              var theWidth = theBounds[2] - theBounds[0];
              var theHeight = theBounds[3] - theBounds[1];
              var theOriginal = myDocument.activeLayer;
              var theHorCenter = (theBounds[0] + ((theBounds[2] - theBounds[0])/2));
              var theVerCenter = (theBounds[1] + ((theBounds[3] - theBounds[1])/2));
    // create layerset;
              var myLayerSet = myDocument.layerSets.add();
              theOriginal.visible = false;
              myLayerSet.name = theName + "_rotation";
    // create copies;
              var theNumber = dlg.number.value.text;
              var theLayers = new Array;
              for (var o = 0; o < theNumber; o++) {
                        var theCopy = theLayer.duplicate(myLayerSet, ElementPlacement.PLACEATBEGINNING);
                        theLayers.push(theCopy);
    // calculate the radius in pixels;
              var theRadius = Number(dlg.radius.number.text) / 10 * myResolution / 2.54;
              myDocument.selection.deselect();
    // get the angle;
              theAngle = 360 / theNumber;
    // work through the layers;
              for (var d = 0; d < theNumber; d++) {
                        var thisAngle = theAngle * d ;
                        var theLayer = theLayers[d];
    // determine the offset for outer or inner radius;
                        var theMeasure = theRadius + theHeight/2;
    //                    var theMeasure = theRadius + theWidth/2;
                        var theHorTarget = Math.cos(radiansOf(thisAngle)) * theMeasure;
                        var theVerTarget = Math.sin(radiansOf(thisAngle)) * theMeasure;
    // do the transformations;
                        rotateAndMove(myDocument, theLayer, thisAngle + 90, - theHorCenter + theHorTarget + (myDocument.width / 2), - theVerCenter + theVerTarget + (myDocument.height / 2));
    // reset;
    app.preferences.rulerUnits = originalUnits;
    app.togglePalettes()
    ////// function to determine if open document is eligible for operations //////
    function photoshopCheck () {
    var checksOut = true;
    if (app.documents.length == 0) {
              alert ("no open document");
              checksOut = false
    else {
              if (app.activeDocument.activeLayer.isBackgroundLayer == true) {
                        alert ("please select a non background layer");
                        checksOut = false
              else {}
    return checksOut
    ////// function to smartify if not //////
    function smartify (theLayer) {
    // make layers smart objects if they are not already;
              if (theLayer.kind != LayerKind.SMARTOBJECT) {
                        myDocument.activeLayer = theLayer;
                        var id557 = charIDToTypeID( "slct" );
                        var desc108 = new ActionDescriptor();
                        var id558 = charIDToTypeID( "null" );
                        var ref77 = new ActionReference();
                        var id559 = charIDToTypeID( "Mn  " );
                        var id560 = charIDToTypeID( "MnIt" );
                        var id561 = stringIDToTypeID( "newPlacedLayer" );
                        ref77.putEnumerated( id559, id560, id561 );
                        desc108.putReference( id558, ref77 );
                        executeAction( id557, desc108, DialogModes.NO );
                        return myDocument.activeLayer
              else {return theLayer}
    ////// radians //////
    function radiansOf (theAngle) {
              return theAngle * Math.PI / 180
    ////// rotate and move //////
    function rotateAndMove (myDocument, theLayer, thisAngle, horizontalOffset, verticalOffset) {
    // do the transformations;
    myDocument.activeLayer = theLayer;
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc3 = new ActionDescriptor();
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc3.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc4 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc4.putUnitDouble( idHrzn, idPxl, horizontalOffset );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc4.putUnitDouble( idVrtc, idPxl, verticalOffset );
        var idOfst = charIDToTypeID( "Ofst" );
        desc3.putObject( idOfst, idOfst, desc4 );
        var idAngl = charIDToTypeID( "Angl" );
        var idAng = charIDToTypeID( "#Ang" );
        desc3.putUnitDouble( idAngl, idAng, Number(thisAngle) );
    executeAction( idTrnf, desc3, DialogModes.NO );

  • How to pass Array of Java objects to Callable statement

    Hi ,
    I need to know how can I pass an array of objects to PL/SQL stored procedure using callable statement.
    So I am having and array list of some object say xyz which has two attributes string and double type.
    Now I need to pass this to a PL/SQL Procedure as IN parameter.
    Now I have gone through some documentation for the same and found that we can use ArrayDescriptor tp create array (java.sql.ARRAY).
    And we will use a record type from SQL to map this to our array of java objects.
    So my question is how this mapping of java object's two attribute will be done to the TYPE in SQL? can we also pass this array as a package Table?
    Please help
    Thanks

    I seem to remember that that is in one of Oracle's online sample programs.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/index.html

  • How to list an array of objects using struts in jsp and ActionForm

    I am using the struts ActionForm and need to know how to display an Array of objects. I am assuming it would look like this in the ActionForm:
    private AddRmvParts addRmv[];
    But I am not sure how the getter and setter in the ActionForm should look. Should it be a Collection or an Iterator?
    I am thinking I need to use an iterator in the jsp page to display it.
    I am also wondering if the AddRmvParts class I have can be the same class that gets populated by the retrieval of data from the database. This class has 10 fields that need to display on the jsp page in 1 row and then multiple rows of these 10 fields.
    Thanks.

    Most probably the easiest way to make it accessible in your page is as a collection.
    ie
    public Collection getAddRmvParts()
    You can use the <logic:iterate> or a <c:forEach>(JSTL) tag to loop through the collection
    As long as the individual items in the collection provide get/set methods you can access them with the dot syntax:
    Example using JSTL:
    <c:forEach var="addRmvPart" items="${addRmvParts}">
      <c:out value="${addRmvPart.id} ${addRmvPart.name} ${addRmvPart.description}"/>
    </c:forEach>

  • How to update an object property located in an array of objects

    Hello all,
    I have a script that creates custom objects and populates them and saves them into an array. This array of objects is later converted to a CSV file for reuse later on. On a subsequent need to run the script and to save time and avoid recollecting
    data I have previously amassed, I read in the contents of the csv file and put this data into an arryOfObjects.
    I need to manipulate the data in specific objects but I can't figure out how to accomplish that task.
    I can identify the correct object within the array with the following command. I have been trying to pipe that result into either set-variable or set-itemproperty without success.
    $arrayOfObjects | select-object | where HostName -like $_.'name'
    This works, I can see my desired object and the data fields contained within it.
    I now need to modify one of the property fields. (Alias).
    I have been trying the following as a line of thought, but so far without success. It doesn't fail/error out, but it doesn't update the data either.
    $arrayOfObjects | select-object | where HostName -like $_.'name' | set-itemproperty -name Alias -value "newAlias"
    I'm wondering if I need to specify something for the -path argument, but since the array is in memory and not a registry location or a file I am not sure what I should use, if this is the problem at all.
    Any suggestions would be appreciated.
    Thanks
    Smitty

    yes, I have redacted things, and obscured other things because I can not go around posting critical infrastructure information out on the internet.
    Here is the first three lines of my .csv file
    "OrigIP","AL_HostName","AL_Found","AL_Enabled","AL_Status","N_HostName","InREDACTED","N_Found","Delta","IsStale","Ping","InDNS","InAD","Location","Alias","IsServer","HostType","OS","ApplianceName","FQDN","ChatterValue"
    "10.24.11.4","ABCD","yes","yes","never","abcd.domain.com","yes","yes","*","*","Y","Y","N","TEST","*","*","eventlog","","","ABCD.DOMAIN.COM","*"
    "10.24.12.18","EFGH","yes","yes","Dec 30 2014 09:15:00","efgh.domain.com","yes","yes","-25","No","Y","Y","Y","TEST","*","yes","eventlog","xxxxxx","","EFGH.DOMAIN.COM","*"
    When I import this file I create a new custom object (objectCurrent) which I populate with the data from the csv file. I then store this object into an array of objects (objectCollection).
    All of the data is present.
    I then read in a new csv file that would contain most of the same hosts, but possibly additional new ones. upon importing the second csv file I loop through the entries.
     I have a conditional statement that checks to see if the host name from the second csv file, if it isn't then treat it like a new object and go fill in all of the details of the object using my various functions, etc.
    Import-CSV$currentALReport-Delimiter","|ForEach-Object
         if($objectCollection.N_HostName
    -notcontains$_.'name')
            # then create a new currentObject and go populate the properties of the object 
         elseif ($objectCollection.N_HostName -contains $_.'name') {
              # copy this object and update the object's AL_Status (which is the last reported message date info)
                  # send that to the function that will parse it, compare Julian dates and see if it falls within my
                  # criteria as being stale.  if so set the IsStale property to Yes, but reguardless set the AL_Status
                  # newest last reported message data
    JRV states that "The "select object" does nothing at all unless you have a column in your CSV called "object".  The where clause will do nothing because it is syntatctically wrong and illogical. "
    I beg to differ.  Using the above command :   with the script running and the current focus ($_.'name') equals "abcd.domain.com"
     $arrayOfObjects | select-object | where N_HostName -like $_.'name'
    It obtain a single object within my array of objects similar to this:
    IP: 1.2.3.4
    N_HostName: abcd.domain.com
    IsStale: No
    LastMsgDate: Dec 30 2014 09:15:00
    Delta: 1
    Ping: Yes
    InDNS: Yes
    InAD: Yes
    Alias: *
    (other fields omitted for brevity) I could get any of my existing objects if I match the hostname
    If I used only the command "  $objectCollection | Select-Object "    it returns every object in my array.
    So to narrow down the selection to a single object I add the " | where N_HostName -like $_.'name'  "
    which gives me the exact object I am searching for.
    My only question is how can I modify the contents of the object that I have specified within the array of object???

  • How to bind bar chart(columns) to array list object in c# win form

    how to bind bar chart(columns) to array list  object in c#win form

    Hi Ramesh,
    Did you want to bind list object to bar chart? I made a simple code to achieve binding list to bar chart.
    public partial class Form0210 : Form
    public Form0210()
    InitializeComponent();
    private void Form0210_Load(object sender, EventArgs e)
    BindData();
    public void BindData()
    List<int> yValues = new List<int>(new int[] { 20, 30, 10, 90, 50 });
    List<string> xValues = new List<string>(new string[] { "1:00", "2:00", "3:00", "4:00", "5:00" });
    chart1.Series[0].Points.DataBindXY(xValues, yValues);
    The links below might be useful to you:
    # Data Binding Microsoft Chart Control
    http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx
    # Series and Data Points (Chart Controls)
    https://msdn.microsoft.com/en-us/library/vstudio/dd456769(v=vs.100).aspx
    In addition, if I misunderstood you, please share us more information about your issue.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • Can�t open array and object manager

    Hello,
    i�ve done a fresh install of SGD 4 on Fedora Core 3.
    Here I am not able to open array and object manager. I see them running in
    the webtop but get no display.
    I get the following logs:
    in wm_errors: X connection to unix:10.0 broken (explicit kill or server
    shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ..skipping...
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ~
    and in error.log
    2005/03/01 18:31:54.951 (pid 20049) pem/circuit #0
    Tarantella Secure Global Desktop Enterprise Edition(4.0) ERROR:
    An error occurred reading on circuit fdcircuit. Reason: (9) Bad file
    descriptor.
    The current operation has failed.
    If persistent, restart the server.
    Restarting the server doesn�t help.
    I�ve also set the xscecurity flag to 0.
    This all works fine with Fedora Core 2
    Anyone any Idea?
    Thanks a lot

    Hi Matthias,
    I had similar problems with (local) X apps.
    via ssh, and I mean they arose with tta vers.
    3.42. The problem seems to appear, because
    both tta and ssh (with X forwarding) are
    using a X-display range from :10 upward.
    So, one simply can resolve this by using a different X-display offset for
    ssh, by setting:
    X11DisplayOffset 100
    (for exsample) in sshd_config.
    Then tta still uses displays :10, :11, ...
    but ssh is using :100, :101, ...,
    (assuming that 90 X/RDP emulator-session are enough in this installation!)
    Don't forget to send a SIGHUP to the master
    sshd after changing sshd_config, telling
    'him' to re-read it's config-file.
    One can verify the effect, by calling
    'ssh localhost' and executing: echo $DISPLAY
    this should give something like:
    localhost:100.0
    Kind regards,
    Tankred
    Matthias wrote:
    Hello,
    not all login authorities are disabled. I have only NT auth. enabled. This
    works fine in EE 3.40 on RH 9 and on SGD4.0 on Fedora Core 2. But seems
    not to run on Fedora Core 3.
    Matthias
    Carmelo wrote:
    Mattias,>>
    >
    http://www.tarantella.com/support/documentation/sgd/ee/4.0/help/en-us/base/indepth/disabled_all_login_authorities.html
    Regards,
    Matthias wrote:
    I think I�ve fixed it.
    I just edited ssh_conf and enabled X11forwarding and it works for me.
    But now I have changed the login authority only to NT auth. and I am no
    longer able to log in to tarantella....
    Matthias wrote:
    Hello,
    i�ve done a fresh install of SGD 4 on Fedora Core 3.
    Here I am not able to open array and object manager. I see them running
    in
    the webtop but get no display.
    I get the following logs:
    in wm_errors: X connection to unix:10.0 broken (explicit kill or server
    shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ...skipping...
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ~
    and in error.log
    2005/03/01 18:31:54.951 (pid 20049) pem/circuit #0
    Tarantella Secure Global Desktop Enterprise Edition(4.0) ERROR:
    An error occurred reading on circuit fdcircuit. Reason: (9) Bad file
    descriptor.
    The current operation has failed.
    If persistent, restart the server.
    Restarting the server doesn�t help.
    I�ve also set the xscecurity flag to 0.
    This all works fine with Fedora Core 2
    Anyone any Idea?
    Thanks a lot

  • How do I insert an object in an array?

    How can I insert an object in an array of variable size?
    I input two numbers from keyboard
    1
    2that form the following object (Pair)
    (1,2)
    how can I add such objects to an array
    private Pair s[];
    e.g.
    public PairList(int x){
    top = -1;
    s = new Pair[x];
    }//constructor
    public void getPairs()throws FullException{
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    try{
    a=input.readLine();b=input.readLine();
    }//try
    catch(IOException e){System.out.println("Can't read input");}//catch
    int x=0;
    int y=0;
    try{
    x=Integer.parseInt(a);}//try
    catch(NumberFormatException e){}
    try{
    y=Integer.parseInt(b);}//try
    catch(NumberFormatException e){}
    Pair k=new Pair(x,y);
    System.out.println(k);
    s[++top]=k; --here is my problem
    }//getPairs

    I tried making as few changes to your code as possible, but your idea should basically work. Potential problems:
    1. Doesn't allow for more input than 1 pair.
    2. By storing pair in an array, you must know the exact size of the array you will need beforehand. You might be better off storing the Pair(s) in a Vector and then converting that to an array.
    3.Your exception handlers need some work. Basically, your exception handlers put out a message or do nothing and then you continue processing. Not good.
    4. No cleanup of file resources after you have completed
    import java.io.*;
    public class PairList{
         private Pair s[];
         private int top;
         public PairList(int x){
              top = -1;
              s = new Pair[x];
         }//constructor
         public void getPairs()throws Exception{
              BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
              String a = null, b = null;
              try{
                   a=input.readLine();
                   b=input.readLine();
              }//try
              catch(IOException e){
                   System.out.println("Can't read input");
              }//catch
              int x=0;
              int y=0;
              try{
                   x=Integer.parseInt(a);
              }//try
              catch(NumberFormatException e){
              try{
                   y=Integer.parseInt(b);}//try
              catch(NumberFormatException e){
              Pair k=new Pair(x,y);
              System.out.println(k.toString());
              s[++top]=k; //here is my problem
         }//getPairs
    class Pair {
         private int xx;
         private int yy;
         public Pair(int x, int y) {
              xx = x;
              yy = y;
         public String toString() {
              return("X = " + xx + "  Y = " + yy);
    }

Maybe you are looking for

  • How do I get my iPod 1st Gen out of recovery mode when it gives an error message (1)?

    I tried to restore my iPod 1st generation and while restoring it got stuck in recovery mode. I tried to get it out of recovery mode by (restoring and updating) but it would say (extracting software) and then would show an error message (1) saying- Wh

  • Why videos do not play correctly in itunes.  They stop and go

    I moved a library to ituenes from another ancient computer which has a centrino duo and the new computer is an i3.  The videos stop and go when played from within itunes.  Outside Itunes with VLC or Quicktime player, they play fine. How can I fix thi

  • "Discuss and comment" link is bad

    The "Discuss and comment on this resource in the BigAdmin Wiki" link at the bottom of this page is bad: [http://www.oracle.com/technetwork/systems/patches/overview/index.html|http://www.oracle.com/technetwork/systems/patches/overview/index.html] Glen

  • Dual layer DVD -R vs. +R

    Hi folks I've got a stock of DVD+R DL and DVD-R DL. I didn't know you could get -R in DL but I got some good JVC ones and that's what they were. No problems with burning them in Encore CS3, but when I analysed the layer break point in GEAR Pro Master

  • Getting error as error spawning cmd.exe  while building a sample plugin by Dollyxs (Windows)

    Hi, I am still new to indesign plugin development. I am not able to build a sample project created using Dollyxs on windows for Indesign CS4. I am getting error as Error spawning cmd.exe . Am I missing some settings to be made for the project. Can an