(Urgent help needed) how to read txt file and store the data into 2D-array?

Hi, I have a GUI which allow to choose file from the file chooser, and when "Read file" button is pressed, I want to show the array data into the textarea.
The sample data is like this followed:
-0.0007     -0.0061     0.0006
-0.0002     0.0203     0.0066
0     0.2317     0.008
0.0017     0.5957     0.0008
0.0024     1.071     0.0029
0.0439     1.4873     -0.0003
I want my program to scan through and store these data into 2D array.
However for some reason, my source code issues errors, and I don't know what's wrong with it, seems to have a problem in StringTokenizer though. Can anybody help me?
Thanks in advance.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.StringTokenizer;
public class FileReduction1 extends JFrame implements ActionListener{
// GUI features
private BufferedReader fileInput;
private JTextArea textArea;
private JButton openButton, readButton,processButton,saveButton;
private JTextField textfield;
private JPanel pnlfile;
private JPanel buttonpnl;
private JPanel buttonbar;
// Other fields
private File fileName;
private String[][] data;
private int numLines;
public FileReduction1(String s) {
super(s);
// Content pane
     Container cp = getContentPane();
     cp.setLayout(new BorderLayout());     
// Open button Panel
pnlfile=new JPanel(new BorderLayout());
     textfield=new JTextField();
     openButton = new JButton("Open File");
openButton.addActionListener(this);
pnlfile.add(openButton,BorderLayout.WEST);
     pnlfile.add(textfield,BorderLayout.CENTER);
     readButton = new JButton("Read File");
readButton.addActionListener(this);
     readButton.setEnabled(false);
pnlfile.add(readButton,BorderLayout.EAST);
     cp.add(pnlfile, BorderLayout.NORTH);
     // Text area     
     textArea = new JTextArea(10, 100);
cp.add(new JScrollPane(textArea),BorderLayout.CENTER);
processButton = new JButton("Process");
//processButton.addActionListener(this);
saveButton=new JButton("Save into");
//saveButton.addActionListener(this);
buttonbar=new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonpnl=new JPanel(new GridLayout(1,0));
buttonpnl.add(processButton);
buttonpnl.add(saveButton);
buttonbar.add(buttonpnl);
cp.add(buttonbar,BorderLayout.SOUTH);
/* ACTION PERFORMED */
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("Open File")) getFileName();
     if (event.getActionCommand().equals("Read File")) readFile();
/* OPEN THE FILE */
private void getFileName() {
// Display file dialog so user can select file to open
     JFileChooser fileChooser = new JFileChooser();
     fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
     int result = fileChooser.showOpenDialog(this);
     // If cancel button selected return
     if (result == JFileChooser.CANCEL_OPTION) return;
if (result == JFileChooser.APPROVE_OPTION)
     fileName = fileChooser.getSelectedFile();
textfield.setText(fileName.getName());
     if (checkFileName()) {
     openButton.setEnabled(false);
     readButton.setEnabled(true);
     // Obtain selected file
/* READ FILE */
private void readFile() {
// Disable read button
readButton.setEnabled(false);
// Dimension data structure
     getNumberOfLines();
     data = new String[numLines][];
     // Read file
     readTheFile();
     // Output to text area     
     textArea.setText(data[0][0] + "\n");
     for(int index=0;index < data.length;index++)
for(int j=1;j<data[index].length;j++)
textArea.append(data[index][j] + "\n");
     // Rnable open button
     openButton.setEnabled(true);
/* GET NUMBER OF LINES */
/* Get number of lines in file and prepare data structure. */
private void getNumberOfLines() {
int counter = 0;
     // Open the file
     openFile();
     // Loop through file incrementing counter
     try {
     String line = fileInput.readLine();
     while (line != null) {
     counter++;
          System.out.println("(" + counter + ") " + line);
line = fileInput.readLine();
     numLines = counter;
closeFile();
     catch(IOException ioException) {
     JOptionPane.showMessageDialog(this,"Error reading File",
               "Error 5: ",JOptionPane.ERROR_MESSAGE);
     closeFile();
     System.exit(1);
/* READ FILE */
private void readTheFile() {
// Open the file
int row=0;
int col=0;
     openFile();
System.out.println("Read the file");     
     // Loop through file incrementing counter
     try {
String line = fileInput.readLine();
     while (line != null)
StringTokenizer st=new StringTokenizer(line);
while(st.hasMoreTokens())
data[row][col]=st.nextToken();
System.out.println(data[row][col]);
col++;
row++;
closeFile();
catch(IOException ioException) {
     JOptionPane.showMessageDialog(this,"Error reading File",
               "Error 5: ",JOptionPane.ERROR_MESSAGE);
     closeFile();
     System.exit(1);
/* CHECK FILE NAME */
/* Return flase if selected file is a directory, access is denied or is
not a file name. */
private boolean checkFileName() {
     if (fileName.exists()) {
     if (fileName.canRead()) {
          if (fileName.isFile()) return(true);
          else JOptionPane.showMessageDialog(null,
                    "ERROR 3: File is a directory");
     else JOptionPane.showMessageDialog(null,
                    "ERROR 2: Access denied");
     else JOptionPane.showMessageDialog(null,
                    "ERROR 1: No such file!");
     // Return
     return(false);
/* FILE HANDLING UTILITIES */
/* OPEN FILE */
private void openFile() {
     try {
     // Open file
     FileReader file = new FileReader(fileName);
     fileInput = new BufferedReader(file);
     catch(IOException ioException) {
     JOptionPane.showMessageDialog(this,"Error Opening File",
               "Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File opened");
/* CLOSE FILE */
private void closeFile() {
if (fileInput != null) {
     try {
          fileInput.close();
     catch (IOException ioException) {
     JOptionPane.showMessageDialog(this,"Error Opening File",
               "Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File closed");
/* MAIN METHOD */
/* MAIN METHOD */
public static void main(String[] args) throws IOException {
     // Create instance of class FileChooser
     FileReduction1 newFile = new FileReduction1("File Reduction Program");
     // Make window vissible
     newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     newFile.setSize(500,400);
newFile.setVisible(true);
Java.lang.NullpointException
at FileReductoin1.readTheFile <FileReduction1.java :172>
at FileReductoin1.readFile <FileReduction1.java :110>
at FileReductoin1.actionPerformed <FileReduction1.java :71>
.

1) Next time use the CODE tags. this is way too much unreadable crap.
2) The problem is your String[][] data.... the only place I see you do anything approching initializing it is
data = new String[numLines][];I think you want to do this..
data = new String[numLines][3];anyway that's why it's blowing up on the line
data[row][col]=st.nextToken();

Similar Messages

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

  • How to read XML file and update the data in MS CRM 2011?

    Hi Folks,
    Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
    Please let me know if any ways of handling it in simple ways.
    Thanks,
    Sri

    HI,
    How to read XML file:
    https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
    How to work with CRM:
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
    Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
    OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
    proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
    IOrganizationService service = (IOrganizationService)proxy;
    //using "service" you can create, update and retrieve entities.
    More information here about service functions:
    https://msdn.microsoft.com/en-us/library/gg328198.aspx

  • How to read a file and save the contents into array list

    i have textfile contains information like:
    Name: James Smith
    Customer no: 663,282
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Feb 10, 2008 6:50:00 PM GMT
    Name: Janet Smith
    Customer no: 663,283
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Jan 11, 2007 8:10:05 PM GMT
    etc...
    how can i read the contents of this textfile and put the data into an ArrayList called ArrayList<Customer> customerList.
    i knew that i need two classes, one for CustomerDetails and one for ReadFile.
    i have already done the customer class as:
    import java.util.Date;
    public class Customer
        String Name;
        int CustomerNo;
        String Postcode;
        String teleNo;
        Date lastModified;
        public Customer(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         assign(Name, CustomerNo, Postcode, teleNo, lastModified);
        public void assign(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         this.Name=Name;
         this.CustomerNo=CustomerNo;
         this.Postcode=Postcode;
         this.teleNo=teleNo;
         this.lastModified=lastModified;
        public String toString()
         String allDetails = "Name: "+Name+
             ", Customer No: "+CustomerNo+
             ", Postcode:"+Postcode+
             ", Telephone No: "+teleNo+
             ", Last Modified Date: "+lastModified;
         return allDetails;
    }i just wondering how can i code the ReadFile class?
    can anyone help me please. thank you in advance.

    thank you for your suggestion, but i have already started to code the readCustomer class using the Scanner.
    the code i got so far is:
    import java.util.Scanner;
    import java.io.*;
    public class readCustomer
        public static void main(String[] args)
         readCustomer("Customers.txt");
        public static void readCustomer(String filename)
         try {
             Scanner scanner = new Scanner(new File(filename));
             scanner.useDelimiter(System.getProperty("line.separator"));
             while (scanner.hasNext()) {
              processLine(scanner.next());
             scanner.close();
         } catch (FileNotFoundException e) {
             e.printStackTrace();
        public static void processLine(String line)
         Scanner scanner2 = new Scanner(line);
         scanner2.useDelimiter("\\s*:\\s*");
         String description = scanner2.next();
    *// here is where i am struggling. i don't know how to get the information after the : sign*   
    }i am currently struggling with the processLine method?
    also, i am not sure how to group a set of information and put them into the arraylist.
    Any hint, please. Thank you.
    Edited by: mujingyue on Feb 26, 2008 12:42 PM

  • // Code Help need .. in Reading CSV file and display the Output.

    Hi All,
    I am a new Bee in code and started learning code, I have stared with Console application and need your advice and suggestion.
    I want to write a code which read the input from the CSV file and display the output in console application combination of first name and lastname append with the name of the collage in village
    The example of CSV file is 
    Firstname,LastName
    Happy,Coding
    Learn,C#
    I want to display the output as
    HappyCodingXYZCollage
    LearnC#XYXCollage
    The below is the code I have tried so far.
     // .Reading a CSV
                var reader = new StreamReader(File.OpenRead(@"D:\Users\RajaVill\Desktop\C#\input.csv"));
                List<string> listA = new List<string>();
                            while (!reader.EndOfStream)
                    var line = reader.ReadLine();
                    string[] values = line.Split(',');
                    listA.Add(values[0]);
                    listA.Add(values[1]);
                    listA.Add(values[2]);          
                    // listB.Add(values[1]);
                foreach (string str in listA)
                    //StreamWriter writer = new StreamWriter(File.OpenWrite(@"D:\\suman.txt"));
                    Console.WriteLine("the value is {0}", str);
                    Console.ReadLine();
    Kindly advice and let me know, How to read the column header of the CSV file. so I can apply my logic the display combination of firstname,lastname and name of the collage
    Best Regards,
    Raja Village Sync
    Beginer Coder

    Very simple example:
    var column1 = new List<string>();
    var column2 = new List<string>();
    using (var rd = new StreamReader("filename.csv"))
    while (!rd.EndOfStream)
    var splits = rd.ReadLine().Split(';');
    column1.Add(splits[0]);
    column2.Add(splits[1]);
    // print column1
    Console.WriteLine("Column 1:");
    foreach (var element in column1)
    Console.WriteLine(element);
    // print column2
    Console.WriteLine("Column 2:");
    foreach (var element in column2)
    Console.WriteLine(element);
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Want to Read the a txt file and put the data into the table colums.

    I have a text file in which data is piped separated and I want to put the data in the table column.
    Eg.
    Text File Column
    First_name|Last_name|address|phone_number
    Database table:
    first_name ,last_name,address,phone_number
    It's very urgent.
    Thanks For your help in advance.
    Himanshu

    Use sqlldr or external file.
    See http://download.oracle.com/docs/cd/E11882_01/server.112/e10701/part_ldr.htm#i436326 for SQL Loader.
    See http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/tables013.htm#ADMIN11705 for External table.

  • How to read a table and transfer the data into an internal table?

    Hello,
    I try to read all the data from a table (all attribute values from a node) and to write these data into an internal table. Any idea how to do this?
    Thanks for any help.

    Hi,
    Check this code.
    Here i creates context one node i.e  flights and attributes are from SFLIGHT table.
    DATA: lo_nd_flights TYPE REF TO if_wd_context_node,
            lo_el_flights TYPE REF TO if_wd_context_element,
            ls_flights TYPE if_main=>element_flights,
            it_flights type if_main=>elements_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
      lo_nd_flights = wd_context->get_child_node( 'FLIGHTS' ).
    CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE
      IMPORTING
        TABLE  = it_flights.
    now the table data will be in internal table it_flights.

  • How to read .html file and store values into oracle table  from html file

    Hi all ,
    How to read .html file and store values into oracle table from html file using pl/sql
    Please Help.....

    Hi,
    Kindly find following sample html code ,i want to store every value in different column in database .
    <html><body><p/>
    <div style="position:absolute;top:47px;left:37px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:47px;left:680px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;">  
    </div>
    <div style="position:absolute;top:94px;left:151px;font-family:'Times New Roman';font-size:1pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:1080px;left:115px;font-family:'Times New Roman';font-size:8pt;white-space:nowrap;">4497743
    </div>
    <div style="position:absolute;top:1079px;left:442px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;"> Miclyn Express Offshore Pre-Quotation Disclosure
    </div>
    <div style="position:absolute;top:1079px;left:680px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:1079px;left:723px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;">page 5
    </div>
    <div style="position:absolute;top:1083px;left:151px;font-family:'Times New Roman';font-size:1pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:107px;left:151px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Attachment 2 ¿ indicative statement of 20 largest shareholders </b>
    </div>
    <div style="position:absolute;top:139px;left:262px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Name </b>
    </div>
    <div style="position:absolute;top:131px;left:415px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Number of Shares </b>
    </div>
    <div style="position:absolute;top:147px;left:458px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Held </b>
    </div>
    <div style="position:absolute;top:131px;left:560px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Percentage of </b>
    </div>
    <div style="position:absolute;top:147px;left:567px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>shares held </b>
    </div>
    <div style="position:absolute;top:179px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Macquarie Capital Group Limited 92,378,000
    </div>
    <div style="position:absolute;top:179px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:179px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">34.00%r
    </div>
    <div style="position:absolute;top:179px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:212px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">HSBC Custody Nominees (Australia)
    </div>
    <div style="position:absolute;top:227px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited
    </div>
    <div style="position:absolute;top:220px;left:464px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">36,458,220
    </div>
    <div style="position:absolute;top:220px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:220px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">13.42%
    </div>
    <div style="position:absolute;top:220px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:260px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Ray Rider Limited 27,170,000
    </div>
    <div style="position:absolute;top:260px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:260px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">10.00%
    </div>
    <div style="position:absolute;top:260px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:300px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:300px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">7.96%
    </div>
    <div style="position:absolute;top:300px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:333px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">National Australia Bank Custodian
    </div>
    <div style="position:absolute;top:348px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Services
    </div>
    <div style="position:absolute;top:341px;left:464px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">12,866,550
    </div>
    <div style="position:absolute;top:341px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:341px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4.74%
    </div>
    <div style="position:absolute;top:341px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:381px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Citigroup Nominees Pty Ltd 6,942,541
    </div>
    <div style="position:absolute;top:381px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:381px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2.56%r
    </div>
    <div style="position:absolute;top:381px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:421px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:421px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2.14%r
    </div>
    <div style="position:absolute;top:421px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:462px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">UBS Securities Australia Ltd 4,806,760
    </div>
    <div style="position:absolute;top:462px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:462px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.77%
    </div>
    <div style="position:absolute;top:462px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:494px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Merrill Lynch Equities (Australia)
    </div>
    <div style="position:absolute;top:510px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited
    </div>
    <div style="position:absolute;top:502px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4,325,000
    </div>
    <div style="position:absolute;top:502px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:502px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.59%
    </div>
    <div style="position:absolute;top:502px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:550px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Equities Ltd
    </div>
    <div style="position:absolute;top:542px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4,150,000
    </div>
    <div style="position:absolute;top:542px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:542px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.53%
    </div>
    <div style="position:absolute;top:542px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:575px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Bond Street Custodians Limited - A/C
    </div>
    <div style="position:absolute;top:590px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Institutional
    </div>
    <div style="position:absolute;top:583px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2,750,000
    </div>
    <div style="position:absolute;top:583px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:583px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.01%
    </div>
    <div style="position:absolute;top:583px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:623px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Cogent Investment Operations Pty Ltd 2,599,321
    </div>
    <div style="position:absolute;top:623px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:623px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.96%
    </div>
    <div style="position:absolute;top:623px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:663px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Skeet Nominees Pty Ltd 2,276,736
    </div>
    <div style="position:absolute;top:663px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:663px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.84%
    </div>
    <div style="position:absolute;top:663px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:704px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Diederik de Boer 1,917,561
    </div>
    <div style="position:absolute;top:704px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:704px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.71%
    </div>
    <div style="position:absolute;top:704px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:744px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Ecapital Nominees Pty Limited 1,594,736
    </div>
    <div style="position:absolute;top:744px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:744px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.59%
    </div>
    <div style="position:absolute;top:744px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:777px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Neweconomy Com Au Nominees Pty 9
    </div>
    <div style="position:absolute;top:792px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited &#60;900 Account&#62;
    </div>
    <div style="position:absolute;top:784px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1,594,7360
    </div>
    <div style="position:absolute;top:784px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:784px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.59%
    </div>
    <div style="position:absolute;top:784px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:825px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Sonray Capital Markets Pty Ltd 1,236,842
    </div>
    <div style="position:absolute;top:825px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:825px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.46%
    </div>
    <div style="position:absolute;top:825px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:865px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Argo Investments Limited 1,050,000
    </div>
    <div style="position:absolute;top:865px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:865px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.39%
    </div>
    <div style="position:absolute;top:865px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:905px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Idameno (No 79) Nominees Pty Limited 724,210</div>
    <div style="position:absolute;top:1103px;">
    </body></html>
    Thanks..........................

  • Read from .txt file and output the content as two arrays

    I am using the contoured move to control the x-y stage. The trajectory datas for x and y axis are generated using my interpolation program and it is stored in a .txt file as two columns. What I want to do is read .txt file and output the content of this file as two arrays. Is there anyone has any ideas? Thanks, the .txt file is attached.
    Attachments:
    R.75.txt ‏172 KB

    Hi Awen,
    This is quite easy to do, you can merely use the "read from spreadsheet file" function to get a 2D array (2 columns and n rows) and then use the index array function to get whatever row/colums you want..
    Hope the attached VI helps you
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    read sprdsheet file.vi ‏27 KB

  • Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin

    Hi ,
    We have a catalog that defines 2 types of products (they have too many different properties), so wanted to keep them on two different MDEX engines and serve the applications requests. Here DB catalog and front end ATG application is same for both the MDEX instances.
    Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin?
    Thanks
    Dev

    Hi, also have had some problem some monthes ago - I created separete component ProductCatalogSimpleIndexingAdminSecond. After that one of my colleage gave me some advice:
    The creating separate component like ProductCatalogSimpleIndexingAdmin for the second IOC is possible way for resolving your situation. But I afraid that this way will be required creating mane duplicates for already existed components.
    In my opinion the better way is the following:
    starting from AssemblerApplicationConfiguration and ApplicationConfiguration component. It contains details for connecting between ATG and Endeca. Of course you should configure different components for different Endeca Apps.
    After that:
    Find all components that uses AssemblerApplicationConfiguration and ApplicationConfiguration. Customize these components for using one or another  *Configuration component depending on what index works. (many variants released it: the most simple global custom component with flag.)
    Then customize the existed ProductCatalogSimpleIndexingAdmin. Using one or another IOC  and setting the flag in global custom component when index started. You can add some methods into your custom ProductCatalogSimpleIndexingAdmin like:
    Execute baseline index for both IOC (one by one)
    Execute baseline for IOC 1
    Execute baseline for IOC 2.
    Note: you should be afraid about incremental (partial) index in this configuration. But resolving conflicts in incremental index should be done after full implementation these changes.
    Regards

  • How to read  *.pdf files and store them in a database?

    Dear programmers,
    I have problem with reading *.pdf files and store them in a database.
    can any one help me, please!
    Is it possible to read more than one file from the local system and store them in a database.
    thnaks in advance.
    bye

    What "problem" are you encountering?
    Depending on your choice of database software, it may or may not support the storage of binary large objects (BLOBs).

  • How to create a file and store its contents into another file?

    Hi,
    I'm having some trouble trying to create a code where I have to to create a file and store its contents into another file?
    I read the API, but I'm not certain how this file thing works.
    Here's my code so far:
    public static void main(String[] args) throws Exception
              File file = new File("tasks.txt");
              if (file.exists())
                   System.out.println("File already exists");
                   System.exit(0);
              Scanner scan = new Scanner(System.in);
              Scanner scan2 = new Scanner(System.in);
              //Scans the input line by line
              scan.useDelimiter("\\n");
              //Scans the input by tabs
              scan2.useDelimiter("\\t");
              PrintWriter outputs = new PrintWriter("newtasks.txt");
              outputs.print("ok");
              outputs.println(3);
              outputs.close();
         }

    I managed to change my text into uppercase, but how do I store the uppercase content into another file.
    -So this is what I did so far, I took a text file and modified its strings to uppercase.
    -Now I need to put those modified strings into another text file, is there a way where I can do that with my current code?
    -I already tried printwriter, but it doesn't seem to work
    public static void main(String[] args)throws IOException
              //Task[] oneHundredTasks = new Task[100];
              String uppercase;
              String combine;
              Scanner scan = null;
              FileInputStream in = null;
            FileOutputStream out = null;
            PrintWriter output = null;
            try
                 scan = new Scanner(new BufferedReader(new FileReader("tasks.txt")));
                 scan.useDelimiter("\\n");
                 scan.useDelimiter("\\t");
                while (scan.hasNext())
                     if(!scan.hasNext())
                          scan.next();
                     combine = scan.next();
                     uppercase = combine.toUpperCase();
                     System.out.println(uppercase);
            finally
                if (scan != null)
                    scan.close();
            //The program will try the input and output files
            try
                 in = new FileInputStream("tasks.txt");
                out = new FileOutputStream("newtasks.txt");
                int c;
                //The number "-1" is used to indicate that it has reached the end of the stream.
                while ((c = in.read()) != -1)
                    out.write(c);
            finally
                if (in != null)
                    in.close();
                if (out != null)
                    out.close();
         }

  • Parsing an EDI file and populating the data into database table

    Hi ,
    Please help me in parsing an edi file and getting the required columns.
    we get an EDI file from a bank. I need to parse that file and populate the db table with the required columns.
    the file is '*' delimited and every line ends with '\'.
    The record starts with 'ST*' and ends with 'SE*'.
    sample edi file is
    ISA*00*          *00*          *ZZ*043000096820   *ZZ*2156833510     *131202*0710*U*00401*000001204*0*P*>\  ignore first 2 lines                                                                                                                                                                                              
    GS*RA*043000096820*2156833510*131202*0710*1204*X*003020\                                                                                                                                                                                                                                                  
    ST*820*000041031\                                                                                                                                                                                                                                                                                     
    BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\                                                                                                                                                                                                                  
    TRN*1*101036661273032\                                                                                                                                                                                                                                                                                    
    DTM*007*131202\                                                                                                                                                                                                                                                                                           
    N1*1U*BPS\                                                                                                                                                                                                                                                                             
    N1*BE*MICHAEL    DRAYTON*34*159783633\                                                                                                                                                                                                                                                                    
    N1*PE*BPS*ZZ*183383689C2 ABC\                                                                                                                                                                                                                                                          
    N1*PR*ABC  TREAS 310\                                                                                                                                                                                                                                                                                     
    SE*9*000041031\ ST*820*000041032\                                                                                                                                                                                                                                                                                         
    BPR*X*686*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\                                                                                                                                                                                                                  
    TRN*1*101036661273034\                                                                                                                                                                                                                                                                                    
    DTM*007*131202\                                                                                                                                                                                                                                                                                           
    N1*1U*BPS\                                                                                                                                                                                                                                                                             
    N1*BE*SAMIA      GRAVES*34*892909238\                                                                                                                                                                                                                                                                     
    N1*PE*BPS*ZZ*184545710C5 ABC\                                                                                                                                                                                                                                                          
    N1*PR*ABC  TREAS 310\                                                                                                                                                                                                                                                                                     
    SE*9*000041032\
    Below is the procedure I am trying to use for parsing that file. but the logic is not working. can you please help me in doing this. its very urgent requirement.
    CREATE OR REPLACE package body p1 is
    Function parse_spec(p_str varchar2) return t_str_nt is
    begin
          return regexp_replace(p_str,'\\$',null);
    end;
    procedure edi( is
    l_out_file              utl_file.file_type;
    l_lin                 varchar2(200);
    field1            number(9);
    field2                varchar2(10 byte);
    field3           varchar2(15 byte);
    field4               varchar2(15 byte);
    field5              varchar2(20 byte);
    field6             varchar2(20 byte);
    field7              varchar2(20 byte);
    field8                  varchar2(9 byte);
    field9              varchar2(15 byte);
    field10             varchar2(5 byte);
    l_item_nt             t_str_nt:=t_str_nt();
    begin
       l_out_file  := utl_file.fopen (file_path, file_name, 'r');
       IF utl_file.is_open(l_out_file) THEN
        LOOP
          BEGIN
           l_item_nt:= utl_file.get_line(l_out_file, l_lin);
            IF l_item_nt IS NULL THEN
              raise no_data_found;
            Else
              for k in 1..l_item_nt.count loop
                  case
                   when l_item_nt(k) like 'ST*%' then
                           field1:= ltrim(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),0);
                   when l_item_nt(k) like 'BPR*X*%' then
                           field2 := regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
                    when l_item_nt(k) like 'TRN*1*%' then
                             field3:= regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
                    when l_item_nt(k) like 'DTM*007*%' then
                            field4:= regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
                    when l_item_nt(k) like '%*BE*%' then
                            field5 := regexp_substr(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),'[^ ]+', 1, 1);
                            field6 := regexp_substr(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),'[^ ]+', 1, 1);
                             field7  := regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,5);
                    when l_item_nt(k) like '%*PE*%*ZZ*%' then
                            field8:= regexp_substr(regexp_substr(parse_spec(line),'[^*]+',1,5),'[^ ]+',1,1)
                            field9 := regexp_substr(regexp_substr(parse_spec(line),'[^*]+',1,5),'[^ ]+',1,2);
                     when l_item_nt(k) like 'SE*%' then
                                                         insert into t1(field1,field2,field3,field5,field6,field7,field8,field9)
                                --  values(field1,field2,field3,field5,field6,field7,field8,field9);
                     else
                            dbms_output.put_line ('end of line');
                         end case;
                end loop;
            end if;
    end loop;
                         utl_file.fclose(l_out_file);
    exception
       when no_data_found then
                   dbms_output.put_line('No data found');
       end;

    I would not use regular expressions for parsing as it is CPU intensive - and standard string processing suffices.
    I would break the EDI up into lines. I would tokenise each line. I then have 2d array that can be referenced to find a specific field. E.g. line x and token y is field abc.
    Basic approach:
    SQL> create or replace type TStrings as table of varchar2(4000);
      2  /
    Type created.
    SQL> -- create a parser that tokenises a string
    SQL> create or replace function Tokenise(
      2          csvLine varchar2,
      3          separator varchar2 default ',',
      4          enclosedBy varchar2 default null
      5  ) return TStrings is
      6          strList         TStrings;
      7          str             varchar2(32767);
      8          i               integer;
      9          l               integer;
    10          enclose1        integer;
    11          enclose2        integer;
    12          encloseStr      varchar2(4000);
    13          replaceStr      varchar2(4000);
    14
    15          procedure AddString( line varchar2 ) is
    16          begin
    17                  strList.Extend(1);
    18                  strList( strList.Count ) := Replace( line, CHR(0), separator );
    19          end;
    20
    21  begin
    22          strList := new TStrings();
    23
    24          str := csvLine;
    25          loop
    26                  if enclosedBy is not null then
    27                          -- find the ennclosed text, if any
    28                          enclose1 := InStr( str, enclosedBy, 1 );
    29                          enclose2 := InStr( str, enclosedBy, 2 );
    30
    31                          if (enclose1 > 0) and (enclose2 > 0) and (enclose2 > enclose1) then
    32                                  -- extract the enclosed string
    33                                  encloseStr := SubStr( str, enclose1, enclose2-enclose1+1 );
    34                                  -- replace the separator char's with zero char's
    35                                  replaceStr := Replace( encloseStr, separator, CHR(0) );
    36                                  -- and remove the enclosed quotes
    37                                  replaceStr := Replace( replaceStr, enclosedBy );
    38                                  -- change the enclosed string in the big string to the replacement string
    39                                  str := Replace( str, encloseStr, replaceStr );
    40                          end if;
    41                  end if;
    42
    43                  l := Length( str );
    44                  i := InStr( str, separator );
    45
    46                  if i = 0 then
    47                          AddString( str );
    48                  else
    49                          AddString( SubStr( str, 1, i-1 ) );
    50                          str := SubStr( str, i+1 );
    51                  end if;
    52
    53                  -- if the separator was on the last char of the line, there is
    54                  -- a trailing null column which we need to add manually
    55                  if i = l then
    56                          AddString( null );
    57                  end if;
    58
    59                  exit when str is NULL;
    60                  exit when i = 0;
    61          end loop;
    62
    63          return( strList );
    64  end;
    65  /
    Function created.
    SQL>
    SQL>
    SQL> declare
      2          ediDoc  varchar2(32767) :=
      3  'ISA*00*          *00*          *ZZ*043000096820   *ZZ*2156833510     *131202*0710*U*00401*000001204*0*P*>\GS*RA*043000096820*2156833510*131202*0710*1204*X*003020\ST*820*000041031\BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\TRN*1*101036661273032\DTM*007*131202\N1*1U*BPS\N1*BE*MICHAEL      DRAYTON*34*159783633\N1*PE*BPS*ZZ*183383689C2 ABC\N1*PR*ABC  TREAS 310\SE*9*000041031\ST*820*000041032\BPR*X*686*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\TRN*1*101036661273034\DTM*007*131202\N1*1U*BPS\N1*BE*SAMIA        GRAVES*34*892909238\N1*PE*BPS*ZZ*184545710C5 ABC\N1*PR*ABC  TREAS 310\SE*9*000041032\';
      4
      5          lines   TStrings;
      6          tokens  TStrings;
      7  begin
      8          -- split EDI string into lines
      9          lines := Tokenise( ediDoc, '\' );
    10
    11          -- process line and extract fields
    12          for i in 3..lines.Count loop
    13                  dbms_output.put_line( '***********************' ) ;
    14                  dbms_output.put_line( 'line=['||lines(i)||']' );
    15                  tokens := Tokenise( lines(i), '*' );
    16
    17                  for j in 1..tokens.Count loop
    18                          dbms_output.put_line( to_char(j,'00')||'='||tokens(j) );
    19                  end loop;
    20          end loop;
    21  end;
    22  /
    line=[ST*820*000041031]
    01=ST
    02=820
    03=000041031
    line=[BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202]
    01=BPR
    02=X
    03=270
    04=C
    05=ACH
    06=PPD
    07=01
    08=101036669
    09=
    10=
    11=9101036669
    12=
    13=01
    14=031000053
    15=DA
    16=00000008606086714
    17=131202
    line=[TRN*1*101036661273032]
    01=TRN
    02=1
    03=101036661273032
    <snipped>

  • Read the file and write the data into string or int

    Ok, here's another rookie question.
    I got to read the line from the file and store it in the memory as string or integer.
    I wrote this code:
    File inputFile = new File("c:/xxx.yyy");
    String outputString = new String();
    FileReader c1 = new FileReader(inputFile);
    StringWriter d1 = new StringWriter(outputString);
    int data;
             while((data = c1.read()) != -1)
                 d1.write(data);
                 System.out.println(data);
             c1.close();
             d1.close();This is how I see it, but it cannot be even compiled because there is no such thing as StringWriter(String) wich I find completely irrational. So tell me, am I retarded or what? No, but seriosly, please help the newbie to understand these streams, am I supposed to use some kind of buffer? Any help appreciated.

    A String is an immutable. You cannot update a String.
    A new String() is basically the same as an empty String ""
    An empty StringWriter can be created with new StringWriter().
    If you use a BufferedReader you can call readLine().
    BufferedReader in = new BufferedReader(new FileReader(filename));
    String line;
    while((line = in.readLine()) != null) {
      System.out.println(line);
    }

  • Urgent HELP! how to resize a layout and change the color from black to white

    Hey!!!
    im in urgent help of someone to answer my questions. I have a huge Indesign exam monday and two of the questions are   
    -resizing a layout
    -changing a color layout to black and white
    I have done many porjects in Indesign but to be honest i don't know what they are refering but resizing a layout or changing the layout color to black and white. If any body can explain me this a little be I be so thankful!
    Thanks,
    Fiama Piccardo

    I've decided to relent a little and give you a hint, so you can do some looking and figure this out for yourself. Everything you need for either of those tasks is accessed from the File menu...
    And a further hint. Indesign does not have a black and white or grayscale working colorspace, so you never truly have a black and white layout, though all of the objects in the file may use only black ink. You can, however, output a PDF, in a couple of ways, that will convert your color file to one that uses only black.

Maybe you are looking for

  • Plant not appearing in dropdown in PO

    Dear Experts , Wen i create a PO for a company code -purchase organisation  , at item level  I am not getting any plant in the dropdown . I have checked the following: ox10 check if plant is created     ox08 check if P org is created ox18 check if pl

  • How to verify stored procedures in Oracle 10g.

    I would like to locate default stored procedure in Oracle 10g database. And Suggest which stored procedure can be converted in to JAVA code ??

  • Dreamweaver CS4- I can't get my site to display the proper image.

    I have a Dreamweaver CS4 Template with an editable area for a header image. I have already assigned a new image to all the header regions but when I moved the site to the web host the pages will only display the Default header image from the template

  • VI01 - Freight cost

    Good Morning SD Champions In shipment cost / freight cost (VI01) system is distributing the frieght cost to each line item in delivery cost. What logic system is using for distributing the cost also where its configured. Kindly revert. Thanks in adva

  • In Nano, can I rewind a song a few steps to hear again and how do I Ado it ?

    In Nano, can I rewind a song a few steps to hear again and how do I do it ?