Asking about a text file

how can i read a list containing some records e.g.fahrenheit temperatures. from a text file already been saved and then using it to make some conversions and calculations like converting to centigrade .after that i must save the outputs to another text file ??
i know that is alot but can anybody help me with it ........

after the above you just need to search the string for 'end of line' and maybe a paramname/value seperator, sperate the values, make sure you dont forget to kill whitespaces, and put the values into a vector or array.
i prefer to read the file line by line with the DataInputStream.readline() command and extract the value line by line.
look at this, maybe you can use it with little modification:
     public PropertiesObject(String name, String path)
          this.name = name;
          this.path = path;
          // sign for linebreak - depends on platforms
          newline = System.getProperty("line.separator");
          // reference to the properties file
          PropertiesFile = new File(path+name+".properties");
          // vector to put the param/value pair-array in
          PropertiesSet = new Vector();
          System.out.println("Properties File wird angelegt: "+PropertiesFile);
          try
               //opening stream to file for read operations
               FileInputStream PropertiesFileInput = new FileInputStream(PropertiesFile);
               DataInputStream PropertiesDataInput = new DataInputStream(PropertiesFileInput);
               while (true)
                    //reading line after line of the properties file
                    String line = PropertiesDataInput.readLine();
                    if (line == null)
                         return;
                    //just making sure there are no whitespaces at the beginng or end of the line
                    line = cutSpaces(line);
                    if (line.length() > 0)
                         //$ indicates a param-name
                         if (line.startsWith("$"))
                              // array to store a param/value pair in
                              propvaluepair = new String[1][2];
                              //get the param-name
                              String parameter = line.substring(1, line.indexOf(separator)-1);
                              //just making sure there are no whitespaces at the beginng or end of the variable
                              parameter = cutSpaces(parameter);
                              //get the value
                              String value = line.substring(line.indexOf(separator)+1, line.length());
                              //just making sure there are no whitespaces at the beginng or end of the variable
                              value = cutSpaces(value);
                              //put the param-name and the value into an array
                              propvaluepair[0][0] = parameter;
                              propvaluepair[0][1] = value;
                              //and finaly put the array into the vector
                              PropertiesSet.addElement(propvaluepair);
          // error handlig
          catch (IOException e)
               System.out.println("ERROR occured while reading property file for: "+name);
               System.out.println("ERROR CODE: "+e);
               System.out.println("this is a serious error - the server must be stopped");
     }

