Incompatibility of array with list

I have three business classes. One is person which has attribute name of string type and a ArrayList of phone class. Phone class itself has one attribute of string type with name of "number". My third class is Patient which is inherited from Person class and has attribute id of string type. All these classes has setter and getter method except in Phone class which has setter and getter methods for array of Phone class because web services does not support collection in rpc literal mode. I have developed a service class which expose a method of insertPatient with parameter of Patient class. But there is an exception of ArrayIndexOutOf Bound Exception. Application server is JBoss and i m compiling my webservices with Netbeans. What can be problem please response me. I m giving structure of my classses
package com.catalisse;
import java.io.*;
import java.util.*;
* @author Amer Sohail
public class Person implements Serializable
private String name = null;
private ArrayList phoneList = new ArrayList();
/** Creates a new instance of Person */
public Person()
public void setName(String name)
System.out.println("setting Name"+ name);
this.name = name;
public String getName()
return this.name;
public void setPhone(Phone[] phone)
System.out.println("setting the Phone number"+ phone.length);
if(phone.length > 0){
System.out.println("Another statement here::: sara khan::: "+ phone[phone.length-1]);
for (int i = 0; i < phone.length; i++)
if (phone[i] != null)
phoneList.add(phone);
else
System.out.println("value not found on index " + i);
//this.phArray = phone;
// this.phoneList = phone;
// public void setPhone(Phone phone)
// if (phone != null)
// phoneList.add(phone);
// else
// System.out.println("yaar i m null" );
public Phone[] getPhone()
Phone ph[] = new Phone[phoneList.size()];
for (int i = 0; i < phoneList.size();i++)
Phone phone = (Phone)phoneList.get(i);
if (phone != null)
ph[i] = (Phone)phoneList.get(i);
else
System.out.println("no value");
return ph;
package com.catalisse;
import java.io.*;
* @author Amer Sohail
public class Phone implements Serializable
private String number;
/** Creates a new instance of Phone */
public Phone()
public void setNumber(String number)
this.number = new String();
System.out.println("from client number = "+ number);
this.number = number;
System.out.println("on server number = "+ this.number);
public String getNumber()
return this.number;
package com.catalisse;
import java.io.*;
* @author Amer Sohail
public class Patient extends Person implements Serializable
private String id = null;
/** Creates a new instance of Patient */
public Patient()
public void setID(String id)
this.id = id;
public String getID()
return this.id;
package com.catalisse;
* This is the service endpoint interface for the PatientWSweb service.
* Created Sep 20, 2005 8:18:49 PM
* @author Amer Sohail
public interface PatientWSSEI extends java.rmi.Remote
* Web service operation
public com.catalisse.Patient getPatient() throws java.rmi.RemoteException;
* Web service operation
public String insertPatient(com.catalisse.Patient patient) throws java.rmi.RemoteException;
public class PatientWSImpl implements PatientWSSEI
// Enter web service operations here. (Popup menu: Web Service->Add Operation)
* Web service operation
public com.catalisse.Patient getPatient()
Patient p = new Patient();
p.setID("1");
p.setName("amer");
Phone ph[] = new Phone[2];
Phone phone1 = new Phone();
phone1.setNumber("12345");
ph[0] = phone1;
phone1 = new Phone();
phone1.setNumber("4555");
ph[1] = phone1;
p.setPhone(ph);
return p;
* Web service operation
public String insertPatient(com.catalisse.Patient patient)
System.out.println("Name = " + patient.getName());
System.out.println("ID = " + patient.getID());
Phone[] ph = patient.getPhone();
System.out.println("I am called");
if (ph != null && ph.length != 0)
System.out.println("phone = " + ph[0].getNumber());
System.out.println("ID = " + ph[1].getNumber());
return "inserted";
I am waiting for reply

Isn't ph supposed to be a phone array and you are assigning it to a single Phone in this line?
public Phone[] getPhone()
Phone ph[] = new Phone[phoneList.size()];
for (int i = 0; i < phoneList.size();i++)
Phone phone = (Phone)phoneList.get(i);
if (phone != null)
ph = (Phone)phoneList.get(i);
else
System.out.println("no value");
return ph;
}

