How to update the record in a File (without closing Writer)?

Well i've got one issue:
I want my program to record in a file updating any time i.e the records are added in append.
But i want the record must be done in a file even if the Writer is not closed because I'd like to see the all logs of user and the main thing is sometimes there could be issue of software crash, powercut off or any So for that reason i 've made code like this but it doesn't update but it only override:
public boolean write(String s){
        boolean isFinished = false;
        try{
            FileOutputStream out = new FileOutputStream("C:\\new.txt"); 
            int i = 0;              
            while(i != s.length()){
                out.write(s.charAt(i));
                i++;
            //here i've not closed file output stream
            isFinished = true;
        catch(IOException i){
            i.printStackTrace();
            isFinished = false;
        return isFinished;
    }

Well, Thanks for the help but,. i didn't understand
try not opening the file every time. As I only know that I need to open a file if i would like to update the records..
The update is not happening :
Firstly it shows like this (new.txt):
STOPSecondly it must show like this (new.txt) BUT NOT HAPPENING AS I EXPECTED:
STOPSTOPBut it's not hapenning

Similar Messages

  • How to update the recorded scripts as per the new interface

    Hi,
    I am using E-tester 8.20 and generating the scripts by record and playback. Here my problem is how to update the scripts when new version of user interface (UI) comes. For example, page1 of UI has recorded with 5 text boxes. In the new version of UI, one more text box (6th text box) has been added and that is mandatory filed. So I have to update my scripts as per the new interface to enter a value in the 6th text box. Is there any way to do it? Any kind of help should be appreciated.
    Regards,
    Vinod

    Hi
    Are you talking functional or load scripts?
    Regards
    Alex

  • How to update the value in xml file using transformer after setNodeValue

    Hi,
    This is my code
    I want to set update the values in xml file using transformer..
    Any one can help me
    This is my Xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <place>
    <name>chennai</name>
    </place>
    Jsp Page
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <% String str="";
    String str1="";
    try
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
    out.println("Before change");
    NodeList n11 = doc.getElementsByTagName("name");
    Node n22= n11.item(0).getFirstChild();
    str1 = n22.getNodeValue();
    out.println(str1);
    out.println("After change");
    String name = "Banglore";
    NodeList nlst = doc.getElementsByTagName("name");
    Node node= nlst.item(0).getFirstChild();
    node.setNodeValue(name);
    NodeList n1 = doc.getElementsByTagName("name");
    Node n2= n1.item(0).getFirstChild();
    str = n2.getNodeValue();
    out.println(str);
    catch(Exception e)
    out.println(e) ;
    %>
    <h1><%=str%></h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>

    hi check this exit...
    IWO10012

  • How to update the record based on checkbox

    Dear All,
    Good Afternoon,
    Here i am creating Company Creation Page,
    Company has multiple personss
    At the time of company creation we set one person as primary person.
    that means we just pass that person id as company primary person id columnnn in company table.
    vo.getCurrentRow().setAttribute("CompPrimarypersonid", pid);
    here i am getting so many persons details with checkboxes.
    suppose i want to set another person as a primary person by just clicking on check box.
    At that time pass this person id into company primary persin id column in company table.
    already primary person id is overwrite with this company id.
    how can we get this requirement.
    its very urgent to mee
    give me the guidance for this requirement.

    Hi,
    You can write a procedure and call it through AM using Callable Statement passing the person_id and company_id.
    Now in the procedure, you can check that what is the primary person_id of this company_id.
    Store that primary_person_id in a variable say test.
    then update the company table with new primary person_id
    update company set primary_person_id = <new person_id > where primary_person_id = test;
    commit;
    Thanks,
    Gaurav

  • How to update the records?

    Dear all,
    We will have two CSV files, File 1 will get loaded it to the DSO in the morning. File 2 which contains addtional information and will get loaded it in the afternoon. How can we load the information to one row not two? For example:
    Files 1:
    ItemNo      Cal/Day            Plant               Divsion           BO Qty          BO Total
    AAAA        04/05/2009         20                   900                2                     200
    File 2:
    Item No        Cal/Day        Plant            Division         ConfirmationDate          ConfirmationQTY
    AAAA        04/05/2009        20               900                   04/10/2009                     2       
    In DSO, I would like to have only one record that combined these two.
    Item No     Cal/Day        Plant       Division       BOQty     BOTotal   ConfirmationDate ConfirmationQTY
    AAAA      04/05/2009        20         900               2             200          04/10/2009                     2

    BI User wrote:
    > Files 1:
    > ItemNo      Cal/Day            Plant               Divsion           BO Qty          BO Total
    > AAAA        04/05/2009         20                   900                2                     200
    >
    > File 2:
    > Item No        Cal/Day        Plant            Division         ConfirmationDate          ConfirmationQTY
    > AAAA        04/05/2009        20               900                   04/10/2009                     2       
    if you have ConfirmationDate as a key figure ànd set it to overwrite, you can accomplish this
    (your other KF's from the first file have to be overwrite as well)
    Edited by: RafB on Apr 13, 2009 10:07 PM

  • How to update the records in SAP table through BADIs?

    Hi all,
    I have added custom tab with one field(input/output field) in ME22N. As soon as the user enters the value in the field,the value should be updated in the appended structure which has been included in EKKO table. I was told to be done in the BADI ME_PROCESS_PO_CUST and method PROCESS_HEADER. Please someone tell me how to do this.
    << Moderator message - The answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
    Thanks,
    MKannan.
    Edited by: Rob Burbank on Nov 15, 2011 10:19 AM

    Hi,
    First subscribe the Header Tab in the method SUBSCRIBE
    DATA: ls_struc  LIKE LINE OF re_subscribers.
    Check for the Header data
        CHECK im_application = 'PO'.
        CHECK im_element     = 'HEADER'.
    CLEAR re_subscribers[].
    ls_struc-name = subscreen1.
        ls_struc-dynpro = '0001'.
      ls_struc-program = <dynpro program name >.
      ls_struc-struct_name = 'CI_EKKODB'.
        ls_subscriber-height = 7.
        APPEND ls_struc TO re_subscribers
    Use the method MAP_DYNPRO_FIELDS
    FIELD-SYMBOLS: <mapping> LIKE LINE OF ch_mapping.
        LOOP AT ch_mapping ASSIGNING <mapping>. 
       CASE <mapping>-fieldname.    
      WHEN <field name>. 
        <mapping>-metafield = mmmfd_cust_03.
        ENDCASE. 
    ENDLOOP.
    use method TRANSPORT_FROM_MODEL
    use method TRANSPORT_TO_DYNP
    TRANSPORT_TO_MODEL
    ls_mepoheader = l_header->get_data( ).
    CALL METHOD l_header->set_data
                EXPORTING
                  im_data = ls_mepoheader.
    Thanks,
    Shailaja Ainala.

  • How to delete the records from database table without using work area

    Hi all,
    The purpose of the down program is to delete the entire contents from all the tables. The deletion of the table should be in sorted manner. Is there any other way to write the code more efficiently,
    TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR, ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL, ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
    DELETE ZFFMCTL_AP.
    IF SY-SUBRC = 0.
    DELETE ZFFMMHDR_AP.
    IF SY-SUBRC = 0.
    DELETE ZFFM_CHANGE_LOG.
    IF SY-SUBRC = 0.
    DELETE ZFFMDTL_AR.
    IF SY-SUBRC = 0.
    DELETE ZFFMHDR_AR.
    IF SY-SUBRC = 0.
    DELETE ZFFMDTL_JV.
    IF SY-SUBRC = 0.
    DELETE ZFFMHDR_JV.
    IF SY-SUBRC = 0.
    DELETE ZFFMDTL_SKF.
    IF SY-SUBRC = 0.
    DELETE ZFFMHDR_SKF.
    IF SY-SUBRC = 0.
    DELETE ZFINVOICE_DETAIL.
    IF SY-SUBRC = 0.
    DELETE ZFFMMASTER.
    IF SY-SUBRC = 0.
    DELETE ZFFMLOGREAD_CLUS.
    IF SY-SUBRC = 0.
    DELETE ZFFMCTL.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    Waiting for response,
    Thanks in advance
    John

    Write this way....
    TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR, ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL, ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
    DELETE ZFFMCTL_AP.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMMHDR_AP.
    CHECK SY_SUBRC = 0.
    DELETE ZFFM_CHANGE_LOG.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMDTL_AR.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMHDR_AR.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMDTL_JV.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMHDR_JV.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMDTL_SKF.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMHDR_SKF.
    CHECK SY_SUBRC = 0.
    DELETE ZFINVOICE_DETAIL.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMMASTER.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMLOGREAD_CLUS.
    CHECK SY_SUBRC = 0.
    DELETE ZFFMCTL.

  • Updating the records

    can anyone plz tell me how to update the records
    in the browser itself?

    Hi,
    See browser is client-side and not server-side. If at all you need to update any record shown in the browser means, it can only be done using javascript or vbscript. But it won't gets reflected in the database unless you do it in server-side.
    Vijay.

  • Replacing the Header in rule file without changing source file(header defi)

    hi,
    i am loading the data using header in the Source file (.xls).
    I need to load the same file but for diff header (say instead of A1 i need A2) without any changes in source file.
    can someone please provide information that how to change the header in source file without opening/changing source file.
    Thanks in advance
    Anubhav Bisht

    HI SM,
    thanks for reply.
    the Problem is that there is two members in header defined in the source file that i need to change while loading the data.
    the load rule is picking header from the Source file, so replacing in the field is not working..
    do you have any other option/Suggestion.
    Regards
    Anubhav

  • How to delete the record in the file present in the application server?

    Hi,
      I have two questions.
      i) How can I delete a record based on some condition in the recordx in the file that is present in the application server?
      ii) How can I lock the users whiel one user is accessing the file on the application server?
    Thanks in advance.
    Suvan

    Hi,
    If u want a frequent deletion this approach to delete a record from a file will havee unnecesary copy of records from one file to another and deletion of one file and renaming activities.
    Instead what u can do is Add and field del_flag to ur record structure.
    If u want to delete the record from a file just mark this del_flag as 'X'.
    While processing u can have a loop like
    loop at it_XXX where del_flag <> 'X'.
    endloop.
    This will logically delete the record.
    When u r to finish the application at that time only perform this copying / deleting / and renaing activity
    Hope this helps.
    Cheers,
    Nitin

  • How to read and update the value of property file

    Hi,
    I am not able read the values from property file.
    Please tell me how to read and update the values from property file using Properties class
    This is my property file : - Config.properties its located in D:\newfolder
    Values
    SMTP = localhost
    Now i need to change the value of the SMTP
    New value :
    SMTP =10.60.1.9
    Pls Help me
    Thanks
    Merlin Rosina,

    Post a small (<1 page) example program that forum members can copy and run that demonstrates your problem.

  • How to update the file in simple java archive file on Netweaver2004s

    We have a J2EE application containing few properties file packed inside a java archive. These properties are Configuration properties which we are required to change few times after deployment.We are using SAP Visual Administrator to deploy\undeploy our application.We found out that Visual Administrator dose not support update of files packed in a simple Java Archive in Single File Update Option. It only allows updates of EJB Modules archive.
    Please let us know if there is any other way we can update a file inside a simple java archive.

    Well, Thanks for the help but,. i didn't understand
    try not opening the file every time. As I only know that I need to open a file if i would like to update the records..
    The update is not happening :
    Firstly it shows like this (new.txt):
    STOPSecondly it must show like this (new.txt) BUT NOT HAPPENING AS I EXPECTED:
    STOPSTOPBut it's not hapenning

  • How we can restrict record in CTL file on the basis of other table ?

    Hello all,
    How we can restrict record in CTL file on the basis of other table ?
    Eg.
    I have following control file to load the records in the table through the sql loader.
    LOAD DATA
    INTO TABLE THIST APPEND
    FIELDS TERMINATED BY "|" TRAILING NULLCOLS
    LNUM POSITION(1) Char "substr(:LOAN_NUM, 4, 13)",
    TSRNUM Char "rtrim:TRAN_SR_NUM)" ,
    TPROCDT Char "to_char(to_date rtrim:TRAN_PROC_DT), 'MMDDYYYY'), 'YYYYMMDD')"      
    I have another table c all TFILE in which I have LNUM. I want to import only those records from input text file using the control file and sql loader in which LNUM is exist in the TFILE.
    So how i can restrict it in the Control File.
    Thanks
    Kamlesh Gujarathi
    [email protected]

    Hello Satyaki De.
    Thank you very much for your suggestion but my Private information is totally apart from this question & I already I have changed each and every information from the question.
    Thanks
    Kamlesh Gujarathi
    [email protected]

  • How To Hide the Record after Update from ADF Front End

    Hi Every One,
    I have done the Scenario of Database Table rows displayed in ADF front end. It is editing and updating also. My Query is after update the record, how to hide that record from adf front end.
    Could any one please help me.
    Thanks,
    Narasimhulu.S

    hi you can create transient field in view object indicate to visibility of row (boolean ) and create view criteria that show only rows that are able to be visible according to transient attribute and at the update process set the attribute to true inside entityImpl class

  • How to update the millions of records in oracle database?

    How to update the millions of records in oracle database?
    table have contraints & index.how to do this mass update.normal update taking several hours.

    LostWorld wrote:
    How to update the millions of records in oracle database?
    table have contraints & index.how to do this mass update.normal update taking several hours.Please, refer to Tom Kyte's answer on your question
    [How to Update millions or records in a table|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6407993912330]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

Maybe you are looking for

  • How do I sync more than one iPhone to one iCal?

    I want to sync my wife's new iPhone 4 with iCal that is synced with my me.com account. How do I set this up?

  • Writing a custom component with multiple fields.

    Does anyone have some pointers on writing a custom component that properly handles multiple input fields? An example usage might be as follows: Assume the following java classes: public interface Address {     //... getters/setters for Address. publi

  • Shouldn't this work? dd command issues.

    I'm hoping to bring together a hodge podge of old parts lying about into a sweet smoking Arch machine. I've got everything I need, except what I thought would be the easiest part of the whole box... a usable hard disk. After finding two reasonably ne

  • Copying smartforms and sapcript-forms

    Hello! How can I copy smartforms and sapcript-forms  from one system to the other ? Ragards sas

  • Two Libraries In iPhoto?

    I would like to have 2 completely separate Libraries in iPhoto, one for personal pictures and the other for work related. If this is possible: (1) How do I set up and name my 2nd. Library? (2) How do I transfer images from my existing Library to the