Monthly Archives: June 2009

Octospider time

day tert woden feng nillet
1 8 64 512 4,096
1 8 64 512
1 8 64
1 8

1 day = 32 hours, 14 minutes, 6.2 seconds

Yes I was masochistic enough to read all 3 Rama books.

Hard drive data recovery

I spent some time over the last week attempting to recover data from a friends laptop hard drive. The machine was dropped from a kitchen table (about 4′) while the disc was spinning and we think writing to the drive. The machine had Windows XP Home (really) and was formatted as NTFS. I never did get the partition table back and so was only able to recover files individually. Thousands of files (35,000 files @ 30GB) with auto-generated names. Figuring out how to put that Humpty Dumpty mess back together is a lost cause.

Booting from a Ubuntu Rescue Remix v9.04 CD, I was able to use Gnu ddrescue to image the drive to an external USB. When TestDisk failed to find the partition information for the main partition, I ended up using PhotoRec to recover as many files as possible. It took the better part of a week just to image the drive and run PhotoRec.

A new hard drive is currently on the way so I can get the machine up and running again. The original drive is still there in case I get a chance to try more aggressive techniques or better technology comes along.

As a personal reminder these are the commands I issued to clone the bad drive:

# mount USB thumb drive for log file
mkdir /tmp/flash
mount /dev/sdb1 /tmp/flash
cd /tmp/flash

# clone drive
sudo mount -t vfat -ouid=ubuntu,gid=users /dev/sdb1
ddrescue -n /dev/sda /dev/sdc logfile
ddrescue -r3 /dev/sda /dev/sdc logfile

Creating/Editing Excel files from the command line

I knew there was an automation object to do this but I never actually had to figure it out until today. I’ve used VBA to automate one app from another (Excel to create a Word doc for example). This little vbs script will update a cell on an existing spreadsheet with the first parameter passed to the script:

Dim objArgs
Dim val
Dim objExcel
Dim objWorkbook

Set objArgs = WScript.Arguments
val = objArgs(0)
Set objExcel = CreateObject(“Excel.Application”)
‘ relative paths do not seem to workat least not ones relative to the CMD interpreter’s current directory.
Set objWorkbook = objExcel.Workbooks.Open(“C:\temp\Book1.xls”)
objExcel.Cells(1, 1).Value = val

There is also an SQL way to do this that uses ADO but even in Excel 2007 it seems buggy at best. If you tend to think of everything like a database though it may be the way to go for you. In this case you open the spreadsheet as though it was a simple database table. By default the top row is assumed to have column headers. Turning that off was one of the many things that does not seem to work very well.

Dim objArgs
Dim szConnect
Dim objConn
Dim val

Set objArgs = WScript.Arguments
val = objArgs(0)
‘ relative paths seem to work with this approach
szConnect = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=””Excel 8.0″”;”
Set objConn = CreateObject(“ADODB.Connection”)
objConn.Open szConnect
objConn.Execute szSQL “update [Sheet1$A1:A1] set F1='” & val & “‘;”
Set objConn = Nothing

You can also do something like this to open the datasource.
objConn.ConnectionString = “Driver={Microsoft Excel Driver (*.xls)};DBQ=Book1.xls;ReadOnly=False;FirstRowHasNames=0;MaxScanRows=1”

Beyond Compare

Beyond Compare from Scooter Software is one of my favorite tools. It even runs on Linux.

Reliable Software’s Code Co-Op can even use it for merging.

Homebrew Chocolate Oatmeal Stout – part deux

So I did the math and since I had to buy all of the equipment my stout ended up costing $18.49 per 16oz. bottle! Of course, my next batch should only be about $1.70 per bottle.

When I bottled the beer it was 58 degrees with a specific gravity of 1.022. 58 is pretty close to the calibration temp for my hydrometer so no adjustment is needed. This gives us a potential alcohol of around 2.6%.

When I brewed and cooled the beer for fermenting it was 75 degrees with a specific gravity of 1.060. 75 degrees means we need to adjust the SG by 0.0018 which we’ll call 0.002. So we end up with 1.062. This gives us a potential alcohol of around 8.1%.

Subtracting 2.6% from 8.1% gives us a final alcohol percentage of 5.5%.