Partitioning and Formatting Blank Drives in Vista


October 23rd, 2008

Recently, I feared that one of my USB drives might be failing, so, after moving the data off of it, I ran it through the gamut of diagnostics, including writing zeros to the drive, which, of course, blew away the data and partition table.

When I went to the Computer Management -> Storage -> Disk Management console in Vista, the drive was there, sure enough, showing as “Unallocated”. I right-clicked and went to create a New Simple Volume.

Normally, this works. I followed the prompts which asked me for the partition’s size, drive letter, and filesystem format, but to no avail. “The operation cannot be completed because the disk is not initialized.”

On closer inspection of the Disk Management screen, sure enough, the drive says Not Initialized, instead of the typical “Online”.

I could find no way to initialize this disk via the GUI. Since I have a genetic aversion to GUIs anyway (especially the useless ones), I bailed out to an Administrator command prompt.

Update

[2008-Nov-18]: As Brian wisely pointed out in the comments, it is actually possible to initialize a disk from the GUI, by right-clicking the Disk Name (i.e., the column heading to the left, in the above picture). This will actually spare you from DiskPart (below). Thanks Brian!

DiskPart to the rescue

DiskPart allows free editing of partitions. Standard disclaimer, here: if you’re not 100% sure of what you’re doing, don’t do it. It is quite possible to mess up your system and/or lose data using this tool.

So, here’s how to rebuild a disk that has been overwritten with zeros, random bits, or worse.

Step 1: Load DiskPart, and find the desired disk

C:\>diskpart

Microsoft DiskPart version 6.0.6001
Copyright (C) 1999-2007 Microsoft Corporation.
On computer: VISTA-PC

DISKPART> LIST DISK

Disk ###  Status      Size     Free     Dyn  Gpt
--------  ----------  -------  -------  ---  ---
Disk 0    Online       233 GB      0 B
Disk 1    Online       932 GB      0 B
Disk 2    Online       466 GB   466 GB
Disk 3    No Media        0 B      0 B
Disk 4    No Media        0 B      0 B

Here, we see that Disk 2 is the one we want (it is also the only one with free space, which is reassuring).

Step 2: Select the disk

This tells diskpart that any operations we want to run will affect Disk 2.

DISKPART> SELECT DISK 2

Disk 2 is now the selected disk.

Step 3: Create a primary partition

DISKPART> CREATE PARTITION PRIMARY

DiskPart succeeded in creating the specified partition.

DISKPART> ASSIGN LETTER=I

DiskPart successfully assigned the drive letter or mount point.

DISKPART>

And, seconds later, a format prompt window popped up.

Success! After a full format, the drive is back in business.

Microsoft TechNet has a good article on DiskPart here: http://technet2.microsoft.com/WindowsServer/f/?en/Library/19a9ac4d-d151-4fde-b187-9f8dfa09cb351033.mspx

DiskPart itself has some decent online help, by typing “HELP” at the prompt.

Happy formatting!

Transparent editing of GPG-encrypted files in Vim


October 21st, 2008

Markus Braun wrote an essential gnupg Vim plugin for Linux/UNIX users who regularly work with GPG encrypted text files at the command line level. (Or, perhaps, for those of you who probably should be working with GPG encrypted text files more often!) Best of all, installation is a one-liner, and it comes with some security benefits, while allowing transparent editing of encrypted files.

One-liner Installation

wget -O ~/.vim/plugin/gnupg.vim \
http://www.vim.org/scripts/download_script.php?src_id=12200

If wget complains that the ~/.vim/plugin directory doesn’t exist, type mkdir -p ~/.vim/plugin to create it.

Usage

Using this plugin really couldn’t be much easier. Simply edit any encrypted file with a .gpg, .pgp, or .asc extension, and you’ll see something like the following:

$ vim top-secret.txt.gpg

"top-secret.txt.gpg" [noeol][converted] 3L, 1045C
You need a passphrase to unlock the secret key for
user: "Ryan Thompson <email@example.org>"
2048-bit ELG-E key, ID 12345678, created 2008-05-26 (main key ID 09876543)

Enter passphrase:

Bingo! Once you key in your passphrase, you will have a normal Vim session with the unencrypted contents of the file. Upon closing the file, the plugin will re-encrypt the file.

It also supports creating new encrypted files. If you edit any nonexistent file with a .gpg, .pgp, or .asc extension, you will first be prompted (within Vim) for a list of recipients in its own buffer:

GPG: ----------------------------------------------------------
GPG: Please edit the list of recipients, one recipient per line
GPG: Unknown recipients have a prepended "!"
GPG: Lines beginning with "GPG:" are removed automatically
GPG: Closing this buffer commits changes
GPG: ----------------------------------------------------------

It’s even smart enough to detect whether recipients are in your public keyring, and will alert you if any errors arise.

Typing the command :GPGEditRecipients will allow you to edit the recipient list on-the-fly.

Security Considerations

No matter which installation method you choose, I highly recommend you verify the download, especially when dealing with software that you are about to trust with your encryption and key data!

