Don't overthink it (Installment #247)

I volunteered to do a tedious job at work -- copy/paste about maybe 200-400 parameters scattered throughout a group of FORTRAN files. The parameters may be in one of maybe 3 different formats. Also, the parameters came with multiline comments (with each commented line starting with !), and sometimes just big wodges of comments on their own that serve as documentation. The goal was to transform these snippets into something our customer could scan using Excel.

I volunteered to do it because it made no sense for a highly paid developer to do such a menial job; also, I kind of like taking on little challenges like this, developing a new technique or learn some new tools, and seeing how quickly I can rip through them. Then it's just a matter of putting on the headphones, pressing a few keys repetitively so the computer does most of the work, and voila.

I realized that my initial solution for this would be overly complicated, as it always is, and that the exploration process as I groped my way toward simpledom would be haphazard, as it always is. I thought "How can I use Applescript to parse the text? Should I just copy the fragments into Word and use Word's formatting functions? Should I use a text editor with some text formatting Services?" (DevonThink makes a killer set of text-formatting services available to Mac users for free; DevonThink not required to use them.)

I spent about 5 hours over the weekend scarfing up text-formatting Applescript code, messing with text editors, messing with Automator, messing with some copied fragments that I was using as my test case, messing with Applescript in Word (which adds its own complications), and seeing possible workflows getting more complicated.

Sometime around Monday evening my brain settled down and I decided on my workflow:

  1. Copy each parameter and comment into a Word file.
  2. Fix the formatting of each snippet to remove the extra lines, excess ! marks, and insert tab marks judiciously to make importing into Excel easier.
  3. Transform the tab-delimited text into a table using Word's Table>Convert>Text to Table command.
  4. Copy and paste the tables into Excel and format accordingly.

The intent of this workflow brings in what I've mentioned before, about batching similar actions together. With this workflow, I could check each line off as done and move fully to the next set of operations. I could do each set of operations more quickly and efficiently than transitioning from 1 to 2 to 3 to 4 within each file.

#2 gave me the headache, of course, and is where I spent the bulk of my think time. I had on blinders as I was sure I could use some sort of Applescript in Word that would reformat everything in one go, without needing multiple passes. And because I thought it could be done, I thought I had to do it that way.

However, I had set myself a time limit for the R&D, and I had passed it. Time to drop that all-in-one solution. As I looked at the line fragments, I noticed that the bulk of the work would be done in the first line of each multi-line fragment. OK, let's start there.

That shift brought me back to the Agile programming maxim of, "Do the simplest thing that could possibly work." This is when I turned back to Keyboard Maestro; it's not as powerful as QuicKeys (or my beloved Macro Express in the Windows world), but it's quick, dependable, and does the job. In this case, I was using it as a robot typing the keyboard, but that keeps it simple.

That's when I cobbled together my workflow for #2:

  • With the text in Word, select the lines that will be reformatted.
  • Run Joe Kissel's great Clean Up Text script (scroll down the page to read about how to coy and paste his code into the Applescript editor). This script removes all spaces and tabs and removes multiple line breaks, making each fragment a unified paragraph. Kissell's article also tells you how to assign a keystroke to a script.
  • For a multi-line parameter with comments, the bulk of the delete symbols/insert tab action happens in the first line of the reformatted paragraph. So, position the cursor on the first line, and run the Keyboard Maestro macro (assigned to the F19 key) that manually moves the cursor, deletes a character, inserts a tab, etc. and then stops. Because the macro is working within Word, I added keystrokes to take advantage of Word's keyboard-based cursor movements.
  • For the remainder of the ! comment marks now studding the reformatted paragraph, select the entire document and use a simple Word find-and-replace to replace all the ! with " ".

Hm. Well, that still looks pretty complicated, doesn't it? But it's faster than me burning hours to get my head deep into Applescript territory, with delimiters, variables, if-thens, and so on.

The other advantage of this workflow is that this should cover about 80% of the code I'll have to reformat. I now have a base set of actions that I can clone and customize to handle the exceptions.

Anyway, the lesson as always: don't overthink it. Keep it simple.


The New Yorker has suffocated at times beneath a mask of wry gentility. For all its glossy reputation, the magazine still turns up its nose at stories and poems that make too many demands on the reader. It’s a middlebrow journal for people who would like to be highbrows — and perhaps for highbrows who love a little slumming. The cartoons, as Biele notes, provide an antiphonal chorus to the reckless consumerism of the ads. Just as the literature is for those who want to think themselves literary, the ads are for those who want to think themselves rich. (If you were old money, you’d already own Tiffany by the trunkload.) Bishop’s close association with the magazine, almost all her best poems appearing there after 1945, probably contributed to her struggle to be taken seriously. To be a New Yorker poet was sometimes a deal with the devil.