Similar Messages

  • Where can i ask about Lifecam video file that won't work?

    i used lifecam studio in order to capture once in a lifetime event. when i wanted to stop, the softwer didn't responded and i was left with 2:30 hours wmv file (1.78gb) that plays for like 1 minute and then stucks! what can i do ?! it's an emergency!

    I'd ask them over here.
    Windows
    Video forums on Microsoft Answers
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Help about editing text file by QT

    Hi again
    I have faced another problem today >> which is so bad
    see this screenshot to understand the problem : http://qkpic.com/c28fb
    Has anybody an idea about how to solve that ?
    This is a quick review about how to do it : http://www.youtube.com/watch?v=6PS2FOjRCgk
    But it dznt work with me at all !
    i tried it in both ".txt" & "png" files >> it dznt work
    Please if anybody has a solution for this problem ,, i would be grateful a lot
    Thanks in advance
    sc0rpio

    Jon Walker wrote:
    My guess would be, if you tried using a PNG image and this work flow failed, that you neglected to export the PNG file with an alpha channel. You must either create the image file on a transparent background or designate what area of the image is to be made transparent before exporting with the alpha channel.pecifics for doing this depend on the graphic application you use. If using an application like Photoshop, create the image as you normally would and then go to the help menu and follow instructions for exporting a transparent image. Either an PNG or GIF will work.
    @Jon Walker
    Thanks for the reply
    You are right if i am using a picture ,, but let me remind you that i am using a subtitle file ".txt"
    which i opened by Quicktime to merge it with the movie file to get a translated movie.
    Anyway ,, i have converted the subtitle file to a ".mov" file so that i can now open it by photoshop
    it's opened as layers ( about 50 layer ) and i am trying now to edit the first layer and apply then to
    all ,, i hope that it works.
    See this screenshot : http://qkpic.com/32ee6
    i believe that it can be solved directly just by using QT >> i feel there is a simply way

  • Asking about run a file

    Right now I develop a Java GUI program that will execute or run a file (meaby like Gel or JCreator IDE). This file is an Oracle Data Mining sample program which is implement Java, this file has two property
    files as input of this file. Actually this Oracle Data Mining sample program can compiled and executed
    through Windows command prompt, to compile and execute this file I also use two batch files. So an
    Oracle Data Mining sample program, two property files, and two batch files, I place those components
    in a specified folder. I also set my Java_Home and Oracle_Home first because in file executing pro
    cess I will connect to Oracle database, to do these settings also from Windows command prompt.
    And for a specified folder I place it under "Oracle_Home/dm/sample".
    If anyone can help me to run or execute an Oracle Data Mining sample program file from my Java GUI program meaby like running a Java program file with Gel, JCreator or other IDE. I am so happy and
    say thank you so much for giving help to me. And for the solution, I want it sent to my e-mail address:
    [email protected]

    It is generally not a good idea to put your e-mail address in forums; but, that is another topic.
    If the data mining program you want to run can be run from the command line then it must have the following method:public static void main(String[] args) You can run this method from your application and pass it the command line arguments - here is one way:
    try {
        String someClassName = "TheDataMiningProgramsFullClassName";
        Class c = Class.forName(someClassName);
        Method mainMethod = c.getMethod("main", new Class[] {String[].class});
        String[] args = . . .
        mainMethod.invoke(null, new Object[] {args});
    } catch (Exception e) { // Easy way out of a problem
        e.printStackTrace();
    }You could also start this in its own Thread if you do not want your program to wait.

  • WTK 2.5.2 Emulator always asks about file access

    Is there a way to suppress the question that the emulator asks about accessing a file using a Fileconnection? It asks it on EVERY SINGLE ACCESS and seriously interferes with debugging. (On the real device, I can give permission once and be done with it).
    Michael D. Spence
    Mockingbird Data Systems, Inc.

    In (for Windows) C:\Documents and Settings\spence\j2mewtk\2.5.2\appdb:
    - Make a copy of _policy.txt so you can undo this later if you want.
    - Find the domain you midlet runs in (e.g., domain: identified_third_party).
    - Change these two lines:
    blanket(oneshot): read_user_data_access
    blanket(oneshot): write_user_data_access
    to read
    allow: read_user_data_access
    allow: write_user_data_access

  • [ASK] About references in PLL

    i want to ask about references in file modul extension .pll <opened using oracle form builder>
    went i trace an error in flow program , i found the flow took me in proc / func and it listed in "references"
    but when i searching in the proc / func in the modul, i didn't find it !!
    example listed in references :
    apps.XXX_XX_test_pkg(package spec)
    and my question how to find that proc / func that not exist in current modul ??
    sorry my bad english :)

    example listed in references :
    apps.XXX_XX_test_pkg(package spec)
    and my question how to find that proc / func that not exist in current modul ??Please run this query to determine under which schema this package exists.
    SQL> select owner, object_name, object_type, status
    from dba_objects
    where object_name like 'XXX_XX_TEST_PKG';Also, please see (SCRIPT: REGENERATING PACKAGE and PROCEDURE CODE from DBA_SOURCE [ID 1012473.7]).
    Thanks,
    Hussein

  • Creating large text files

    What is the fastest as well as less memory intensive way to create large files.
    Current State
    I have an application where I am reading the database and processing the information (formatting it) and using some third party API to add the information and then finally save as text file. The problem is since its third party API and we do not have any control on that and it takes very long time to generate the files
    Future state
    I want to build the file generator which will read from the database and then process/format the information one by one. Now I have following options.
    1) Add the processed information in a StringBuffer line by line and at the end of it create a file from the StringBuffer and save it.
    2) Create a custom object with different ArrayLists and keep on adding the processed lines into appropriate lists and at the end of it while saving it to a file read the custom object and save it as a file.
    3) Create a file at the start of it and then keep on adding and flushing the lines one by one and at the end of it close the file.
    For handling files I was thinking of using PrintWriter. I am talking about the text files anyware from 50 KB to 20 MB.
    I have performance concerns as well as memory issues. So I want a balanced solution so that I am able to handle both.

    Use a BufferedWriter to write each line/entry/record as you process it.
    Don't do any special flushing() (unless you need special transactional properties in which case you need a lot more than simple flush() calls).

  • Is it possible to export all information (metadata, list of pictures within each album or project) about ALL pictures in Aperture to text files, in a single operation?

    I have downloaded a trial version of Aperture because I would like to switch from using Picasa and gimp to using Aperture.  I already know that I want to use Aperture, and that I cannot learn how in 30 days.  I want to use the 30 days to see if I can solve a different problem: bulk export of all information except edits and versions from Aperture.
    I want to avoid locking information (other than than the edits and version information that Aperture maintains) about my photos into any one piece of software.
    Picasa stores a copy of almost all its information in text filies (mostly XML or .ini format) that are scattered through its picture library.  These files can be scanned and found by use of Mac OS X tools that are availabe in Terminal (at the bash command line).  All of the information about albums, faces, etc can be exported by a single command (after wtiting the progams that the command will initiate.  I have not yest found any similar files in Aperture.
    Aperture supports the export of EXIF and IPTC metadata, but only for selected photos, and does not appear to support the export of other information at all.
    What I would like to do with a single operation, from either Aperture or Terminal, is to export the entire arrangement of phost ins albums and projects, lists of albums, projects and phots with all metadata (including added keywords) attached to each, and for referenced photos, the external file name.  I do not care if would be in one file or many different text files, because Mac OS X provides all the tools I would need to extract the information I would want from any number of text files.
    This would allow me to reconstruct all of the information about my photos (except for edits and versions) outside Aperture, and to use that info in a database outside Aperture.  I would then be able to use Aperture while still being able to do everything that I could do with Picasa.
    The most helpful form of an answer to this question might be a list of places to look in the Apple support and Apple developer documentation.  It is difficult to teach me anything complicated, but I am fairly good at figuring out things from documentation.

    The following script recursively lists the content of an Aperture library.  The output is simple, for demonstration puposes, but could be modified to XML.  If the XML were that of a PLIST, the Apple Property List viewer oculd be used to diaplsy the output.
    A simlar script produces all of the keywords and tags for all of the images in Aperture.
    The scripts run much faster in the shell than in the AppleScript Editor bcause the shwll produces no debugging or monitoring information.
    #!/usr/bin/env osascript
    (*    Demo: list the containment hierarchy in Aperture, starting from libraries.
        Runs from AppleScript Editor, or as a shell command
        References:
            Aperture 3 AppleScript Reference Manual,
                particularly the Containment Diagram in Appendix A
                from the link on "Aperture Resources" web page at http://images.apple.com/aperture/resources/
            Aperture AppleScript Dictionary, accessed from AppleScript Editor
        Ian E. Gorman
    global outputFile
    set outputFilePath to "/Users/ian/prj/sw/AppleScript/ApertureContainment.txt"
    global lineEnd
    set lineEnd to "
    global tabChar
    set tabChar to "    "
    on writeText(str)
        write str to outputFile
    end writeText
    # Open the file, guarantee closure after any error, and list the contents of Aperture libraries
    try
        set outputFile to open for access POSIX file outputFilePath with write permission
        set eof outputFile to 0 # truncate the file, if it already exists
        my listAll()
        close access outputFile
    on error errorMsg number errNum from offendingObj partial result resutList to expectedType
        try
            display alert "Operation failed, attempting to close output file" & lineEnd & "Error number " & errNum & ": " & errorMsg
            close access outputFile
            display alert "Operation failed, but output file has been closed"
        on error
            display alert "Operation failed, also failed to close output file"
        end try
    end try
    # top-level in Aperture
    on listAll()
        tell application "Aperture"
            repeat with eachLibrary in libraries
                my listLibrary(0, eachLibrary)
            end repeat
        end tell
    end listAll
    on listLibrary(level, thisLibrary)
        local newLevel
        set newLevel to 1 + (level as integer)
        tell application "Aperture"
            my writeText((newLevel as rich text) & tabChar & "library" & tabChar & (name of thisLibrary) & lineEnd)
            repeat with eachAlbum in albums of thisLibrary
                my listAlbum(newLevel, eachAlbum)
            end repeat
            repeat with eachFolder in folders of thisLibrary
                my listFolder(newLevel, eachFolder)
            end repeat
            repeat with eachProject in projects of thisLibrary
                my listProject(newLevel, eachProject)
            end repeat
            repeat with eachImageVersion in image versions of thisLibrary
                my listImageVersion(newLevel, eachImageVersion)
            end repeat
        end tell
    end listLibrary
    on listAlbum(level, thisAlbum)
        local newLevel
        set newLevel to 1 + (level as integer)
        tell application "Aperture"
            my writeText((newLevel as rich text) & tabChar & "album" & tabChar & (name of thisAlbum) & lineEnd)
            repeat with eachImageVersion in image versions of thisAlbum
                my listImageVersion(newLevel, eachImageVersion)
            end repeat
        end tell
    end listAlbum
    on listFolder(level, thisFolder)
        local newLevel
        set newLevel to 1 + (level as integer)
        tell application "Aperture"
            my writeText((newLevel as rich text) & tabChar & "folder" & tabChar & (name of thisFolder) & lineEnd)
            repeat with eachAlbum in albums of thisFolder
                my listAlbum(newLevel, eachAlbum)
            end repeat
            repeat with eachFolder in folders of thisFolder
                my listFolder(newLevel, eachFolder)
            end repeat
            repeat with eachProject in projects of thisFolder
                my listProject(newLevel, eachProject)
            end repeat
            repeat with eachImageVersion in image versions of thisFolder
                my listImageVersion(newLevel, eachImageVersion)
            end repeat
        end tell
    end listFolder
    on listProject(level, thisProject)
        local newLevel
        set newLevel to 1 + (level as integer)
        tell application "Aperture"
            my writeText((newLevel as rich text) & tabChar & "project" & tabChar & (name of thisProject) & lineEnd)
            repeat with eachAlbum in albums of thisProject
                my listAlbum(newLevel, eachAlbum)
            end repeat
            repeat with eachSubfolder in subfolders of thisProject
                my listSubfolder(newLevel, eachSubfolder)
            end repeat
            repeat with eachImageVersion in image versions of thisProject
                my listImageVersion(newLevel, eachImageVersion)
            end repeat
        end tell
    end listProject
    on listSubfolder(level, thisSubfolder)
        local newLevel
        set newLevel to 1 + (level as integer)
        tell application "Aperture"
            my writeText((newLevel as rich text) & tabChar & "subfolder" & tabChar & (name of thisSubfolder) & lineEnd)
            repeat with eachAlbum in albums of thisSubfolder
                my listAlbum(newLevel, eachAlbum)
            end repeat
            repeat with eachSubfolder in subfolders of thisSubfolder
                my listSubfolder(newLevel, eachSubfolder)
            end repeat
            repeat with eachImageVersion in image versions of thisSubfolder
                my listImageVersion(newLevel, eachImageVersion)
            end repeat
        end tell
    end listSubfolder
    on listImageVersion(level, thisImageVersion)
        local newLevel
        set newLevel to 1 + (level as integer)
        tell application "Aperture"
            my writeText((newLevel as rich text) & tabChar & "image version" & tabChar & (name of thisImageVersion) & lineEnd)
        end tell
    end listImageVersion

  • I want to ask about deleting files that have been deleted in the trash but I want to remove it permanently from the trash can not

    I want to ask about deleting files that have been deleted in the trash but I want to remove it permanently from the trash can not, indeed I delete files that are partly contained in the application file. I want to delete files that are also quite a lot by 5 Gyga, I've tried to remove it from the normal trash remains are not removed. How should I do?

    +

  • Question about writing a text file

    As we know, we can write a text file using class "FileWriter". I did a test (Please see the code below).
    I found that if I used Notepad to open it, it would show "ab", But if I used "MS Word" or "UltraEdit" to open it, it would show " 'a' , new line and 'b' ".
    Why Notepad can not display the right format? What's wrong with my code?
    //code begin*************************************************
    import java.io.*;
    public class writeTest {
    public writeTest() {
         try{
              File f = new File( "C:\\writeTest.txt" );
              FileWriter fout = new FileWriter( f );
              fout.write( "a" );
              fout.write( "\n" );
              fout.write( "b" );
              fout.close();
         catch( IOException e ){
              e.printStackTrace();
    public static void main(String[] args) {
    writeTest writeTest1 = new writeTest();
    //code end***************************************************

    You may use system-dependent line separator:
    static final String ls=System.getProperty("line.separator");
    fout.write( "a" );
    fout.write( ls );
    fout.write( "b" );

  • Batch list import is picky about line terminations in the text file

    After running into trouble trying to compose a batch list for import, I isolated the issue:
    The text file that you attempt to import must have "carriage return" characters at the end of each line. It can have a "carriage return" and a "line feed", but it cannot have only a "line feed".
    If you feed Final Cut a text file that does not meet this criteria, it will barf up this error message:
    One or more items on the header line do not match valid Browser column headers.
    Line terminators have been the cause of many a problem over the years! Typically, MSDOS/Windows systems tend to create text files that use a CR-LF combo. While Mac OS was typically just a CR. And UNIX systems have typically been just an LF. However, since Mac OS X is now a hybrid of older Mac ways, and UNIX ways, you can find mixed situations there. For example, the Mac OS X Text Edit program saves out files with just an LF, and thus can't be directly used to create batch lists for Final Cut.
    So, you need to be careful what means you use to create batch list text files.
    Hope this helps some poor soul some day!
    -Rick

    I am trying to export a batch list created in FCP 5.1 to someone with 6. I follow directions, export and save and then e-mail the file. When he tries to import it, he gets that message ("One or more items on the header line do not match valid Browser column headers"). But I have tried re-importing it from my desktop and have no problem. Is there a problem going with such simple data from 5.1 to 6? Is it possible that the e-mail transmission is corrupting the files?
    Thanks for suggestions.

  • Basic question about text files from a PC

    I am being sent a book project on a CD from a PC; the text is in Microsoft Word and there are no images. Is there a way to work on this document. I only have Appleworks on my iBook. Can the person who is sending me this CD save it in another format that will work with my iBook. Thanks in advance for any guidance.
    iBook G4 Mac OS X (10.3.9)

    Hi MelissaSF,
    Welcome to Apple Discussions
    Do you have AppleWorks on your iBook? Search for "AppleWorks". Do you have iWork (demo) or any other word processor? They can save it as .txt (text file) so you can access it with Text Edit.
    Jon
    PS You might want to look at Apple - Switch - Moving your files to a Mac
    Mac Mini 1.42Ghz, iPod (All), Airport (Graphite & Express), G4 1.33Ghz iBook, G4 iMac 1Ghz, G3 500Mhz, iBook iMac 233Mhz, eMate, Power Mac 5400 LC, PowerBook 540c, Macintosh 128K, Apple //e, Apple //, and some more...  Mac OS X (10.4.5) Moto Razr, iLife '06, SmartDisk 160Gb, Apple BT Mouse, Sight..

  • How to input data into an arraylist from a text file?

    I am trying to take data from a text file and put that data into an arraylist. First here is the text file:
    [item1, 10, 125.0, item2, 10, 12.0, item3, 20, 158.0]
    3
    4530.0
    [item5, 65, 555.5, item4, 29, 689.0]
    2
    56088.5
    [item7, 84, 34.5, item6, 103, 0.5, item8, 85, 1.36]
    3
    3065.1The text between the [ ] is the output from my arraylists. I have three arraylists. The first [ ] belongs to arraylist A, the second to arraylist B, and the third to arraylist C. The format of the arraylists is this:
    <item name>,<# in stock>,<value of one item>
    The first number below the arraylists in the text file represents the number of items in the list. The second number below the arraylists represents the total value of the items in the arraylists.
    Here is the class file I have (yes, it does everything):
    import java.io.*;
    import java.util.Scanner;
    import java.util.ArrayList;
    public class Inventory extends Object
         public int toAdd = 0;
         private boolean done = false;               //Are we done yet?
         public String strItemName;                    //The name of the item type.
         public int intNumInStock;                    //The number in stock of that type.      
         public double dblValueOfOneItem;          //The value of one item.
        public String strNumberInStock;               
        public double dblTotalValueA;               //The total value of warehouse A.
        public double dblTotalValueB;               //The total value of warehouse B.
        public double dblTotalValueC;               //The total value of warehouse C.
        public int intWarehouseAItemCount;          //Counter for items in warehouse A.
        public int intWarehouseBItemCount;          //Counter for items in warehouse B.
        public int intWarehouseCItemCount;          //Counter for items in warehouse C.
         ArrayList warehouseAList = new ArrayList();     //Create the Warehouse A ArrayList.                                   
         ArrayList warehouseBList = new ArrayList(); //Create the Warehouse B arrayList.
         ArrayList warehouseCList = new ArrayList(); //Create the Warehouse C arrayList.
         /** Construct a new Inventory object. */
         public Inventory()
              super();
         /**Add items to the Warehouse A ArrayList.*/
         private void createWareHouseA()
              System.out.println("!" + toAdd + " item types will be added to warehouse A.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseAList :  " +
                                                                warehouseAList.size());
              //Add items to the array List
              warehouseAList.add(this.strItemName);
              warehouseAList.add(this.strNumberInStock);
              warehouseAList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseAList.size());
         /**Add items to the Warehouse B ArrayList.*/
         private void createWareHouseB()
              System.out.println("!" + toAdd + " item types will be added to warehouse B.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseBList :  " +
                                                                warehouseBList.size());
              //Add items to the array List
              warehouseBList.add(this.strItemName);
              warehouseBList.add(this.strNumberInStock);
              warehouseBList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseBList.size());
         /**Add items to the Warehouse C ArrayList.*/
         private void createWareHouseC()
              System.out.println("!" + toAdd + " item types will be added to warehouse C.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseCList :  " +
                                                                warehouseCList.size());
              //Add items to the array List
              warehouseCList.add(this.strItemName);
              warehouseCList.add(this.strNumberInStock);
              warehouseCList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseCList.size());
         /**Interpret the commands entered by the user.*/
         public void cmdInterpreter()
              this.displayHelp();
              Scanner cin = new Scanner(System.in);
              while (!this.done)
                   System.out.print(">");
                   //"line" equals the next line of input.
                   String line = cin.nextLine();
                   this.executeCmd(line);
         /**Execute one line entered by the user.
          * @param cmdLN; The command entered by the user to execute. */
          private void executeCmd(String cmdLN)
               Scanner line = new Scanner(cmdLN);
               if (line.hasNext())
                    String cmd = line.next();
                    //What to do when users enter the various commands below.
                    if (cmd.equals("help"))
                         this.displayHelp();
                    else if (cmd.equals("Q!"))
                         this.done = true;
                    else if (cmd.equals("F") && line.hasNext())
                         this.inputFromFile(line.next());
                    else if (cmd.equals("K") && line.hasNext())
                         int numItemsToAdd = Integer.valueOf( line.next() ).intValue();
                         this.toAdd = numItemsToAdd;
                         this.inputFromKeyboard(numItemsToAdd);
          /**What to do if input comes from a file.
           *     @param inputFile; The name of the input file to process.*/
          private void inputFromFile(String inputFile)
               Scanner cin = new Scanner(System.in);
               System.out.println("!Using input file " + inputFile + ".");
               System.out.print("!Enter the name of the output file: ");
               String outputFile = cin.next();
               System.out.println("!Using output file " + outputFile + ".");
              try
                   BufferedReader in = new BufferedReader(new FileReader(inputFile));
                   //Scanner in = new Scanner(new File(inputFile));
                   //Initialize the String variables.
                   String line1 = null;
                   String line2 = null;
                   String line3 = null;
                   String line4 = null;
                   String line5 = null;
                   String line6 = null;
                   String line7 = null;
                   String line8 = null;
                   String line9 = null;
                   System.out.println(in.equals(",") + " see?");
                   //System.out.println((char)(char)in.read() + " experiment");
                   /**This loop assigns values to the string variables based on the
                    * values on each line in the input file. */
                   while(in.readLine() != null)
                        line1 = in.readLine();
                        line2 = in.readLine();
                        line3 = in.readLine();
                        line4 = in.readLine();
                        line5 = in.readLine();
                        line6 = in.readLine();
                        line7 = in.readLine();
                        line8 = in.readLine();
                        line9 = in.readLine();
                   //Print the contents of each line in the input file.
                   System.out.println("!value of line 1: " + line1);
                   System.out.println("!value of line 2: " + line2);
                   System.out.println("!value of line 3: " + line3);
                   System.out.println("!value of line 4: " + line4);
                   System.out.println("!value of line 5: " + line5);
                   System.out.println("!value of line 6: " + line6);
                   System.out.println("!value of line 7: " + line7);
                   System.out.println("!value of line 8: " + line8);
                   System.out.println("!value of line 9: " + line9);
                /**Add items to the warehouses.*/
                   warehouseAList.add(line1);
                   warehouseBList.add(line4);
                   warehouseCList.add(line7);
                /**Add the item count and total value for warehouse A.*/
                   int intLine2 = Integer.valueOf(line2).intValue();
                   this.intWarehouseAItemCount = intLine2;
                   double dblLine3 = Double.valueOf(line3).doubleValue();
                   this.dblTotalValueA = dblLine3;
                /**Add the item count and total value for warehouse B.*/
                   int intLine5 = Integer.valueOf(line5).intValue();
                   this.intWarehouseBItemCount = intLine5;
                   double dblLine6 = Double.valueOf(line6).doubleValue();
                   this.dblTotalValueB = dblLine6;
                /**Add the item count and total value for warehouse C.*/
                  int intLine8 = Integer.valueOf(line8).intValue();
                  this.intWarehouseCItemCount = intLine8;
                  double dblLine9 = Double.valueOf(line9).doubleValue();
                  this.dblTotalValueC = dblLine9;
                /**Ask the user how many items to add or delete from inventory.*/
                  System.out.print("Enter the number to add to inventory for " +
                                                               warehouseAList.get(0) + ":");
                  String toAddOrDel = cin.next();
                /**Print the contents of all the warehouses. */
                   System.out.println(" ");
                   //Print the contents of warehouse A.
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse A:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse A.
                   System.out.println(warehouseAList);
                   //Print the total amount of items in warehouse A.
                   System.out.println("Total items: " + this.intWarehouseAItemCount);
                   //Print the total value of the items in warehouse A.
                   System.out.println("Total value: " + this.dblTotalValueA);
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse B:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse B.
                   System.out.println("!warehouseB: " + warehouseBList);
                   //Print the total amount of items in warehouse B.
                   System.out.println("Total items: " + this.intWarehouseBItemCount);
                   //Print the total value of the items in warehouse B.
                   System.out.println("Total value: " + this.dblTotalValueB);
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse C:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse C.
                   System.out.println("!warehouseC: " + warehouseCList);
                   //Print the total amount of items in warehouse C.
                   System.out.println("Total items: " + this.intWarehouseCItemCount);
                   //Print the total value of the items in warehouse C.
                   System.out.println("Total value: " + this.dblTotalValueC);
                   in.close();
              catch (FileNotFoundException e)
                   System.out.println("!Error: Unable to open file for reading.");
              catch (EOFException e)
                   System.out.println("!Error: EOF encountered, file may be corrupted.");
              catch (IOException e)
                   System.out.println("!Error: Cannot read from file.");
          /**What to do if input comes from the keyboard.
           *     @param numItems; The total number of items that will be added to the
           *                      Warehouse(s). */
          public void inputFromKeyboard(int numItems)
               System.out.println("!You will be adding " + numItems + " items to " +
                                             "inventory from the keyboard. ");
               this.toAdd = numItems;
               Scanner cin = new Scanner(System.in);
               //Prompt user for name of output file.
               System.out.print("!Enter the name of the output file: ");
               String outputFile = cin.next();
               /**This loop asks the user for information about the item(s) and inputs
                 *them into the appropriate array.*/
               int count = 0;
               while (numItems > count)
                    //Item name.
                    System.out.print("!Item name: ");
                    String addItemName = cin.next();
                    //Number in stock.
                    System.out.print("!Number in stock: ");
                    String addNumInStock = cin.next();
                    //Initial warehouse.
                    System.out.print("!Initial warehouse(A,B,C): ");
                    String addInitWarehouse = cin.next();
                    //Value of one item.
                    System.out.print("!Value of one item: ");
                    String addValueOfOneItem = cin.next();
                    //Add or delete from inventory
                    System.out.print("!Enter amount to add or delete from inventory: ");
                    String strAddOrDelete = cin.next();
                    System.out.println("!Amount to add or delete: " + strAddOrDelete);
                    //Cast
                    int intAddNumInStock = Integer.valueOf(addNumInStock).intValue();
                    double doubleAddValueOfOneItem = Double.valueOf(addValueOfOneItem).doubleValue();
                    int intAddOrDelete = Integer.valueOf(strAddOrDelete).intValue();
                    /**Add intAddNumInStock with intAddOrDelete to determine the amount
                     * to add or delete from inventory (If a user wishes to remove items
                     * from inventory simply add negative values). */
                    intAddNumInStock = intAddNumInStock + intAddOrDelete;
                    System.out.println("!Inventory after modifications: " + strAddOrDelete);
                    this.strItemName = addItemName;
                    this.intNumInStock = intAddNumInStock;
                    this.dblValueOfOneItem = doubleAddValueOfOneItem;
                    //Put items into warehouse A if appropriate.
                    if (intAddNumInStock < 25)
                        //Increment the warehouse A item count.
                        this.intWarehouseAItemCount = this.intWarehouseAItemCount + 1;
                        //Calculate the total value of warehouse A.
                        this.dblTotalValueA = this.dblTotalValueA + intAddNumInStock * doubleAddValueOfOneItem;
                        //Create the warehouse A array list.
                        this.createWareHouseA();
                    //Put items into warehouse B if appropriate.
                    if (intAddNumInStock >= 25)
                        if (intAddNumInStock < 75)
                             //Increment the warehouse B item count.
                             this.intWarehouseBItemCount = this.intWarehouseBItemCount + 1;
                             //Calculate the total value of warehouse B.
                             this.dblTotalValueB = this.dblTotalValueB + intAddNumInStock * doubleAddValueOfOneItem;
                             //Create the warehouse B array list.
                             this.createWareHouseB();
                    //Put items into warehouse C if appropriate.
                    if (intAddNumInStock >= 75)
                        //Increment the warehouse C item count.
                        this.intWarehouseCItemCount = this.intWarehouseCItemCount + 1;
                        //Calculate the total value of warehouse C.
                        this.dblTotalValueC = this.dblTotalValueC + intAddNumInStock * doubleAddValueOfOneItem;
                        //Create the warehouse C array list.
                        this.createWareHouseC();
                     //display helpful information.      
                    System.out.println("!--------------------------------");
                    System.out.println("!" + addItemName + " is the item name.");
                    System.out.println("!" + addNumInStock + " is the number in stock.");
                    System.out.println("!" + addInitWarehouse + " is the initial warehouse.");
                    System.out.println("!" + addValueOfOneItem + " is the value of one item.");
                    System.out.println("!--------------------------------------------------");
                   //Increment the counters.
                    count++;
               /**Create and write to the output file. */
               try
                     //Use the output file specified by the user.
                    PrintWriter out = new PrintWriter(outputFile);
                 /**Write warehouse A details.*/
                      //Blank the first line.
                      out.println(" ");
                    //Write the array list for warehouse A.
                    out.println(warehouseAList);
                    //Write the amount of items in warehouse A.
                    out.println(intWarehouseAItemCount);
                    //Write the total value for warehouse A.
                    out.println(dblTotalValueA);
                 /**Write warehosue B details.*/
                   //Write the array list for warehouse B.
                    out.println(warehouseBList);
                    //Write the amount of items in warehouse B.
                    out.println(intWarehouseBItemCount);
                    //Write the total value for warehouse B.
                    out.println(dblTotalValueB);
                 /**Write warehouse C details.*/
                      //Write the array list for warehouse C.
                    out.println(warehouseCList);
                    //Write the amount of items in warehouse C.
                    out.println(intWarehouseCItemCount);
                    //Write the total value for warehouse C.
                    out.println(dblTotalValueC);
                    //Close the output file.
                    out.close();     
                catch (FileNotFoundException e)
                   System.out.println("Error: Unable to open file for reading.");
               catch (IOException e)
                   System.out.println("Error: Cannot read from file.");
               /**View the contents and the value of each warehouse.*/
               System.out.println("!---------------Inventory Summary------------------");
               System.out.println("!--------------------------------------------------");
               System.out.println("!--------------------LEGEND:-----------------------");
               System.out.println("!<item type>, <amount in stock>,<value of one item>");
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse A:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse A.
               System.out.println(warehouseAList);
               //Total items in warehouse A.
               System.out.println("Total items: " + intWarehouseAItemCount);
               //Display total value of warehouse A.
               System.out.println("Total value: " + "$" + dblTotalValueA);
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse B:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse B.
               System.out.println(warehouseBList);
               //Total items in warehouse B.
               System.out.println("Total items: " + intWarehouseBItemCount);
               //Display total value of warehouse B.
               System.out.println("Total value: " + "$" + dblTotalValueB);
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse C:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse C.
               System.out.println(warehouseCList);
               //Total items in warehouse C.
               System.out.println("Total items: " + intWarehouseCItemCount);
               //Display total value of warehouse C.
               System.out.println("Total value: " + "$" + dblTotalValueC);
         /**Display a help message.*/
         private void displayHelp()
              System.out.println("!--------------------------------");
              System.out.println("! General Help:");
              System.out.println("!--------------------------------");
              System.out.println("! ");
              System.out.println("!'help' display this help message.");
              System.out.println("!'Q!' quit this program.");
              System.out.println("!--------------------------------");
              System.out.println("! Input File Specific Commands:");
              System.out.println("!--------------------------------");
              System.out.println("! ");
              System.out.println("!'F' <name> type F followed by the name of the " +
                                       "file to be used for input.");
              System.out.println("!---------------------------------------");
              System.out.println("! Input From Keyboard Specific Commands:");
              System.out.println("!---------------------------------------");
              System.out.println("! ");
              System.out.println("!'K' <number> type K followed by the number of " +
                                        "items that will be added. ");
              System.out.println("! ");
    }Program file:
    public class InventoryProg
         public static void main(String[] args)
              //Create a new Inventory object.
              Inventory test = new Inventory();
              //Execute the command interpreter.
              test.cmdInterpreter();
    }Right now I am stuck on this and I cannot progress any further until I figure out how to input the data in the text file back into a arraylist.
    Thanks in advance.

    Thanks but I figured it out. Heres a sample of the code i used to solve my problem:
    try
                           //Warehouse A BufferedReader.
                   BufferedReader inA = new BufferedReader(new FileReader(inputFileWarehouseA));
                   //Warehouse B BufferedReader.
                   BufferedReader inB = new BufferedReader(new FileReader(inputFileWarehouseB));
                   //Warehouse C BufferedReader.
                   BufferedReader inC = new BufferedReader(new FileReader(inputFileWarehouseC));
                   //Warehouse details BufferedReader.
                   BufferedReader inDetails = new BufferedReader(new FileReader(inputFileDetails));
                   //Will hold values in warehouse arraylists.
                   String lineA = null;
                   String lineB = null;
                   String lineC = null;
                   //Will hold the details of each warehouse.
                   String line1 = null;
                   String line2 = null;
                   String line3 = null;
                   String line4 = null;
                   String line5 = null;
                   String line6 = null;
                   //Get the item count and total value for each warehouse.
                   while(inDetails.readLine() != null)
                        line1 = inDetails.readLine();
                        line2 = inDetails.readLine();
                        line3 = inDetails.readLine();
                        line4 = inDetails.readLine();
                        line5 = inDetails.readLine();
                        line6 = inDetails.readLine();
               /**Assign the item count and total value to warehouse A.*/
                  //Cast.
                   int intLine1 = Integer.valueOf(line1).intValue();
                   double dblLine2 = Double.valueOf(line2).doubleValue();
                   //Assign the values.
                   this.intWarehouseAItemCount = intLine1;
                   this.dblTotalValueA = dblLine2;
                /**Assign the item count and total value to warehouse B.*/
                     //Cast.
                   int intLine3 = Integer.valueOf(line3).intValue();
                   double dblLine4 = Double.valueOf(line4).doubleValue();
                     //Assign the values.
                   this.intWarehouseBItemCount = intLine3;
                   this.dblTotalValueB = dblLine4;
                /**Assign the item count and total value to warehouse C.*/
                     //Cast.
                     int intLine5 = Integer.valueOf(line5).intValue();
                   double dblLine6 = Double.valueOf(line6).doubleValue();
                   //Assign the values.
                   this.intWarehouseCItemCount = intLine5;
                   this.dblTotalValueC = dblLine6;
                /**Put the items back into the warehouses arraylists. */
                   //Add items to warehouse A.
                   while((lineA = inA.readLine()) != null)
                        warehouseAList.add(lineA);
                   //Add items to warehouse B.
                   while((lineB = inB.readLine()) != null)
                        warehouseBList.add(lineB);
                   //Add items to warehouse C.
                   while((lineC = inC.readLine()) != null)
                        warehouseCList.add(lineC);
                   }(this isn't the whole try statement its pretty long)

  • Print text file with labview 2011 and windows 7

    I am having some strange problem, hope someone out there knows the solution.
    We have a labview program running under windows xp, the program runs some test and print label from a local label printer. Last week, I have to upgrade the computer to windows 7 and all the sudden the printer will not print any more.
    The print vi is very simple. I am using the report function and I am attaching the diagram of that vi below. 
    If I use windows notepad to open that small text file, I can print fine. This means the printer driver itself is OK. However, if I print the same text file through Labview printing vi, from the printer's task list, I can see it does not recognize the char. From the attached png file, the top one is the task from notepad, it shows 2 pages and the bottom one is from the labview, it becomes 33 pages. 
    For the printer part, I use Generic / Text Only printer driver which comes from windows itself. And I am aslo attaching a sample of the text file, there are quite a lot of special char, it is for print bar code. When I tried to use labview print text vi to print general text from my computer to a regular printer, the vi works. So it seems Labview print can not handle the special char? Although it worked many years under windows XP in the past.
    Welcome to any suggestions!
    Thanks
    Attachments:
    print vi.gif ‏9 KB
    labview print bug.png ‏26 KB
    SerialLabel.txt ‏1 KB

    DGU wrote:
    where to check RAW or TEXT? the print report vi only asks for file name and printer name.
    When I print from notepad, everything just goes by default. This is a label printer, so I never need to specify printing parameter such as size, orientation, etc in the past
    Famous last words go something like this: "...never had to do that before."  Maybe you have to do that now.  It's worth at least comparing the defaults settings for bothe generic drivers.  It could save you a lot of headache if you notice something different.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Error importing text file into SQL Server when last column is null

    Hello all. Happy holidays!
    I'm trying to import a text file into a SQL Server table, and I get the error below when it gets to a row (row 264) that has null in the last column. I'm guessing the null jumbles up the delimiters somehow. The nulls are not errors, and I need to import
    them into the table with the rest of the rows. Any idea how I can do that?
    Thanks!
    [Flat File Source [1]] Error: Data conversion failed. The data conversion for column "XYZ" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
    [Flat File Source [1]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "output column "XYZ" (178)" failed because error code 0xC0209084 occurred, and the error row disposition on "output column "XYZ"
    (178)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
    [Flat File Source [1]] Error: An error occurred while processing file "ABC.txt" on data row 264.
    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Flat File Source" (1) returned error code 0xC0202092.  The component returned a failure code when the pipeline engine called PrimeOutput().
    The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.
    WeeLass

    Hi WeeLass,
    The error that” Data conversion failed. The data conversion for column "XYZ" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".” is generally error message, and the error indicates
    that there is data type mismatch issue between the input columns and the output columns.
    Based on your description, the issue is that you trying to convert a column contains empty value from string to integer data type for the output column "XYZ" in Flat File Source [1]. Please note that we cannot type an empty value as integer data
    type column value, so the error occurs.
    To fix this issue, just as you did, we should convert the data type for the output column "XYZ" in Flat File Source [1] back to DT_WSTR or DT_STR, then use a derived column task to replace the current column (UBPKE542). But the expression should
    be like below:
    LEN(TRIM(UBPKE542)) > 0 ? (DT_I8)UBPKE542 : NULL(DT_I8)
    In this way, the data type of the column in SQL table would be int, and the empty value would be replaced with NULL.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • LOV does not get invoked the second time

    Hi I'm using JSF-ADF-BC with JDeveloper 10.1.3.1 I've been following the Hands-on Practices from Oracle JDeveloper 10g for Forms and PL/SQL Developers. I have an edit page which invokes a LOV page. The first time I click on the flashlight (af:SelectI

  • J2me with javaservlet

    hello Sir i want to call a servlet program in a j2me program i have found a program related to my requirment on net. But there is a problem that when i run as it is program according to net i give url="http://www.mycgiserver.com/servlet/corej2me.Webs

  • Anchor Link inside a Scrollpane

    Is it possible to create anchor links in text within a scrollpane.  I created text with a list of questions at the top of the list and answers at the bottom of the list. I want to be able to click on a question and jump down the list to the answer wi

  • Image (jpeg, gif) display in AWT layout manager

    Goodmorning All, I am looking for some help, a hint on my AWT Layout challenge i have. Example GUI_1: ========================= Window border..................[_][x].. ========================= [label]....|display_area|....[button]. [label]....|displ

  • No pure white in colour picker

    After replaced and upgraded the old monitor.  I fail to see the pure white anymore in Photoshop.  Even though RGB are all set as 255, the whitest I can see is a light beige.  What do I need to do please? I could see the rulers and the sub-menu boxes