Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Corrupted NB

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14419] Re: Corrupted NB
  • From: gwinn at ma.ultranet.com (Joe Gwinn)
  • Date: Wed, 21 Oct 1998 03:32:17 -0400
  • Organization: Gwinn Instruments
  • References: <70dd69$234@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I have also had this problem, but I have never succeeded in fixing a
damaged notebook.  The problem has always happened when Mathematica
crashed while saving the notebook  Now I periodically make a no-output
backup copy called "<whatever>.nb short" so I don't lose everything
when Mathematica crashes. 


This kind of destroy-file-on-save behaviour was very common in early
(mainframe and mini) computer software, and subsequently in early PC
and Mac software, but is now mostly a thing of the bad old days.  The
standard solution is to do file saves in such a way that there is never
a window of vulnerability, where a computer crash (for whatever reason)
could leave one with only a corrupted file.

The method?  Simple.  One 1970s variant:  Open a temporary file and
write the new version of the document into it.  If successful, rename
the old file with a temporary name, and then rename the just-written
temporary file (containing the new document) to be the updated file. 
Delete the old file with the temporary name.  No matter when the crash,
there is at least one good file surviving, perhaps with a temporary
name.  Temporary files are not deleted on a crash, so this can work.

This does require that one have scratch disk space sufficient to carry
an extra copy of the file, but this is generally true, especially in
this day of multi-gigabyte disks.  More to the point, this method was
used even when disks were tiny, so one can conclude that users would
rather have bulletproof file saves than the extra disk space. 

Joe Gwinn


In article <70dd69$234 at smc.vnet.net>, "Kevin J. McCann"
<kevinmccann at Home.com> wrote:

> I have a NB which when I try to run it tells me that there was a syntax
> error.  The popup goes on to say that I can open it as a text file,
> etc.  Is there a way to recover from this.  The problem appears to have
> been generated when Mathematica crashed.
> 
> Kevin


  • Prev by Date: Sorting of Matrixes and Lists
  • Next by Date: Re: Recommended books for Mathematica
  • Previous by thread: Corrupted NB
  • Next by thread: Re: Re: Corrupted NB