Similar Messages

  • I have read 118 files (from a directory) each with 2088 data and put them into a 2 D array with 2cols and 246384row, I want to have aeach file on a separate columns with 2088 rows

    I have read 118 files from a directory using the list.vi. Each file has 2 cols with 2088rows. Now I have the data in a 2 D array with 2cols and 246384rows (118files * 2088rows). However I want to put each file in the same array but each file in separate columns. then I would have 236 columns (2cols for each of the 118 files) by 2088 rows. thank you very much in advance.

    Hiya,
    here's a couple of .vi's that might help out. I've taken a minimum manipulation approach by using replace array subset, and I'm not bothering to strip out the 1D array before inserting it. Instead I flip the array of filenames, and from this fill in the end 2-D array from the right, overwriting the column that will eventually become the "X" data values (same for each file) and appear on the right.
    The second .vi is a sub.vi I posted elsewhere on the discussion group to get the number of lines in a file. If you're sure that you know the number of data points is always going to be 2088, then replace this sub vi with a constant to speed up the program. (by about 2 seconds!)
    I've also updated the .vi to work as a sub.vi if you wa
    nt it to, complete with error handling.
    Hope this helps.
    S.
    // it takes almost no time to rate an answer
    Attachments:
    read_files_updated.vi ‏81 KB
    Num_Lines_in_File.vi ‏62 KB

  • Arrays with more than 2^31-1 (2147483647) elements?

    Hi,
    I'm working with very large datasets and would like to be able to process arrays with more than 2^31-1 elements. This limit seems to come about because Java requires a signed integer to be passed as a parameter to an array declaration, e.g.:
    Object bytes = new byte[2147483647]; // works
    Object bytes = new byte[2147483648]; // failsIs there any way to get around this?
    Thanks very much,
    - Davi

    Is there any way to get around this?What about creating a class that aggregatesseveral
    arrays and implements the List API?
    KajUnfortunately, many of the methods in the List
    interface depend on int indexes also. You would
    probably want these methods to use a long index
    instead.True. I should have said that he should mimic the behaviour of the List interface, but not implement it.
    Kaj

  • Sort an array with two fields

    i have an array with three fields: id, name and date.
    i want to sort it by name first and then date.
    the size of my array could be as large as 1 million.
    what could be the most efficient way to do so?
    tia!

    It's very inefficient to sort an array on "the fly".
    In that case at least use a linked list so you don't
    have to move all elements after the insertion point to
    make room for a new insert. But it's much better to
    sort afterwards when all elements are in the array.Use a TreeSet. A linked list will be slower than a TreeSet, I suspect.
    I believe that with a TreeSet, insertions will be somewhat slower (O(logN) vs O(c)), but the subsequent sorting of a linked list will be, what, at least O(NlogN) and possibly O(N^2)? And when you're inserting the first elements into the TreeSet, it should be closer to O(c) anyway, whereas the after-the-fact sorting of a LinkedList wouldn't have an advantage like that.
    Then if necessary extract an array out of the TreeSet when you're done creating/inserting elements.
    But really, use a database.

  • Using an 9 by 9 Array of Lists

    I am currently programming a suduko puzzle and am using a 9 by 9 array of lists to do this.
    List[][] A;                          
    A = new List[9][9];this creates a 9 by 9 array of lists but when i use:
    List A[x][y] = new List[A.add(ob1)][A.add(ob1)];I get an error. Does anyone now how to correctly add numbers to the lists that i have just created.
    Help is much appreciated

    I get an error. Only one? Oh well, I guess you scared the poor compiler to death with that piece of code. If you have any pity at all for your compiler, read the array tutorial:
    http://java.sun.com/docs/books/tutorial/java/data/arraybasics.html
    and then the list tutorial:
    http://java.sun.com/docs/books/tutorial/collections/interfaces/list.html
    If you really need an array of lists, that is...

  • Failed MDADM Array With Ext.4 Partition

    Hi Guys,
    I had a powerfailure and now my MDADM array with Ext4 partition is broken.
    The array has now rebuilt but I still can't mount.
    sudo mdadm -D /dev/md0
    [hodge@hodge-fs ~]$ sudo mdadm -D /dev/md0
    /dev/md0:
    Version : 0.90
    Creation Time : Sun Apr 25 01:39:25 2010
    Raid Level : raid5
    Array Size : 8790815232 (8383.57 GiB 9001.79 GB)
    Used Dev Size : 1465135872 (1397.26 GiB 1500.30 GB)
    Raid Devices : 7
    Total Devices : 7
    Preferred Minor : 0
    Persistence : Superblock is persistent
    Update Time : Sun Aug 8 07:30:06 2010
    State : clean
    Active Devices : 7
    Working Devices : 7
    Failed Devices : 0
    Spare Devices : 0
    Layout : left-symmetric
    Chunk Size : 128K
    UUID : 44a8f730:b9bea6ea:3a28392c:12b22235 (local to host hodge-fs)
    Events : 0.1307880
    Number Major Minor RaidDevice State
    0 8 81 0 active sync /dev/sdf1
    1 8 97 1 active sync /dev/sdg1
    2 8 113 2 active sync /dev/sdh1
    3 8 65 3 active sync /dev/sde1
    4 8 49 4 active sync /dev/sdd1
    5 8 33 5 active sync /dev/sdc1
    6 8 16 6 active sync /dev/sdb
    sudo mount -a
    [hodge@hodge-fs ~]$ sudo mount -a
    mount: wrong fs type, bad option, bad superblock on /dev/md0,
    missing codepage or helper program, or other error
    In some cases useful info is found in syslog - try
    dmesg | tail or so
    sudo fsck.ext4 /dev/md0
    [hodge@hodge-fs ~]$ sudo fsck.ext4 /dev/md0
    e2fsck 1.41.12 (17-May-2010)
    fsck.ext4: Group descriptors look bad... trying backup blocks...
    /dev/md0: recovering journal
    fsck.ext4: unable to set superblock flags on /dev/md0
    sudo dumpe2fs /dev/md0 | grep -i superblock
    hodge@hodge-fs ~]$ sudo dumpe2fs /dev/md0 | grep -i superblock
    dumpe2fs 1.41.12 (17-May-2010)
    Primary superblock at 0, Group descriptors at 1-524
    Backup superblock at 32768, Group descriptors at 32769-33292
    Backup superblock at 98304, Group descriptors at 98305-98828
    Backup superblock at 163840, Group descriptors at 163841-164364
    Backup superblock at 229376, Group descriptors at 229377-229900
    Backup superblock at 294912, Group descriptors at 294913-295436
    Backup superblock at 819200, Group descriptors at 819201-819724
    Backup superblock at 884736, Group descriptors at 884737-885260
    Backup superblock at 1605632, Group descriptors at 1605633-1606156
    Backup superblock at 2654208, Group descriptors at 2654209-2654732
    Backup superblock at 4096000, Group descriptors at 4096001-4096524
    Backup superblock at 7962624, Group descriptors at 7962625-7963148
    Backup superblock at 11239424, Group descriptors at 11239425-11239948
    Backup superblock at 20480000, Group descriptors at 20480001-20480524
    Backup superblock at 23887872, Group descriptors at 23887873-23888396
    Backup superblock at 71663616, Group descriptors at 71663617-71664140
    Backup superblock at 78675968, Group descriptors at 78675969-78676492
    Backup superblock at 102400000, Group descriptors at 102400001-102400524
    Backup superblock at 214990848, Group descriptors at 214990849-214991372
    Backup superblock at 512000000, Group descriptors at 512000001-512000524
    Backup superblock at 550731776, Group descriptors at 550731777-550732300
    Backup superblock at 644972544, Group descriptors at 644972545-644973068
    Backup superblock at 1934917632, Group descriptors at 1934917633-1934918156
    sudo e2fsck -b 32768 /dev/md0
    [hodge@hodge-fs ~]$ sudo e2fsck -b 32768 /dev/md0
    e2fsck 1.41.12 (17-May-2010)
    /dev/md0: recovering journal
    e2fsck: unable to set superblock flags on /dev/md0
    sudo dmesg | tail
    [hodge@hodge-fs ~]$ sudo dmesg | tail
    EXT4-fs (md0): ext4_check_descriptors: Checksum for group 0 failed (59837!=29115)
    EXT4-fs (md0): group descriptors corrupted!
    EXT4-fs (md0): ext4_check_descriptors: Checksum for group 0 failed (59837!=29115)
    EXT4-fs (md0): group descriptors corrupted!
    Please Help!

    Give a tip here is somewhat delicate. Perhaps a tip works perfect in some cases and in one case only worsen the situation.
    Have you tried to send an email to linux-ext4 mailing list? There are lots of people involved that may help. http://vger.kernel.org/vger-lists.html#linux-ext4
    I hope that you recover all your information.

  • Accessing arrays within lists

    Hi,
    I have a linked list with arrays of type byte stored in. I have managed to access each individual array using list.get(i) but how can I access an individual element of a specific array in the list?
    Thanks and regards,
    Krt_Malta

    void f(List<byte[]> list) {
        byte me = list.get(0)[17];
    }

  • User command is not getting triggered in interactive ALV with LIST display

    Hi experts,
    I have developed an interactive ALV report with LIST display. Here, the issue is, when i double click a record in the primary ALV list, the control must go to the USER COMMAND event which i have written in my report. But the user command event is not getting triggered at all when i double click any record.
    It gives the following information instead.
    "Choose a valid function".
    (My user command name and its respective form name are same.)
    Here is my code..
    START-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'TST1'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    FORM tst1 USING r_ucomm LIKE sy-ucomm
                    rs_selfield TYPE slis_selfield.
    * Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    * Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    * Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.  CASE r_ucomm.
    *   When a record is selected
        WHEN '&IC1'.
    *     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.      IF sy-subrc = 0.
    *       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
    *       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
    Please advice what is the msitake i have done here..

    Read the following code:
    pass the  i_callback_user_command = g_user_command to the ALV function module and write the FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
    as shown below.
    thanx
    Data for ALV display
    DATA  : gt_fieldcat TYPE slis_t_fieldcat_alv,
            gt_events           TYPE slis_t_event,
            g_variant LIKE disvariant,
            g_user_command      TYPE slis_formname VALUE 'USER_COMMAND',
            g_status            TYPE slis_formname VALUE 'SET_PF_STATUS',
            gt_list_top_of_page TYPE slis_t_listheader,
            g_repid LIKE sy-repid,
            gf_pos TYPE i
    Data for ALV display
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
               EXPORTING
              i_callback_program      = g_repid
                 i_callback_program      = sy-repid
                 it_fieldcat             = gt_fieldcat[]
           it_events               = gt_events[]
              i_callback_user_command = g_user_command
                 i_save                  = 'A'
                 is_variant              = g_variant
               TABLES
                 t_outtab                = it_print.
    FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN '&IC1'.
          CASE selfield-sel_tab_field.
            WHEN '1-KUNNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'BPA' FIELD wa_print-kunnr.
                CALL TRANSACTION 'BP'.
              ENDIF.
            WHEN '1-MATNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'JP_ISS' FIELD wa_print-matnr.
                CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN..
               GET PARAMETER ID 'WRK' FIELD wa_zprint-werks.
               SET PARAMETER ID 'VKO' FIELD wa_zprint-vkorg.
               SET PARAMETER ID 'VTW' FIELD wa_zprint-vtweg.
               CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN.
              ENDIF.
    Endcase.
    Endform.

  • Issue with list saving data after sites upgrade from sharepoint 2010 to sharepoint 2013

    Issue with list saving data after sites upgrade from sharepoint 2010 to sharepoint 2013 
    Newform.aspx of list:-
    Custom List is not saving data sometimes in the new form after 15 minutes and only blank entry record got created without saving data, even though some columns are mandatory fields?

    Hello dcakumar,
    Sounds like a strang issue. If you can reproduce this can you see some errors in the ULS logs?
    - Dennis | Netherlands | Blog |
    Twitter

  • Lots of blank space when printing array with only last element printed

    I have a slight problem I have been trying to figure it out for days but can't see where my problem is, its probably staring me in the face but just can't seem to see it.
    I am trying to print out my 2 dimensional array outdie my try block. Inside the trying block I have two for loops in for the arrays. Within the second for loop I have a while to put token from Stringtokeniser into my 2 arrays. When I print my arrays in this while bit it prints fine however when I print outside the try block it only print the last element and lots of blank space before the element.
    Below is the code, hope you guys can see the problem. Thank you in advance
       import java.io.*;
       import java.net.*;
       import java.lang.*;
       import java.util.*;
       import javax.swing.*;
       public class javaflights4
          public static final String MESSAGE_SEPERATOR  = "#";
          public static final String MESSAGE_SEPERATOR1  = "*";
          public static void main(String[] args) throws IOException
             String data = null;
             File file;
             BufferedReader reader = null;
             file = new File("datafile.txt");
             String flights[] [];
                   //String flightdata[];
             flights = new String[21][7];
             int x = 0;
                   //flightdata = new String[7];
             int y = 0;
             try
                reader = new BufferedReader(new FileReader(file));   
                //data = reader.readLine();   
                while((data = reader.readLine())!= null)   
                   data.trim();
                   StringTokenizer tokenised = new StringTokenizer(data, MESSAGE_SEPERATOR1);
                   for(x = 0; x<=flights.length; x++)
                      for(y = 0; y<=flights.length; y++)
                         while(tokenised.hasMoreTokens())
                            //System.out.println(tokenised.nextToken());
                            flights [x] [y] = tokenised.nextToken();
                            //System.out.print("*"+ flights [x] [y]+"&");
                   System.out.println();
                catch(ArrayIndexOutOfBoundsException e1)
                   System.out.println("error at " + e1);
                catch(Exception e)
                finally
                   try
                      reader.close();
                      catch(Exception e)
             int i = 0;
             int j = 0;
             System.out.print(flights [j]);
    //System.out.println();

    A number of problems.
    First, I bet you see a lot of "error at" messages, don't you? You create a 21x7 array, then go through the first array up to 21, going through the second one all the way to 21 as well.
    your second for loop should go to flights[x].length, not flights.length. That will eliminate the need for ArrayIndexOutOfBounds checking, which should have been an indication that you were doing something wrong.
    Second, when you get to flights[0][0] (the very first iteration of the inner loop) you are taking every element from the StringTokenizer and setting flights[0][0] to each, thereby overwriting the previous one. There will be nothing in the StringTokenizer left for any of the other (21x7)-1=146 array elements. At the end of all the loops, the very first element in the array (flights[0][0]) should contain the last token in the file.
    At the end, you only print the first element (i=0, j=0, println(flight[ i][j])) which explains why you see the last element from the file.
    I'm assuming you have a file with 21 lines, each of which has 7 items on the line. Here is some pseudo-code to help you out:
    count the lines
    reset the file
    create a 2d array with the first dimension set to the number of lines.
    int i = 0;
    while (read a line) {
      Tokenize the line;
      count the tokens;
      create an array whose size is the number of tokens;
      stuff the tokens into the array;
      set flights[i++] to this array;
    }

  • How I can stop the combo box with list of values from fireing validations

    Hi I'm using Jdeveloper 11.1.2.3.0
    Using Hr Schema employees table
    I Display employees data in af:table
    and I make List Of values on Department_id filed to easy change the employee department
    and another one on Job_id filed
    and Imake them UI Hints as ( combo box with list of values ) in the employeesVO
    the problem is when I Select a value from department or jobs ( combo box with list of values )
    fires the entire filed validations for mandatory atributes
    Note : the af:table Property ( contedelivery) is set to (immediate )
    How I can stop the combo box with list of values from fireing validations

    check it out.,
    http://andrejusb.blogspot.in/2012/09/what-to-do-when-adf-editable-table.html

  • Is there a way to shorten the "Open With" list?

    Hi -
    This may be a question for Apple because it is a uniquely Apple Finder problem.
    Or maybe some clever 3rd party Apple developer will take this on - because this is an Apple Finder problem (hint).
    Is there a way to shorten the "Open With" list that appears when I right-click on a file?
    Heres why this is important to me.
    1- I'm seeing multiple versions of the same app on the list, like Photoshop CS5, Photoshop CS5.1, Photoshop CS 5.5.  I can't think of any reason why I would ever want to use an older version of Photoshop.  And it's not only Photoshop or even Adobe products.
    2- I see incorrect apps being suggested.  If I right click on an Illustrator file I see that TextEdit is one of the choices.  I get Photoshop as an option to open HTML files.  I see BBEdit as an option to open JPEG files.  These are bizarre associations.  Why are they even on the list?
    3- With so many irrelevant choices the possibility of selecting the wrong application increases and doing so is a waste of time and resources.  Once I accidentally selected a text editor to open a JPEG.  After about 3 minutes of RAM-sucking processing I got a huge file of jibberish text characters that was thousands of lines long.  Waste of time!
    I KNOW I'm not the only one with this question. 
    Is there anyone out there with an answer???
    Thanks,
    JL

    baltwo - thank you for the expert advice. 
    I did as you instructed and the situation is better but I don't believe it's solved. 
    I still get 3 versions of Photoshop when I right click on a PSD.  I also get Dashcode and Textwrangler - which are the oddest associations.  All together I get 25 apps responding to "Open With" on a PSD.  And this is an improvement.
    Do you think I would get even better results if I ran the same command again?
    Thanks again.
    JL

  • Is there a way to remove items from "Open With" list?

    I have an interesting dilemma that I have not yet found an answer to in all of my internet/discussion forum searches.  Maybe I'm asking the wrong questions or searching in the wrong places, but I've given up and now have to post the question in hopes there's an answer out there.
    My issue is that whenever I want to use the "Open With" feature for an image/jpeg file, the list of choices is massive! Looking at it now, it lists over 30 applications, but at most I would only ever want to open this type of file in one of maybe four applications.
    Starting off, I used to have Parallels on my computer.  Have since purchased VMWare Fusion 4 and now use that as my virtual machine to run Windows for some of my design work.  As far as I know, I had removed ALL of Parallels from my computer when I uninstalled the app.  I followed all of the instructions in the uninstall process, but there seems to be something left behind.
    It may seem that mentioning that wouldn't have anything to do with the "Open With" function, but here is a screen shot to show what happens whenever I right-click an image file:
    http://www.virtuosocreative.com/apple/openwith1.jpg
    Most of the time, if I right click the image, it'd be to open in Photoshop or Set as Desktop.  On occasion I have had to open a jpeg file in Illustrator, but that's it.
    For some reason, there are still Parallels applications showing on the "Open With" list, even though it was uninstalled and removed from my computer.  But like I said earlier, it looks like I missed something. 
    In addition, although I am not logged into Windows or have Fusion running in the background, the "Open With" list includes all of the suggested Windows apps as well.  why???
    As much as I appreciate there being such an abundance of options to choose from, this gets extremely annoying when using the feature and I wanted to see if there was any way to modify this list. 
    More than anything, I really want to get rid of all the Parallels extras that are left on my system.  But also, I wanted to see if there was a setting to tweak so that whenever I click on "Open With" on my Mac, it'll only list applications that are my Mac applications and nothing through Fusion or Parallels or anything else.  And to take it a step further, it'd be nice to shorten the list to only applications I would personally use for opening a jpeg file. (i.e. Preview (default), Photoshop, Illustrator, Safari).
    My system is a 2010 iMac i5 2.8GHz/8GB RAM. Lion OS X 10.7.3
    Thanks!

    The Open With menu is built by LaunchServices which collects the information from each app as to what it says it can open. VMWare appears to be registering every app to open jpegs.
    You might try rebuilding the LaunchServices database. I believe this command still works in Lion. Or, you could use a utility like OnyX to call it:
    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

  • Auto-indexing is slow for arrays with 1 dimensions

    Hi,
    I was looking at the performance of operations on all individual elements in 3D arrays, especially the difference between auto-indexing (left image) and manual-indexing (right image, calling "Index array" and "Replace array subset" in the innermost loop). I'm a bit puzzled by the results and post it here for discussion and hopefully somebody's benefit in the future.
    Left: auto-indexing; right: manual-indexing
    In the tests I added a different random number to all individual elements in a 3D array. I found that auto-indexing is 1.2 to 1.5 times slower than manual-indexing. I also found that the performance of auto-indexing is much more dependent on the size the dimensions: an array with 1000x200x40 elements is 20% slower than an array with 1000x40x200 elements. For manual-indexing there is hardly any difference. The detailed results can be found at the end of this post.
    I was under the impression that auto-indexing was the preferred method for this kind of operation: it achieves exactly the same result and it is much clearer in the block diagram. I also expected that auto-indexing would have been optimized in LabView, but the the tests show this is clearly not the case.
    What is auto-indexing doing?
    With two tests I looked at how auto-index works.
    First, I looked if auto-indexing reorganizes the data in an inefficient way. To do this I made a method "fake-auto-indexing" which calls "Array subset" and "Reshape array" (or "Index array" for a 1D-array) when it enters _every_ loop and calls "Replace array subset" when exiting _every_ loop (as opposed to manual-indexing, where I do this only in the inner loop). I replicated this in a test (calling it fake-auto-indexing) and found that the performance is very similar to auto-indexing, especially looking at the trend for the different array lengths.
    Fake-auto-indexing
    Second, I looked if Locality of reference (how the 3D array is stored in memory and how efficiently you can iterate over that) may be an issue. Auto-indexing loops over pages-rows-columns (i.e. pages in the outer for-loop, rows in the middle for-loop, columns in the inner for-loop). This can't be changed for auto-indexing, but I did change it for manual and fake-indexing. The performance of manual-indexing is now similar to auto-indexing, except for two cases that I can't explain. Fake-auto-indexing performs way worse in all cases.
    It seems that the performance problem with auto-indexing is due to inefficient data organization.
    Other tests
    I did the same tests for 1D and 2D arrays. For 1D arrays the three methods perform identical. For 2D arrays auto-indexing is 15% slower than manual-indexing, while fake-auto-indexing is 8% slower than manual-indexing. I find it interesting that auto-indexing is the slowest of the three methods.
    Finally, I tested the performance of operating on entire columns (instead of every single element) of a 3D array. In all cases it is a lot faster than iterating over individual elements. Auto-indexing is more than 1.8 to 3.4 times slower than manual-indexing, while fake-auto-indexing is about 1.5 to 2.7 times slower. Because of the number of iterations that has to be done, the effect of the size of the column is important: an array with 1000x200x40 elements is in all cases much slower than an array with 1000x40x200 elements.
    Discussion & conclusions
    In all the cases I tested, auto-indexing is significantly slower than manual-indexing. Because auto-indexing is the standard way of indexing arrays in LabView I expected the method to be highly optimized. Judging by the tests I did, that is not the case. I find this puzzling.
    Does anybody know any best practices when it comes to working with >1D arrays? It seems there is a lack of documentation about the performance, surprising given the significant differences I found.
    It is of course possible that I made mistakes. I tried to keep the code as straightforward as possible to minimize that risk. Still, I hope somebody can double-check the work I did.
    Results
    I ran the tests on a computer with a i5-4570 @ 3.20 GHz processor (4 cores, but only 1 is used), 8 GB RAM running Windows 7 64-bit and LabView 2013 32-bit. The tests were averaged 10 times. The results are in milliseconds.
    3D-arrays, iterate pages-rows-columns
    pages x rows x cols : auto    manual  fake
       40 x  200 x 1000 : 268.9   202.0   268.8
       40 x 1000 x  200 : 276.9   204.1   263.8
      200 x   40 x 1000 : 264.6   202.8   260.6
      200 x 1000 x   40 : 306.9   205.0   300.0
     1000 x   40 x  200 : 253.7   203.1   259.3
     1000 x  200 x   40 : 307.2   206.2   288.5
      100 x  100 x  100 :  36.2    25.7    33.9
    3D-arrays, iterate columns-rows-pages
    pages x rows x cols : manual  fake
       40 x  200 x 1000 : 277.6   457       
       40 x 1000 x  200 : 291.6   461.5
      200 x   40 x 1000 : 277.4   431.9
      200 x 1000 x   40 : 452.5   572.1
     1000 x   40 x  200 : 298.1   460.4     
     1000 x  200 x   40 : 460.5   583.8
      100 x  100 x  100 :  31.7    51.9
    2D-arrays, iterate rows-columns
    rows  x cols  : auto     manual   fake
      200 x 20000 :  123.5    106.1    113.2    
    20000 x   200 :  119.5    106.1    115.0    
    10000 x 10000 : 3080.25  2659.65  2835.1
    1D-arrays, iterate over columns
    cols   : auto  manual  fake
    500000 : 11.5  11.8    11.6
    3D-arrays, iterate pages-rows, operate on columns
    pages x rows x cols : auto    manual  fake
       40 x  200 x 1000 :  83.9   23.3     62.9
       40 x 1000 x  200 :  89.6   31.9     69.0     
      200 x   40 x 1000 :  74.3   27.6     62.2
      200 x 1000 x   40 : 135.6   76.2    107.1
     1000 x   40 x  200 :  75.3   31.2     68.6
     1000 x  200 x   40 : 133.6   71.7    108.7     
      100 x  100 x  100 :  13.0    5.4      9.9
    VI's
    I attached the VI's I used for testing. "ND_add_random_number.vi" (where N is 1, 2 or 3) is where all the action happens, taking a selector with a method and an array with the N dimensions as input. It returns the result and time in milliseconds. Using "ND_add_random_number_automated_test.vi" I run this for a few different situations (auto/manual/fake-indexing, interchanging the dimensions). The VI's starting with "3D_locality_" are used for the locality tests. The VI's starting with "3D_norows_" are used for the iterations over pages and columns only.
    Attachments:
    3D_arrays_2.zip ‏222 KB

    Robert,
    the copy-thing is not specific for auto-indexing. It is common for all tunnels. A tunnel is first of all a unique data space.
    This sounds hard, but there is an optimization in the compiler trying to reduce the number of copies the VI will create. This optimization is called "in-placeness".
    The in-placeness algorithm checks, if the wire passing data to the is connected to anything else ("branch"). If there is no other connection then the tunnel, chance is high that the tunnel won't create an additional copy.
    Speaking of loops, tunnels always copies. The in-placeness algorithm cannot opt that out.
    You can do a small test to elaborate on this: Simply wire "0" (or anything less than the array sizy of the input array) to the 'N' terminal.......
    Norbert
    PS: Auto-indexing is perfect for a "by element" operation of analysis without modification of the element in the array. If you want to modify values, use shift registers and Replace Array Subset.
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Unable to plot 1-D array with a cluster of 2 elements on an XY graph

    I'm Unable to plot a 1-D array with a cluster of 2 elements on an XY graph. The data appears at the input to the graph but nothing is plotted. I'm trying to plot a line connecting each point generated.
    Solved!
    Go to Solution.
    Attachments:
    TEST11.vi ‏13 KB

    Chuck,
    0. Do not post VIs with infinite loops! Change the True constant to a control.  One of the regular participants on these Forums has commented that using the Abort button to stop a VI is like using a tree to stop a car.  It works, but may have undesired consequences!
    1. Use a shift register on the For loop also.
    2. Inserting into an empty array leaves you with an empty array.  Initialize the array outside the loop to a size greater or equal to the maximum size you will be using.  Then use Replace Array Subest inside the loop.
    3. Just make an array of the cluster of points.  No need for the extra cluster.
    Lynn
    Attachments:
    TEST11.2.vi ‏11 KB

Maybe you are looking for

  • Cant find my music

    please help I can't finkd my music that I backed up...

  • Travelling to U.S. with unlocked iPhone... Suggestions for SIM card use?

    I have an unlocked iPhone 3G and will be in the U.S. for 3 weeks. I would like to have all available 3G services while visiting, but could settle for text and voice. Where can I find a prepaid SIM that will work with my iPhone? Thanks much!

  • Method 'getAttributeInternal' deprecated

    I'm creating a new page using Jdev 10.1.3 and getting warnings as Method 'getAttributeInternal' deprecated How to fix this? Thanks!

  • Anybody Can Help Me ?

    Hi, I have installed oracle 8i database in my Personnel system . And created one listener and Service name . Also i have installed Oracle Forms Developer 6i in the same system . Problem is i am not able to connect Forms 6i with databse . Alone i can

  • Why does my Firefox continue to hang?

    I've really had it up to here with Firefox hanging/freezing. Just like many others have posted in the help forums, after leaving my browser open for a few days, Firefox begins to hang every 10-12 seconds, for a few seconds at time. It doesn't matter