Archive for the ‘Computers’ Category

Saved by PhotoRec

This weekend I had a memory card catastrophically fail. I had done a portrait shoot with coworkers earlier that day, and had shot Laura’s rehearsal and about an hour of the dinner when the camera said something like “Failed to write. Invalid Card.” I turned the camera off, back on, and pressed the Play button: “Folder contains no images”. Oh crap.

I figured there would be some utility that might help, so I immediately removed the card and set it to read-only, and put a new card in. I continued shooting the rehearsal dinner, and some barely willing subjects even said “But you already took a picture of us!” Yeah, sorry about that. I may not have that picture.

When I got home, I put the card in the SD reader in my wife’s laptop. Windows 7 recognized the card, but told me it was unformatted. When I looked at the card in Disk Manager,  it said it was partitioned, but with no file system. Oh dear. Remembering my Unix Admin days, I started looking for a Windows equivalent to the dd command, figuring that if I read the raw partitition, I might be able to find some way to extract the files. In my searches, I saw mention of PhotoRec.

I downloaded the program, told it where to find the memory card, and told it that the card had a PC based file system (as opposed to Linux/Unix) and told it where I wanted to save the files. 15 minutes later, I had a directory full of JPG and NEF files. The file names were apparently randomish sequential numbers, but that’s OK–JPGs are easy to rename.

So, PhotoRec saved my butt. All the photos I took that day were recovered, along with some older files from months ago.

 

KB980232 and thumbnails on a network drive

We have a network drive, NSLU2 with Unslung,  with some secured SMB shares that we each have mapped for easy family access to photos, MP3, etc. A few weeks ago, my wife started to notice that there were problems viewing thumbnails on this drive. Everything else seemed to be fine, but if she was browsing a folder in a thumbnail view, only some of the thumbnails would be visible. Tonight she discovered that only the files that she had opened in some sort of viewer would then have a thumbnail visible. We used to see all the thumbnails without any difficulty, though it was sometimes slow to load them for large directories.

Today I finally figured out the problem: KB980232 has evidently fixed some vulnerabilities in their implementation of the SMB client. I uninstalled the update (rebooted) and now the thumbnails view perfectly. After reading the threat assessment, I don’t think it will be possible (or at least it is incredibly unlikely) for someone to offer us a specially formed SMB link inside our network that could have malicious code on it. So I’ve set Windows Update to hide this update so we don’t get it again.

 

My Daughter’s First Program

My daughter has been expressing interest in learning “how to program” for a couple of weeks now. I’ve attempted to narrow down a little bit what that means to her: Windows programs? Web Programs? Web Pages? Flash games? The computer technology world seems endless at this point–and that’s coming from someone who earns his living in the industry. Perhaps that’s a little bit of my problem–I see too much possibility in the request to learn “how to program”. She really wasn’t able to narrow it down much at all because she is at that age where she is interested in a great many things. And she’s bright enough to grasp real programming concepts, and as a result, the technology world really is wide open to her.

A couple of weeks ago, I went looking for resources to help teach a kid about real programming. I decided to start where I started–BASIC. I learned to program in basica back in the early 80s. I figured VisualBasic would be a good place for her to start. Fortunately, Microsoft makes VisualBasic Express available for free and even has an e-book VB for Very Bright Kids.

Today we started working through the first couple of chapters. The look on my daughter’s face when she ran her first program–the modern equivalent to “Hello World”, “PleaseSayYo”–was priceless. Here, for posterity, is her first program:

Imports System

Class PleaseSayYo
Shared Sub Main()
Console.WriteLine(“Yo!”)
Console.ReadLine()
Console.WriteLine(“Barack Obama is Prezident!”)
Console.ReadLine()
Console.WriteLine(“I didn’t Like McCain.”)
Console.ReadLine()
Console.WriteLine(“Got to go. Bye!”)
Console.ReadLine()
End Sub
End Class

We’re continuing to work through the topics, covering classes, objects, properties, methods, and even subroutines. To help explain subroutines and parameters, I helped her re-write the above using a subroutine:

Module Module1
Sub Writeandread(ByVal message As String)
Console.WriteLine(message)
Console.ReadLine()
End Sub
Sub Main()
Writeandread(“Yo!”)
Writeandread(“Barack is President!”)
Writeandread(“I didn’t like McCain.”)
Writeandread(“Got to go. Bye!”)
End Sub
End Module

She’s very excited–much more so than I would have thought she would be. I thought she would get frustrated at not writing a new Club Penguin in 1 hour or less. But she is, for now at least, completely immersed.

 

Using winscp to back up my mom’s files

My mom has a computer, but it has been years since I encouraged her to have any sort of data backup plan. I have two low-cost, low pain (for her) options for attempting to secure her data.

  1. Plug a USB drive into the back of her PC, and script an xcopy command (or something similar) so that every hour or so, it copies her important files to the drive. This would be cheap (she doesn’t have that much data), and pretty easy. The solution would protect against drive failure, but not against robbery, fire, or flood.
  2. Use winscp to securely copy her files over her internet connection to my NSLU2 network storage. This is more complicated, costs nothing but a bit of time to figure it out, and protects against all possible forms of data loss (unless our whole city is consumed with a fire or flood).

Since I’m already sharing my NSLU2 with Skippy, and I’ve got way more space than she’ll ever need, and I like a bit of a challenge, I’ll go with winscp.
Some pre-requisites that I’ve already got set up:

  • NSLU2 running Unslung.
  • Use OpenSSH for remote access.
  • Forward a port on my router to the OpenSSH port on my NSLU2.
  • Establish an account with a Dynamic DNS host, such as DynDNS.com, and set up my router to check in with DynDNS to update my IP address periodically.

Now, on to using winscp for this application.

  1. Download the “portable” version of winscp and  save it to a new directory. I renamed it from winscp416.exe to just winscp.exe.
  2. Create a new user on my NSLU2 for my mom, and give the account ssh access.
  3. Establish the first winscp session to my NSLU2 to save the security keys: winscp sftp://user:password@host:port
  4. Save that session in winscp by choosing Save Session… from the Session menu. The default name was user@host, and I chose to keep the password.
  5. Create a list of winscp commands, and store them in winscp-commands.txt. The following commands will copy everything from the current directory structure to the home directory on the NSLU2.

    option batch on
    option confirm off
    option transfer binary
    synchronize remote -delete
    close
    exit

  6. Create a batch file, named backup-files.cmd with the following command
    winscp user@host /console /script=winscp-commands.txt
  7. Set backup-files.cmd to run as a scheduled task.

The “synchronize remote -delete” command will put all files from the local directory into the remote directory, deleting any files on the remote that have been removed from the local.

It is also possible to add multiple synchronize commands to this file, but be careful, because the remote directory must exist for the sync to work. For example:

synchronize remote -delete “c:\documents and settings\me” /user/my_stuff

will only work if the directory /user/my_stuff already exists.

 
  

Switch to our mobile site