Ouput file problems

Hi,
The attached code is supposed to read in a file and only print out to a file those lines that have CA and ARG. However, it is also printing out other rubbish: Please help, thanks
import java.io.*;
public class ForCampBell {
/** Creates a new instance of ForCampBell */
public ForCampBell(String inputFile, String outputFile) {
File input = new File(inputFile);
File output = new File(outputFile);
if (input.exists()){
BufferedReader oInput;
PrintWriter oOutput;
try {
oInput = new BufferedReader (new FileReader(input));
oOutput = new PrintWriter( new FileWriter(output), true);
String strLine = "";
while ((strLine = oInput.readLine ()) != null){
if (strLine.indexOf("CA") != -1){ // the line contains CA
int argLocation = strLine.indexOf("ARG");
oOutput.println( strLine.substring(0, argLocation + 3));
oOutput.close();
oInput.close();
catch (IOException err) {
System.out.println("IO Error while reading input file...");
else{
System.out.println("Input file specified not found...");
public static void main(String[] args) {
if (args.length != 2){
System.out.println("usage: java ForCampBell inputFile outputFile");
else{
new ForCampBell(args[0], args[1]);
input file:
ATOM 138 CA ASP 8 109.508 74.207 140.047
ATOM 150 CA LYS 9 108.132 70.857 141.312
ATOM 172 CA ARG 10 110.758 70.962 144.119 // only this line for example
outputfile:
AT
ATOM 172 CA ARG 10 110.758 70.962 144.119
AT

You have told it to print out all lines with CA in them, up to and including where it finds ARG (though if it doesn't find an ARG it will print out the first couple characters, I think) - did you mean to do that? Or did you mean something like:
if (strLine.indexOf("CA") != -1){ // the line contains CA
    int argLocation = strLine.indexOf("ARG");
    if (argLocation != -1) {
        // line also contains an ARG - dump it
         oOutput.println( strLine.substring(0, argLocation + 3));

Similar Messages

  • DW CS5 Missing Related Files Problem

    Hello
    Hoping somebody may be able to help me with a missing related files problem in CS5. I've tried Adobe phone support but they couldn't solve the problem.
    *Some* of my sites (but not all) are not showing all the files related to that page. My pages are typically in .asp vb server model and contain .asp virtual includes (header, nav etc) plus .js and .css linked files
    However DW is only showing the .asp includes as related files and not css or js ones. In design view the CSS is displaying correctly, and all styles appear in the CSS inspector but not showing as a related file in the bar. In CS4 it works fine.
    I've tried deleting the site and recreating it, copying the files to a new folder and setting up a fresh site, creating a new folder and downloading all files from the remote server but no joy. I've also tried refreshing related files. if I click on the filter in the bar it only shows the asp includes and nothing else.
    Any help would be gratefully appreciated, this is a great feature when it works
    Cheers
    MB

    UPDATE:
    Managed to solve this problem, this is a new issue to DW CS5, previous versions do not seem to exhibit this problem
    It occurs when you use site root rather than document relative paths for js/css etc files AND don't have the remote site url (web url) specified in the site setup | local info dialog, or do not have it fully qualified with http://
    ie. ../js/file.js works fine without a remote web url but /js/file.js does not show the related file in the bar unless a remote url is defined.
    Hope that helps anyone else that encounters the same issue!
    MB

  • With conversion to Leopard, file problems with networked Windows computer

    Last night I did an Archive & Install from Tiger to Leopard on my Intel MacBook Pro. Today, I had trouble finding the other computers at my office. Once I finally got them to show up, I opened a Word file found on another computer, made some changes, and when I tried to save it, I got this message: "This is not a valid file name. Try one or more of the following: *Check the path to make sure it was typed correctly. *Select a file from the list of files and folders." Since this file already existed and I wasn't changing the name, I thought this was odd, but I changed the name from "Seating Chart 3-8-08" to "SeatingChart3-8-08" in case Leopard didn't like spaces when talking to Windows, but I got the same error message. Finally I gave up, not knowing what to do, then discovered that it had in fact saved my file. Still, every time I try to save ANY Word document from the shared folder of the Windows computer, I get the same error message endlessly until I choose "Don't Save."
    When I try to open an Excel file from that computer, it won't even open; it says " 'File Name.xls' cannot be accessed. This file may be Read-Only, or you may be trying to access a Read-Only location. Or, the server the document is stored on may not be responding." As with the Word file problem above, I did not have any problem accessing the files until I converted to Leopard.
    The Windows machine is Windows XP using Microsoft Office 2003; I have Microsoft Office 2004 on my machine.

    See if this Link, by Pondini, offers any insight to your issue...
    Transfer from Old  to New
    http://pondini.org/OSX/Setup.html
    Also, See here if you haven't already...
    http://www.apple.com/support/switch101/     Switching from PC

  • I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

    I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

    I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

  • Anyone know if the long standing duplicate files problem with File History has been fixed yet?

    There are loads of public threads about the duplicate files problem
    with Windows 8/8.1 File History backup system.
    From all the threads I've looked at, there seems to be no solution,
    and no acknowledgement from MS that they can even repro the problem
    (which surprises me considerably as there are so many people who
    notice the problem).
    Is anyone aware of whether MS (may) have fixed this for Win10?
    Are MS aware of the problem and if they're able to fix it?
    Dave - with many GB of duplicated files in File History :)

    Hmm, is that the attitude MS would recommend? :)
    Why would I care what Microsoft would recommend?
    Clearly you don't, and you appear to have missed my smiley. Calm down
    Noel, many of us are as annoyed by aspects of modern Windows as you
    are. :)
    I'm all about making Windows actually WORK/./
    Aren't we all? Windows is software I use too many hours every day, I
    along with many millions of others need it to work really well. You
    are not alone.
    When they implement something that doesn't work, and even if it did work doesn't do what's needed - and/beyond that/ they remove features people DO need (such as the GUI for Windows Backup), I see no wrong in advising people of the way things
    really are.
    File History essentially does work - it's saved me a couple of times
    in the past couple of weeks. It just has a highly annoying habit of
    creating 100% duplicates of some files for no apparent reason. If MS
    have fixed that I won't have any known complaints about it.
    If you don't like it, you don't have to use it. I generally like it, I
    just want to see that its fixed.
    Dave

  • Idoc to file problem.......... IDOC lost

    i have a idoc to file problem,
    the idoc is sent from R/3 to XI,
    the problem is IDOC is sent from R/3,
    it didnt reach to XI.....
    i have checked.......we05 in R/3, it gives a status 3,
    then i checked SM58 in R/3, it shows nothing,
    when i check in idx5 in XI, theres no trace of that idoc....and no trace of the scenario run in SXMB_MONI
    pls help, where can i trace the idoc.....
    pls help

    Hi sudeer,
    Did You Check It In WE19.(Test Tool For Idoc Processing)
    If Not Do The Following Steps:
    <u><b>Step1:</b></u>
      >>      Give Your Existing Idoc Number.
    <u><b>Step 2:</b></u>
      >>      Basic Type is Your Message type.
            Ex: MATMAS05 or CREMAS05.
    <u><b>Step 3:</b></u>
      >>      In Your Existing MATMAS05 or CREMAS05 Structure say EDIDC,
      >>      You Should Fill  Your Mapped Entries In Data Structure of EDIDC.
      >>      So that Those Fields Gets Framed as Segments.
    <u><b>Step 4:</b></u>
      >>      After Doing It goto  Menu Bar and Click Idoc And Goto  Edit Control Record.
    <u><b>Step 5:</b></u>
      >>      Now You Give Your Sender And Receiver Port Number Along With Your 
            Logical System And Message Type again its Your MATMAS05  or
           CREMAS05 .
    <u><b>Step 6:</b></u>
      >>      After Doing It Click Standard Outbound Processing.
    <u><b>Step 7:</b></u>
      >>      It Will Say what Happened To your Idoc.
    <u><b>Step 8:</b></u>
      >>     It Is For Sure That if This Processing Fails It Wont Go To XI..
    Regards,
    Dhayanandh .S
    Dont forget To Provide Points If Found Helpful...
    Message was edited by:
            DHAYANANDH SIVASANKARAN

  • TS5179 I've been bitten by the "Missing MSVCR.dll file" problem when downloading the latest iTunes update (PC w/ Win-7 & Outlook-2007#. 'Have followed Apple's instructions of un-installing all Apple software, and re-installing it. #out of space...??)

    I've been bitten by the "Missing MSVCR.dll file" problem when downloading the latest iTunes update, 11.4.62 (on a PC w/ Win-7 & Outlook-2007#. 'Have followed Apple's instructions of un-installing all Apple software, and re-installing it (Ugh).  First result Outlook couldn't find my 1,385 item contact file in iCloud, although the outlook distribution lists were there.  Second result, upon installing iCloud again, I have two iCloud contact files shown in outlook - "iCloud" & iCloud, within iCloud".  1,332 & 1,385 contacts respectively. 
    Plus an iCloud installation error message saying iCloud moved 6,835 files to a "deleted items folder" somewhere.  This is NOT fun at 72-yrs old...!!
    So, how do I make sure I haven't lost anythying from Outlook?   Russ-AZ

    Interesting response, Kappy  -  Back to original post: "First result: Outlook couldn't find my 1,385 item contact file in iCloud, although the outlook distribution lists were there (therefore, initially I had lost my contact file from Outlook).  Second result, upon installing iCloud again, I now have two iCloud contact files shown in Outlook - "iCloud" & iCloud, within iCloud".  W/ 1,332 & 1,385 contacts respectively.  
    Plus an iCloud installation error message saying iCloud moved 6,835 files to a "deleted items folder" somewhere.  This is NOT fun at 72-yrs old...!!
    So, how do I make sure I haven't lost anythying from Outlook?   Russ-AZ"
    You can safely assume that I have tried using it!   So, to make things a little clearer:
         1)  I now have two iCloud "contacts files", w/ a different total count. What's the difference?  Why the different toatl count?
         2)  Since re-installing the Apple software (part of the MSVCR" recovery instructions) "couldn't possible affected Outlook", why am I getting an iCloud installation error message saying iCloud moved 6,835 files to a "deleted items folder" somewhere.  What's in those files? And where are they?
    Probably more important questions get down to:
         3)  Why is a basic Apple product upgrade "screwing-up Outlook"?  This iTunes upgrade, failing to install properly forced Outlook 2007 into a 2-min start-up cycle.  Which was fixed with this "Goat-Rpdeo" of re-installing MSVCR80.dll.
         4)  And under the latest release of iOS-7.0.4 on our iPhones, why is Apple now forcing us to use the iCloud to back-up our contacts, calendars & tasks, vs. allowing these files to be backed-up directly on our PC's via the USB cable?
    Thanks again for your interest and comments.  - Russ-AZ

  • RMI class file problem

    I have already write a RMI example for self-study successfully, but there are a little class file problem that I'm not able fix it.
    In my RMI example there are 3 .java files (RMIServer.java, RMIClient.java and a MethodImpl.java)
    After I have javac and rmic them, I got RMIServer_Skel.class, RMIServer_Stub.class, RMIClient.class and the MethodImpl.class
    In order to run the RMI in a local envirnment, I divide them into 2 folders as listed below:
    Server - RMIServer_Skel.class, RMIServer_Stub.class and the MethodImpl.class
    Client - RMIServer_Stub.class, RMIClient.class and the MethodImpl.class
    Then when I start to run them in a DOC envirnment...
    start rmiregistry........(run successful and another rmiregistry DOC window created)
    java RMIServer.........Exception in thread "main" java.lang.NoClassDefFoundError: RMIServer
    Oops? Class not found? How can that be? And after that, I tried something.......to add the RMIServer.class into the Server folder.
    Again, I start to run them in a DOC envirnment...
    start rmiregistry........(run successful and another rmiregistry DOC window created)
    java RMIServer.........The server is instantiated(run successful and print out a String)
    Um...is the RMI have to run with a RMIServer.class file? But the RMI notes I refered from is not seems to be telling me to do this, are there any one can give me a helping hand?

    please, go here, read thoroughly
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html

  • Locked file problem with WebDAV

    I am using DreamWeaver CS3 on my Macintosh at home and on a
    PC at work. I am connecting to my website via WebDAV, and for some
    reason Dreamweaver cannot edit the files on the site. When I try to
    check out any file I get an error stating: "file.html is locked and
    can be viewed but not edited" I then have the option to check it
    out or view or cancel. Regardless of what I do, if I continue and
    open the file and make changes the file will not get updated on the
    remote server even though Dreamweaver reports a successful "put" or
    "check in" command in the log file. This happens on both the
    Macintosh and the Windows PC. Both are also updated to the latest
    versions of Dreamweaver.
    The strange thing is, if I mount the WebDAV server as a
    filesystem on my macintosh and authenticate with the same
    login/password that entered in Dreamweaver's WebDAV settings, I can
    edit the html files using a text editor and they save perfectly
    fine. Additionally, while the web server is mounted on the desktop,
    if I change Dreamweaver's site settings to "local/network" and
    enter the locally mounted WebDAV share path instead of using
    Dreamweaver's built-in WebDAV client, then everything works
    properly in Dreamweaver. Reverting back to using WebDAV in
    dreamweaver (as opposed to through the OS) brings about the same
    "locked file" problem as before.
    There appears to be a problem with Dreamweaver's WebDAV
    access to the site, and I'm wondering if there's an easy fix or if
    this has been experienced by others?
    Thanks,
    -Topher

    Have a look at FileUtils::DecomposeUnicode and NormalizeUnComposedUnicodeChars. Use the first to convert before using i.e. FileUtils::PMStringToSysFile() and the later afetr i.e. FileUtils::IDFileToPMString().
    HTH

  • Bat file problems with 5.2(3)

    I'm having bat file problems with CCM 4.2(3) with bat version 5.2(3). When adding phone/users getting an error number -2146828279 with this message "Description -Subscript Out of range".

    Hi Denis,
    Just wanted to know if the description contained a comma? There was a bug in a previous BAT version that would affect phone/user inserts if there was a comma.
    CSCsb61425 Bug Details
    Headline BAT insert fails if phone description contains comma
    This was in BAT 5.1.4
    Hope this helps!
    Rob

  • [RFC to File]Problem about Changing file name in message mapping.

    Hi,
    my problem:
        Type:RFC to File
        I change the file name in message mapping.
    when I call the RFC to send the data twice at the same time, both of the output file names are changed while I only want to change the second output file name.
        thanks
    Sam

    In my MM, the input values to these variables (var1, var2 and var3) are (<ZZCOMBI>array,G499999,END_FIFC0029) ,
    var1 is an array of input <ZZCOMBI> item list;
    var2 is get from a property file by call another UDF;
    var3 is constant value.
    the test input data :
    I send the data for the first time:
    - <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <T_ZIFCTS82100010>
    - <item>
    <ZZCOMBI>G000002G000002</ZZCOMBI>
    <ZZKYKBN>*</ZZKYKBN>
    <ENAME_VE />
    <ENAME_Z5 />
    </item>
    </T_ZIFCTS82100010>
    </rfc:Z_IFCFR821_ZIFCTT82100010>
    so the input values to these variables (var1, var2 and var3) are (G000002G000002,G499999,END_FIFC0029)
    the output file name(File1) :END_FIFC002920090413-171534-053.dat
    output record: G000002G000002
    because the data what I send is the last record, the system send the dummy data for the second time by program.
    - <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <T_ZIFCTS82100010>
    - <item>
    <ZZCOMBI>G499999</ZZCOMBI>
    <ZZKYKBN />
    <ENAME_VE />
    <ENAME_Z5 />
    </item>
    </T_ZIFCTS82100010>
    </rfc:Z_IFCFR821_ZIFCTT82100010>
    so the input values to these variables (var1, var2 and var3) are (G499999,G499999,END_FIFC0029)
    the output file name(File2) :END_FIFC002920090413-171533-928.dat
    output record: G499999
    I find that File2(20090413-171533-928) was ouput before File1(20090413-171534-053 ) from the time stamp.
    I am not sure about that "XI will create a message ID for each message and the messages are independent." as you mentioned above.
    Best regards
    Sam
    Edited by: YONGHE ZHOU on Apr 15, 2009 3:59 AM

  • Tcode FILE problem

    I am trying to use the Direct Input method in the LSMW (It is my first time using the Direct Input method) but I encounter a problem during the Specify File step saying that No Logical Path was specified. I look into the forums and they told me that I needed to define one with the FILE Tcode but when go to the FILE Tcode a message pops up saying Changes to Repository or cross-client Customization are not permitted.
    What would cause this? How should I deal with it?

    Hi Obie,
    I guess you are testing in Testing client .
    Do it in development client.
    Mohinder

  • Macbook Air 11" i7 corrupt files problem with Adobe Illustrator CS4

    Hi
    this problem may not be entirely related but maybe someone could help anyways or knows how I can proceed...
    I'm running Illustrator CS4 on a Macbook Air 11" (latest 2011 model, with i7, 4GB, 128SSD), and lately some files are getting corrupted. specifically, adobe illusrator CS4 files with weeks of work. interestingly, the time machine backups are also getting corrupted.
    its like I'm working on a file for a few days, backing up with time machine as well
    closes the file, after a few days returns to it… (normal behavior)
    then when i try to get back to the file then sometimes it says "Cant open the illustration, could not complete the operation" and opens a blank canvas.
    restoring the file via time machine also gives the same error (its like all versions get corrupted simultaneously), even 4-5 versions backwards, even though they worked before when the file worked
    it happened quite a few times, ruining weeks of work.
    I tried the following:
    reinstalling CS4 - didn't work
    Opening the files on CS5 - still don't open
    doing the file recovery thing and then opening it in a notepad - didn't work at all
    using Time machine - the files are still corrupt
    it only happenes with AI files, not photoshop files, for example.
    I thought maybe it has anything to do with SSD? since my previous macbook pro (15", 2007) never did these errors…
    please help
    Eido

    If at all, this would be I/O performance and bandwidth issues with Time Machine, but I don't think that's the problem. More to the point I think that it's a case of Preview opening the files to genereate thumbnails and icons and something going wrong there. I'd look up some guides on how to edit the relevant plist and conf files to exclude your AIs or turn off the behavior to generate these previews globally. This may help hugely...
    Mylenium

  • Spool file problem,Can't see the query in output file.

    Hello ,
    I am facing a very old school kind of problem .....about spool file ....
    The scenario -
    I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many queries regarding the data dictionary views to know about the database. It consist of nearly 25-30 different select queries..
    The problem is i want to make a spool file of the output of that query....i want to see the SQL query & the output below in the spool file, so it will be easy for me to judge the result. But i can't see the SQL query , i can only see the output , & in so many queries it all gets jumbled up....even i can't understand where the next output starts ...
    Sample of my SQL Script ....
    clear buffer
    spool D:\DB_status.txt
    /*To check the database startup time*/
    Select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
    from v$instance
    .........next query n so on....
    spool off;
    In the output pf the spool file at D:\db_status.txt..
    Startup time
    08:25 16-JUL-10It shows only the output of the query in the spool file not the query,
    What should i do to get the SQL query as well as the output of that query just below it in the spool file ???
    Please suggest if you have anymore ideas , regarding this .....
    ORACLE 10g R2
    Windows Server 2008
    Thanks in advance ...

    Why don't you just use database control, instead of re-inventing the wheel?
    Apart from that, SQL*Plus has it's own reference manual, which you apparently refuse to read.
    The answer to your quiz/doc question is
    set echo on
    Sybrand Bakker
    Senior Oracle DBA

  • Edge Animate's OAM file problem placed in Muse or other unknown problem??  Please help!

    Hi,
    I need help please.  Did anyone do a whole page animation in Edge Animate and place the OAM file into Muse, and somehow all the menu and social media icon buttons in Muse are blocked by the placed animation?  All my menu buttons, social media icon buttons and a link are not working (blocked by the transparent AN stage).   I can't go to any other pages because of this issue when previewed in browser.  My animation is a slide-open page from center of the page to both right and left side, also text moved up to the top.  All are moved out of the stage once animation finished to show the home page with contents, including menu and social media icon buttons.  Thanks for your help in advance!!
    Thanks,
    mykw123     

    That answers why the two G4's talk normally! I do
    have the TCP/IP settings set up manually.
    Well, if they are already set manually, maybe you should change them to Auto-negotiate. You shouldn't have to use the Manual setting at all. If you so, then someone, usually the people who wrote the driver for the network card, have screwed something up. It then becomes your job to fix it.
    The problems are just very slow document/file
    transfer from either new to old or old to new
    computer over network, which usually is great with
    the two G4's.
    That is probably the problem. You may want to go ahead and setup the new machine with manual settings to match the G4s. Otherwise, even the Internet will be noticeably slower.
    As for Target Disk Mode...so reboot the old G4
    holding the T key and the hard drive should show up
    on the desktop of the new computer?
    That will do it. It is the best and fastest option to transfer large amounts of data. But even target disk mode is kind of slow. A real, external firewire hard drive will be the fastest of all. It is an excellent idea for backups and this kind of thing.

Maybe you are looking for

  • How can I add a privacy statement to my outgoing emails, below my signature?

    I'm a therapist and need to have a privacy statement/disclaimer below my signature on my outgoing emails...something like the following: STATEMENT OF CONFIDENTIALITY AND PRIVILEGE The contents of this e-mail (including its attachments) are intended f

  • Audio from a captured clip over still graphics

    I capture the on-camera portion of my presentation and then place graphics and titles over the captured video. How can I allow the audio from the clip to continue when a graphic appears, other than using the non-transition effects? To see what I'm do

  • Slow Broadband after line fault fixed

    Hi, After a fault was fixed on the line two weeks ago Broadband speed has been incredibly slow - 32kBs at the most (previously it was around 400kBs) After replacing the microfilter, resetting the router, plugging directly into the test socket I just

  • Can not install adobe download assistant

    there is an error when I install adobe download assistant. How can I fix this?

  • Migration Assistant screwed up my brand new iMac

    So my brand new iMac (MC812LL/A) was delivered today. Upon opening, I decided to use the Migration Assistant to bring over userids from my older intel iMac. I was shocked to see the time needed to be over 10 hours for a 175kb transfer. Anyway, I let