Assigning Values from a file to an Array

hey everyone I am working on a program that inputs values from a text file into an array i got the first array to work but the second array does not work. Please if you have a moment lend a hand. Here is my code. the program compiles fine but will not run right with the second array in it. The second array is called "B"
import java.util.*;
import java.io.*;
import javax.swing.*;
class algorithmAssignment1{
     public static void main (String[] args)throws IOException{
     int mark, counter, arrayAsize, mark2;
     counter=0;
     arrayAsize=100;
     int [] A= new int[arrayAsize];
     int [] B= new int[arrayAsize];
    String fileName = "arraynumbersa.txt";
    String value,value2;
    BufferedReader input;
    input = new BufferedReader (new FileReader (fileName));
    value = input.readLine ();
   while (value != null){
       mark = Integer.parseInt (value);
       A[counter]=mark;
       counter=counter+1;
       value = input.readLine ();
  /*  String fileName2 = "arraynumbersb.txt";
    BufferedReader input2;
    input2 = new BufferedReader (new FileReader (fileName2));
    value2 = input2.readLine ();     
     while (value2 != null){
       mark2 = Integer.parseInt (value2);
       B[counter]=mark2;
       counter=counter+1;
       value2 = input2.readLine ();
     bubbleSort(A,A.length);
     bubbleSort(B,B.length);
     System.out.println("Here is list A");
     for (int i = 0; i < A.length; i++){
         System.out.println( A[i] );
    System.out.println();
    System.out.println("Here is list B");
    for (int i=0;i<B.length;i++){
         System.out.println(B);
/*change
for (int i=0;i<A.length;i++){
     for (int j=0;j<B.length;j++){
          if (A[i]==B[j]){
               System.out.println("Numbers that are in list A and B are "+ B[j]);
static void bubbleSort(int numbers[], int array_size){
     int i, j, temp;
     for (i = (array_size - 1); i >= 0; i--)
     for (j = 1; j <= i; j++)
     if (numbers[j-1] > numbers[j]){
     temp = numbers[j-1];
                         numbers[j-1] = numbers[j];
                         numbers[j] = temp;

Ok new problem now. I have to get the duplicates to go into a new array in order to display the duplicates. I can't figure out why it just lists the one duplicate but not the others.(It lists the final duplicate)
Here is my code:
import java.util.*;
import java.io.*;
import javax.swing.*;
class algorithmAssignment1{
     public static void main (String[] args)throws IOException{
     int mark, counter, arrayAsize, mark2,counter2;
     counter=0;
     arrayAsize=100;
     counter2=0;
     int [] A= new int[arrayAsize];
     int [] B= new int[arrayAsize];
     int [] C=new int [arrayAsize];
    String fileName = "arraynumbersa.txt";
    String value,value2;
    BufferedReader input;
    input = new BufferedReader (new FileReader (fileName));
    value = input.readLine ();
   while (value != null){
       mark = Integer.parseInt (value);
       A[counter]=mark;
       counter=counter+1;
       value = input.readLine ();
    String fileName2 = "arraynumbersb.txt";
    BufferedReader input2;
    input2 = new BufferedReader (new FileReader (fileName2));
    value2 = input2.readLine ();     
     while (value2 != null){
       mark2 = Integer.parseInt (value2);
       B[counter2]=mark2;
       counter2=counter2+1;
       value2 = input2.readLine ();
     bubbleSort(A,A.length);
     bubbleSort(B,B.length);
     System.out.println("Here is list A");
     for (int i = 0; i < A.length; i++){
         System.out.println( A[i] );
    System.out.println();
    System.out.println("Here is list B");
    for (int i=0;i<B.length;i++){
         System.out.println(B);
for (int i=0;i<A.length;i++){
     for (int j=0;j<B.length;j++){
          if (A[i]==B[j]){
               for (int k=0;k<C.length;k++){
                    C[k]=(B[j]);
               System.out.println("Here"+B[j]);
System.out.println("Here are A and B");
for (int i=0;i<C.length;i++){
     System.out.println(C[i]);
static void bubbleSort(int numbers[], int array_size){
     int i, j, temp;
     for (i = (array_size - 1); i >= 0; i--)
     for (j = 1; j <= i; j++)
     if (numbers[j-1] > numbers[j]){
     temp = numbers[j-1];
                         numbers[j-1] = numbers[j];
                         numbers[j] = temp;

Similar Messages

  • Help with getting array values from a file

    Hey ppl. Im doing a programming assignment just now and im completely stumped. I know i can ask my tutor but that will take a week (he is never in) so i was wondering if any of you could help. The basic idea is that you have to store numbers read from a file into an array. The catch is that you are not given the size of the array, you have to discover this by counting the numbers in the file. It terminates when -1 is discovered. This 'count' then states the size of the array.
    I got this done ok and i thought I was on easy street after that. All i had to do was read the numbers into the array but alas its not working. The compiler gives it the ok, but when i run the program i get the following error
    Exception in thread "main" java.lang.nullPointerException
    at marks.main(marks.java:48)
    By the way line 48 is as follows
    numbers[index] = Integer.parseInt(infile.readLine().trim());
    and here is the evil program!!!!!
    //Paul Rodger ***MARKS*** 14/1/02
    //A program which takes numbers from a file and enters them into an array.
    //The stream of numbers is terminated when the number -1 is discovered
    import java.io.*;
    class marks
    static BufferedReader keyboard = new
    BufferedReader(new InputStreamReader(System.in));
    static PrintWriter screen = new PrintWriter(System.out, true);
    static public void main(String[] args) throws IOException{
    FileReader file = new FileReader("numbers.txt");
    BufferedReader infile = new BufferedReader(file);
    //local Data
    int COUNT;
    double x;
    char ans;
    COUNT=0; // initialising the counter
    //inputs values and calculates the sum
    x = Double.parseDouble(infile.readLine().trim());
    while (x>=0){
    COUNT++;
    x= Double.parseDouble(infile.readLine().trim());
    // display the count
    screen.println("the number of values entered was : " +COUNT );
    // stores numbers in the array
    int[] numbers = new int[COUNT];
    for(int index=0 ; index < COUNT; index++)
    numbers[index] = Integer.parseInt(infile.readLine().trim());
    infile.close();
    Any help is appreciated!

    What was suggested is this -
    prior to this line ...
    int[] numbers = new int[COUNT];insert these lines ...
    file = new FileReader("numbers.txt");
    infile = new BufferedReader(file);An alternative solution, one which reads the file only once, is to do it this way ...
    1. read the numbers and put them into a List (either ArrayList or Vector)
    2. instantiate the array based on the size of List (list.size())
    3. populate the array from the list

  • I am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    i am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    hi TimoHahn,
    i am getting following exception in JDeveloper(11g release 2) Studio Edition Version 11.1.2.4.0 but it works perfectly fine in JDeveloper 10.1.2.1.0
    Root cause of ServletException.
    java.lang.NullPointerException
    at java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:136)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
    at java.util.ResourceBundle.getString(ResourceBundle.java:334)
    at org.rbi.cefa.master.actionclass.UserAction.execute(UserAction.java:163)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • Passing Value from one File to Another !!!

    Hi Friends,
    I have an issue, I have two different Swing programs (two seperate java files). I want to transfer value from one file to the another. Like we do in Servlets or JSP, we use sessions or Hiddenfields. The same way I want to retriev value in a new file from a previous one.
    Hope that all u champs out there have the answer to my query.
    Thanks,
    [email protected]

    This is a B2B comms question...
    A quick and dirty method is to use Socket/ServerSocket and use a basic protocol to do the transfer, if you are feeling heroic then use XML as the message format...
    A lot depends on whether your applications are running on separate boxes, i.e. do you need to communicate across a network...
    If not, if they are always going to be on the same "box" then you could just use well-known places for files...not portable but effective...

  • Passing The Value from csv file to a WebApplication

    Hi to all,
    i have a csv file. my requirement is to transfer data from csv file to a specified website(i have no control over website.). How can i solve this problem?
    I am giving you an Example for better understanding:
    I have a csv file named "abc.csv" in which my login id and password of my mail is written.
    abc.csv:----
    Userid:Admin
    Password:Admin
    Now i want a program which will take these values and pass these values to my mail server so that i can login without entering manualy.
    How can i solve this Problem
    Thanks

    hi
    what You are telling is correct when we our form is in the same application. but i said that i have only csv file and my program to read that file and now with those values from csv fil ei have to lo in a diffrent site over which i don,t have any control. means i can not know the name of action class of that login page.

  • Reading Design values from readback file

    Hi All,
    I am trying to understand the process of reading back design signal values from readback file.
    I have both the .ll file and the readback.bin file
    To get the readback file, I executed the below command:
    % readback_hw_device [current_hw_device] -readback_file <filename.rbd> -bin_file <filename.bin>
    Now, I want to know the command or process to read the design signal values from this .bin file? Is there any command provided by Xilinx or anything else that I can do to read the signal values?
    Rgds
    Sapan
     

    
    Hi Syed,
    Thanks for the reply. It was actually my own started thread. I had few questions unanswered from that post:
    Question:
    The procedure for readback that I am following here is based on the ug908-vivado programming and debugging.  
    I first uploaded the image on FPGA and then I executed the following commands in Vivado Hardware Manager
    % create_hw_bitstream -hw_device [current_hw_device] -mask fpga.msk fpga.bit
    % verify_hw_devices [current_hw_device]   #### For readback verify
    readback_hw_device [current_hw_device] -readback_file <filename.rbd> -bin_file <filename.bin> #####for readback capture
    This looks a little different from the one suggested in your document. Can you please confirm if my steps are correct?
    Using the above procedure, I did not have to explicitly send readback commands to the FPGA using JTAG as mentioned in doc:
    http://www.xilinx.com/support/documentation/sw_manuals/xilinx2015_1/ug908-vivado-programming-debugging.pdf
    However the other doc http://www.xilinx.com/support/documentation/application_notes/xapp1230-configuration-readback-capture.pdf mentions sending commands to the device in order to be able to do a readback.
    So I am a little confused which one is correct?
    Also which document will give the words per frame information for  FPGA XC7VX485TFFG1761?
    Rgds
    Sapan
     

  • MD5 hash value from a file

    Hello Oracle Community,
    version 11.1
    well a lof of questions from me today. Is it possible to generate a MD5 value from a file with PL/SQL and if so how can I do it ?
    Ilja

    Hi Ilja,
    I never work with files from Oracle, but maybe you could try combining these:
    UTL_FILE.GET_RAW (
       fid  IN  utl_file.file_type,
       r    OUT NOCOPY RAW,
       len  IN  PLS_INTEGER DEFAULT NULL);
    DBMS_OBFUSCATION_TOOLKIT.MD5(
       input         IN  RAW)
      RETURN raw_checksum;Regards
    Peter

  • Assign values from one array to another

    Hi, I am trying to solve a problem that asks that I assign values in the array that is input, which meet a certain criteria, into another array. isFunny will determine if a given integer is funny, countFunnies will determine how many integers in the given array are funny or not. collectFunnies should assign elements from the first array that are funny into the new array. Please take a look at the code, I am at a loss, everything looks good to me.
    public class BatchOne
    public boolean isFunny(int x) {
    if (x%2 == 0) {return true;}
    else {return false;}
    public int countFunnies(int[] a) {
    int count = 0;
    for (int funCheck :a) {
    if(isFunny(funCheck)) {
    count++;
    return count;
    public int[] collectFunnies(int[] a) {
    int count = 0;
    int i = 0;
    for (int funCheck :a) {
    if(isFunny(funCheck)) {
    count++;
    int[] array = new int[count];
    for (int funCheck : a) {
    if(isFunny(funCheck)) {
    array[i] = funCheck;
    i++;
    return array;
    Thanks,
    T

    Ok, I am new to programming and posting so likely need some refinement to my posts.
    I am using BlueJ to write my code, the above posted is my entire code. It is compiling correctly but when I run, the return was giving me back something strange, I am not sure if I can post a screenshot because it would be hard to explain.
    However, upon further review, it seems that there are some intricacies with BlueJ that I am obviously not used to, because when I select to inspect the return, the program seems to be returning an array of values that is in line with my intended goal.
    Thank you for your guidance in terms of how to use the forums.
    T

  • Assigning value to a two-dimensional byte array - problem or not?

    I am facing a really strange issue.
    I have a 2D byte array of 10 rows and a byte array of some audio bytes:
    byte[][] buf = new byte[10][];
    byte[] a = ~ some bytes read from an audio streamWhen I assign like this:
    for (int i=0; i<10; i++) {
        a = ~read some audio bytes // this method properly returns a byte[]
        buf[i] = a;
    }the assignment is not working!!!
    If I use this:
    for (int i=0; i<10; i++) {
        a = ~read some audio bytes
        for (int j=0; j<a.length; j++) {
            buf[i][j] = a[j];
    }or this:
    for (int i=0; i<10; i++) {
        System.arraycopy(a, 0, buf, 0, a.length);
    }everything works fine, which is really odd!!
    I use this type of value assignment for the first time in byte arrays.
    However, I never had the same problem with integers, where the problem does not appear:int[] a = new int[] {1, 2, 3, 4, 5};
    int[][] b = new int[3][5];
    for (int i=0; i<3; i++) {
    b[i] = a;
    // This works fineAnybody has a clue about what's happening?
    Is it a Java issue or a programmers mistake?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Back again! I'm trying to track down the problem.
    Here is most of my actual code to get a better idea.
    private void test() {
         byte[][] buf1 = new byte[11][];
         byte[][] buf2 = new byte[11][];
         AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(audioFile);
         byte[] audioBytes = new byte[100];
         int serialNumber = 0;
         while (audioInputStream.read(audioBytes) != -1) {
              if (serialNumber == 10) {
                   serialNumber = 0; // breakpoint here for debugging
              // Fill buf1 -- working
              for (int i=0; i<audioBytes.length; i++) {
                   buf1[serialNumber] = audioBytes[i];
              // Fill buf2 -- not working
              buf2[serialNumber] = new byte[audioBytes.length];
              buf2[serialNumber] = audioBytes;
              serialNumber++;
    }I debugged the program, using a debug point after taking 10 "groups" of byte arrays (audioBytes) from the audio file.
    The result (as also indicated later by the audio output) is this:
    At the debug point the values of buf1's elements change in every loop, while buf2's remain unchanged, always having the initial value of audioBytes!
    It's really strange and annoying. These are the debugging results for the  [first|http://eevoskos.googlepages.com/loop1.jpg] ,  [second|http://eevoskos.googlepages.com/loop2.jpg]  and  [third|http://eevoskos.googlepages.com/loop3.jpg]  loop.
    I really can't see any mistake in the code.
    Could it be a Netbeans 6.1 bug or something?
    The problem appears both with jdk 5 or 6.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Assigning value from Flash

    Hi,
    Thank you in advance for your help.
    I have the following problem. I want to embed a .swf animation into a Captivate project. This .swf is a form, which the user submits and I need to assign the validated value from this form to a variable in the Captivate movie, so it can be used on the other frames. I searched around, tried some code, but unfortunately it didn't work.
    submit_btn.addEventListener(MouseEvent.CLICK,validate_func);
    function validate_func(e) {
    //do some validation here
    _parent._parent.UserInputInCaptivateVar=UserInputInFlashVar.text;
    How can I assign this value? Should the variable UserInputInCaptivateVar be defined in Captivate or it will be defined only with this AS code?
    Thanks!

    Hi acsemaph,
    Please create a captivate project and create a variable by name cpVar with some initial value.
    Insert this variable into a text caption and set the display time for the caption to sufficient amount.
    Now insert the attached animation and preview the project.
    During preview type something in the input field and press the button.
    The value will be reflected in the text caption.
    NOTE: The variable must be defined inside captivate.All the user defined variables will be present on the main time line of captivate movie. Also note that when the display time for the animation is set to "rest of project", it is placed in the main project movie clip, hence refernce to the main timline will be(_parent._parent)  . For other display time settings the animation will be placed inside the slide movie clip hence the reference to main timeline will be(_parent._parent._parent).
    Not able to attach the FLA. The code inside the fla is as follows:
    sub_btn.addEventListener("click",sendText);
    function sendText()
         if(_parent._parent._parent.cpVar != null)
         _parent._parent._parent.cpVar = flash_txt.text;
         else
         _parent._parent.cpVar = flash_txt.text;
    Please mail me at [email protected] to get the SWF file.

  • Sample Applescript: scraping values from numbers files into a master file

    Hi, I have programming experience in c and other languages, but am new to applescript and so am learning a lot from this forum.
    My goal is to make a timesheet system for my Dad (for a bday present) where every time he helps a client, he fills out a newly created numbers file - and after a week or so, he can run a script that scrapes certain values from each numbers file and places it into a master numbers file. Then saving and closing the file.
    Vince, it sounds like you've written a script that does this feature of looping through all numbers files in a folder and putting select values from each numbers file into a master numbers file (after clearing the previous values of the master file).
    Specifically, I'm looking for a sample script that opens up a numbers file, clears its table, then fills this table by scraping one value from a particular cell in every numbers file in a folder.
    If anyone has a similar script they would be willing to post or email to me, for me to use as a foundation and to learn from, I would be very very very grateful. My email is forman.jq at gmail dot com.

    I guess that this script may be a good starting point.
    --[SCRIPT fromfolder_2spreadsheet1]
    The target spreadsheet must be open at front and must contain the sheet sheet_destination which much contain the table table_destination.
    Choose the folder supposed to store the source sopreadsheets.
    Yvan KOENIG (VALLAURIS, France)
    2010/08/18
    --=====
    (* Edit these height properties to fit your needs *)
    property destination : "destinationDoc.numbers"
    property sheet_destination : "destination"
    property table_destination : "insert here"
    property premierelignedestination : 2
    property colonne_destination : 2
    property ledossierhabituel : "Macintosh HD Maxtor:Users:yvan_koenig:Desktop:dossier habituel:"
    property ligne_source : 2
    property colonne_source : 2
    --=====
    on run
    my activateGUIscripting()
    Select the folder storing the spreadsheets from which we will extract values *)
    set dossier_source to choose folder with prompt "Choose folder storing the Numbers documents…" default location (ledossierhabituel as alias)
    Build a list of disk items available in the selected folder *)
    tell application "System Events"
    set les_elements to every disk item of folder (dossier_source as text) --whose (get type identifier) is in
    set les_tableurs to {}
    Extracts the list of the Numbers spreadsheets available in the selected folder *)
    repeat with refsurelement in les_elements
    if type identifier of refsurelement is in {"com.apple.iwork.numbers.numbers", "com.apple.iwork.numbers.sffnumbers"} then
    copy path of refsurelement to end of les_tableurs
    end if
    end repeat
    end tell -- System Events
    if les_tableurs is {} then
    No Numbers documents available so we stop the process. *)
    set rapport to "The folder “" & dossier_source & "” doesn’t contain Numbers documents !"
    else
    set rapport to {}
    end if
    Check that the target Numbers document is open at front
    and that it embed the defined sheet embedding the defined table. *)
    tell application "Numbers"
    activate
    set existants to name of documents
    if destination is not in existants then
    copy "The document " & destination & " is not open !" to end of rapport
    else
    tell document destination
    if sheet_destination is not in (name of sheets) then
    copy "the sheet " & sheet_destination & " is unavailable in the document " & destination & " !" to end of rapport
    else
    tell sheet sheet_destination
    if table_destination is not in (name of tables) then copy "The table " & table_destination & " is unavailable in the sheet " & sheet_destination & " of the document " & destination & " !" to end of rapport
    end tell -- sheetSource
    end if
    end tell --document destination
    end if
    If target document is not at front or if it doesn't match the defined requirements,
    we quit the process. *)
    if rapport is not {} then error my recolle(rapport, return)
    Clean the target table, minus row 1 supposed to be storing columns headers *)
    tell document destination to tell sheet sheet_destination to tell table table_destination
    set selection range to range ("A2 : " & name of last cell)
    end tell --document destination
    end tell -- Numbers
    my selectMenu("Numbers", 4, 9) (* Suppress *)
    set liste_valeurs to {}
    tell application "Numbers"
    repeat with un_tableur in les_tableurs
    Open the spreadsheets and extract from each of them the wanted value *)
    open un_tableur
    tell document 1 to tell sheet 1 to tell table 1
    set une_valeur to value of cell 2 of column 2
    end tell
    if une_valeur is 0.0 then
    copy "empty" to end of liste_valeurs
    else
    copy une_valeur as text to end of liste_valeurs
    end if
    close document 1
    end repeat
    Now, it's time to insert the values in the target table *)
    set ligne_destination to premierelignedestination
    tell document destination to tell sheet sheet_destination to tell table table_destination
    repeat with une_valeur in liste_valeurs
    if not (exists row ligne_destination) then add row below last row
    if une_valeur is not "empty" then
    set value of cell ligne_destination of column colonne_destination to une_valeur
    end if
    set ligne_destination to ligne_destination + 1
    end repeat
    end tell -- document destination
    save document destination
    end tell -- Numbers
    end run
    --=====
    on recolle(l, d)
    local oTIDs, t
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set t to l as text
    set AppleScript's text item delimiters to oTIDs
    return t
    end recolle
    --=====
    on activateGUIscripting()
    (* to be sure than GUI scripting will be active *)
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true
    end tell
    end activateGUIscripting
    --=====
    my selectMenu("Pages",5, 12)
    ==== Uses GUIscripting ====
    on selectMenu(theApp, mt, mi)
    tell application theApp
    activate
    tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
    tell menu bar item mt to tell menu 1 to click menu item mi
    end tell -- application theApp
    end selectMenu
    --=====
    --[/SCRIPT]
    I apologize, I'm too busy to write more explanations.
    Yvan KOENIG (VALLAURIS, France) mercredi 18 août 2010 21:38:04

  • How to get the values from xml file to java combo box

    Hi frens,
    I am new to java and xml programming,
    Now, i want to have a code of getting the tag values from the xml file
    into the swing combo box of java front end.
    How can we do that?
    any help of code or tutorial or an ebook is a great help for me.
    Thank you,
    Karthik.
    Edited by: Karthik84 on Aug 27, 2008 1:49 AM
    Edited by: Karthik84 on Aug 27, 2008 11:29 PM

    look at this link
    http://www.stylusstudio.com/docs/v2006/d_help30.html
    I read sometime back that castor has a tool to do
    conversion. You might have a look into casto as well.

  • Reading values from properties file

    Hi All,
    I am in need of a help from you all.I have a login.jsp which gets username and password as user input and checks in the servlet that if it was admin and admin it will take to index.jsp and if it was other than admin and other users it should take to index1.jsp.For now i am using an if condition to check the values and to dispatch the request.I need to use a properties file for this and need to check by getting the values from the properties file.And also it should check for each entry in properties file and if it finds any matches it should take to the corresponding page.
    Please help me in achieving this.
    Thanks,
    laxmi

    Hi All,
    I am in need of a help from you all.I have a login.jsp which gets username and password as user input and checks in the servlet that if it was admin and admin it will take to index.jsp and if it was other than admin and other users it should take to index1.jsp.For now i am using an if condition to check the values and to dispatch the request.I need to use a properties file for this and need to check by getting the values from the properties file.And also it should check for each entry in properties file and if it finds any matches it should take to the corresponding page.
    Please help me in achieving this.
    Thanks,
    laxmi

  • Why does Read from Text file default to array of 9 elements

    I am writing to a text file starting with a type def. cluster (control) of say 15 dbl numeric elements, that works fine I open the tab-delimited text file and all of the elements appear in the file.  However when I read from the same text file back to the same type def. cluster (indicator), the read from text file defaults to 9 elements?? Is there a way to control how many elements are read from the file.  This all works great when I initially use a cluster of 9 elements and read back to a cluster of 9 elements.
    Solved!
    Go to Solution.

    From the LabVIEW Help: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/array_to_cluster/
    Converts a 1D array to a cluster of elements of the same type as the array elements. Right-click the function and select Cluster Size from the shortcut menu to set the number of elements in the cluster.
    The default is nine. The maximum cluster size for this function is 256.
    Aside: so, how many times has this question been asked over the years?

Maybe you are looking for

  • I cannot turn on my notes in icloud without signing up for a new account.  I already have a functioning account, but just want to turn on another function.  What do I do?

    I already have a functioning icloud account that syncs my information from my iphone to my PC.  I don't want to start a new account, but it seems that Apple is forcing me to open a new account to merely turn on a new function, which is my notes.  Any

  • Error while invoking PL/SQL API from DB Adapter

    Hi everybody. We have a plenty of processes, which invokes PL/SQL API using DB Adapters. Everything goes ok, but sometimes API invocations results with error like this: <bindingFault> <part name="code" > <code>902</code> </part> <part name="summary"

  • XML attributes and object types

    I want to create an XML Document of the following form <family> <parent attr1="val1"> <child attr2="val2" attr3="val3"/> </parent> </family> Using object table and object type (for the child element), I am able to produce the following XML Document (

  • User -profile has "bad-screen-layout"

    Hi, on my Old Imac, 10.4 and now again with the conversion to my new Imac Intel 10.4.9 the user profile shows the desktop not very good. It looks just like it's over-exposed. To much contrast, white is very white and the menu isn't very good readable

  • XSL indentation help

    Hi everybody, I managed to pass a .xsl file to my method that writes out the DOM in a xml file. For the moment it just prints out the nodes in different lines (instead of writing them in one eternal line) with this code: <xsl:stylesheet xmlns:xsl="ht