Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Corruption of file
Replies: 3   Last Post: Dec 19, 2012 4:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David Bailey

Posts: 712
Registered: 11/7/08
Re: Corruption of file
Posted: Dec 19, 2012 4:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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
http://www.dbaileyconsultancy.co.uk







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.