10 Comments »

Although I mess around with DOS batch files and the command line, I’ve never really gotten into the FOR command. Wow, what a powerful little puppy that is. I read a post at LifeHacker today that has inspired me to figure out how to use the FOR command to handle a little housekeeping task that I’ve never figured out how to do. Until today.And even if you don’t need to rename files, there may be some other housekeeping chores that this can help you with. Actually, the FOR command is really quite powerful; it can even look into files, which opens up all sorts of possibilities for use.

Setup

Let’s say that I’ve got some files that I’ve tacked .del onto, so that I know that I don’t want them any more. For example:

Directory of F:\ToDo\archive

Wed 15 Nov 06 12:13 29 peek.bat.del

Wed 15 Nov 06 11:12 225 peek.pl.del

Wed 15 Nov 06 12:13 28 pop.bat.del

Wed 15 Nov 06 12:13 32 push.bat.del

4 File(s) 314 bytes

0 Dir(s) 3,808,210,944 bytes free

Now, let’s say that I’ve decided to archive them instead of deleting them, so I move them to another directory. I don’t want to keep the .del extension, but I don’t want to rename each file by hand (either in Windows Explorer, or from the command line).

I know that I can rename each file individually, e.g.,

rename peek.bat.del peek.bat

But simply making use of wildcards doesn’t work at all. For instance

rename *.bat.del *.bat

just leaves me with files with names like peek.bat.bat. Not what I’m looking for at all.

It’s possible to use the DOS “for” command to handle this, as long as you make use of tokens. For instance, I can’t just say something like

for %i in (*.*.del) do rename *.*.del *.*

It just doesn’t work.

After some web-searching, and general messing around, I can now do it with the following command (all on one line please):

for /f “tokens=1,2 delims=.” %i in (’dir *.*.del /b’) do rename %i.%j.del %i.%j

And it’s really that easy! Here’s what the various bits of the command are:

  • for /f - We’re using the for command. The /f flag here means that we’re parsing the output of a command (the dir command that’s discussed below).
  • “tokens = 1,2 delims=.” - This breaks up each item into parts, each part deliminated by a period “.”. The 1,2 shows that I’m naming the first two tokens.
  • %i - What I’m going to call each element that I pull from the set. Actually, %i will be the first term, %j will be the second, etc.
  • in (’dir *.*.del /b’) - This defines the set that I’m pulling each element out of. I got this fu from a Yahoo Answers page, and all it does is take a bare directory listing of my current directory, showing only those files that fit the *.*.del filename pattern.
  • do rename - I’m going to be performing the rename command on each element.
  • %i.%j.del - The rename command takes two arguments; the first is the name of the file to be renamed. Here, we see that each file to be renamed has three parts, the %i part (file name), the %j part (original extension of the file, e.g., bat, pl) and the .del part (final extension that the file now has).
  • %i.%j - The second argument is what I want the renamed file to be called. Here we’re just saying that we want the file to have its file name and original extension.

Example

Here’s what it would look like in action:

F:\ToDo\archive>for /f “tokens=1,2 delims=.” %i in (’dir *.*.del /b’) do rename %i.%j.del %i.%j

F:\ToDo\archive>rename peek.bat.del peek.bat

F:\ToDo\archive>rename peek.pl.del peek.pl

F:\ToDo\archive>rename pop.bat.del pop.bat

F:\ToDo\archive>rename push.bat.del push.bat

Note: I typed the first line, DOS took care of the rest. And here’s what I see in my directory now:

Wed 15 Nov 06 12:13 29 peek.bat

Wed 15 Nov 06 11:12 225 peek.pl

Wed 15 Nov 06 12:13 28 pop.bat

Wed 15 Nov 06 12:13 32 push.bat

Sources

  • Impetus to try figuring out the FOR command, as I’ve never really gotten into it: LifeHacker post.
  • Help on FOR command: “help for” at command prompt
  • Help on setting up tokens and dir command to deal with file names: Yahoo answers page.
6 Comments »

A couple of weeks ago, I discussed My Super-Duper Personalized Productivity Desktop Background, made possibly by Samurize (see my intro to Sam here).

Today, let me introduce you to my stack. For those of you in the computer science field, yes, I mean that kind of stack. For those of you in the business world, I mean my LIFO system. For those of you who still don’t know what I’m talking about, it’s Last In First Out.

Why a Stack?

