Monitor changes in text file

I have a text file named Log.txt. I want that as soon as something is written on log.txt a notification is generated instantly. I don't want to use two threads: one that writes and other that reads and generates notification instead I want to use some kind of event generator such that as soon something is written an event is generated in which I will add send notification in the action part. Please guide me its urgent

Hi.
I'm afraid I do not know of any possibility other than periodically polling for changes. As far as I know, e.g. log4j also solves its reconfiguration using a thread checking the last modified timestamp on its configuration file.
Sorry.

Similar Messages

  • Editing and changing large text file

    hi,
    new to this, so bare with me.
    got a large text file 44meg and i need to change some values in it.
    example:
    TSX ;20030102;40302216;40300579;1980;1900;3762000
    i need to change the lines so that they read:
    TSX ;20030102;302216;300579;1980;1900;3762000
    thus removing the leading 40 in the middle cols.
    Thanks in advance
    john

    crap, small mistake
    1) use BufferedReader to read in the file line by line (BufferedReader.readLine())
    2a) for each line, split it on the semicolons (String.split())
    2b) change the middle value using String.substring()
    2c) construct a new line by appending all strings in the array returned by 2a) to eachother
    2d) write this new line to a file using PrintStream (PrintSteam.println())
    3) when done, close both the reader and the printstream.

  • Make changes in text file.

    Hi all,
    we are uplaoding a text file by bdc but when we are importing our text file from some other system we are  getting some  box type symbol in that text file , how to delete those boxes before uploading it to sap
    plz help
    regards
    sarabjit

    Hi,
      That is aspecial character you need to remove this special character before you pass this data to BDC....
    data: lv_char  type x value '0D'.
    do.
       if view_fields-value cs lv_char.
         replace lv_char with space into view_fields-value.
         condense view_fields-value.
         modify view_fields index lv_index transporting value.
       else.
         exit.
       endif.
    enddo.
    here you might have to replace 0D with the correct value whihc you can see in dbug mode by clicking on the hex display button also try with '09 in place of 0D.
    Regards,
    Himanshu

  • Loading a text file into a global variable issue - really a global var?

    From all the documentation and examples I can find, it appears that it would be
    correct to create a global array variable [outside of any functions] to load image names into,
    then use these images for a slideshow. I want to make the app dynamic, in that changing the text file gives a new set of images.
    The global variable goes null [no values] after the load event listener. Why is that?
    Isn't global, well global, and alive for the duration of the SWF?
    PARAMS.TXT:
    monthNames=January,February,March,April,May,June,July,August,September,October,November,De cember&dayNames=Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
    CODE:
    var dNames:Array = new Array();
    var mNames:Array = new Array();
    var request:URLRequest = new URLRequest("images/params.txt");
    var variables:URLLoader = new URLLoader();
    variables.dataFormat = URLLoaderDataFormat.VARIABLES;
    variables.addEventListener(Event.COMPLETE, completeHandler);
    try
    variables.load(request);
    catch (error:Error)
    trace("Unable to load URL: " + error);
    trace("2 mNames 2: " + mNames[2]);
    trace("2 dNames 3: " + dNames[3]);
    stop();
    function completeHandler(event:Event):void
    var loader:URLLoader = URLLoader(event.target);
    dNames = loader.data.dayNames.split(",");
    mNames = loader.data.monthNames.split(",");
    trace(loader.data.dayNames);
    trace("1 mNames 2: " + mNames[2]);
    trace("1 dNames 3: " + dNames[3]);
    OUTPUT:
    2 mNames 2: undefined
    2 dNames 3: undefined
    Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
    1 mNames 2: March
    1 dNames 3: Wednesday
    How do I access these values after loading from the external file, after the load?
    Thanks in advance.

    The statement you quoted from whatever Adobe documentation is correct.
    If you want to load the data into the arrays before anything else happens, then have anything else that happens execute via the completeHandler function... after the data is loaded and processed into the arrays.
    the command: loadFile() executes before the trace("2:" +images[4]); command.  The loadFile function is processed and the loading process BEGINS... but starting the loading does not delay the main processing from continuing down the line--the loading itself becomes a secondary/background task.  The command was to execute the loadFile function and the processing of that function was completed.  If you don't believe so, then add a trace...
    function loadFile():void
         vars.dataFormat = URLLoaderDataFormat.VARIABLES;
         vars.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
         vars.load(new URLRequest("images/fnames.txt"));
         trace("started loading");
    If you add that trace, you should see that the loadFile function execution is completed and the next line in your code is then processed... trace(2....)
    The addEventlistener does not stop anything.  The addEventListener code is assigning a monitor, not a traffic controller... it is telling the monitor to indicate when the data has finished loading.  It is not telling anything to stop program execution.
    So if you want to wait until the data is loaded before you do anything else... it goes....
    function onComplete(evt:Event):void
         var urlVars:URLVariables = evt.target.data;
         images = vars.data.images.split(",");
         tnails = vars.data.thumbnails.split(",");
         ................HERE.................

  • Find Change through external text file

    Hello folks
    I am bit pretty in InDesign scripting so could you please look into this.
    How can i change any particular text field in Indesign CS3 document from text file.
    I do have find change script but for each InDesign document specific text file is assigned.
    So each time i have to modify find change GREP property that is also repetetive of work. Is there any way to get find change information should be extract from external text file.
    Many Tanks in advance

    In the FindChangeByList script, you could customize the function myFindFile(myFilePath) {...} as to search the FindChangeList text file in the document location rather than the script location. That's an example. The question is: given a document, where will you have the corresponding FindChangeList?
    @+
    Marc

  • Change of a single line in a text file

    Is there a option in CVI to change a single line in a text file (.txt), without reading the whole text file into the buffer and writing the whole buffer back after the editing from the one line?

    Not that I am aware of.
    I'll be glad to know such a function if somebody can point us to it! 
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Why Acrobat x professional is changing the text formatting specifically the font family  and the font size of the text in my pdf on exporting it to Microsoft word file format ?How should i stop Acrobat x professional from doing that so that i get an exact

    Why Acrobat x professional is changing the text formatting specifically the font family  and the font size of the text in my pdf on exporting it to Microsoft word file format ?How should i stop Acrobat x professional from doing that so that i get an exactly same word file on exporting it from its pdf counterpart?

    I was testing the preciseness & efficiency of Adobe acrobat x professional's doc conversion capabilities. As i have to take a document editing project in future which is going to need lot of pdf to word and vice versa conversions . What I did was I created a test word document converted into a pdf using a pdf maker in my word 2007 , Acrobat did convert the document from word to pdf keeping everything in the source file intact , However when i tried the other way round and attempted to convert the same pdf to word 2007 file format I lost my formatting ?So the font that I used to create the pdf are the ones taken from word 2007 which i believe is using the fonts that are installed in my computer. Any suggestions on how to preserve the formatting of the document after converting it from pdf to word file format?
    Regards
    Mike

  • How to update a text file or change some text easily ??

    Hi
    I want to change some text inside a text file. I can do it as below:
    1) new a File file
    2) new a FileInputStream(file) and call read()
    3) modify text
    4) new a File newfile
    5) new FileOutputStream(newfile) and call write()
    6) delete file
    7) rename newfile to file
    It is too complecated. What is easy way to do it ? Thanks for help
    Gary

    Hi NLSurfMan,
    I ceate a coding below , it always give me error:
    java.io.FileNotFoundException: c:\abc\file.rtf (The process cannot access the file because it is being used by another process)
    I have closed the FileReader and BufferedReader. I still have this problem. Why. Thanks. Gary
    int c;
    String text="";
    File filename=new File("c:/abc/file.rtf");
    FileReader fileReader =new FileReader(filename);
    BufferedReader bReader=new BufferedReader(fileReader);
    while ( (c=bReader.read())!=-1 ) {
    text=text+(char)c;
    bReader.close();
    fileReader.close();
    System.out.println("text="+text);
    text=text+" I want to make some change here";
    File filename1=new File("c:/abc/file.rtf");
    BufferedWriter bWriter =new BufferedWriter(new FileWriter(filename1));
    bWriter.write(text,0,text.length());
    bWriter.close();

  • How to effect changes made in a jTable into a text file

    i have created a jTable in netbeans6. The table model is DefaultTableModel.
    i'm not understanding the concept of firecellupdate and other events listeners.
    i want the changes i make to the table during runtime to be written into a Text file.
    any help would be greatly appreciated.

    rishi_86 wrote:
    i have created a jTable in netbeans6. The table model is DefaultTableModel.
    i'm not understanding the concept of firecellupdate and other events listeners.
    i want the changes i make to the table during runtime to be written into a Text file.
    any help would be greatly appreciated.you need to add the TableModelListener to your table model.
    for example:
    model.addTableModelListener(new TableModelListener() {
                public void tableChanged(TableModelEvent e) {
                    // TODO Auto-generated method stub               
             });then, you need to put your custom business logic(saving data to a text file, etc) into the tableChanged method.
    From TableModelEvent you can get all information about the model changes.

  • Want to change the SQL Server Agent Job History Text Files Location

    We have SQL Server 2014 installed on a couple servers, but they were not consistent on directory paths during the installs. I am trying to get the servers to all match.
    On one server, SQL Server the Agent Log and Job History files were being written to [H:\Data Root Directory\MSSQL12.MSSQLSERVER\MSSQL\Log].
    I want to change that to [H:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log] to match the other server.
    I have ALREADY gone into SSMS - [SQL Server Agent] - [Properties] and changed the "Error Log " "Fle Name" to [H:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log\SQLAGENT.OUT].  And that is working great.
    In [SQL Server Configuration Manager] - [SQL Server (MSSQLSERVER)] - [Properties] - Startup Parameters entries have been changed to the new path (-d, -e, and -l), and under [Advanced] both Data Path and Dump Directory are pointing to the new path. 
    In [SQL Server Configuration Manager] - [SQL Server Agent (MSSQLSERVER)] - [Properties] - [Advanced] Dump Directory is pointing to the new path. 
    However, the job's History text files are still being written to the old path.
    There is no setting in the Jobs or the Maintenance Plans that controls the history file location.
    I have searched the registry and changed three settings from the old path to the new path.  The registry does NOT contain any more references to the old path.
    I rebooted the server, but when the jobs run their history text files are still be written to the old path.
    Does anybody have any ideas??   Thanks

    I checked the [Job] - [Step] - [Advanced ] - "Output File", and the field is blank.
    I then reviewed all the tabs and left menu items in the Job...I cannot find any where the references the old path.
    I then went to the Maintenance Plan and checked every thing there.  Still cannot find what is referencing this old path.
    SQL Server is also still writing xel files to this old path...if that offers any clues.
    The text file being generated is the recap of the Job run.  Starts with this:
    Microsoft(R) Server Maintenance Utility (Unicode) Version 12.0.2430
    Report was generated on "xxxxxxxxxxxxxxx".
    Maintenance Plan: SQL_Backups_Log
    Duration: 00:00:03
    Status: Succeeded.
    Details:
    Thanks for the ideas....

  • There are marker elements in my FM file,How can I  change their text information?

    In my Fm file,I want to change the text information of marker,How can I deal with it?

    Jack:
    Begin by selecting the marker. If you haven't already done so, use View --> Text Symbols to allow you to see the markers.
    You can then use your mouse or keyboard to select the marker manually or use
    CTRL+f to open the Find/Change tool, in the
    Find list choose
    Marker of Type and specify the type of marker (or choose
    Any Marker if you don't the marker type), then click
    Find.
    After a marker has been selected, press in sequence
    ESC s m to open the
    Marker tool, edit the marker text, then click
    Edit Marker.
    Cheers & hope this helps,
    Riley

  • When I send inline photos, recipients receive jumbled text file. What setting do I need to change?

    When I send inline (embedded) photos, along with text; my recipients say they only receive a jumbled text file. Is there a setting within TB I can change to correct this? See below:
    Message-Id: <iPTA1p0151ZQlML01PTCq2>
    Old-Message-Id: <[email protected]>
    X-CT-Class: Clean
    X-CT-Score: 0.00
    X-CT-RefID: str=0001.0A020202.54BEE450.020A,ss=1,re=0.001,fgs=0
    X-CT-Spam: 0
    X-Authority-Analysis: v=2.0 cv=ZM0JbwHb c=1 sm=1
    a=H9ApUXk15iS5yeOMHhxLeQ==:17 a=XD52yEjQpfAA:10 a=IkcTkHD0fZMA:10
    a=8LaAqv5HAAAA:8 a=YNv0rlydsVwA:10 a=ZtyhI0BCAAAA:8
    a=6SNPnC5c-BsZy3R9Qp8A:9
    a=QEXdDO2ut3YA:10 a=_W_S_7VecoQA:10 a=dEDsMZyNvvyTj/aoxoOu+Q==:117
    X-CM-Score: 0.00
    Received: from [192.168.11.108] (really [173.216.226.221])
    by txofep02.suddenlink.net
    (InterMail vM.8.04.01.08 201-2343-100-153-20121108) with ESMTP
    id
    <20150120232710.SKRU21350.txofep02.suddenlink.net@[192.168.11.108]>;
    Tue, 20 Jan 2015 17:27:10 -0600
    Message-ID: <[email protected]>
    Date: Tue, 20 Jan 2015 17:27:03 -0600
    From: "Ron F." <[email protected]>
    User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101
    Thunderbird/31.4.0
    MIME-Version: 1.0
    To: undisclosed-recipients:;
    Subject: Have A Great Day!!!!
    References:
    <[email protected]m>
    In-Reply-To:
    <[email protected]m>
    Content-Type: text/html; charset=utf-8
    Content-Transfer-Encoding: 8bit
    X-Cloudmark-Analysis: v=2.1 cv=fccjyigF c=1 sm=0 tr=0 a=2fDfVs0_6TAA:10
    a=IkcTkHD0fZMA:10 a=8LaAqv5HAAAA:8 a=YNv0rlydsVwA:10 a=ZtyhI0BCAAAA:8
    a=6SNPnC5c-BsZy3R9Qp8A:9 a=8YrWDim6EiZkUi7e:21 a=QEXdDO2ut3YA:10
    a=_W_S_7VecoQA:10
    X-Antivirus: AVG for E-mail 2014.0.4800 [4257/8962]
    X-AVG-ID: ID39D19FBF-2644597C
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <div>
    <div>
    <div>
    <div style="background:white"><b><span
    style="font-size:13.5pt"><img moz-do-not-send="true"
    src="http://j.b5z.net/i/u/7000617/i/a.jpg?n=34148"
    height="492" width="658"></span></b><span
    style="color:black"></span></div>
    </div>
    </div>
    </div>
    <div>
    <div>
    <div>
    <div style="background:white"><span
    style="font-size:10pt"></span><span
    style="color:black"></span>Â <b><span
    style="font-size:13.5pt"><img moz-do-not-send="true"

    this forum just scrambles posts like yours... could you email me one of your problem email to unicorn dot consulting at gmail dot com.... Please put a subject in that will give me a clue.

  • Changing HTML to text file using java

    Hi,
    I am doing a project in which i have to read news articles from websites. I have tried XML but for that i need to know which tag has the article in it. Since i have to read from various websites so each site used different tags for different informations.
    Is there anyway that i can change an HTML file into a text file using java. Maybe some command that removes all the HTML tags and gives just the information. Is there anything else that anyone would like to recommend?
    Thanx
    yafis

    Maybe something like this:
    import java.io.*;
    import java.net.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    class GetHTMLText
         public static void main(String[] args)
              throws Exception
              EditorKit kit = new HTMLEditorKit();
              Document doc = kit.createDefaultDocument();
              // The Document class does not yet handle charset's properly.
              doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
              // Create a reader on the HTML content.
              Reader rd = getReader(args[0]);
              // Parse the HTML.
              kit.read(rd, doc, 0);
              //  The HTML text is now stored in the document
              System.out.println( doc.getText(0, doc.getLength()) );
         // Returns a reader on the HTML data. If 'uri' begins
         // with "http:", it's treated as a URL; otherwise,
         // it's assumed to be a local filename.
         static Reader getReader(String uri)
              throws IOException
              // Retrieve from Internet.
              if (uri.startsWith("http:"))
                   URLConnection conn = new URL(uri).openConnection();
                   return new InputStreamReader(conn.getInputStream());
              // Retrieve from file.
              else
                   return new FileReader(uri);
    }

  • How to change the text in EPS file

    I purchased an image on iStockPhoto and the text is supposed to be changed but I dont know how. Everything is vectorized...Is somebody knows how I can change the text and keep the same font?
    Thanks

    You can't if it's been outlined / vectorised.

  • Select Correct Text File - Names Changing

    Eevery few hours my AS400 generates a text file. I am writing a program that will automatically take this file and convert it to an XML. The problem I am having is with the naming convention of the text file:
    "IR + 6 digit number which increments by one each time a file is generated + _ + The start date and time for the file +_to_ + end date and time for the file + .txt". For example IR000002_20070528141515_to_20070528170003.txt is the name of the second file generated which started at 14:15:15 on 28/05/2007 and ended at 17:00:03 on 28/05/2007.
    Each time my program runs I want it to read the latest file that has been generated. I know where the file will be found and how to select the file when it is generated with the same name each time but havnt a clue now that each file has a different name. Can anybody help? Can I use JFileChooser?

    You can use the lastModified() method of the File object to your benefit:
    import java.io.File;
    public class FindLatestFile {
            public static File getLatest(File thisDir) throws Exception {
                    long latestModDate = -1;
                    File latestFile = null;
                    if (!thisDir.isDirectory()) {
                            throw new Exception("Please pass in a directory.");
                    File[] fileList = thisDir.listFiles();
                    for (File f : fileList) {
                            if (f.lastModified() > latestModDate) {
                                    latestModDate = f.lastModified();
                                    latestFile = f;
                    return latestFile;
            public static void main(String[] args) {
                    try {
                            System.out.println("The latest file in the current directory is " +
                                            getLatest( new File(System.getProperty("user.dir") ) ) + ".");
                    } catch (Exception e) {
                            e.printStackTrace();
    }

Maybe you are looking for

  • A UPS model that works with Mac Native software to do a graceful shutdown and automatic restart during a power failure.

    I've tried 3 UPS's (2 APC and one TripLite) that state they are OSX compatible, however, they do not fully respond to the native osx setting in (system Preferences/ Energy Saver/ UPS/Start up automatically after a power failure). This is what happens

  • Oracle9ias R2 RHAS2.1 installation problem

    hi tried to install oracle9ias r2. i follow below docs doc id:215288.1 doc id:191567.1 doc id:200471.1 in the metalink. searched metalink and found a code. "pre-install check for linux system " there s code written for specific platforms. i run it an

  • Posting invoice discounts using RFBIBL00

    I am generating a file to be processed by the program RFBIBL00 to clear incoming invoice payments using transaction FB05.  The input file being supplied by the user already has the cash discount identified in a separate field.  Can someone tell me wh

  • Problem in using database control in JPD.

    Hi All, I am developing a JPD which also involves using DB control. The connected DB is Oracle 9.2. I have created DB control with "insert" method and one with "update" method. When i call "insert" method in JPD by dynamically passing values, it work

  • CSS Expressions and IE8 compatibility

    CSS Expressions have been removed from IE8. This is one feature that our app uses to render a table with a fixed left column . So the first column of teh table is fixed even though the rest of the columnes scrolls as the table has many columns. Any s