Thursday, January 26, 2012

How to Shampoo Your Employees

I joined the Israeli Defense Force in 1997 and served the mandatory three year period as a software developer. Army service usually consists of three* phases: first year - you learn the ropes, second year - you get things done, third year - you teach the new guys.

The Hebrew term for this period where the veterans teach the newcomers is called "the overlap", which, incidentally, is exactly the same Hebrew word for "shampooing". Don't ask me why. It's weird. So the veterans shampoo the newcomers and thus the wheels keep rolling from year to year.

Something similar happens in software companies. The term "training period" doesn't really capture the essence of what really goes on. Newcomers are often extremely well trained at their job already and all they really have to go though is a getting-to-know phase. Getting to know the product, the team, how things usually work. You know, shampooing... English speakers, I suggest you adopt this term.

One problem that plagues many software teams is knowledge hoarding. You all know someone like that. Someone who really loves being the most informed. Some veteran to whom everyone comes with questions. I guess some people think that makes them more valuable. I think they should be fired as quickly as possible because I've yet to see someone like that actually mend his ways. 

The perfect team player, on the other hand, is someone who's powerful, effective, but also completely replaceable. Like a CPU core. Your machine has four of them. They're expensive and they get things done. But lose one of them and your computer will keep on going, just a little slower. There's nothing it won't be able to do with just three cores, and when you plug in a new one things will go back to normal. 

Now here's the secret for ultimate shampooing. 
Ready?
Take the third year and the first year and squish them together. In other words, when a newcomer arrives on the scene his first order of business is to write the shampooing plan for his replacement. If one was already written, he can improve and augment it as he picks things up. 

That's a great general principle, and it applies not only to newcomers, because in our line of work we constantly learn new things. Keep nothing solely in your head. Be mindful of what you learn, and document it in a discover-able, public way. Not only the idiosyncratic quirks of your project, but also tricks of the trade, theoretical knowledge of the problem domain, mapping out who knows what and where to find stuff. Everything. 

Gigantt has recently recruited a QA manager. Until now the QA team had to deal without one. His first job is to write our QA Manager Handbook, which ought to include 100% of what his successor would have to read in order to get going. Being completely replaceable as a team member almost makes you irreplaceable, because so few of us are actually that minded towards knowledge sharing.

_________________________________________________________

* Actually everything in the army consists of three parts. It's... exhausting.

Sunday, January 1, 2012

Handwritten Signatures in MS Word

How many times have you had to print a Word document just so you can sign it and then fax/scan it back to someone?

Ideally you should be able to add your signature directly to the Word document, and then print it to PDF or just send it. This turns out to be really tricky to do, but today I've cracked the problem.

Typically, you get a document looking like this:



How do we add a signature? Well, we could sign our name on a white piece of paper, scan it  and just plant that image in Word, right? Not quite. When you scan an image (or take a photo with your iPhone for that matter) you get a JPEG image, and JPEG images do not support transparency.

Here's what a scanned signature looks like right off the scanner:




First thing you'll notice is it's big. If you want your signature to look legit when the document is printed you have to scan it at at least 300 DPI. Your computer screen, however, has a resolution of about 75 DPI normally. So if you add this photo to Word you'll have to re-size it down. The end result is something that looks like this when printed:




Terrible.

First of all, the white background of the signature photo is opaque. As a result the image hides the "Signature" text and the line we're supposed to sign on. We want to somehow make the white areas transparent, so that when we plant the signature onto the page it looks as if it was drawn on by hand, not plastered on with a computer. This can be done with image editing software, such as Paint.NET (free), if you know what you're doing. The resulting image must be saved in a more appropriate image format - one that supports transparency. Best is PNG. 

But even that's not enough. The end result, when printed, still looks terribly fake. Here's a close-up version to illustrate:



See how pixelated it looks? When you print this on a piece of paper you definitely see the difference. Why is this happening? Didn't we take a hi-res scan of the signature?

Why? Because Word is dumb. When you scan an image in high resolution (e.g. 300 or DPI, same as a good printer) the image you get on your computer is big. When you then resize the image in Word to fit the signature space, Word just prints the picture as it appears on screen (i.e. in 75 DPI). It's not smart enough to say "this picture is scaled down, but I do have the original high-resolution at hand, so I can send it to the printer at 300 DPI".

Also, what if we want to print at 600 DPI, but our scanned image is just in 300 DPI? Ideally we'd want a vector image of our signature, not a raster image. Vector graphics nowadays is usually saved in the popular (and open) SVG format. And you can find services online that will try to convert a raster image (e.g. jpg) to SVG. Only one problem with this: Word can't handle SVG. So there's one more hoop to jump through.

Here's what you need to do to take a scanned image of a signature and convert it to something you can actually add to Word. You need just one application - it's called Inkscape and it's a totally free vector graphics application. 


  1. Take a white A4 paper and put your signature on it using a nice, thick pen.
  2. Scan it at 300 DPI (grey-scale is fine, too).
  3. Crop out everything but the signature. This can usually be done in the scanner program itself if you do a pre-scan. But you can also do it with MS Paint.
  4. Save it as JPG.
  5. Open Inkscape.
  6. Drag and drop your scanned JPG into Inkscape.
  7. Select the image in Inkscape and choose Path -> Trace Bitmap from the menu.
  8. Use "Brightness Cutoff" with a high threshold (over 0.9) and press Ok. 
  9. It will create a vector version of the signature and place it directly above the image. Drag it away to see the difference between the two.
  10. Feel free to play with the threshold until you get a good reproduction of the original image.
  11. Now select the original image and delete it (DEL).
  12. Select the good vector version and do File -> Document Properties -> Fit page to selection.
  13. Now save as EMF
  14. You can now drag and drop this EMF into Word. Make sure the Text Wrap property of the image in Word is set to "In Front of Text" and then just place it over the signature space.
Here's a close-up of the raster vs. vector images side by side in Inkscape:




Here's just one letter scaled way up, just so you see how good the vector version is:



And here's what it looks like in Word:



Keep that EMF file at hand. No more printing, faxing and scanning.