Array of Strings?

How can I make an array of strings?

or, depending on what the heck you're talkingabout
That's bad advice now that Java is in version 5.
The standard loop is the for-each loop. If you don't
use it you're going down in complexity which is a
very bad thing according to the "premature
optimization is evil" bunch. So use for-each if you
don't want to be accused of "premature optimization"
by jverd and yawmark and other prominent members of
that bunch.Thanks for your advice. I use version 1.4.2. I did not intend to give bad advice. My post was targeted at someone who obviously did not understand "nuts and bolts" of java. It was not intended to be a lesson about "good design" or "real life applications" or "standard for loops in version 1.5". I gave an example that i feel is both adequate and appropriate for the target audience. It's intended purpose was to demonstrate very simple and basic concepts to someone who asked a seemingly simple and basic question that could possibly irritate a seasoned programmer like yourself. I have read your helpful posts in this thread and would welcome comments from yawmark and jverd also. I am sure they would be helpful to others who would read this thread in the future but their level of experience (along with Mr Warnerja) would perhaps be lost and uncomprehended by the OP. If in the context of the original question, you believe that my posts and simple examples are inappropriate, then would you kindly explain in terms that the OP can understand? Also explain (in this context) how my posts were wrong and meaningless.
respectfully yours,
Arbie

Similar Messages

  • Get numerical values from 2D array of string

    Hello! 
    I start by saying that I have a base knowledge of LabView. I'm using LabView 2011. I'm doing some communications test via Can-Bus protocol. As you can see in pictures of the block diagram and of the front panel that I've attached I'm using "Transmit Receive same Port" LabView example. It works very good but I would need to insert the 8 data bytes that I receive from the server in 8 different numerical variables so that I could use them to make some operations. How can I get numerical values from the 2D array of string that I attached? 
    Every example that you can provide is important! 
    Thank you very much! 
    Attachments:
    1.jpg ‏69 KB
    2.jpg ‏149 KB

    Hi martiflix,
    ehm: to unbundle data from a cluster I would use the function Unbundle(ByName)…
    When you are new to LabVIEW you should take all the FREE online resources offered by NI on their website!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How do I write an array of strings to a single Excel row?

    I'd like to write test data, as an array of strings, to an Excel file. Attached is my attempt to modify one of the Labview 6.1 example files. This modified example will write the data to the correct row, which is determined by serial # of the UUT, but to a new sheet for each unit. I'd like to do the same thing, but to just one sheet. This sheet's data would then be saved after 50 rows of collected test data.
    Thank you in advance,
    Tim Denson
    Attachments:
    Write Table To XL.vi ‏58 KB

    Sorry I didn't get back to faster on this. I've been out of town working and just really haven't had time.
    Yes,
    The Report Generation toolkit would make this very easy. If you have it, I'd suggest using it.
    The image shown below shows the five VIs from the toolkit that I've used to write to Excel.
    What this loop does is receive a string through a Queue, either open a
    template or open todays file, convert the tab delimited string to an
    array, write the array to the next line of the Excel file, Save (with
    todays date stamp if opened from the tempate) and close it. It's a good
    idea to always save and close teh file after each write if it's not
    being continuously written to. In this case, a new line will be written
    only once a minute or so. This lessens the chance of losing data if the
    machine locks up for some reason. Opening and closing does take time
    and can slow down a loop that needs to run at a certain rate. This loop
    actually runs in a background process and several other processes send
    data to it through the queue to be written. The queue can buffer
    several data streams if needed so you won't lose data if it's busy and
    you don't have to worry about two processes accessing the Excel sheet
    at the same time.
    Ed
    Message Edited by Ed Dickens on 02-18-2006 11:12 AM
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    RGTK Array to Excel.gif ‏14 KB

  • I need to sort an array of strings based on the number in each string.

    Basically, I have a directory of files that all have the same name but each with a different number on the end.
    example: image 1.jpg, image 2.jpg, etc.
    When I use the List Directory function that returns an array of strings containing the file names in the directory, they don't come out in a 1, 2, 3, order like they appear in the directory. It sorts them character by character so that they come out like: 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22 etc.
    Is there a simple way of sorting this array of strings with the file names (as above) so that they are in numerical order?

    It's a while since this thread was started, but I am sure others will have use for this so here goes:
    The in-built array sort function sorts the strings the same way DOS and Windows do. Microsoft has fixed this in the Explorer that comes with XP, however the rest of the OS(s) still sorts the old way.
    The attached "AlphaLogical String Array Sort" VIs will sort strings arrays the same way as the new XP Explorer. There are three different implementations of the sorting, one based on the Insertion sort algorithm, a Quick Sort based on recursive calls (the most elegant way, but unfortunately LabVIEW has too much overhead when doing recursive calls so this is actually a very slow alternative) and finally the fastest; a stack based Quick Sort. There is also a test VI that will show you how the different implementations perform.
    I had not used recursive calls in LV much until I made the attached quick sort and was a bit disappointed by the fact that it is so slow, but it's a good learning example...The ability to do recursive calls this way was introduced in LV7 I believe...There is an example here on the zone that shows how you can calulate a factorial by using recursive calls, however - unlike for the quick sort (normally) - recursive calls are actually not the optimal solution for that calculation.
    Message Edited by Mads on 09-13-2005 02:30 AM
    MTO
    Attachments:
    AlphaLogical Sorting.zip ‏142 KB

  • Problem in converting vector to array of strings

    hi
    i am having a vector which in turn contains hashtable as elements
    Vector v=new Vector()
    Hashtable ht=new Hashtable();
    v.add(ht.add("key1",value1))
    v.add(ht.add("key2",value2))
    v.add(ht.add("key3",value3))
    v.add(ht.add("key4",value4))now i am trying to conver this vector in to a array of string like
    String[] str=(String[])v.toArray(new String[v.size()]);but i am getting java.lang.ArrayStoreExceptioncan anybody help me plz
    Thanks

    Hi,
    The api for public Object[] toArray(Object[] a) says
    Returns an array containing all of the elements in this Vector in the correct order; the runtime type of the returned array is that of the specified array.
    ArrayStoreException will be thrown if the runtime type of a is not a supertype of the runtime type of every element in this Vector.
    The runtime type of the elements of the vector is Hashtable.
    Because String is not a supertype of Hashtable the ArrayStoreException is thrown.

  • [CS3][JS] How to turn negative number in array into string

    Hello,
    I have a script that compares the array of the geometric bounds of all text frames to the margins for a document (all pages having the same margins). Any frames that do not match the margins are flagged.
    In order to compare the array of text frame geometric bounds to two arrays of margins (because they are facing pages), I have to convert the numbers to strings.
    My problem is that in the following snippet of code that creates the two margin arrays, the negative of the variables become numbers again. This would not be too difficult to solve except that all the numbers have to be 4 decimal points before converted to strings.
    Thanks,
    Tom
    var myDoc = app.activeDocument;
    var marginY1 = myDoc.pages.item(0).marginPreferences.top.toFixed(4);
    var marginX1 = myDoc.pages.item(0).marginPreferences.left.toFixed(4);
    var marginY2 = (myDoc.documentPreferences.pageHeight - myDoc.pages.item(0).marginPreferences.bottom).toFixed(4);
    var marginX2 = (myDoc.documentPreferences.pageWidth - myDoc.pages.item(0).marginPreferences.right).toFixed(4);
    var marginsRHand = [marginY1, marginX1, marginY2, marginX2];
    var marginsLHand = [marginY1, -marginX2, marginY2, -marginX1];

    Well, I think I have solved it. But I don't know why this solves it.
    I would think that in the above script all the variables would be numbers and not strings. But the data browser says they are strings.
    The solution is:
    var marginsLHand = [marginY1, Number(-marginX2).toFixed(4), marginY2, Number(-marginX1).toFixed(4)]
    If someone can explain why now all variables in the arrays are strings and not numbers, I'll be happy.
    Tom

  • Mapping lookup up failure with input JavaBean with an array of strings

    To receive input data our Web service defines a JavaBean one element of which is
    an array of strings. When a test Java client calls the service method the call
    is completed successfully. When a Perl client calls the service method an exception
    is returned. If I understand BEA's Web service documentation, it isn't necessary
    to do development for the service specifically to enable correct processing of
    an array of strings.
    In our environment we are running WL 8.1 SP 1.
    Please review the problem documentation and explain to me the cause of the exception
    and what I must do to prevent it.
    Thank you.
    The exception:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Exception
    during processing: weblogic.xml.schema.binding.DeserializationException: mapping
    lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema context=TypedSchemaContext{javaType=java.lang.String}
    (see Fault Detail for stacktrace)</faultstring><detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"/>weblogic.xml.schema.binding.DeserializationException:
    mapping lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema
    context=TypedSchemaContext{javaType=java.lang.String}
         at weblogic.xml.schema.binding.RuntimeUtils.lookup_deserializer(RuntimeUtils.java:461)
         at weblogic.xml.schema.binding.SoapArrayCodecBase.getComponentDeserializer(SoapArrayCodecBase.java:574)
         at weblogic.xml.schema.binding.SoapArrayCodecBase.deserialize(SoapArrayCodecBase.java:285)
         at weblogic.xml.schema.binding.BeanCodecBase.processElement(BeanCodecBase.java:183)
         at weblogic.xml.schema.binding.BeanCodecBase.processAllElements(BeanCodecBase.java:165)
         at weblogic.xml.schema.binding.BeanCodecBase.processElements(BeanCodecBase.java:145)
         at weblogic.xml.schema.binding.BeanCodecBase.deserialize(BeanCodecBase.java:108)
         at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:428)
         at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:328)
         at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:384)
         at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:458)
         at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
         at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
         at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)
         [more]
    The XML generated for the Perl client:
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getWorkOrdersByFilters
    xmlns:namesp1="ncr.com"><gIMServiceRequest xsi:type="ns:GIMServiceRequest" xmlns:ns="java:com.ncr.gim.bean.service"><applicationID
    xsi:type="xsd:string">REVLOG</applicationID><nodeId xsi:type="xsd:string">00XH</nodeId><stopCodes
    xsi:type="namesp2:array" SOAP-ENC:arrayType="xsd:string[2]"><xsd:string xsi:type="xsd:string">06</xsd:string><xsd:string
    xsi:type="xsd:string">16</xsd:string></stopCodes></gIMServiceRequest></namesp1:getWorkOrdersByFilters></SOAP-ENV:Body></SOAP-ENV:Envelope>
    The XML generated for a test Java client:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getWorkOrdersByFilters
    xmlns:m="ncr.com"><gIMServiceRequest xmlns:n1="java:com.ncr.gim.bean.service"
    xsi:type="n1:GIMServiceRequest"><CSRCode xsi:type="xsd:string">987x00</CSRCode><applicationID
    xsi:type="xsd:string">GIM</applicationID><incidentNbr xsi:nil="true"/><nodeId
    xsi:type="xsd:string">00T5</nodeId><stopCodes soapenc:arrayType="xsd:string[3]"><xsd:string
    xsi:type="xsd:string">00</xsd:string><xsd:string xsi:type="xsd:string">01</xsd:string><xsd:string
    xsi:type="xsd:string">02</xsd:string></stopCodes></gIMServiceRequest></m:getWorkOrdersByFilters></env:Body></env:Envelope>
    The JavaBean:
    public class GIMServiceRequest implements Serializable {
         private String applicationID = GIMConstants.UNKNOWN_APPLICATION_ID;
         private String nodeId = null;
         private String incidentNbr = null;
         private String CSRCode = null;
         private String[] stopCodes = null;
         public void setStopCodes(String[] aStopCodes) {
              stopCodes = aStopCodes;
         public String[] getStopCodes() {
              return stopCodes;
         [more]
    The service build.xml file:
    <project name="GIMService" default="all" basedir=".">
         <target name="all" depends="ear"/>
    <target name="ear">
    <servicegen
    destEar="GIMService.ear"
    contextURI="GIMContext" >
    <service
         ejbJar="GIMServiceEJB.jar"
         targetNamespace="ncr.com"
                        serviceName="GIMService"
                        serviceURI="/GIM_URI"
                        generateTypes="True"
                        expandMethods="True"
                        style="rpc"
                        protocol="http" >
              <client
                   clientJarName="GIMService_client.jar"
                   packageName="com.ncr.gim.gimservice.client" >
              </client>
    </service>
    </servicegen>
    </target>
    </project>

    Hi Jeff,
    Looks like the Perl client is using an older (deprecated) schema
    namespace "http://www.w3.org/1999/XMLSchema" that is causing this
    failure.
    Hope this helps,
    Bruce
    Jeff Carey wrote:
    >
    To receive input data our Web service defines a JavaBean one element of which is
    an array of strings. When a test Java client calls the service method the call
    is completed successfully. When a Perl client calls the service method an exception
    is returned. If I understand BEA's Web service documentation, it isn't necessary
    to do development for the service specifically to enable correct processing of
    an array of strings.
    In our environment we are running WL 8.1 SP 1.
    Please review the problem documentation and explain to me the cause of the exception
    and what I must do to prevent it.
    Thank you.
    The exception:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Exception
    during processing: weblogic.xml.schema.binding.DeserializationException: mapping
    lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema context=TypedSchemaContext{javaType=java.lang.String}
    (see Fault Detail for stacktrace)</faultstring><detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"/>weblogic.xml.schema.binding.DeserializationException:
    mapping lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema
    context=TypedSchemaContext{javaType=java.lang.String}
    at weblogic.xml.schema.binding.RuntimeUtils.lookup_deserializer(RuntimeUtils.java:461)
    at weblogic.xml.schema.binding.SoapArrayCodecBase.getComponentDeserializer(SoapArrayCodecBase.java:574)
    at weblogic.xml.schema.binding.SoapArrayCodecBase.deserialize(SoapArrayCodecBase.java:285)
    at weblogic.xml.schema.binding.BeanCodecBase.processElement(BeanCodecBase.java:183)
    at weblogic.xml.schema.binding.BeanCodecBase.processAllElements(BeanCodecBase.java:165)
    at weblogic.xml.schema.binding.BeanCodecBase.processElements(BeanCodecBase.java:145)
    at weblogic.xml.schema.binding.BeanCodecBase.deserialize(BeanCodecBase.java:108)
    at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:428)
    at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:328)
    at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:384)
    at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:458)
    at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
    at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
    at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)
    [more]
    The XML generated for the Perl client:
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getWorkOrdersByFilters
    xmlns:namesp1="ncr.com"><gIMServiceRequest xsi:type="ns:GIMServiceRequest" xmlns:ns="java:com.ncr.gim.bean.service"><applicationID
    xsi:type="xsd:string">REVLOG</applicationID><nodeId xsi:type="xsd:string">00XH</nodeId><stopCodes
    xsi:type="namesp2:array" SOAP-ENC:arrayType="xsd:string[2]"><xsd:string xsi:type="xsd:string">06</xsd:string><xsd:string
    xsi:type="xsd:string">16</xsd:string></stopCodes></gIMServiceRequest></namesp1:getWorkOrdersByFilters></SOAP-ENV:Body></SOAP-ENV:Envelope>
    The XML generated for a test Java client:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getWorkOrdersByFilters
    xmlns:m="ncr.com"><gIMServiceRequest xmlns:n1="java:com.ncr.gim.bean.service"
    xsi:type="n1:GIMServiceRequest"><CSRCode xsi:type="xsd:string">987x00</CSRCode><applicationID
    xsi:type="xsd:string">GIM</applicationID><incidentNbr xsi:nil="true"/><nodeId
    xsi:type="xsd:string">00T5</nodeId><stopCodes soapenc:arrayType="xsd:string[3]"><xsd:string
    xsi:type="xsd:string">00</xsd:string><xsd:string xsi:type="xsd:string">01</xsd:string><xsd:string
    xsi:type="xsd:string">02</xsd:string></stopCodes></gIMServiceRequest></m:getWorkOrdersByFilters></env:Body></env:Envelope>
    The JavaBean:
    public class GIMServiceRequest implements Serializable {
    private String applicationID = GIMConstants.UNKNOWN_APPLICATION_ID;
    private String nodeId = null;
    private String incidentNbr = null;
    private String CSRCode = null;
    private String[] stopCodes = null;
    public void setStopCodes(String[] aStopCodes) {
    stopCodes = aStopCodes;
    public String[] getStopCodes() {
    return stopCodes;
    [more]
    The service build.xml file:
    <project name="GIMService" default="all" basedir=".">
    <target name="all" depends="ear"/>
    <target name="ear">
    <servicegen
    destEar="GIMService.ear"
    contextURI="GIMContext" >
    <service
    ejbJar="GIMServiceEJB.jar"
    targetNamespace="ncr.com"
    serviceName="GIMService"
    serviceURI="/GIM_URI"
    generateTypes="True"
    expandMethods="True"
    style="rpc"
    protocol="http" >
    <client
    clientJarName="GIMService_client.jar"
    packageName="com.ncr.gim.gimservice.client" >
    </client>
    </service>
    </servicegen>
    </target>
    </project>

  • Array of strings strict type def not updating

    I have defined an Array of Strings (ctrl) as a strict type def. When I update this array (add another string to it) the values don't update where this control is used. Can someone please explain why this is occuring.

    Only the size of the array _shell_ is locked, not the size of the array data. The array shell is a window into the data of the array control. If you change the value of the index display you will change the indices visible inside the array shell.
    -Jim

  • Array of strings to vector

    Hi,
    I have an array of strings like:
    private String myStrArr[];
    myStrArr = new String[256];
    I have to get rid of hard coded size.
    Is it ok to use vector instead , or is there another way to get rid of hard coded size.
    If we can use vector instead , is there a solution similar for booleans??
    I also have an array of booleans:
    private boolean myBoolArr[];
    myBoolArr = new boolean[256]

    You can wrap the primitive booleans you have in the Boolean class via
    myList.add(new Boolean(primitiveBooleanValue));Even better, to save space, use the already existing Boolean values instead of creating new ones. If you are using Java 1.4, you can:
    myList.add(Boolean.valueOf(primitiveBooleanValue));Otherwise you can do one of these:
    myList.add( primitiveBooleanValue ? Boolean.TRUE : Boolean.FALSE );

  • "Using a CIN to Create an Array of Strings in LabVIEW" example crashes LV on Linux

    Tried to utilize this NI example: "Using a CIN to Create an Array of Strings in LabVIEW" (http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B4B282BE7EF907C8E034080020E74861&p_node=&p_source=External)
    Compiles OK with the makefile made by the LV's lvmkmf utility. Nevertheless when I try to run the VI (with the code loaded into the CIN, of course), LabVIEW 7.1.1 on a SUSE 9.3 Linux machine crashes:
    LabVIEW caught fatal signal
    7.1.1 - Received SIGSEGV
    Reason: address not mapped to object
    Attempt to reference address: 0x0
    Segmentation fault
    Any ideas? Did anybody try this on a Windows machine?

    H View Labs wrote:
    Tried to utilize this NI example: "Using a CIN to Create an Array of Strings in LabVIEW" (http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B4B282BE7EF907C8E034080020E74861&p_node=&p_source=External)
    Compiles OK with the makefile made by the LV's lvmkmf utility. Nevertheless when I try to run the VI (with the code loaded into the CIN, of course), LabVIEW 7.1.1 on a SUSE 9.3 Linux machine crashes:
    LabVIEW caught fatal signal
    7.1.1 - Received SIGSEGV
    Reason: address not mapped to object
    Attempt to reference address: 0x0
    Segmentation fault
    Any ideas? Did anybody try this on a Windows machine?
    This code is badly broken. In addition to resizing the actual handle to hold the number of string handles you also would need to create the string handles itself before attempting to write into them. NumericArrayResize is the fucntion to use as it will either resize an existing handle (if any) or create a new one if the value is uninitialized (NULL).
    /* resize strarr to hold handles to NUMSTRINGS strings */
    err = SetCINArraySize((UHandle)strarr, 0, NUMSTRINGS);
    if (err)
    goto out;
    /* perform this loop once for each element */
    /* of array of strings being created */
    for (i = 0; i < NUMSTRINGS;) {
    LStrHandle handle = (*strarr)->arg1[i];
    /* determine length of string that will be element of strarr */
    strsize = StrLen(str[i]);
    err = NumericArrayResize(uB, 1, &handle, strsize);
    if (err)
    goto out;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /* moves strsize bytes from the address pointed to */
    /* by str[i] to the address pointed to by the data pointer in the handle */
    MoveBlock(str[i], LStrBuf(*handle), strsize);
    /* manually set size of string pointed to by *strarr */
    (*((*strarr)->arg1[i]))->cnt = strsize;
    /* manually set dimSize of strarr */
    (*strarr)->dimSize = ++i;
    return noErr;
    out:
    return err;
    Rolf KalbermatterMessage Edited by rolfk on 06-30-2005 03:15 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • H:dataTable value as array of Strings vs array of objects

    I'm trying to use a h:dataTable with an h:inputText as one of the columns. If my bean returns an array of Strings, then the h:dataTable can't update them. (I added a submit button that just updates the fields and returns to the current page.) If I use an array of objects, in this case a simple wrapper class, it works. Why is this?
    This won't work:
    public class EmailBean {
        private String[] m_emails;
        public String[] getEmails() {
            return m_emails;
        public void setEmails(String[] emails) {
            m_emails = emails;
    }But this will:
    public class EmailBean {
        private Email[] m_emails;
        public EmailBean() {
            m_emails = new Email[] {
                    new Email("[email protected]"),
                    new Email("[email protected]"),
                    new Email("[email protected]")
        public Email[] getEmails() {
            return m_emails;
        public void setEmails(Email[] emails) {
            m_emails = emails;
    }

    public class Email {
        private String email;
        public Email(String email) {
            this.email = email;
        public String getEmail() {
            return email;
        public void setEmail(String email) {
            this.email = email;
    }For the one that uses the Email class, I use this:
    <h:dataTable value="#{emailTestBean.emails}"
                                  var="email">
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Email Address" />
              </f:facet>
              <h:inputText value="#{email.email}" />
         </h:column>
         <f:facet name="footer">
              <h:commandButton value="Submit" />
         </f:facet>
    </h:dataTable>Otherwise I don't need the extra ".email":
    <h:dataTable value="#{emailTestBean.emails}"
                                  var="email">
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Email Address" />
              </f:facet>
              <h:inputText value="#{email}" />
         </h:column>
         <f:facet name="footer">
              <h:commandButton value="Submit" />
         </f:facet>
    </h:dataTable>

  • How do I get ColdFusion to put information in the WSDL to show it returns an array of strings?

    How do I specify that the return value of my web service is an array of strings?
    Saying
       <cffunction name="getInfoSources" access="remote" returntype="string[]">
    produces the error:
    coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException : Cannot resolve CFC datatype: string.]
    when I try to create the WSDL
    I know that I can specify "array", which puts into the WSDL:
    <wsdl:part name="getInfoSourcesReturn" type="impl:ArrayOf_xsd_anyType"/>
    I want users of the service to know that the array is specifically made up of _strings_.
    Thanks!
    -- Mabel :-)
    [email protected]

    What if you click Never remember for this site and later change your mind? There should be a way to remember the username and password later if you'd like. I installed the Saved Password Editor 2.6.3 extension and added in the information manually i.e. by choosing New and it still isn't making a difference. What happened to the live chat support Firefox used to have?

  • How can I resize an array of strings?

    I'm having a problem of not being able to use the CIN functions and therefore can't use the convenient resizing methods. I have tried to use NumericArrayResize to resize an array of strings, but it's not working correctly. Here's what I've tried most recently. I have tried many variations, so if you want to modify what I have posted, or just provide new code, please feel free.
    typedef struct {
    int32 dimSize;
    LStrHandle elt[1];
    } LStrHandleArray;
    typedef LStrHandleArray **LStrHandleArrayHandle;
    void someMethod(LStrHandleArrayHandle arrayOut) {
    // attempting to write the string "asdf" in the first element in the array. (1D array)
    int newSize = 1;
    MgErr e = NumericArrayResize(uL, 1L, (UHandle*)&arr
    ayOut, newSize);
    (*arrayOut)->dimSize = newSize;
    LStrHandle hdl = *(*arrayOut)->elt;
    long str_size = strlen("asdf");
    MgErr err = NumericArrayResize(uB, 1L,(UHandle *)&hdl, str_size);
    LStrLen(*hdl) = str_size;
    MoveBlock("asdf", LStrBuf(*hdl), str_size);
    The code above doesn't result in crashing labview at any time. The string "asdf" is not copied though. And, after being able to copy one string I would like to extend this to many elements in a 1D array of strings.
    Thanks!
    Naveen

    LabVIEW stores string arrays as an array of handles to those strings. To resize an array of strings you need to declare a new string in LabVIEW's data space, resize the handle array, and add a handle to your new string. Here is an example program which does this.
    -Aaron Marks
    National Instruments
    Attachments:
    resize.zip ‏252 KB

  • How to store Array of Strings in MS-Access

    Dear all,
    i am facing a problame from the couple of days can any one plzzzzzzz guide what should i do to over come my problame....>
    I want to store a String array in Microsoft Access database but i couldn't find the way how can i do so
    public class ArrayJDBC {
    /** Creates a new instance of ArrayJDBC */
    public ArrayJDBC() {
    public static void main(String[] args){
    System.out.println("main started");
    new ArrayJDBC().enterArray();
    System.out.println("main after data entry");
    public void enterArray(){
    Connection con = null;
    PreparedStatement pstm = null;
    String dataSource = "checkArray";
    String query = "INSERT INTO array(Object) VALUES(?)";
    String[] strArray = {"one","two","three"};
    con = new JDBCConnection().makeConnection(dataSource);
    try{
    pstm = con.prepareStatement(query);
    System.out.println("pstmt created");
    pstm.setObject(1,strArray);
    System.out.println("array seted as object");
    int r = pstm.executeUpdate();
    System.out.println("data updated "+r);
    pstm.close();
    con.close();
    }catch(SQLException se){
    System.out.println("Data could not be update "+se);
    this is my class the conncection is already established.
    i use updateObject() method but it doesnt work..
    plz guide me that how can i store
    strArray in Microsoft Access and also tell me that what should be the data type in my database i.e ms-access

    Well easiest way to do that is to create a single String where the values from array will be separated by some separator for example semicolon so you will get "one;two;three" this string you will store in database as a text, then when you read it back you need to parse it again to get an array of Strings. I am originally C# programmer there i would do serialization to XML and store it into database try looking here http://iharder.sourceforge.net/current/java/xmlizable/ they are creating XML Serializer.
    Peter.

  • Using an array of strings to name an object

    Hey everyone
    I have an array of strings that are supposed to be the names of each panel in a grid, but I dont know how to use the string values to name the panels. From searching the forums almost everything refered to using a Map to do this, but I still can't grasp how to use one. Can someone help me with this?
    import java.awt.*;
    import javax.swing.border.*;
    import javax.swing.*;
    public class test
        public test()
        public JPanel grid()
             JPanel mainPanel = new JPanel(new GridLayout(10, 10));
             String [] names = new String[100];
             Border innerBorder = BorderFactory.createLineBorder(Color.black, 1);
              for (int i = 0; i < 100; i++)
                   names[i] = "Panel" + i;
              for (int r = 0; r < 100; r++)
                   String varName = names[r];
                   JPanel /*I would like the JPanel to be named what the string varName is*/justSoItCompiles = new JPanel(new GridLayout(2,1));
                   /*The JPanel above*/justSoItCompiles.setBorder(innerBorder);
                   mainPanel.add(justSoItCompiles);
              return mainPanel;
    }Thanks in advance

    You just make a Map as:
    Map<String, JPanel> panelMap = new HashMap<String, JPanel>();then add a panel as
    panelMap.add("Panel1", new JPanel());then you can do whatever with it by saying
    panelMap.get("Panel1").add(something);Make sense?

Maybe you are looking for

  • Can i have the same itunes acct for two ipods (one nano and one shuffle)?  the shuffle is new and i want to duplicate the music. how do i do this?

    I have a nano that's a couple years old with an itunes acct.  Just got a shuffle and want to duplicate the playlist on the shuffle.  When I plug in the shuffle to the existing acct nothing happens.  How do I copy that music onto my shuffle.  thanks.

  • Time capsule and external hard drives

    Good morning support group! I have a new Macbook and time capsule. My iPhoto library and iTunes are on external hard drives and are (gulp) not backed up properly. Can I set up the TC to back up the external hard drives and the macbook. If I set it up

  • Partial Invoice from Purchase Order

    Hi Experts I did a Purchase order for 10,000 and invoiced for 5,000 but when I try to do the incoice for the balance amount the sytem does not have any open purchase orders. My question is if we do invoice for partial amount can we have the purchase

  • AIP-SSM 40 Inline vs Promiscuous

    Have been running new sensor for about a week now.  I implemented in promiscuous mode as the documentation seemed to indicate that inline will tend to bottleneck internet traffic. My questions are : Are you running in inline mode and what can I expec

  • Panther to Tiger - Where's my iPhoto?

    After updating to Tiger I notice iPhoto is not included in the retail package. Is there a way to install it from my Panther discs? I also have Jaguar discs. I'm using Kodak's app, but I really miss iPhoto!