I went to a “mindfulness” group at the psychological clinic here. I don’t know much about the topic yet, but it struck me that one definition would be using your own mind to your benefit rather than to your detriment. In other words, don’t outthink yourself. Notice the thoughts and emotions you are having and allow them to pass through you without overstaying their welcome. I’ve always thought the best way of dealing with negative emotions is to pay no attention to them at all and hope they would go away, but I’m open to new approaches.

Writing in the library

I had an excellent ~6 hours of solid writing/wrestling with my master's paper one day last week. At this stage, I'm still drafting raw text and am not in the polish stage where I'm honing the thoughts in the sentences and paragraphs, and ensuring my themes and the story I'm telling are all working together, which is what I would call "the writing phase". Right now, I'm at the "vomit text" stage, if I may be forgiven for such a phrase.

Here's how I structured my time and my environment to encourage me to work:

  • I staked out a table in Davis Library, 7th floor. There are plenty of big tables that are hardly used, wall plugs are nearby for the MikeBook, and -- most importantly -- the books on the shelves are from the Asian collection, printed in Chinese and Japanese -- so I'm not tempted to browse them during my breaks!
  • I have MacBreakz set to annoy me every 50 minutes with some simple ergonomic exercises. In the preferences, I removed the ability to banish the window, so that I have to force myself to stand, stretch, walk, go to the bathroom -- anything but sit and stare at the screen. The breaks last 10 minutes.
  • During that break, I put some Genteal drops in my eyes to keep them my moist. My cataract doctor said that, when you work on a computer, you tend to not blink, which dries out your eyes, causing strain. The regular breaks to look out the window and away from the screen (MacBreakz includes eye exercises) and the wetting drops help keep my eyes healthy.
  • Most important -- Fred Stutzman's Freedom app, to keep me from surfing the web when I should be working. I usually set it for 125 minutes, to really enforce that I should be working.
  • For the paper, I had some clear goals defined: insert the new stats graphs, write text describing the graphs, create new stats tables as needed from my original data. Instead of floundering, I had specific tasks in mind.
  • Also important: work in batch mode. When adding graphics into my Word file, insert one, got to the next page, insert one, etc. When applying the Figure style, walk through the file and apply it to each graphic. I like a lined border around each graphic, so do that action for each graphic before moving on to the next task; this enables me to run the command once and then select the next graphic, press Command+Y to repeat the previous command, and move on to the next. Trying to do all of those actions at one time for each graphic -- insert graphic, format, write text, insert caption, etc. -- would have meant too much fiddling and interruption for each operation. By breaking the separate tasks into separate streams, as it were, I was able to move more quickly. It also meant that when it was time to write, the figures were exquisitely formatted so that didn't distract me.
  • When writing, know when you're creating text and when you're editing text. That workday was dedicated to creating text and not to wordsmithing. I didn't try to push my argument too heavily, I tried not to get too nervous when I could see some ideas not quite aligning as I'd hoped or that I hadn't written as much as I'd hoped. The goal was to just get the words down in a rough draft, which is the hardest part of writing (at the start anyway!). I knew that the several passes through the text I still had to make would bring tweaks and additions and polish, so there was no need to get too stressed about expression and articulacy just yet.
  • Others might not be able to do this, but I had a good breakfast and skipped lunch. Once I plopped myself down, unpacked my stuff, set up the computer, etc. I really didn't want to interrupt the flow to pack up, eat, walk back, unpack, set up, and then hope I'd get back into the flow. I fueled up at the top of the day and it powered me well into the afternoon. Once I got in the flow of working on the paper, time did indeed both stand still and whiz by.

I'm now at the point where i'm trying to generate text for the last part of the paper, the discussion and conclusion, and find myself somewhat lacking for words. I've started with random ideas and sentences i put under those headings as I worked on other sections of the paper and so this has provided me a starting point. But the section still feels anemic.

I think the solution here is, again, to trust the process. As my favorite book on writing says, use the words you have to attract the words you want. So, let the the sections feel thin for now and as I continue sweeping through and reading and re-reading, let any other words or ideas bubble up when they're ready.

I should say, this is also the time when it's helpful to have another pair of eyes look at the text, so I'm trying to get a draft finished for my advisor to review so she can tell me where I've gone too far or not far enough.


Little steps

In trying to implement some new behaviors, I'm finally listening to advice and looking at how to piggyback the new behaviors on existing behaviors. The best way to introduce a new habit being to start small and link the new behavior to an existing behavior. These are basically implementation intentions [1], as introduced to me by the Psychology Today blogger on procrastination, Dr. Timothy Pychyl [2] (who also has an extensive site devoted to his procrastination research, an affordable e-book on the topic, and scads of podcasts subscribable through iTunes).

