Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )
Thursday, March 26, 2015
cp -u and filesystems
The otherwise excellent cp -u variant is no good for copying between ext3 and fat32 filesystems - fat32 records last modification times to the nearest 2 seconds (just like MS-DOS!) and ext3 is much more accurate. So very often cp -u will wish to make an unnecessary copy from ext3 to fat32, and fail to suggest a necessary copy from fat32 to ext3.
There used to be a page at http://vb.mvps.org/hardcore/html/filedatestimes.htm explaining that there's even more bizarreness to the FAT32 date situation than I mention here, but it's been replaced by one of those smart-arse 404 messages, so fuck them.
Saturday, March 21, 2015
dd and 'Safely Remove Hardware'
I spent several hours of the night, early morning and morning trying to write bootable USBs using the dd+iso method. None of them would boot, and all of them showed as 'unpartitioned' to TRK and as having 1 partition to diskpart.
Finally tried not tidily clicking 'Safely remove hardware' before taking the freshly-written USB out of the PC. And it worked fine!
Possibly 'Safely remove hardware' does something to the drive that isn't necessary with a directly-written drive, and indeed that corrupts it.
Btw, I'm glad so many people are finding my original 'dd' post, it's the most popular thing I've ever written on the net by an order of magnitude, so I hope it's helpful.
Wednesday, March 18, 2015
C# try...catch scope
If you do this
XDocument xdocument;
try {
xdocument = XDocument.Load(args[1]);
} catch (Exception e) {
MessageBox.Show("All kinds of fucked up shit happened - " + e.ToString());
Environment.Exit(-3);
}
xdocument.DoStuff();
you'll get a 'use of unassigned variable' error for the xdocument.DoStuff() line.
What C# actually means is that xdocument might be unassigned at that point in the code, cos we didn't assign it on the first line of the example.
Solution is to replace the first line with:
XDocument xdocument = null;
As this page told me.
Subscribe to:
Comments (Atom)