Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-22 Thread Eric Means
That's why I suggested using MSMQ, which can be used to guarantee that the log messages are not lost or removed until they have been successfully written. Obviously there's still the possibility of catastrophic system failure, but in a case where that matters, there are hardware solutions (RAID et

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-22 Thread Girish Jain
estions Regards, Girish Jain From: "J. Merrill" <[EMAIL PROTECTED]> Reply-To: "Discussion of advanced .NET topics." To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file Date: Sat, 19 Nov 2005 16:58:38 -0500 Your

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-21 Thread J. Merrill
The only real disadvantage of this is that the data is not written to the file "in real time" -- so it's vaguely possible that some log info could be lost if there's a very bad crash that shuts down the logging task. (But it's probably more likely that the disk onto which the data is being writ

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-20 Thread Girish Jain
: Eric Means <[EMAIL PROTECTED]> Reply-To: "Discussion of advanced .NET topics." To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file Date: Sat, 19 Nov 2005 08:18:12 -0600 On 11/19/05, Girish Jain <[EMAIL PROTECTED]>

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-20 Thread Girish Jain
ECTED]> Reply-To: "Discussion of advanced .NET topics." To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file Date: Sat, 19 Nov 2005 16:58:38 -0500 Your class is multi-thread safe, but not multi-user (on different machi

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-19 Thread J. Merrill
Your class is multi-thread safe, but not multi-user (on different machines) safe. If that's your requirement, fine -- just want to make sure that you realize that the locking won't do anything useful if more than one machine is writing to the same file with this code. (I am uncertain whether t

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-19 Thread Eric Means
On 11/19/05, Girish Jain <[EMAIL PROTECTED]> wrote: > > Thanks Ian, > > You got it correct, it's the IO cost and time constraint that I am worried > about. The log file is generated on a daily basis, still the amount of > data > that is written to the log file is moderately large. > > I want the lo

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-19 Thread Girish Jain
} } public enum LogDirection { Beginning = 0, End = 1 } Thanks Regards, Girish Jain From: Ian Griffiths <[EMAIL PROTECTED]> Reply-To: "Discussion of advanced .NET topics." To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginn

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Jon Rothlander
18, 2005 11:03 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file But didn't he start off by saying he wanted something better than writing out the entire file again every time he did an insertion? Moving to XML doesn't solve

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Seth Sticco
Ian Griffiths wrote: Could the original poster please tell us: is it the IO costs you're worried about, or the coding effort? I thought it was pretty obvious that he was concerned with the IO costs. How could it be the coding effort if he had already written the code? - Seth Sticco ===

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Steve Johnson
On 11/18/05, Jon Rothlander <[EMAIL PROTECTED]> wrote: > > My point was that if he designed his own log file format, he can do > whatever > he wishes and could use XML for this. Of course, he may not be able to use > XML if he is not controlling the log file format, which is why I asked the > quest

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Ian Griffiths
But didn't he start off by saying he wanted something better than writing out the entire file again every time he did an insertion? Moving to XML doesn't solve that file writing problem. You can insert stuff into an XML DOM, but the DOM is a data structure in memory. If you want the file on disk

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Jekke Bladt
ovember 18, 2005 11:25 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file Based on his questions, he is not using a windows event log and he seems to just be using his own log file design. Nothing in his post says that he does or does not

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Jon Rothlander
opics. [mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson Sent: Friday, November 18, 2005 9:00 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file On 11/18/05, Jon Rothlander <[EMAIL PROTECTED]> wrote: > > Can you use XM

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Ryan Heath
You might want to use a BufferedStream (for reading & writing) when the log file is going to be to large to fit into memory. The idea is to always write to another file, and rename it afterwards. using ( FileStream readFs ...) using ( BufferedStream readBuf( readFS)) using ( FileStream writeFs ...

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Steve Johnson
On 11/18/05, Jon Rothlander <[EMAIL PROTECTED]> wrote: > > Can you use XML? If so, you can easily handle this using an XML log file. > How? Steve Johnson === This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread J. Merrill
The Windows file system doesn't support "inserting" data, so you have to either write to the end of the file, or do what you've done and re-write the file with new data at the front. If you are able to provide a reader for the log file, you could provide one that shows the "sections" of the log

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Peter Ritchie
I would suggest using a memory-mapped file. You could then do all your manipulation in memory then have Windows dump the memory back out to the file. .NET 1.1 doesn't have inherent support for memory-mapped files; but there's at least one class that wraps the required PInvoke code: http://www.win

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Jon Rothlander
-DOTNET] Writing data to the beginning of a file Hi All, I am writing a log file with the requirement that the latest entry in the log should be on the top. For the purpose I looked for ways of doing that but ended up by reading the entire contents of the existing file into a byte array and then re

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Bob Provencher
r 18, 2005 7:22 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [ADVANCED-DOTNET] Writing data to the beginning of a file Hi All, I am writing a log file with the requirement that the latest entry in the log should be on the top. For the purpose I looked for ways of doing that but ended up

Re: [ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread dave wanta
putting it back together Thanks, Dave - Original Message - From: "Girish Jain" <[EMAIL PROTECTED]> To: Sent: Friday, November 18, 2005 6:22 AM Subject: [ADVANCED-DOTNET] Writing data to the beginning of a file > Hi All, > > I am writing a log file with the requir

[ADVANCED-DOTNET] Writing data to the beginning of a file

2005-11-18 Thread Girish Jain
Hi All, I am writing a log file with the requirement that the latest entry in the log should be on the top. For the purpose I looked for ways of doing that but ended up by reading the entire contents of the existing file into a byte array and then re-write the file with the new content. Is there