There are many ways of looking at lists. Some people make a To Do list, and work their way through it, top to bottom. (That would be a queue, or FIFO ;)). Some people write things on sticky notes, one per note, and do whatever grabs them first. Some people (say, the Getting Things Done crowd) write things on lists, but segregate, organize, manipulate, etc. those lists, e.g., divide your next actions by physical context. Even when looking at a context list, you can still sort through the items, deciding what NA you have the time and energy for.

I want to tell you about a simple tool that I’ve found indispensable lately. I’m not talking about next actions, but something at an even more lower-level, if such a thing is possible. Let’s say that I’m writing a report. I’m going to be working on it solidly for a few hours, and if little things come up, I’m not going to actually create a next action. Instead, I’m just going to scribble it down and fix it later. The little things that I’m talking about are things like “Fix format of heading x”, “Double check spelling of Author x’s last name”, “center picture on page 5″, etc. etc. These are things that I can just collect on a scrap of paper. Things that I don’t want to forget, and I’m going to do in this session, but I don’t want to do *right now* because I’m actually in the middle of my writing flow. We all know what that flow feels like, eh? You don’t want to mess with it by changing mental gears and fixing something.

When writing a report, a stack is not necessary - kind of silly actually. Just collect these notes in a list, or on stickies or whatever, and get them done, in whatever order at the end.

So, Again, Why a Stack?

Now, let’s switch gears. Instead of writing a report, where it’s very important for me to get all the stuff out of my head onto paper, with as few interruptions as possible, I’m now actually going to do some programming. Other processes can fit into this mindset - modelling software, designing anything, physically building, car mechanics, whatever.

The key to the kind of workflow that I’m talking about here is that while you’re working away, something comes up that directly impinges on your work, and *has* to be done before you can do anything else. I find this most often in programming. For example, let’s say I’m coding the implementation of one particular part of the program. It calls on something from somewhere else. Sometimes I can guess exactly what the call will look like, sometimes I want to head to that other place and make that code work first. Sometimes it’s more drastic, especially when debugging. I code something, it doesn’t work. I try to find the error. Trying to fix that error leads me to another part of the code, where I need to fix something else, which leads me somewhere else, etc. etc. It’s a little like walking through a maze. Actually, it’s exactly like that, except I want to be able to come back to exactly where I am to finish things off.

Because I can only keep so many things in my head, I found that I needed a way of keeping track of what I was working on, and every detour I was making, just so that I could find my way back to the starting point again. Enter the stack.

The Stack

All the stack is, is a list where new things get written at the top. I’ve got it set up as a text file. When it looks like I’m going to get diverted from what I’m currently working on, I write a line saying where I am and what my goal is. Then I write a line (above that one) that tells me what I need to fix. When I get there, and find somewhere new to go, I add another line (at the top). When I get to the end of the line, I can work my way back to my starting point by looking at the top of the list, making sure that item is well and truly done, and deleting it. Look at the next item, etc.

Pretty Stack