An implementation intention basically says. "I will do behavior x when y happens so that I can achieve z." The objective is to have your environment deliver the cue for the behavior you want to encourage. In addition to supporting your goals, implementation intentions can support something called prospective memory, which I'll blog about someday (after putting it off for nearly a year!).

If a task I need or want to do is a one-off, or requires extra will-power to motivate myself to do it, then that's a task I'm not likely to do. Therefore, I need to plan how to make more routine the things that I that I think will be beneficial to me. So here are some behaviors I'm trying to implement now:

  • Liz always goes to bed an hour or so before I do. After I kiss her good night, I always walk past the bathroom on my way to my office. So, an obvious intention would be, "When I walk past the bathroom, floss and brush my teeth so I can have better gum health and keep the dentist far away from me." I'm very bad about flossing regularly.
  • I have my banjo lesson on Friday mornings. When I come back home, I always leave the banjo in its case until the next time I decide to practice, which may not be till Monday or Tuesday. And I leave the case sitting off to the side even though Liz gave me a banjo stand for my birthday. So, to encourage me getting my banjo out and ready to play, my new intention is: "When I get home from my lesson on Friday morning, I will remove the banjo from its case and put it on the stand so I can quickly pick up the instrument when I want to practice." Even though removing the banjo from its case involves tiny effort, it's just enough resistance to keep me from practicing. By making this new behavior a policy or rule, I remove the need to use emotions or will power to get the task done.
  • On a related note (heh): I often practice my banjo immediately after I get home from work or school and before I pull my MacBook out of my backpack. I do this because once I have the MacBook out and plugged in, I get lost checking email, blogs, etc. With my desk clear of the computer, I have more room to set up my music, I can sit in my chair, swivel around to the banjo stand, pick up the banjer, and start plunking away. Little steps, and probably silly to someone who's more disciplined, but the more I can clear my path of little stones like this, the easier the journey.
  • A long-standing rule of mine has been to fill up the car when the gas gauge indicates there's a quarter of a tank left. Lately, though, I've come close to running on fumes so I needed to change this. There's nothing worse than being in a hurry to get to the next town and then discovering you have to divert to get some gas. My new rule now is to fill up every Friday on my way home from grocery shopping, no matter how much gas is in the tank. This lets me start off the next week with a full tank.

Now, will these intentions work every time? Maybe not. But by thinking about how to work around my natural resistance, I increase the chance that I'll do them more often. And more often is better than not at all.

Links [1] http://www.psychologytoday.com/blog/dont-delay/201001/implementation-intentions-facilitate-action-control [2] http://www.psychologytoday.com/blog/dont-delay

Libra Horoscope for week of December 30, 2010

In 2011, I believe you will have the chance to weave your fortunes together with an abundance of allies who are good for you. They will be your equals, they will share at least some of your most important values, and they will respect you for who you are. That’s excellent news, right? My only worry is that you might shy away from the demands that such invigorating collaborations will make on you. It would be less work, after all, to fall back into reliance on more prosaic relationships that don’t ask so much of you. Please don’t take the easy way out, Libra. Rise to the occasion!

2010 leaving, 2011 rushing forward

2011 begins much better, in many ways, than did 2010. At this time last year, I was involved in helping to put on some events that scared me and my companions witless. My vacation time had been spent working on a paper so I could finish an incomplete. I had a full load of classes ahead of me and still no clear idea of what I was doing. January 2010 would finish with me at probably my lowest point of the entire year, wondering what had gone wrong.

The year evened out. I had the support and help of good friends and advisors and decided to leave the PhD program and finish my masters. I ticked off that earlier incomplete, staggered through the rest of the semester (which included a statistics class -- blearrrgghh) with only one incomplete, and helped execute a weeklong conference that, by all accounts, went very well.

I spent the summer finishing an incomplete from the spring (I wish I could have written that paper faster, but...). I spent the fall executing a hard-copy, hand-delivered questionnaire to my neighborhood and taking a Chekhov course that was a long, cool drink of water, and for which I wrote one of my best-ever papers.

I read, in the book Dirty Words of Wisdom, a good quote from Alanis Morrisette, that everyone has times when they go through s--- and that you always get through them. So don't worry about them. Nice thought, though it's hard to keep that perspective when reality bombards you with reasons not to get up in the morning. One of the things I learned this year were various tools to help me get through those times so that I can make it to the other side.

