# OCR PDF on Windows

This turns out to be fairly easy.
1. Install Tesseract
2. Convert your PDF to TIFF (Print > Fax > check option print to file and save as TIFF)
OR install Ghostscript, and convert using the command line (I installed the 64 bit version):
gswin64c -r300x300 -o out.tif -sDEVICE=tiffg4 in.pdf
3. Convert the PDF: tesseract input.tif out -l deu pdf (skip the -l deu bit if it’s not in German; out is the name of the output file, the extension, e.g. pdf, will be appended)

Done.  You can even get Google to translate the output.

# Show only unread or flagged or todays mail in Outlook

I use this filter so that I can manage my inbox in outlook. It means that once I’ve read a message, it isn’t shown unless I flag it. I also have a filter that keeps todays mail shown too.

Adding the “Change View” option to the quick launch bar makes changing between views less painful. Go to the “View” ribbon and then right click “change view” and “add to quick access toolbar”:
Select “Manage Views”:
Select New, and give it a name, hit ok:
Select “Filter”, and enter one of these:
a)  Only unread and flagged:
(“urn:schemas:httpmail:read” = 0) OR (“http://schemas.microsoft.com/mapi/proptag/0x10900003” > 1)
b)  Unread, flagged and todays messages:
(“urn:schemas:httpmail:read” = 0) OR (“http://schemas.microsoft.com/mapi/proptag/0x10900003” > 1) OR (“urn:schemas:httpmail:datereceived” >= ‘Today’)
Hit OK a few times and then select you view.  Sorted.

# Running a Canon CanoScan FS 2710 on Windows 10

…Isn’t easy.

I have an Adaptec AHA-2940 SCSI controller, which doesn’t have any drivers available on their support site for x64 systems.  I found them on a forum somewhere (perhaps not overly trust worthy): AdaptecAic78xx.  They have been taken from a Windows 7 x64 system apparently.

These aren’t signed, so you have to disable driver signing:

1. Hit the start button, power and then shift-click restart.
2. Select “Troubleshoot”->“Advanced options”->“Windows Startup Settings”->restart.
3. When the system starts up you get a selection of options.  Option 7 disables driver signing requirements.

Then you can go to device manager, update the driver, go to “have disk” and select the folder extracted from the zip linked above.

The next bit isn’t all that intelligent, but works.  Go buy VueScan, it seems to have drivers for every scanner under the sun.

# PowerShell – Delete all directories with a given name recursively

It turns out to be a bit of a pain to delete all the directories/folders with a certain name.  This’ll do it.

Get-ChildItem C:\path\to\start\directory -Include search1,search2 -Recurse -force | Remove-Item -Recurse -Force

It just gets all the child items in a directory recursively and then removes them.  The -Recurse parameter on the Remove-Item is so that the entire directory and its contents are removed.  search1 and search2 are the the names it is looking for – more or less could be included.

# Delete all files with a given extension recursively

Windows CLI one liner:

FOR /R "c:\path\to\directory" %I IN (*.gz) DO del "%I"

Just iterates recursively over the given directory, and in this case just the .gz files, and deletes them.

# Extract all compressed (gzip zip) files in a directory recursively

Another one liner, but for Windows CLI:

FOR /R "C:\path\to\directory" %I IN (*.gz) DO "c:\Program Files\7-Zip\7z.exe" x "%I" -aou -o"%~dpI"

This requires z-Zip to be installed.  The gz could be altered to another compressed file extension.

# Update last modified date to current date for all items in a directory using powershell

The title says it all.  It’s incredibly simple:

gci | %{$_.LastWriteTime = date} gci is shorthand for Get-ChildItem, and % is shorthand for ForEach-Object.$_ refers to the current element being iterated over.  Date returns the current date (and time).

The script therefore gets all items (in the context of the current directory) and updates the LastWriteTime for them all to the current date.  Sorted.

# MS SQL 2012 Fails to install – installation never goes past installing setup files

Whilst attempting to get some software to communicate with MS SQL Server 2012, I decided to try reinstalling SQL.  I removed all the SQL components in add/remove programs and attempted a reinstall.  The installer got part way and then just gave up.

After some Googling, I found that the SQL installer leaves log files in %temp% (SqlSetup.log and SqlSetup_1.log).  SqlSetup_1.log had the following lines:

07/29/2013 12:44:41.033 Error: Failed to launch process
07/29/2013 12:44:41.033 Error: Failed to launch local ScenarioEngine.exe: 0x80070003

Nothing on the net seemed to have a solution (or I need to improve my Google skills).  I found one post about VS2010 problems which seemed vaguely related and decided to remove all the visual studio components to see if that sorted things.  It did.

A dialog from the installer and a more helpful error message would have been nice.