MathGroup Archive 2012

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

Search the Archive

Re: Corruption of file

  • To: mathgroup at
  • Subject: [mg129176] Re: Corruption of file
  • From: David Bailey <dave at>
  • Date: Wed, 19 Dec 2012 05:00:59 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <kap6ca$46e$>

On 18/12/2012 07:35, Alexei Boulbitch wrote:
> Dear David, dear John, dear Helen,
> Yes this file is very valuable. In fact it is one of the files, where I collect tips and tricks on Mathematica learned from others or invented by myself, but those that I have at least once successfully tried. It enormously accelerates my work.
> And for this reason, yes, I made a backup rather recently, so I have not lost a lot. I had already such an event once, few years ago and then I lost alot of valuable information: a lecture prepared during several days.
> David, none of the scenarios proposed in your mail was the case. Just in a fresh notebook I made a cell with a simple code illustrating the new way of the use of LineLegends and Placed statements in M9 like this:
> Plot[{t*Exp[-t], Sin[t^2]}, {t, 0, 2 \[Pi]}, PlotStyle ->  {Red, Blue},
>    PlotLegends ->
>    Placed[LineLegend[{Red, Blue}, {"exp", "sin"},
>      LegendLayout ->  "Column"], Scaled[{0.15, 0.2}]]]
> and evaluated it successfully. Then I copy-pasted this cell into another notebook, the one in question. This time it was a very large notebook, where I made a separate cell for this example. I also inserted two comments of the form (* a comment *) like this:
> Plot[{t*Exp[-t], Sin[t^2]}, {t, 0, 2 \[Pi]}, PlotStyle ->  {Red, Blue},
>   (* the Legend starts here *)
>   PlotLegends ->
>    Placed[LineLegend[{Red, Blue}, {"exp", "sin"},
>      LegendLayout ->  "Column"], Scaled[{0.15, 0.2}]]
>   (* The Legend ends here*)
>   ]
> and again evaluated it, this time in the large notebook. In the process of this second evaluation I have got the message described below, and the notebook got corrupted.
> First I thought that this may be the comment problem (as described by Fred Simons few days earlier). For this reason I tried to make the same code with comments in another (fresh) notebook and evaluate it. It evaluated successfully.
> I tried the way proposed by Helen Read (see below), it did not work in M9.
> I tried to open the file by the Notepad and cut away the mentioned piece of the text: bdnhsNoXjUtzE3OjHyBhBxTcduHehni+. It did not help. I tried to find and cut away the whole new cell, but did not really succeeded to find where the cell starts and stops. The more that I am not sure that the corrupted part is in that cell.
> John, I tried to send you the file, but the server rejected my mail saying that your address does not exist. I will try again later.
> My question is not that much about how to open just this file. It is more general: what could be done in such a case? Just in case it will start happening.
> Best, Alexei

One advantage of having been a software developer for many years, is 
that disks broke very frequently in the past, so we all got used to 
backing up our programs and data multiple times, and checking that the 
backup was sound!

Nowadays I use a product called EASEOUS TODO BACKUP (I know it is a 
crazy name!), which used to be free, but costs something now. Under 
Windows, it will copy a compressed version of the partition(s) holding 
your data and operating system, on to another drive. Typically the 
compressed drive is much smaller than the capacity of the original 
drive. The beauty of this software, is that it will open a compressed 
drive as a read-only drive, so that individual files can be retrieved, 
and if your drive fails completely, you can restore the drive on to a 
new drive of the same size or larger!

The Mathematica box structure is quite intricate, as I am sure you have 
discovered, and unless it is fixed down to the last comma, it will not 
load into Mathematica. The portion of random text in your example, may 
have replaced some box structures and brackets - so just cutting it out, 
doesn't generate a viable notebook.
One approach can be to identify whole cells in the structure, and remove 
the damaged ones with a text editor.

I like to keep my code in .m files, rather than notebooks. These can be 
edited inside Mathematica, very much like notebooks, but are relatively 
small files because when you save them, the output cells are not 
preserved. This seems to greatly reduce problems of corruption. Note 
that although a .m file is called a package file, it does not need to 
contain a package!

I guess it is a problem for WRI, but of course, it is very hard to 
specify exactly how it happened after the event!

David Bailey

  • Prev by Date: PlotLegends package obsolete?
  • Next by Date: Re: Incorrect Summation
  • Previous by thread: Re: Corruption of file
  • Next by thread: Help_Dynamic_Popupmenu