This plugin actually takes some additional precautions that would be difficult to achieve manually. This plugin:

  • Does not use temp files. All editing is done in RAM; the plaintext is never written to disk
  • Automatically disables the Vim swapfile and viminfo, to prevent cached copies of the data from being saved on disk
  • Overrides Vim’s “write” command such that it writes back the encrypted file from the buffer

In short, this plugin makes encryption significantly easier to use on a daily basis, without compromising security (depending on your existing habits, it may arguably handle editing more securely). If that gives you the freedom to encrypt sensitive material that you previously couldn’t be bothered to encrypt, that’s a pretty big win (assuming, of course, that your Poodle doesn’t eat your private key–but that’s a topic for another article). My thanks to Markus for creating this.

Personal/Professional Balance


July 19th, 2008

Hobbies.png

Lisa Neal Gualtieri of CIO.com just published an article, “Job Hunting? Think Twice about Revealing your Hobbies”. In the article, she discourages job applicants from including the ubiquitous “Hobbies” section on their resumes, suggesting that “employers can read anything the wrong way”. She goes on to list examples, such as:

If you list artistic pursuits, such as sculptor, they worry that you work only to support your artistic passion.

and:

If you list activities revolving around children, such as soccer coach, you raise concerns about your priorities.

As someone who has made selections based on just a few tens of thousands of resumes, I completely disagree. I would never, ever pass on a candidate based on my own preconceived notion of where I think their priorities lie. Not only would I likely be overlooking well-qualified candidates, but potentially opening myself to liability via the labor laws in most jurisdictions, too.

In fact, I would be a little concerned about someone who wouldn’t put their children first. Employers, for the most part, recognize the value of a healthy work/life balance with their employees. Why on Earth would an employer not want to hire someone who had a passion for something outside of work, assuming no illegal activity or conflict of interest?

As a manager, I have happily granted leave requests for World of Warcraft campaigns, kids’ sports games, sick pets, religious holidays, band gigs, unicycling contests, and, my all-time favorite: “Hey Ryan, is it OK if I stay home today? I think I pulled something in my leg playing Wii Sports Bowling”. These people all applied the same passion and focus to their software development, and were among my top performers. Unlike some of their more dedicated counterparts, these folks didn’t burn out.

Besides–depending on your outlook–any employer that passes on your resume because you might have a life outside of work may just be helping with your job screening process.

What do you think? Please post your comments below.

[ CIO.com Article ]

Tags: , , , ,

Put Mac OS X Dashboard Widgets on your desktop


July 6th, 2008

Picture 3.png

The Mac OS X Dashboard is nice enough to completely disappear when you tell it to go away. However, in some cases, you might want one or two of the widgets to remain visible all the time, even if the Dashboard is not active. Here’s how to hack your Dashboard to do just that, in OS X Tiger or Leopard:

If F12 doesn’t bring up the dashboard: Some newer Mac keyboards have multiple functions assigned to the F12 key. If F12 turns up your system volume instead of bringing up the dashboard, you probably need to press Fn + F12 when the video prompts you to press F12.

Quick Reference

For a quick reference (or for you experts out there), here is a summary of the steps:

  1. Open Terminal (Macintosh HD -> Applications -> Utilities -> Terminal)
  2. Type the following commands:

    defaults write com.apple.dashboard devmode YES
    killall Dock

  3. Press F12 (or Fn + F12) to bring up the Dashboard
  4. Click and hold the left mouse button on the desired widget
  5. Press F12 (or Fn + F12) again
  6. The widget is now on the desktop

To put the widget back in the Dashboard, simply repeat steps 4 and 5.

If you found this helpful, I would really appreciate it if you would give the video a 5-star rating on YouTube.

Tags: , , , , , ,

Sharp to Unveil See-Through Solar Cell Module


July 5th, 2008

I am a pretty big proponent of alternative energy sources, and I’ve always had a special place in my heart for solar. After all, even at a distance of eight light minutes from the Sun (that’s 93 million miles, or 152 million km), we still get enough energy on every square meter of the Earth’s surface on average to power 40 or 50 MacBooks. This of course is an average, and is based on 100% efficiency in collecting the energy. There is real potential, here.

Sharp announced yesterday that they will be exhibiting “environmentally conscious” products in the Environmental Showcase in the G8 Summit. One of the products they are unveiling is a “Thin-Film Solar Cell Module”, which apparently incorporates a “see-through solar module”. That’s right. See-through solar collector. They call this a “quantum leap in innovation”.

To be honest, it took me a few minutes to appreciate the significance of this. After all, solar cells work by absorbing light. If light is allowed to pass through, the solar cell obviously isn’t absorbing it. However, the visible spectrum makes up only a small part of the energy we get from the sun, so there is still, in theory, plenty of energy to absorb. When you give it a few minutes’ thought, see-through solar cells could have many useful applications.

When we can start replacing skylights, windows, vehicle windshields, and other bits of transparent exterior with solar panels, solar energy can gain a lot more real-estate that would not have been previously accessible. Hence, even with less efficient panels, the benefit could be huge.

Sources: [ Sharp, Wikipedia ]

Tags: , , ,