scan - Dave's Blog

Search
My timeline on Mastodon

Tweet from David Risney

2016 Sep 19, 3:05
@David_Risney Scan reveals the creatures are passive and no threat. But... they're so... ugly. Time to leave this solar system forever.
PermalinkComments

Tweet from David Risney

2016 Sep 19, 3:04
Playing No Man's Sky collecting resources on an hospitable planet and suddenly notice several creatures approaching. I quickly scan them.
PermalinkComments

Tweet from Anil Before Zod

2016 Aug 18, 5:42
More than 2000 kids' lives were ruined by the "kids for cash" bribery scandal, including some suicides; the CEO who did it is already free.
PermalinkComments

Tweet from David_Risney

2015 Oct 14, 2:54
Thor's hammer = Microwave's electromagnet + Arduino + fingerprint scanner. Inventor trolls Venice Beach bystanders: http://www.cnet.com/news/engineer-builds-working-thors-hammer-only-he-can-lift/ …
PermalinkComments

Tweet from David_Risney

2015 Oct 7, 10:17
An interesting history of car manufactures cheating emissions tests: http://arstechnica.com/cars/2015/10/volkswagens-emissions-cheating-scandal-has-a-long-complicated-history/ …
PermalinkComments

Retweet of dangoodin001

2015 Mar 23, 5:55
We know where you’ve been: Ars acquires 4.6M license plate scans from the cops. Fantastic reporting by @cfarivar http://ars.to/1LShUdc 
PermalinkComments

Going Paper-Free for $220 / Steve Losh

2011 May 26, 1:17PermalinkCommentshowto paperless scanner ocr technical

Feasibility and Real-World Implications of Web Browser

2010 May 23, 4:32"The ability to detect visitors' browsing history requires just a few lines of code. Armed with a list of websites to check for, a malicious webmaster can scan over 25 thousand links per second (1.5 million links per minute) in almost every recent browser."PermalinkCommentstechnical privacy security web browser

NOVA | The Pluto Files | Hate Mail from Third Graders (non-Flash) | PBS

2010 Apr 15, 2:52Scans of some of a few instances of hate mail Neil deGrasse Tyson received from elementary school students after demoting Pluto to non-planet status.
PermalinkCommentshate-mail mail humor cute children neil-degrasse-tyson science pluto space planet astronomy

ARMY MAN: America's Only Magazine - a set on Flickr

2010 Feb 2, 2:49A small number of select scans at higher resolution
PermalinkCommentsflickr photo army-man scan humor

Picasa Web Albums - JanJaap - army man scans

2010 Feb 2, 2:40Scans of the Army Man zine. Unfortunately they're in just poor enough quality to make you squint and wish and pretend.PermalinkCommentsarmy-man humor magazine zine photo scan

3D scanning with a plain webcam - Boing Boing

2009 Nov 20, 6:43PermalinkCommentsvideo 3d scanner technical

Kid Robot’s QR Code Scavenger Hunt - PSFK

2009 Sep 1, 4:59"...toy and apparel designers Kid Robot (with the help of creative ideas studio We Are Plus) have organized a mobile phone-based scavenger hunt in Manhattan centered around scanning QR codes."PermalinkCommentsqrcode phone scavenger-hunt toy advertising

Time/Date Conversion Tool

2009 Aug 28, 3:39

I built timestamp.exe, a Windows command line tool to convert between computer and human readable date/time formats mostly for working on the first run wizard for IE8. We commonly write out our dates in binary form to the registry and in order to test and debug my work it became useful to be able to determine to what date the binary value of a FILETIME or SYSTEMTIME corresponded or to produce my own binary value of a FILETIME and insert it into the registry.

For instance, to convert to a binary value:

[PS C:\] timestamp -inString 2009/08/28:10:18 -outHexValue -convert filetime
2009/08/28:10:18 as FILETIME: 00 7c c8 d1 c8 27 ca 01

Converting in the other direction, if you don't know what format the bytes are in, just feed them in and timestamp will try all conversions and list only the valid ones:

[PS C:\] timestamp -inHexValue  "40 52 1c 3b"
40 52 1c 3b as FILETIME: 1601-01-01:00:01:39.171
40 52 1c 3b as Unix Time: 2001-06-05:03:30:08.000
40 52 1c 3b as DOS Time: 2009-08-28:10:18:00.000
(it also supports OLE Dates, and SYSTEMTIME which aren't listed there because the hex value isn't valid for those types). Or use the guess option to get timestamp's best guess:
[PS C:\] timestamp -inHexValue  "40 52 1c 3b" -convert guess
40 52 1c 3b as DOS Time: 2009-08-28:10:18:00.000

When I first wrote this I had a bug in my function that parses the date-time value string in which I could parse 2009-07-02:10:18 just fine, but I wouldn't be able to parse 2009-09-02:10:18 correctly. This was my code:

success = swscanf_s(timeString, L"%hi%*[\\/- ,]%hi%*[\\/- ,]%hi%*[\\/- ,Tt:.]%hi%*[:.]%hi%*[:.]%hi%*[:.]%hi", 
&systemTime->wYear,
&systemTime->wMonth,
&systemTime->wDay,
&systemTime->wHour,
&systemTime->wMinute,
&systemTime->wSecond,
&systemTime->wMilliseconds) > 1;
See the problem?

To convert between these various forms yourself read The Old New Thing date conversion article or Josh Poley's date time article. I previously wrote about date formats I like and dislike.

PermalinkCommentsdate date-time technical time windows tool

Apollo 11 lunar and command module software open-sourced

2009 Jul 23, 2:59"hand-typed from original scans by the Virtual AGS project; in the comments, numero mysterioso and hope hope hope"PermalinkCommentshumor code space programming via:waxy technical