Other learnings:

  • Accountability gets me up in the morning. Knowing people are depending on me, or that I've committed to a deadline, spurs me to get stuff done. Filthy dirty deadlines -- hate 'em, but they work.
  • My mentor, The Unclassifiable Cassidy, advised to commit to the deadline before you're ready -- it's the only way to make sure you get the work done. If you wait till you have the data analyzed, the conference will have already taken place. In other words: you'll never be ready, so just get on with it.
  • This means, setting personal or arbitrary deadlines for yourself can work too, if I make them personal enough. For my questionnaire, I knew they needed it to be delivered at least 2 weeks before Thanksgiving, because once the holidays started people would be too busy to respond. For my Chekhov paper, I aimed to have it done the weekend before it was due and so worked on it bit by bit over several weeks (one of the few times I've done such a thing). This turned out to be a good thing, as I had two great insights occur to me in the shower the day before the paper was due; I spent that evening bolstering the paper with those insights and it really strengthened the whole thing.
  • This means, relatedly, disassociating the deadline from the project's completion, as explained by Cal at Study Hacks. He recommends starting on a project within 24 hours of receiving the assignment. I must admit, I like the idea.
  • My advisor last year had a few core principles that stick in my ind, even if I've not fully adopted them. Among them: it takes as much time to do a big project as it does a small project, so go for the bigger win - make the effort mean something. She also emphasized that no one ever told her what to do; she had to decide what were her priorities and what she wanted to accomplish with her energy, time, and career. It's about being independent rather than being a student -- or an employee.
  • I need structure. When I don't have structure (as expressed by deadlines, accountability) then I flounder and flop and end the day feeling worse rather than better. This, although there's often a voice within that screams not to be chained by these dreary and boring rules. I have not worked out trade negotiations between these voices yet, but it's coming.
  • It has to be the journey and the destination. I heard several times during my year in the academic vineyard, that if some part of you isn't perversely enjoying at least some of what you're going through, then that isn't the job for you. I'm all for delayed gratification, but it needs to come sooner rather than later in some form.

I ended 2010 way more upbeat then when I started. I spent my Christmas break reading a wonderful book and not even checking my email. There is still, at the back of my head, that niggling puritanical whisper "but you aren't accomplishing anything." I begin 2011 less sure of my path -- say what you will about the academic experience, it's run by the calendar and the pace ensure you're productive. I certainly never wrote or created as much in a short period of time as I did while working full-time and going to school. (In fact, I see now that the academic expectations of research, teaching, publications, and service formally externalizes what employees are always told to do -- but rarely do -- in their careers: work hard, network, be active in your professional association, keep your resume updated.)

I am joining with a few other people in creating a mastermind group, admitting which in public makes me feel like I'm coming out of the closet as a Kenny G fan or Republican or something equally shunned by society as simple-brained and noxious. Still, 2010 taught me that my old ways of believing and living were not enough to cope with the stress of what I went through. I want to experiment with and play with new methods to express (and maybe form) new beliefs.

I've set myself a deadline of January 31 to have my masters paper drafted, with the data entered and crunched, and the literature updated. It's an aggressive schedule and it's the kind of spur I need to get things done. Even if I'm not finished, I'll have accomplished more than if I'd waited for the mood to strike me.

Other goals for the year include finding work, making some money, networking, raking the leaves, cleaning my office closets from 4 years of neglect, etc. As I look at my calendar book for January, and think about what I need/want to do, I want to see how much benevolent pressure I can put on myself such that I get done what I want without stressing out too much. Journey and destination.

Another tool I plan to use is Christine Kane's Word of the Year. I've not gone through her worksheet, but I want this year's word to be ACTION. As I look back over 2010, much of my distress was caused by my worrying over a problem, journaling about it, brooding, sitting and looking out the bus window while morosely spinning dark futures about it, when only a few minutes of action was enough to dispel about 90 percent of the gloom. Taking action -- even and especially -- when I don't feel like it, is what I want 2011 to be about. I want to look back on 2011 and marvel at all that I did, all the people I met, all the things I wrote, and wonder at how I did it all while feeling on top of things the whole time.

Of course, there may be a problem with FOCUS or CLARITY. If I take action on all things, large and small, won't that dissipate my effectiveness? Maybe, but that's a problem to deal with when I'm actioning all over the place (and it's something I hope the mastermind group would help me to rein in).

Today, for example, I have 5 things written down that I'd like to accomplish by the end of the day (writing a blog post is one of them), yet I see that the dishes need to be washed and the clothes need to be put away. Do I put them on my list? Do the other more important things first? Whoa, Sparky, slow down. Those are my thought processes running amuck again, and not serving me. The thing to do is simply to take action -- wash the dishes, put away the clothes, clean my desk, take a nap, even. Don't let my thinking get in the way of taking action.

Here's to 2011.