Home Download Buy Blog Forum Support

Lost an afternoon's work using ST2

Lost an afternoon's work using ST2

Postby dmorrill on Mon Jan 23, 2012 12:30 pm

I just lost an entire afternoon's work using ST2, and was wondering if anyone else has run into a similar situation.

Here's what happened:

- I plugged my laptop in at a Starbucks and did several hours work which involved creating a new file in ST2 as well as editing several other files using a different text editor (jEdit). Being my normal, cautious self, I saved all edited files frequently. The ST2 file was probably last edited and saved an hour or two before I wrapped up the session.
- My Windows 7 laptop was (unknown to me) suffering from the bug that prevents charging the battery when plugged in. The battery had over time lost its charge (since the bug was preventing it from charging). So when I left Starbucks and closed the lid and unplugged it, the machine crashed.
- When I got home and went to resume editing the file, I first had to wait while the machine mysteriously had to re-boot (I didn't know about the battery bug at this point).
- Once re-booted, I restarted ST2, only to find that the file I had been editing was blank.
- All of the other files I had been editing in jEdit were fine.
- The ST2 file existed, and had a size of about 5K (probably the right size), but when I checked its contents more closely, I found that every byte was a \x00.

Now, I'm tempted to blame this on the Windows 7 file cache never having been flushed to disk before the crash, but since it probably had over a hour before the crash to flush it to disk, I doubt that is the problem. And since the jEdit files were all fine, this leads me to think that somehow ST2 was involved in the lost data.

I don't know if ST2 was to blame, but it does now have the dubious distinction of being the only text editor I have used in the last 20 years that has caused me to lose data :-(
dmorrill
 
Posts: 11
Joined: Sun Oct 16, 2011 4:47 pm

Re: Lost an afternoon's work using ST2

Postby iamntz on Mon Jan 23, 2012 12:41 pm

Maybe you have a Dell computer with this setting?
Image
iamntz
 
Posts: 910
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Lost an afternoon's work using ST2

Postby sublimator on Mon Jan 23, 2012 1:07 pm

Sublime usually *saves* work during a powerout, with the autosave/session feature.

Ouch. An on_save backup plugin could better your odds.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Lost an afternoon's work using ST2

Postby jps on Mon Jan 23, 2012 1:18 pm

Sublime Text does a simple fopen, fwrite, fclose sequence to write a file. Null bytes are not written to disk at any point.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Lost an afternoon's work using ST2

Postby dmorrill on Mon Jan 23, 2012 2:06 pm

iamntz wrote:Maybe you have a Dell computer with this setting?


Actually it is a Samsung. Once I realized there was a problem, I googled for it and quickly found that it was a fairly common Windows 7 bug. I followed a long sequence of steps to remedy the problem, and the end result was that the battery started charging again. Don't know why the problem suddenly starting occurring, but it seems to be gone for the moment...
dmorrill
 
Posts: 11
Joined: Sun Oct 16, 2011 4:47 pm

Re: Lost an afternoon's work using ST2

Postby alanandersen1 on Tue Jan 24, 2012 7:21 pm

I thought I had something similar happen to a tomcat .log file I had open just now and I remembered this post and thought I'd mention it. I had deleted everything in it and saved it to get a clean log, did some testing, went back to the tomcat log file tab and it looked something similar, mostly (but not all) null bytes. Then i realized it looked a lot like the hex editor that ST2 uses for binary files, so I used the reopen with encoding option to UTF-8 and it looked normal again. Every time I open that file however it still opens it in hex and to view it normally I have to reopen with encoding. Restarting ST2 doesn't seem to fix it. All my other log files open normally though...
alanandersen1
 
Posts: 10
Joined: Mon Jul 25, 2011 4:45 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 41 guests