PowerShell Scanning Script

2009 Jun 27, 3:42

I've hooked up the printer/scanner to the Media Center PC since I leave that on all the time anyway so we can have a networked printer. I wanted to hook up the scanner in a somewhat similar fashion but I didn't want to install HP's software (other than the drivers of course). So I've written my own script for scanning in PowerShell that does the following:

  1. Scans using the Windows Image Acquisition APIs via COM
  2. Runs OCR on the image using Microsoft Office Document Imaging via COM (which may already be on your PC if you have Office installed)
  3. Converts the image to JPEG using .NET Image APIs
  4. Stores the OCR text into the EXIF comment field using .NET Image APIs (which means Windows Search can index the image by the text in the image)
  5. Moves the image to the public share

Here's the actual code from my scan.ps1 file:

param([Switch] $ShowProgress, [switch] $OpenCompletedResult)

$filePathTemplate = "C:\users\public\pictures\scanned\scan {0} {1}.{2}";
$time = get-date -uformat "%Y-%m-%d";

[void]([reflection.assembly]::loadfile( "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll"))

$deviceManager = new-object -ComObject WIA.DeviceManager
$device = $deviceManager.DeviceInfos.Item(1).Connect();

foreach ($item in $device.Items) {
        $fileIdx = 0;
        while (test-path ($filePathTemplate -f $time,$fileIdx,"*")) {
                [void](++$fileIdx);
        }

        if ($ShowProgress) { "Scanning..." }

        $image = $item.Transfer();
        $fileName = ($filePathTemplate -f $time,$fileIdx,$image.FileExtension);
        $image.SaveFile($fileName);
        clear-variable image

        if ($ShowProgress) { "Running OCR..." }

        $modiDocument = new-object -comobject modi.document;
        $modiDocument.Create($fileName);
        $modiDocument.OCR();
        if ($modiDocument.Images.Count -gt 0) {
                $ocrText = $modiDocument.Images.Item(0).Layout.Text.ToString().Trim();
                $modiDocument.Close();
                clear-variable modiDocument

                if (!($ocrText.Equals(""))) {
                        $fileAsImage = New-Object -TypeName system.drawing.bitmap -ArgumentList $fileName
                        if (!($fileName.EndsWith(".jpg") -or $fileName.EndsWith(".jpeg"))) {
                                if ($ShowProgress) { "Converting to JPEG..." }

                                $newFileName = ($filePathTemplate -f $time,$fileIdx,"jpg");
                                $fileAsImage.Save($newFileName, [System.Drawing.Imaging.ImageFormat]::Jpeg);
                                $fileAsImage.Dispose();
                                del $fileName;

                                $fileAsImage = New-Object -TypeName system.drawing.bitmap -ArgumentList $newFileName 
                                $fileName = $newFileName
                        }

                        if ($ShowProgress) { "Saving OCR Text..." }

                        $property = $fileAsImage.PropertyItems[0];
                        $property.Id = 40092;
                        $property.Type = 1;
                        $property.Value = [system.text.encoding]::Unicode.GetBytes($ocrText);
                        $property.Len = $property.Value.Count;
                        $fileAsImage.SetPropertyItem($property);
                        $fileAsImage.Save(($fileName + ".new"));
                        $fileAsImage.Dispose();
                        del $fileName;
                        ren ($fileName + ".new") $fileName
                }
        }
        else {
                $modiDocument.Close();
                clear-variable modiDocument
        }

        if ($ShowProgress) { "Done." }

        if ($OpenCompletedResult) {
                . $fileName;
        }
        else {
                $result = dir $fileName;
                $result | add-member -membertype noteproperty -name OCRText -value $ocrText
                $result
        }
}

I ran into a few issues:

PermalinkCommentstechnical scanner ocr .net modi powershell office wia

HP All-in-Ones-The Scan Button on the All-in-One Does Not Function When the Printer is Connected to Windows Vista

2009 Jun 20, 9:45"When the scan button is pressed on the product, nothing happens. The scan button does not work correctly." The workarounds are all basically, "don't use that button then." They say their Vista driver doesn't support sending the appropriate event. Lame.PermalinkCommentsvista hp scanner driver lame technical

Coding4Fun : Look at me! Windows Image Acquisition

2009 Jun 20, 9:43How to use the WIA APIs in C#. WIA is Windows API to get images from scanners and cameras. And, as I found out, if you want to use the API in PowerShell try '$deviceManager = new-object -ComObject WIA.DeviceManager'PermalinkCommentsvideo scanner api wia csharp howto programming camera image photo .net webcam technical

Free OCR software? You may already have it... - Jon Galloway

2009 Jun 20, 9:39If you have Office installed you may have an OCR library sitting on your hard drive just waiting to be used via C#...PermalinkCommentsocr microsoft office .net automation scanner camera windows technical

Send URL to Cellphone - QR Encode Accelerator

2009 Apr 14, 9:26

I've made a QR Encode accelerator around Google Chart's QR code generator. QR codes are 2D bar-codes that can store (among other things) URLs and have good support on mobile phones. The accelerator I've written lets you generate a QR code for a selected link and view it in the preview window. In combination with the ZXing bar-code scanner app for my Android cellphone, its easy for me to right click on a link in IE8 on my desktop PC, hover over the QR Encode accelerator to have the link's associated QR code displayed, and then with my phone read that QR code to open my phone's browser to the URL contained inside. Its much easier to browse around in the comfort of my desktop and only send particular URLs to my cellphone as necessary.

PermalinkCommentstechnical boring accelerator android barcode ie8 google qr code
Older Entries Creative Commons License Some rights reserved.