Of course, I can’t just use a simple text file. I have to automate it. And display it. And massage it. So here’s what I have in my little stack system:

  • stack.txt - just a plain text file. I’ve put a line in it “=====Bottom=====” so that I’ll know when I hit the bottom and have nothing left to backtrack to.
  • push.pl - a little Perl script to insert some text at the beginning of the file. There’s got to be an easier way to do this, but my script does the following:
  • get today’s date and time
  • open my stack.txt and read everything into an array
  • open my stack.txt again, this time for writing
  • write the date/time, plus whatever text I’ve passed in - this becomes the first line, i.e., the one that I’m going to deal with next
  • write everything else back to the file
  • a SlickRun command for push. So all I have to do is trigger my SlickRun and enter something like “push Testing - this is where I am”.
  • pop.pl - another little Perl script to grab the first line from the file. It does this by:
    • open the stack.txt file and read everything into an array
    • grab the first line
    • delete the first line
    • open the stack.txt file again, for writing
    • write the rest of the lines to the stack
  • a SlickRun command for pop. This is a more challenging command; it uses the @MULTI@ command to do two things for me:
    • first, it runs the pop SlickRun command for me, which calls the pop.pl script, which removes the first line
    • then, it runs the peek SlickRun command (described below)
  • peek.ahk - an AutoHotkey script, and this is my favourite. All this little gem does is remind me what I’m supposed to do next. I find this useful because when I’m working, I don’t see my desktop. Sometimes I just want a reminder of what’s on the top of the stack. This script reads the first line from the stack.txt and file and gives it back to me in a popup box - so I can get an in-my-face reminder of what I need to be working on right now, without having to break my train of thought and open the file.
  • a SlickRun command for peek. It just calls on the peek.ahk script.
  • Screenshots

    Here are a couple of images of what this all looks like. First, here’s me putting something onto the stack:


    And here’s what the stack could look like after I’ve started down the long winding path:

    Note: there’s not really any reason it has to be displayed on my desktop; but I like to keep it there as a reminder, for when I stop programming for the day. Then, I can look at the whole stack and get a picture of where I am.

    And here’s what a peek operation looks like:


    When I pop something from the stack, the first line is deleted, and then a pop is done; that’s to tell me what I have to work on next, since I’m finished the current thing I’m on.

    Because I leave one line in the stack to signify the bottom, when I’ve run out things to pop of the stack, the last message box shows me:


    Now I know that I’m back to where I started and I can continue with my primary task.

    Conclusion

    In writing this up, I feel that it sounds much more complicated than it really is. The take-away point is that sometimes when you’re working, you’re in a flow that lets you make note of new things to do, and then ignore them until later. But sometimes, you have to fix something else before you can finish what you’re working on. In the latter case, the concept of a stack or FIFO list can help you track where you’re going, and more importantly, how to get back to where you were when you first got diverted.

    It’s this concept that’s important, not the tools you use to handle it. This is one of the reasons I’m telling you about my system, but not uploading the files (although interested parties can receive them if they wish). You can accomplish the exact same effect with a piece of paper - it’s just the order in which you write things down and cross things off that’s important.

    1 Comment »

    It’s been a long time since I posted about EverNote templates. That’s because I haven’t needed to think about them for a while. However, there’s a new question over at the EverNote user forum, asking if it’s possible to change the background colour for text notes, to help out with aging eyes. A nice soft yellow was recommended.

    There’s no really easy way to change the colour of background notes. However, you could make use of a simple template (not a fancy one with fields, but a plain one). For instance, this lovely little gem that I just whipped up. Here’s an image of it in action:


    It’s a short little xml template file that you can download here (right-click on “here” and select Save As…). Import into your EverNote database. See my EverNote Template Pages for more detailed instructions.

    If you look at the image above, it gives you the instructions for setting this template as your default background. Hint - it’s in the options. However, this only works for new notes that you create from inside EN. It won’t work for anything that you clip from the web, or use CTRL+ALT+V for.

    And, if you don’t like my particular shade of soft mellow yellow, it’s easy to change. Using a simple text editor (like Notepad), open the xml file to edit it. Find the funny looking hex colour. It looks like this:

    Simply change #xxxxx (shown in the red outline) to a better colour for you. Where to find hex colours? I got mine from here, but there are lots of other places (web sites, paint/drawing programs, even a Yahoo Konfabulator widget called ColourMod). If you like, you can even change the name of the template, and save it as a new file. That way, you could end up with a whole new range of coloured backgrounds. One for every mood :)

    5 Comments »

    There’s a fascinating new thread over at the EverNote Forum about “best practices” - how are EN users actually using their databases, how does EN make people more productive, etc. etc. If you’re an EN user, or are thinking about exploring it as a new tool, this thread is a great place to start for ideas on exactly what you can do with it. It’s not necessarily laid out in the most logical fashion - imagine walking into a room of people, all yammering about their favourite things. However, the enthusiasm of the users is most evident, and can be infectious.

    But that’s not what I want to talk about. There’s a particular post in the thread, by marcclarke, which I found extremely interesting. Not because he was talking about EN, because he wasn’t. Someone noted that Marc is extremely prolific on the board, and how did he do that? Marc replied that he cheated, and proceeded to tell us exactly what he does to make himself faster/more productive, and what tools enable him. I loved the reply and asked Marc if I could reproduce it here. I think it’s begging for a larger audience, and I want to share his ideas with you.

    So, shamelessly copied and pasted, and only slightly redacted, here’s Marc’s reply to the question “How do you find the time?”:

    How do I find the time? I cheat. Shamelessly. Although I type at speeds well over 100 words per minute, I type only as a last resort. I use Dragon NaturallySpeaking v9 and a good noise-cancelling head set with a speech-optimized USB sound module to talk to my computer. Dragon will happily take what I say and transform it into text at about 180 words per minute, even on my little laptop’s modest CPU. The version of Dragon that handles Excel spreadsheets (as well as everything else out there) runs about US $200 these days, and anyone in the business world who does not use it is just plain crazy, IMHO.I can see that I am going to have to start another thread titled “The Pen is Mightier Than the Sword, and the Tablet is Mightier Than the Pen” or some such, to talk about how productive one can really be. I treat computers as nothing more than tools, just another chisel or hammer. I geek to live; I don’t live to geek. (I shamelessly stole that one from Gina Trapani over at the LifeHacker Blog.)

    EverNote is the foundation tool in my tool suite, let there be no doubt.

    The Getting Things Done gurus all seem to use Tablet PCs. I had a terrible time figuring out why. I thought it was just because a Tablet PC was a cool ubergeek toy. I was wrong.

    One of the first people to really open my eyes was author Michael Linenberger and his great GTD book “Seize the Work Day: Using the Tablet PC to Take Total Control of Your Work and Meeting Day” and his GTD and Outlook-specific book “Total Workday Control Using Microsoft Outlook: The Eight Best Practices of Task and E-Mail Management“.

    I was listening to a podcast interview with Micheal Linenberger and James Keating (JKOnTheRun) and Marc Orchant. Both James and Marc are Microsoft Tablet PC Most Valuable Professionals (MVPs) and both hold Linenberger in high esteem. The interview was a real productivity eye-opener for me. Author Linenberger said that he wrote his books without every touching a key. He uses the Tablet PC OS’s voice recognition feature to capture his speech and then uses editing gestures with a pen on the Tablet PC in Microsoft Word to do all his mark-up and editing. Here was alpha-geek Linenberger blowing the socks of two of the most formidable alpha-geeks I know of (Keating and Orchant).

    I have both written and edited a few large books in my day. I used EMACS outline mode and LaTeX. I thought I was one of the most productive authors anywhere in the world (and I have had publishers tell me that). I about fell off my chair listening to the interview with Linenberger. Here was someone explaining true high productivity to some of the most formidable high-productivity alpha-geeks in the world (IMHO). As I had both of Linenberger’s books on my shelf, I immediately cut an order for Dragon NaturallySpeaking and the optimized hardware to run it (noise-cancelling head set and speech-oriented sound dongle). I have never regretted it.

    Linenberger writes his books using MindJet’s MindManager mind mapping tool, voice recognition (part of the Microsoft Windows Tablet PC OS), and a Tablet PC. He has a webinar on how he uses this combination of tools on the MindJet web site.

    All the GTD and Tablet PC alpha-geeks seem to agree that one keeps three applications open on one’s Tablet PC all day: Outlook, MindManager, and OneNote. Personally, I have Outlook, MindManager, and EverNote open on my laptop all day every day. I think EverNote is even more powerful than Microsoft’s OneNote (though not as well integrated with Outlook, a minor problem that I easily work around by dragging links from EverNote notes to Outlook appointments, tasks, and contacts).

    Microsoft claims that a Tablet PC is about 20% more productive across the board for an average user.

    Quote:
    “Results from post-deployment surveys exceeded expectations, showing that productivity improved by an average of nearly 20 percent per user. Longtime Tablet PC users reported much higher levels of productivity and were particularly impressed with second-generation technology.”


    I tended to discount that claim as marketing fluff until I had a chance to play with a friend’s HP TC1100 Tablet PC. For the power user, I think Microsoft’s 20% number is low by at least an order of magnitude.

    Mind maps are about an order of magnitude more productive than even the best outliners. In fact if you turn off almost all of MindManager’s brains you can run it as a classical textual outlining tool (and you can switch back and forth between the textual outline mode and the graphical mind map mode). MindManager understands the Tablet PC and pen gestures. My buddy with the Tablet PC can blow me off the map when we race making mind maps, me with my laptop and him with his Tablet PC using his pen.

    For uber-productivity, you use a Tablet PC, Dragon NaturallySpeaking for voice recognition, and MindManager. You enter information from your brain using Dragon. You edit using the pen and the Tablet PC. You organize using MindManager. You capture bloody everything in EverNote. You do your e-mail and task management in Outlook. You cross-load projects and tasks from MindManager to/from Outlook. You schedule your day using Taskline.

    As I said, I found Marc’s post fascinating, and quite inspiring. I’ve always wondered about a tablet PC, and decided that I probably would only use the tablet part for marking things up, like highlighting a document that I was reading, or maybe making a few quick drawings. In addition, I’ve always thought that voice recognition software was not worthwhile for me - after all, I’m a pretty quick typist, and pretty quick on the mouse too. But Marc’s experiences hint that I should rethink my position. I’m planning on checking out his links, and who knows, maybe, when I have more disposable income, I can think about ramping up my productivity with some pretty neat tools.

    No Comments »

    So it turns out that not only do I have Bluetooth on my laptop (never turned on), but I have Bluetooth on my Palm Zire 72 as well. What does this mean? It means that it might actually be possible for me to use GooSync to sync my Google Calendar with my Palm, without having to buy the third-party PPP software from Softick PPP.

    And yes, it turns out that I can actually pull this off, but it took me the entire afternoon to figure it out. And much chicken bone waving. It might actually be worth it to just buy the Softick PPP if you’re not into installing and tweaking mumbo jumbo. But give this a shot first, it only took me, say 3 hours.

    The first thing I did was start surfing the Web, looking for people that had done this before. What I found was scary - it seemed possible, but all the web sites were scary, full of arcane details and mysterious mumbo jumbo. Here’s a look at how I pulled it off.

    First, I turned on my Bluetooth adapter (I always leave it off, since I don’t want people connecting to me accidentally, or wasting my battery power. I’ll also admit that I know absolutely nothing about Bluetooth, so turning it off was probably safest.) I turned it on on both my laptop and Palm. Then I messed around for half an hour or so, trying to get it to work on my own. No go. Back to the arcane instructions online.

    My laptop is a ThinkPad, with integrated Bluetooth, so I focused on web sites that discussed this hardware. Some places, like this forum, said that it was bad to have both my IBM device, and the Microsoft device running at the same time, i.e.,

    Check your device manager to see if Microsoft Enumerator is listed under the Bluetooth Devices listing. If it is you’ll have to get rid of that.

    Later on in the forum post is a link to instructions at Microsoft on how to disable the Microsoft device. I followed them, but I’m not sure it was effective. I seem to recall that the next time I rebooted, the second, i.e., Microsoft, device was back. Shaky ground here.

    What I did like about the forum post was that it gave a good link to a Thinkpad download, which I did end up using later on. The major confusion that I had was that originally, my device manager said that I had an IBM Integrated Bluetooth III device. But the download specifically says “Integrated Bluetooth II” software, which seemed to be going backwards.

    Anyway, the most help I got was from this particular page at Whizoo, where the author explains how to set up a Bluetooth connection so that you can connect to the Internet through your Palm. It was a little daunting, especially since his screenshots didn’t look anything like what my computer looks like. And he kept saying that if you don’t see such and such, then you’re set up wrong.

    So, I puttered away for a while, trying to make it work somehow. Finally, I just bit the bullet. I turned off my Bluetooth radio on the laptop. I disabled the two devices, so that there was no more Bluetooth visible in my hardware devices. Then, using the download page above, I downloaded the IBM Integrated Bluetooth II software exe and ran it. This creates a directory on your machine, full of goodies. I went to that directory, said, “the heck with it” and ran the setup file. It installed some stuff, and then all of a sudden, I had an icon on my desktop for “My Bluetooth Places”. This was new. I also had a different icon in my taskbar - one that changes colour depending on whether or not I have a connection happening.

    Here’s what my Hardware Devices look like now:

    Here you can see my new Bluetooth Places:

    And here’s what my Palm looks like when it’s connected:

    And here’s the taskbar item when connected:


    Now my computer looked (more) like the screenshots discussed on the instruction page. I scrolled down the header “PC Setup for sharing the Internet”, maybe a tenth of the way down the page, and started following the instructions from there. These instructions are very clear, and I had no problems at all. I managed to set up my desktop properly, then followed the instructions for the Palm side of things. Again, no problems. At the end of it, I was able to connect to the Internet through my Bluetooth. I gave GooSync a try, and it worked perfectly.

    On the same, page, about two-thirds of the way down is a header called “HotSyncing“, where the author describes how to do a HotSync via Bluetooth. He doesn’t recommend it, because it’s not as fast or stable as with a USB cable, but the instructions still work. I just like being able to know that I can do it, if I want to.


    If you’re interested, here are some of the links I used while figuring this out:

    If this is something you’re dying to try, give it a whirl - hopefully this post, and the pages I’ve linked to will help you out. If not, don’t worry - you can still use (quite easily, I might add) the PPP functionality offered through Softick PPP. It’s extremely easy to install and use.