I had a Utah ski trip on the books before the mcl thing happened. I decided to go anyway and made an eleventh hour decision to bring skis even if I wasn't fit to use them.
I spent the beginning of Friday working in the Powder Mountain lodge. It was pleasant, but I decided to risk a half day on the slopes. It went pretty well, although new snow didn't arrive until Monday. I left on Sunday. But I did get to sample the local brews and have a spontaneous League of Sport mini golf event.
Hard drive
So I always knew that Seagate sucked. I heard stories back at an old job. Ted said so and he deals with this stuff. Why did I end up with a Seagate drive? I think it was the farfetched hope that when they bought Maxtor, their desktop department would be more Maxtor than Seagate. This was naive.
My data drive (os is on ssd, of course) decided to stop working seconds to minutes after every bootup. Of course this all began just after uploading photos from a birthday session. I looked around the internets and didn't find good things:
The .11 line is notorious for this problem, especially the 1.5TB version.
The only HDDs I've had ever problems with were Seagate drives, and both were .11 drives. My issue was different - very high error counts which caused very poor performance from sector reallocation. That whole line was very problematic.
Turns out this was common enough to provoke an offer for free data recovery. Wish I had known about it when the drive was still under warranty. Would they honor it still? Doubtful. I expected them to go full ASUS. On the other hand, this appeared to be a design defect, not manufacturing.
I called customer service. Not open on weekends. Does this mean it's not outsourced? Weird. Oh well, I took matters into my own hands.
I appeared to have a brief window from which to extract files after each bootup. No way was I going to do this thing manually. Not only would all the clicking take forever, but Windows file copy isn't exactly quick. So it was time to throw together a little app.
Since my stuff was pretty well organized, there were a few well known locations I needed to save, e.g. photos/2016/*. Meaning I could plug in a few super-directories and let it do its thing - for the few moments before the drive barfed. Then reboot and repeat.
So the code had to keep progress and be ready for file access errors.
package file_copy;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class Main {
public static void main(String args[]) {
String dir = "[dir name]";
StringBuffer log = new StringBuffer();
// Define file locations.
File destination_super = new File("[new dir]");
File source_super = new File("[old dir]");
File destination = new File(destination_super, dir);
File source = new File(source_super, dir);
if (!destination.exists()) {
destination.mkdir();
}
File last_file = null;
int count = 0; // Keep track of files copied.
int fails = 0; // Let a few failures occur before bailing.
try {
if (source.exists()) {
// Randomize the files in the directory, this will avoid
hitting
// bad sectors repeatedly.
Random random = new Random();
log.append("Running: " + source.getAbsolutePath() + " " +
source.listFiles().length + " files\n");
List<File> files = new ArrayList<File>();
for (File file : source.listFiles()) {
if (files.size() == 0) {
files.add(file);
}
else {
files.add(random.nextInt(files.size()), file);
}
}
// Walk the randomized file list.
for (File file : files) {
File target = new File(destination, file.getName());
// Don't try to go deep, just inform user of a subdirectory.
if (file.isDirectory()) {
log.append("Skipped subdirectory: " +
file.getAbsolutePath() + "\n");
}
last_file = target;
if (!target.exists()) {
try {
count++;
Files.copy(Paths.get(file.getAbsolutePath()),
Paths.get(target.getAbsolutePath()));
}
catch (Exception e) {
log.append("Failed on " +
last_file.getAbsolutePath() +
"\n");
fails++;
if (fails > 7) {
throw e;
}
}
}
}
log.append("Finished " + source.getAbsolutePath() + " " +
source.listFiles().length + " files\n");
}
else {
log.append("Could not find: " + source.getAbsolutePath());
}
}
catch (Exception e) {
log.append("Failed on " + last_file + " " + count + "
completed\n");
log.append(e.getMessage());
}
try {
PrintWriter writer = new PrintWriter(
new FileOutputStream(new File("C:\\data\\output.txt")));
writer.write(log.toString());
writer.close();
System.exit(0);
}
catch (Exception e) {
System.exit(1);
}
}
}
All's well that ends well. Running it took some time (on account of the reboots), but it gave me a chance to work on my Fire Emblem: Fates playthrough.
WTF SQL?
On the subject of code, but completely unrelated, say you have a sql table with a set of columns that collectively form a uniqueness constraint. Yeah, well, for a given row, if any of those columns is null suddenly the constraint doesn't matter. Like... why?
Ugh, sql.
Pool
The pool is now indoors-ish. The primary motivation was to prevent all the leaves and junk from going into the water. It may also keep the thing warmer and reduce evaporation of water and/or chlorine.
Texts
Tatooine vacation, I guess.
Who wore it better?
Helldivers
I've gotten a bit deeper into Helldivers, and even recruited Dave for some couch co-op.
I saw through an entire galactic war (community effort). We even overflowed the shot counter.