vim: cleaning up mixed indents

Thanks to the wiki for this.  If you run across a file that mixes tabs and spaces (ewww!), set the tab settings the way you want (e.g., ts=4 sts=4 sw=4 et ai) and run

:retab

to convert all the tabs to the right number of spaces.  This takes tab stops into account, which :%s/^I/    /g won’t.

This replaces what I used to do, which was /^I s<Tab><Esc> followed by a whole lot of n.n.n.n.n.n.n.n. … .  One command is much better 🙂 .  I’m not even going to try to count the keystroke savings on my current project (pym, a preprocessor written in Python).

Advertisements

When programmers get it right

Technology makes our lives better to the extent we don’t have to think about it.  Robert Pirsig makes this point in Zen and the Art of Motorcycle Maintenance, and it’s still true: technology that draws attention to itself has failed (except to a very hard-core audience of which I am probably part 😉 ).

For the last two years, I have been using Google Chrome to view PDFs at work.  Dozens a day, usually with at least five open at a time.  For the last two years, every time I have rotated the view clockwise or counterclockwise, my page has shifted off-screen and I have had to scroll to get back to it.  Has that stopped me from doing my job?  No.  Has it drawn undue attention to the underlying technology?  Yes.  Very yes.

I cannot express my delight at finding, after a recent Chrome update, that I wasn’t the only one with this problem — and that it has been fixed!  I rotated my PDF and reached for the scrollbar, but then I noticed the underlying technology in a good way: I was still looking at the same page I had been.  Now each day is a bit smoother, and my job is a bit easier, because the fix has reduced, rather than increased, my mental workload.

My sincere thanks to everyone involved in pdfium bug 116297.  Special thanks to thestig at chromium.org for making the fix!  If you read this, thestig, please know you have succeeded.

Note to programmers: sometimes small fixes are big wins.  It took thestig two lines of code to save me several minutes of wasted effort per work day, every work day, possibly for the rest of my career.  Fix the small things — your users will thank you!

How not to waste disk bandwidth

In the Windows 7 search boxkeywords are case-insensitive, but Boolean operators are case-sensitive.  Typing

System.FileName:~=".doc" AND datemodified:‎1/‎5/‎2016

works fine. Typing

System.FileName:~=".doc" and datemodified:‎1/‎5/‎2016

doesn’t given an error message or a warning — it just burns a lot of disk searching and finding nothing. Live and learn!