Changing to an array of Objects!!

void add_ActionPerformed(ActionEvent event)
try{
String t,n,a,s,p;
t=title.getSelectedItem();
n=fname.getText();
s=fsurname.getText();
a=county.getSelectedItem();
p=fphone.getText();
int ph=Integer.parseInt(p);
mem.setTitle(t);
mem.setName(n);
mem.setSurname(s);
mem.setCounty(a);
mem.setPhone(ph);
catch(NumberFormatException e)
JOptionPane.showMessageDialog(null,e,"Invalid Number",JOptionPane.ERROR_MESSAGE);
System.exit(0);
I wish to have the above details of "mem" stored in an array instead of having only one instance of "member" mem?

hi,
When i understand it correctly. You want to create an array of Member objects. The best thing you can do is create a new Member obeject every time the Action is performed. If you don't now how many Members will be generated you could use a java.util.Collecton for example a java.util.Vector.
A Vector doesn't have a fixed size it can grow.
Depending on the JVM version ( <1.5 ) you have to typecaste the objects when you read them out of the vector e.g. Member mem = (Member)v.elementAt(2);
Vector v = new Vector();
void add_ActionPerformed(ActionEvent event)
try{
String t,n,a,s,p;
t=title.getSelectedItem();
n=fname.getText();
s=fsurname.getText();
a=county.getSelectedItem();
p=fphone.getText();
int ph=Integer.parseInt(p);
Member mem = new Member();
mem.setTitle(t);
mem.setName(n);
mem.setSurname(s);
mem.setCounty(a);
mem.setPhone(ph);
v.add(mem);
catch(NumberFormatException e)
JOptionPane.showMessageDialog(null,e,"Invalid Number",JOptionPane.ERROR_MESSAGE);
System.exit(0);
}

Similar Messages

  • Property List error: Unexpected character b at line 1 / JSON error: JSON text did not start with array or object and option to allow fragments not set.

    Hi,
    I have a MBP 13' Late 2011 and Yosemite 10.10.2 (14C1514).
    Until yesterday, I was using Garmin ConnectIQ SDK and all was working fine.
    Yesterday, I've updated my system with latest security updates and Xcode updates too (Version 6.2 (6C131e)).
    Since, I can't launch the ConnectIQ simulator app, I have this message in console :
    8/04/2015 15:19:04,103 mds[38]: There was an error parsing the Info.plist for the bundle at URL Info.plist -- file:///Volumes/Leto/connectiq-sdk-mac-1.1.0_2/ios/ConnectIQ.bundle/
    The data couldn’t be read because it isn’t in the correct format.
    <CFBasicHash 0x7fa64f44e9a0 [0x7fff7dfc7cf0]>{type = immutable dict, count = 2,
    entries =>
      0 : <CFString 0x7fff7df92580 [0x7fff7dfc7cf0]>{contents = "NSDebugDescription"} = <CFString 0x7fa64f44f0a0 [0x7fff7dfc7cf0]>{contents = "Unexpected character b at line 1"}
      1 : <CFString 0x7fff7df9f5e0 [0x7fff7dfc7cf0]>{contents = "kCFPropertyListOldStyleParsingError"} = Error Domain=NSCocoaErrorDomain Code=3840 "The data couldn’t be read because it isn’t in the correct format." (Conversion of string failed.) UserInfo=0x7fa64f44eda0 {NSDebugDescription=Conversion of string failed.}
    I have looked at this file and it looks like a binary plist
    bplist00ß^P^V^A^B^C^D^E^F^G^H
    ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_ !"$%&'()'+,^[\CFBundleNameWDTXcodeYDTSDKName_^P^XNSHumanReadableCopyrightZDTSDKBuild_^P^YCFBundleDevelopmentRegion_^P^OCFBundleVersi    on_^P^SBuildMachineOSBuild^DTPlatformName_^P^SCFBundlePackageType_^P^ZCFBundleShortVersionString_^P^ZCFBundleSupportedPlatforms_^P^]CFBundleInfoDictionaryVersion_^P^RCFBundleE    xecutableZDTCompiler_^P^PMinimumOSVersion_^P^RCFBundleIdentifier^UIDeviceFamily_^P^QDTPlatformVersion\DTXcodeBuild_^P^QCFBundleSignature_^P^ODTPlatformBuildYConnectIQT0611[iph    oneos8.1o^P-^@C^@o^@p^@y^@r^@i^@g^@h^@t^@ ^@©^@ ^@2^@0^@1^@5^@ ^@G^@a^@r^@m^@i^@n^@.^@ ^@A^@l^@l^@ ^@r^@i^@g^@h^@t^@s^@ ^@r^@e^@s^@e^@r^@v^@e^@d^@.V12B411RenQ1V14C109Xiphoneos    TBNDLS1.0¡#XiPhoneOSS6.0YConnectIQ_^P"com.apple.compilers.llvm.clang.1_0S8.1_^P^Tcom.garmin.ConnectIQ¡*^P^AW6A2008aT????^@^H^@7^@D^@L^@V^@q^@|^@<98>^@ª^@À^@Ï^@å^A^B^A^_^A?^AT^    A_^Ar^A<87>^A<96>^Aª^A·^AË^AÝ^Aç^Aì^Aø^BU^B\^B_^Ba^Bh^Bq^Bv^Bz^B|^B<85>^B<89>^B<93>^B¸^B¼^BÓ^BÕ^B×^Bß^@^@^@^@^@^@^B^A^@^@^@^@^@^@^@-^@^@^@^@^@^@^@^@^@^@^@^@^@^@^Bä
    I guess it is a normal format but my system seems to be unable to read binary plist ?
    I tried some stuff with plutil
    plutil -lint Info.plist
    Info.plist: Unexpected character b at line 1
    Same for convert
    plutil -convert xml1 Info.plist
    Info.plist: Property List error: Unexpected character b at line 1 / JSON error: JSON text did not start with array or object and option to allow fragments not set.
    I also try to download a fresh version of the connectIQ SDK and no changes.
    Any idea ?
    Thanks

    Step by step, how did you arrive at seeing this agreement?

  • Check this out: making a copy of an array of objects

    I have an array of objects called Figs of type Figure and I am making a copy of this array called OriginalFigs so later when Figs change, I can use the original values stored in OriginalFigs.
    But I found out that when values in Figs change, values in OriginalFigs also change.
    I tried to store values in Vector too but even in Vector values are changing.
    seems like they both are storing reference to Figs and when Figs change , they(Vector and OriginalFigs) chnage too.
    Is there any way to come around this problem?
    if u know then plz share with me..........

    Hi,
    how do you copy them - if you use the method from Object(? was it there, never use this), you will get a shallow copy - that is a new object with the same references in it - not a new object with new objects of the figures in it.
    How about providing a methode in your figure-objects which can do a total copy? - This must be easy as so you know how to construct such an object efficiently.
    Another way to hold a copy is to write the figures out to a stream temporarily - all objects are serializable and so they can be stored to a stream - but your figures should not have references to other parts of the program in it, because the serialisation-process tries to serialize all references the object has, that is to be serialized. If there is for exampe a link to the main JFrame in it, the serialisation process tries to store your hole program to the stream and this may be impossible - I hat this with parts of a JTree that refuse to be stored to a stream.
    Hope, this will help
    greetings Marsian

  • 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.

  • Reading arrays of objects

    I am new to OCI programming, but have read the manuals on reading objects, but can not figure out how to do what I want to do from that documentation. I am using oracle 9.2.0.7
    I have a package that produces a bunch of data. Currently this data is stored as records in local variables. From my understanding OCI can not read oracle records
    so that I will need to change package to use either varrary or associative arrays. I do not want to place this data into a actual oracle table because the data only has meaning at time package procedure is run and then is out of date for any other purposes. I Only want to read the data that is created in sql packages so that my C program can do other work with that data. It will change data into an XML format that Internet Application will use.
    This is where I am stuck, it is implied that OCI should be able to read these created arrays of objects, but all examples are reading oracle tables that have objects in them. So I would like either an example or some suggestions on how to get started on doing this. So far I have created and oracle object type that has my fields in it. Since I do not know how many records I will be creating when I
    run this package I think I should put data in an associative array.

    Hi
    Yes, you'll need to publish the data somehow. One way to do it is to place the data into a PL/SQL collection; then select from that.
    There's a write up of some examples at http://www.dbasupport.com/oracle/ora9i/cast.shtml
    HTH
    regards Nigel

  • How to Monitor a Change in an Array

    I have a class called Array, and this class is just able to add or remove an Object to/from the array.
    But I need to automatically increase the size of the array when a new Object is inserted to the array with full capacity. And I don't want to change any codes for current add and remove methods. So to do this, I think I have to be constantly monitoring the changes in the array somehow. How do I do this?
    Thank you.

    Is this for a class, and are you prevented from using ArrayList or other classes from the Collections group?

  • Plz help!! array of object (for search)

    i've got few questions of array of object
    1-how to search for a price that is greater than 300 in the array of object
    and how to list all of them?
    2- how to search for the smallest price in the array of object, and how to list?
    can anyone provde a java code for me:P?
    but plz don't too complex
    coz i'm a learner of javaT_T

    _< i still can't understand, and dunno how to change into the code that i needand you guyz help me change it?
    /*wirte the driver program which will define and create an array of
    objects instantiated from the class WaterBill
    Create Accessor and Mutator methods to get/set data from the class.
    write code within the driver method to perfrom the following:
    a) The final total of funds
    b) To search for accounts greater than $300 in the array of objects,
         and list all the customer details
    c)To search for the lowest bill in the array of objects, and list
    those customer dtails
    Class definitions and Objects  using price
    import java.text.*;
    import javax.swing.JOptionPane;
    public class Pre_pb3
         public static void main(String []args)
              int  TTc=0;
              int accNum[]=new int[20];
              String name[]=new String[20], output, stans, display; //stAccNum, stUsage, stTTc;
              double usage[]=new double[20];
              double TTa=0.0;
              double price[]=new double[20];
              char ans;
              double acctG,lowest;
              int i=0;
              waterBill MYwaterBill = new waterBill();
              ans='Y';
              while (!(ans=='N'))
                   name=inputName();
                   accNum[i]=inputAccNum();
                   usage[i]=inputUsage();
                   price[i]=calculateAmountOwing(usage[i]);
                   TTa=MYwaterBill.TTaPrice(price[i]);
                   output=MYwaterBill.outputInfo(name[i], accNum[i], usage[i], price[i]);
                   waterBill MYwaterBill2= new waterBill(name[i], accNum[i],usage[i], price[i]);     
                   stans=JOptionPane.showInputDialog("Do you wanna continue?, (Y)es, (N)o");
                   stans = stans.substring(0, 1);
                   stans=stans.toUpperCase();
                   ans=stans.charAt(0);
                   TTc++;     
              MYwaterBill.outputoutput(TTc, TTa);
              MYwaterBill.findGreat();     //b)
              MYwaterBill.searchDetail();     //c)
              System.exit(0);                                                  
         public static String inputName()
                   String name;
                   name=JOptionPane.showInputDialog("Enter Name ");
                   return name;
         public static int inputAccNum()
              int accNum;
              String stAccNum;
              stAccNum=JOptionPane.showInputDialog("Enter Account Number");
              accNum=Integer.parseInt(stAccNum);
              return accNum;
         public static double inputUsage()
              double usage;
              String stUsage;
              stUsage=JOptionPane.showInputDialog("Enter Water Usage");
              usage=Double.parseDouble(stUsage);
              if (!(usage>=0 && usage<=99999999))
                   System.out.println("water useage is invalid");
                   System.exit(0);
              return usage;
         public static double calculateAmountOwing(double usage)
              double price=0.0;
              if (usage>=0)
                   if (usage<=10000)
                        price=(10000/10)*0.01;
                   else if (usage>10000)
                        price=((10000/10)*0.01)+(((usage-10000)/10)*0.02);
              else
                        System.out.println("Error of usage");
                   return price;
    class waterBill
         private static     int TTc=0 ,accNum=0;
         private static String name, stAccNum, stUsage, stTTc;
         private static String output=" ";
         private static double usage=0.0;
         private static double TTa=0.0;
         private static double price=0.0;
         private static String lowest;
         public waterBill()
              name=" ";
              accNum=0;
              usage=0.0;
              price=0.0;
         public waterBill(String n,int an, double us, double p)
              setName(n);
              setAccNum(an);
              setUsage(us);
              setPrice(p);
         public void setName(String n)
              name=n;
         public void setAccNum(int an)
              accNum=an;
         public void setUsage(double us)
              usage=us;
         public void setPrice(double p)
              price=p;
         public String getName()
              return name;
         public int getAccNum()
              return accNum;
         public double getUsage()
              return usage;
         public double getPrice()
              return price;
         public double TTaPrice(double price)
              TTa=TTa + price;
              return TTa;
         public String outputInfo(String name, int accNum, double usage, double price )
              String output=" ";                         
              output: System.out.println( "Account Number: "+ accNum +
                                       "\nWater Usage: " + usage +
                                       "\nCost Owing: " price
                                       "\nName: "+ name+"\n");
              return output;
         public void outputoutput(int TTc, double TTa)
              display:     System.out.println("Total customer: "+ TTc +
                                  "\nTotal amount owing: " + TTa + "\n\n");
         public void findGreat()//search the a/c that is greater than 300.
              //dunno how to do, so i just leave it blank^^"
              public String searchDetail()//search the smallest a/c
              //same...dunno how to doT_T     

  • Renumber an Array of Object

    How would I renumber a property in an array of Object?
    For instance, say I have 5 Projects each with it's own corresponding priority property. Say I want to change the priority of the 5th Project to have a priority of 1. Meaning that the orginial 1 -4 projects would be pushed down and their proirities changed accordingly. Is there an API out there that does this?
    Thanks!
    Pete

    Not sure of the API but a possible solution is to sort the object array by that particular object property at the time of its creation. Later when you change the property you can use the same method that traverses the array again and re-arranges the objects based on new priorities.
    I agree this won't the most efficient solution but i'm sure you should be able to optimize it to some extent. :)
    Hope it helps.
    -ts

  • Creating array of object

    Using JNI, I'm trying to pass an array of object from the C native side to
    the Java side. I have the following code:
    JNIEXPORT jint JNICALL Java_classA_methodB(
    JNIenv *env,
    jobject obj,
    jobjectArray objArr )
    jclass objClass = ( *env )->FindClass( env, "arrObjClass" );
    jmethodID methodID = ( *env )->GetMethodID( env, objClass, "<init>", "()V" ); // Default constructor
    jobject objElement = ( *env )->NewObject( env, objClass, methodID );
    // ... Fill objElement with values
    ( *env )->SetObjectArrayElement( env, objArr, 0, objElement ); // <-- program core dumps here.  WHY? 
    return 1;
    The program core dumps at the line above and I don't understand why?
    objArr is originally set to null when pass to the native function. Does
    objArr have to be allocated using new before pass to the native function?
    Thank you in advance,
    Duong

    You seem to be trying to write into an array passed as an input argumenet, when you haven't in fact passed an array object.
    (At least that's what I interpreted you to say what you are doing.)
    Either construct an array in java and pass it to C++, or if that is probelmatic, then change the C++ return object from an int to an array, and do the construction in C++.

  • 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

  • Adding an Array of Objects into an external Web-Service

    Hi all,
    I want to populate an Array of Objects into an external Web-Service which I have introspected into BPM. But I am finding it difficult to do so which should be very easy I guess.
    When i use the EXTEND keyword for adding the array of objects, it gives me the following parameters which are not required:-
    testArray.records.extend(name : "", attributes : null, value : "", children : {  }, tagName : "", namespace : "", isNil : false);
    I only need to populate the name and value pairs and do not need to populate others. But there is no way for me to do this.. How do I populate other parameters or skip them especially
    children which is a Fuego.Xml.XMLObject[].. How do I populate that? How do I populate attributes which is an associative array and not required..
    Is there a proper documentation of consuming external Web-Services into BPM?

    Very interesting, I am going to have to really break this down and see if I can make sense out of it with my 300 lines of code LOL.
    I think this may jsut work at first glance and will let you know!
    It works. We all use it all of the time. The old Add-Member was a big pain in the neck.  InPowerShell V2 New-Object -Property ws added to take a hash of name/value pairs and convert them into an object in one step.  It is faster and more reliable.
    $myprops=@{
        Name='joe'
        Birthdate=[datetime]'02-12-1965'
        Weight=[int]130
        Married=$false
        Flags=[byte]0x3F
    # we can change a value on the fly
    $myprops.Weight+=5  # adjust weight for liars
    New-Object PsObject -Property $myprops
    OR get name=value pairs from a file and make into an object
    $fileprops=Get-Content mydata.txt | ConvertFrom-StringData
    New-Object PsObject -Property $fileProps
    There are more than a dozen other variations of how to levcerage this to create objects out of other things like results from old DOS commands.
    ¯\_(ツ)_/¯

  • CASTING AN ARRAY OF OBJECTS

    Hi guys, How I need do to cast an array of objects to a String array??!?!
    I am using
    String array[] = (String[]) getObjects();
    //getObjects() return a Object[]Thanks.
    Giscard

    And what? You get a ClassCastException? If so, you're attempting to change the type of reference that points to the object to a type that isn't the same as the class of the object instance, or a class that the class of the object instance extends, or an interface that the class of the object instance implements.

  • Array of objects in class private data and calling overridden VIs on these objects?

    Hello
    I am developing part of an application using the actor framework and have run into problems.
    I have a several actors and will try briefly describe them and their intended functionality. All actors are started by a Controller actor and in the actor core for the controller I have the possibility to do a lot of intiliazation etc.
    Logger:
    Has a message (Send Log Message) that other actors can use to write to the log. It is supposed to take a string input and a log level (error, warning, debug etc). This message chain sends data to the actor core with a user event.
    The Actor Core of Logger is supposed to save the incoming message to a log, but should be able to do it in several different ways (file, database, email or whatever).
    Logger Output:
    Abstract class that has a dynamic dispatch vi called "Write Output" that all it's children are supposed to overwrite.
    Logger Output File
    Child of Logger Output and overwrites "Write Output" to save the string to a file on disk.
    Problem:
    I want to be able to set up the actor core for Logger once and for all but still be able to create new children of "Logger Output" and have them be handled in the Logger actor core.
    My idea was to have Logger use an array of objects as private data and initialize this array in the Controller actor core.
    In the logger actor core I could then auto index the array and use each element (each Logger Output child) and the abstract "Write Output" vi to get the correct functionality.
    HOWEVER, I cannot get this to work properly and I think I have misunderstood something or stared myself blind on this problem. I have tried 3 different methods when it comes to private data for Logger.
    1. Labview Object
    2. Array of Labview Object
    3. Array of Logger Output Object
    Of these 3 methods, I can only get the first one to work and that doesn't accomplish what I want in the end (being able to add more classes without changing private data / actor core for Logger).
    I have included 3 screenshots that show snippets of 2 of the actor cores and the private data. File names should correspond to my description above.
    The screenshot "Logger actor core.png" shows a very fast test of the 3 different methods I described above. Each of the 3 tunnel inputs to the event structure can be wired to the "Reference" input of "To More Specific Class", but only method 1 (Labview Object) works.
    If you need additional information / screenshots or whatever please ask.
    Thanks in advance
    Attachments:
    Logger ctl.PNG ‏8 KB
    Logger actor core.PNG ‏25 KB
    Controller Actor Core.PNG ‏11 KB

    Thanks for the reply and sorry for the confusing OP. It was meant as a quick test and a way to skip making 10+ screenshots .
    I updated the actor core for the Controller and Logger to be less confusing (hopefully) and attached 2 screenshots.
    I agree with you that it would be a good idea to make a message for the controller that can launch new children of the L" abstract actor, but for these tests I have just launched it the easy way (dragging it to the controller actor core).
    Both Logger Output and Logger Output File are actors and in Logger Output there is a dynamic dispatch vi called Write Output that I want to override in all its children.
    The problem is when I run the actor core of Logger (see the screenshot) only the abstract version (the one in Logger Output) of Write Output is executed, not the overridden version from Logger Output File.
    When I did the same thing with the actor cores looking like the did in my original post, then the correct overridden version got executed when I used the method with one Labview Object in private data (not any array or an array of Logger Output objects).
     EDIT: I just tried to have the Logger private data be a single Logger Output object and writing the Logger Output File to that piece of private data in the Controller and the correct Write Output override method gets called now. So apparently I have done something stupid when it comes to creating the array of Logger Output objects and writing them in the controller? The private data is in the Logger actor so I have simply right clicked and chosen "New VI for Data Member Access" and chosen "Write" for "Element of Array of Logger Output Objects".
    Attachments:
    Controller Actor core updated.PNG ‏10 KB
    Logger actor core updated.PNG ‏24 KB

  • How to initialize the array with object?

    Here is type I have.
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_TYPE AS OBJECT
    BU_AP VARCHAR2(5),
    VOUCHER VARCHAR2(10),
    V_LINE INTEGER,
    USERID VARCHAR2(20),
    COMMENT_DTTM DATE,
    COMMENT VARCHAR2(254)
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_COLL AS VARRAY(1000) OF SYSADM.AP_COMMENT_TYPE;
    Then I created a procedure to grab some data.
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher
    AND voucher_line_num = voucher_comment (i).v_line;
    BEGIN
    voucher_comment (1) := ap_comment_type (' ', ' ', 0, ' ', '', ' ');
    --voucher_comment (1) := ap_comment_type (null, null, null, null, null,null);
    IF voucher_comment (i).v_line = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;
    But when I tried to test the procedure, got error: ORA-06531: Reference to uninitialized collection. Does anyone have experience of handling array with object?
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL;
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 1, 'KEHE', O_voucher_comment);
    end;

    Thanks for that. I changed it a little bit, but when i ran this script, got ORA-06532: Subscript outside of limit.
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL := sysadm.ap_comment_coll(null);
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 0, 'KEHE', O_voucher_comment);
    end;
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in
    AND voucher_line_num = v_line_in;
    BEGIN
    --voucher_comment() := SYSADM.ap_comment_type (NULL, NULL, NULL, NULL, NULL, NULL);
    --' ', ' ', 0, ' ', '', ' ' sysadm.ap_comment_coll
    voucher_comment := sysadm.ap_comment_coll(null);
    IF v_line_in = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              if i > 1
              then
                   voucher_comment.EXTEND;
              end if;
    voucher_comment (i) := ap_comment_type (v_bu_in,
    v_voucher_in, v_line_num, v_userid,
    TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), v_comments );
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.extend(6);
    voucher_comment (i) := ap_comment_type (v_bu_in, v_voucher_in, v_line_num, v_userid, TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS' ), 'DD-MON-YYYY HH24:MI:SS'), v_comments);
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;

  • Displaying the contents of an array of objects

    Hello All,
    My Java teacher gave us a challenge and I'm stumped. The teacher wants us to display the contents of the array in the main menthod. The original code is as follows:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    }I understand that the elements of the array are objects, and each one has a value assigned to it. The following code was my first attempt at a solution:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
                                    for ( int i = 0; i < thingArray.length; i++)
                                       System.out.println( thingArray );                         
    }To which I'm given what amounts to garbage output. I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array. There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. Thanks very much in advance!

    robrom78 wrote:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    for ( int i = 0; i < thingArray.length; i++)
    System.out.println( thingArray );                         
    Note that you're trying to print the entire array at every loop iteration. That's probably not what you meant to do.
    You probably meant to do something more like
                                 System.out.println( thingArray[i] );Also, note that the java.util.Arrays class has a toString method that might be useful.
    To which I'm given what amounts to garbage output. It's not garbage. It's the default output to toString() for arrays, which is in fact the toString() defined for java.lang.Object (and inherited by arrays).
    I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array.It displays a default result that is vaguely related to the memory, but probably shouldn't be thought of us such. Think of it as identifying the type of object, and a value that differentiates it from other objects of the same type.
    By the way I assume you mean "+not+ the contents of the array" above. If so, that is correct.
    There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? No, you don't override a method in println; actually methods don't contain other methods directly. You probably do need to override toString in Thing.
    I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. You can get to the individual objects in the array just by dereferencing it, as I showed you above.
    But I suspect that won't be sufficient. Most likely, Thing doesn't have a toString method defined. This means that you'll end up with very similar output, but it will say "Thing" instead of "[Thing" and the numbers to the right of the "@" will be different.
    You'll need to override the toString() method in Thing to get the output you want.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Using SQVI to generate report of open and released delivery schedule lines

    All, I'm using SQVI  to generate an excel spreadsheet for some buyers to show open released schedule lines because they are a 1 line item per scheduling agreement company. I used the logical database MEPOLDB instead of a table joint and pulled fields

  • How to wrap a view in oracle

    Does any one know how to wrap a view in Oracle, I know it is not possible, yet. Are there any third party software to wrap the logic in the view. Thanks, Sanjay

  • 865PE Neo2-PFISR problems after power outage

    I need some help with a problem.  A recent power outage while my supposedly "surge protected" 865PE Neo2 based machine was running, apparently messed something up.  After our power came back on, I powered it back up and discovered that I now have 4 o

  • New documentation for Cache-crossbar interface posted

    Hello Everyone, There have been several questions recently about the interface between the SPARC core and the cache-crossbar (CCX). As a result, we have posted a supplement to the OpenSPARCT1 Microarchitecture Document which goes into more detail abo

  • App Builder doesn't advance - single edition user

    I have followed directions identified in the following chain with Neil Enns - Adobe but have not be able to be successful in advancing in DPS app builder. Re: Can't advance in DPS App Builder I've completed building my folio and have chosen 'Create A