Category Archives: Personal productivity

Sublime Text: Always run a single file in a project no matter what is focused

When I program, I often try to split up my code into modules. This requires that I use different files. However, I also want to run my code from a “main” or a “master” file as well. It’s pretty annoying in Sublime Text, or any text editor, to have to switch to your main file to run your project.

I’ve talked about how to do this in TextMate but how can you pull this off in Sublime Text? Let me show you how.

  1. Create a Sublime Text project for your program. You can do this by using the menu Project > Save Project As…”.
  2. Open the settings for your project using the menu Project > Edit Project.
  3. You’ll get a mostly empty text window. Modify this window to include a build definition, such as the following one for Python:
    • "build_systems": [
        {
          "name": "PyProj",
          "cmd": ["python", "-u", "$file"],
          "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
          "selector": "source.python"
        }
      ]
      
  4. Modify the line with “cmd” and change “$file” to the master file you always want to run. For example, if your main file is called pyproj.py, then change it to pyproj.py.
Add the "build_systems" JSON field in your project settings file, accessible through the Project menu > Edit project.

Add the “build_systems” JSON field in your project settings file, accessible through the Project menu > Edit project.

That’s it! While you’re editing your project settings, you can make other customizations as well as you see fit.

Obviously, this isn’t limited to just setting a file to be run no matter what file you’re focused on. You could use this to add command-line arguments to a single project, to run project-specific scripts for building and testing, or to otherwise customize the way the “Control-B” (Command-B on Mac OS X) works when you are running the project. You can essentially define your own build system on a per-project basis in a project file’s “build_systems” section and use any information in Sublime Text’s build system documentation to do so. Unfortunately, the build system documentation doesn’t really describe this because it’s focused more toward Package development.

For more information about how project settings work, look at Sublime Text’s documentation for build systems and for projects!

Advertisement

The Function (Fn) key is on the full-size Apple Keyboard

Are you one of those Mac users who generally turns on the F1, F2, keys as standard function keys option in System Preferences? If you do that, then if you want to use your keyboard to control the volume or the screen brightness, you need to find the Function (or Fn) key. (Alternatively, if you don’t turn it on then you need the Fn key to simulate F1, F2, and so forth keypresses).

Do you check off the box in System Preferences > Keyboard that makes the F keys behave as standard function keys?

Do you check off the box in System Preferences > Keyboard that makes the F keys behave as standard function keys? I usually do. I think I only ever use the Volume Control function on the keyboard anyway.

On the laptop and the wireless keyboards, Apple usually puts the Fn key on the lower-left hand corner, next to the “Control” key. But it’s not there on the full-sized Apple Keyboard with the numeric keypad!

Or is it?

The Fn Key on an Apple Keyboard is next to the home and above the delete key in the area above the arrow keys.

Ha, it’s in the middle of the keyboard between the letters and the numeric keypad, right below the F13 key and above the Delete key!

Eject All of your Removable Mac OS X Disks Quickly!

Are you always using hard disks and USB keys in your Mac? Getting annoyed with having to go to the Finder, scrolling down in the sidebar, and then ejecting these disks before you can unplug all of these devices to move your computer? Or, maybe you just pull out the USB and let Mac OS X complain at you about how the disk was removed without you ejecting it first?

Try using this AppleScript along with a launcher application like QuickSilver to save time and eject all of your disks with one command! A launcher application is basically a quick way to start up applications – you press a keystroke like “Ctrl-Space” and then begin typing, and QuickSilver will find applications that match what you’ve typed. Ejecting disks is quite literally at your fingertips.

  1. Open up the AppleScript Editor (it’s in /Applications/Utilities)
  2. Copy and paste the following code:
    try
      tell application "Finder"
        eject the disks
        display dialog "Successfully ejected disks." buttons {"Close"} default button "Close"
      end tell
    on error
      display dialog "Unable to eject all disks." buttons {"Close"} default button "Close"
    end try

    AppleScript Editor with the Eject All script

    AppleScript Editor with the Eject All script.
  3. Save it into a place you’ll find it later. I used ~/Library/Scripts and called the script “EjectAll.scpt”.
  4. Compile it!

Now, if you double-click on that script, it’ll automatically eject all of your media and give you a dialog box to let you know when it’s finished.

quickSilverCatalogScripts

QuickSilver Catalog Preferences Window

In QuickSilver, I added the ~/Library/Scripts directory to my catalog by opening the QuickSilver Preferences, clicking on Catalog, then going to Scripts in the sidebar. I then ensured that “Scripts (User)” was checked.

Then, you can relaunch QuickSilver, press its hotkey (Ctrl-Space by default), and type “EjectAll” and press enter to run the script. It’ll automatically eject all of your media and then you can pull out all of your plugged-in devices without worry!

Programming in the console with GNU Screen and vim

When I program, I use a text editor. Now, even though I recently bought Sublime Text (and I’ll probably do a post on that later), I still use vi a lot – specifically, vim. I also occasionally used GNU screen (mostly for managing remote IRC sessions with the irssi client).

So why use the console to program? Well, the main reason is that typing in the keyboard and not using the mouse is faster if your keyboard skills are good. Given the quality of most laptop trackpads, getting away from the need to use the mouse is actually something of a relief sometimes. The second reason to be familiar with the console is if you’re logging in to a remote session, you often don’t have a mouse available to you at all.

The learning curve is quite steep for console applications, but once you get familiar with them you can get your editing tasks done very quickly because everything’s quite literally right at your fingertips.

Screen: Access Terminal Applications All The Time, Anywhere You Want

GNU Screen is a terminal emulator that’s available on most flavours of Unix-like operating systems, including Linux, BSD, and Mac OS X. Screen runs inside a shell. I think the “killer feature” of screen is the fact that screen is persistent, so you can essentially make your terminal applications run all the time, from anywhere you want.

A terminal window that has screen running inside it.

A typical screen session

What this means is that if you log into a remote machine, and use “screen”, you can start commands that you expect to run for a long time, close the SSH window, and then log back in and resume what you were doing. Everything will be chugging along just as you had it. It’s especially useful for applications that need to run in the background for a long time, like IRC windows or really, really long compilations or analysis.

Another feature of screen is the fact that it has “tabs”, or multiple windows within screen. You can then run multiple terminal programs in the same screen session, resuming them when you want.

A Basic Screen Workflow

To use screen, open a terminal window and then type screen. You will get a splash screen, but then you will be kicked out into what is essentially a shell. From here, you can basically do everything you normally would in a console.

Let’s say you want a new console to work in – a new “tab”, so to speak. In screen, press Control-a, let go of control, then c (c for create). This will create a new console for you to work in. You now have two consoles!

To switch between these consoles, use Control-a + n (n for next) and Control-a + p (p for previous). Try this now: Control-a c, Control-a n, Control-a p.

In screen, every command is preceded by a “Control-a”. It’s kind of the secret shortcut in the program, it’s often abbreviated, so Control-a and a (which means to go to the beginning of the current line) is often written as C-a a.

Let’s say you’re doing a lot of work in screen and now you need to log out, but you want to keep all of your work active. This is a “detach”. If you want to “detach” a screen and do other things in your original shell, you can do that with C-a d. If you’re working in a windowed environment, if you close the program that screen is running in, it’ll also detach for you.

Later that day, you want to log back in to the machine and resume your work. To “attach” a screen, type screen -R -D. That finds a screen for you, detaches it from other consoles if necessary, and resumes it.

The workflow for screen is pretty simple overall: you basically attach a screen when you start, then you create new windows, and detach when you’re done (or if you’re like me, you’ll just lock your computer and reattach it whenever you get around to it from whereever).

I find that using screen in conjunction with vi is extremely useful: you edit it one screen session, then compile/run/test in another.

For more information, take a look at this handy screen command reference.

Making Screen Look Pretty and Useful

You’ll notice that screen on the surface is pretty minimal. However, there are a lot of features built in that make it quite handy as a terminal emulator.

It’s possible to list the windows in your screen at the bottom of the terminal. You can see which one you’re currently working on. You can list the hostname, the current time, and so forth. With a little bit of work, you can make a very simple statusbar that will increase the usability of screen significantly.

To do this, first edit the .screenrc file in your home directory. Then, add the following lines:

hardstatus on
hardstatus alwayslastline
hardstatus string "%{.kw}%-w%{= kR}(%{r}%n %t%{-}%{= kR})%?%{= .kw}%+w%? %{.kw}%=%c %d/%m/%Y" #B&W & date&time

I won’t step through the syntax in its entirety (it’s very cryptic and confusing), but you’ll end up with a handy listing of the current screen windows in the session with the current one visible in red.

I followed the syntax on the GNU Screen manual to customize the string to my liking. %{.kw} colours the string with a black background and white text…. %-w lists all of the windows in screen up to, but not including your current session, %{= kR} makes the next section black and red, ( is a parentheses, %n is the number of the current window, and so forth. It takes a bit of starting at to understand, but it’s not too difficult to customize to your linking.

Vim: Navigate your Documents in an Instant

Vi is a text editor that originated in the mid 70s. One of the most popular modern incarnations is Vi Improved (vim). One of the most powerful features of Vim is the speed at which you can navigate through your documents. You can immediately jump to lines, delete a range of lines, move forward four spaces (or four words), search for words easily, and more, without your hands leaving the keyboard. I use it for much of my small-scale programming work even though I like my GUI-based text editors.

To launch it, open a text editor and type vi.

Configuring vim

I’m really not that much of a vim power user; my .vimrc file is really simple compared to some people who live in vim full-time. I like navigating code in vim and I use it for most of my console-based editing but if I am working on large, multi-project files I end up using a text editor like Sublime Text instead.

Regardless, it’s nice to have a decently usable set of vim defaults. Here’s mine:

syntax on
set number
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab

In this setup, I turn on syntax highlighting, print numbers on the side (considering how dependent vim is on navigating by line numbers, this is essential), I turn on auto-indentation, set the tab size and indentation sizes to 4, and expand tabs to spaces.

A swift introduction to using vi

vim is pretty intimidating to use, because it uses multiple modes. The default mode is a “navigation” mode where you can move the cursor around, and then there’s a “line editor” mode where you actually modify the text on the screen. There’s also a “command” mode where you enter custom commands, too.

The most important command in vi

If you don’t know anything else about vi, learn this:

ESC :q!

Press the escape key, press colon, press q, then press !. This exits the program with no changes! If you have absolutely no idea how to do anything, you can at least get back out to the console.

Related but important as well:

ESC :wq

Press the escape key, press colon, press w, then press q.

This writes the current file, then quits the program. Basically, it’s a “save and quit”.

Navigating

When you start vim, you’re always in navigation mode. You can navigate using the h, j, k, and l keys. These correspond to left, down, up, and right respectively (this was so ingrained into me that I had to actually start vim to check the directions). One reason why this is great is because the controls are on the home row, so navigating in vi is pretty fast.

If you want to jump to a line, you enter the line number and press G. So going to the first line of a file is 1 G whereas going to line 23 is 23 G.

You can move multiple lines and characters up, left, down, and right as well. 3 h moves three characters left. 5 j moves five lines down.

Editing

i to enter “insert” mode. You can then type to enter characters at the current cursor position. You’ll see -- INSERT-- at the bottom of your screen. To stop editing, press Escape.

There are many variations of insert in vi to help people insert things really, really quickly. I (capital I, vi is case-sensitive) inserts at the beginning of the current line, A inserts at the end of the current line, o inserts a new line before the current line, O inserts a new line after the current line. You can even combine these with numbers and the directional hjkl keys to insert multiple lines. That’s probably too much information.

You can also delete quickly vi as well. x is the basic “delete one character”. dd deletes a line.

Finally, u undoes the last command, so if you find yourself deleting the wrong lines, hit u repeatedly.

Conclusion

I hope this serves as a brief introduction to vim and screen for most people. Anyone with a Unix-like computer and the need to write text or markup should consider looking into these kinds of programs because they increase the flexibility of what you can do.

TextMate and Running a Master File

Many people find my blog searching about how to make their multi-file LaTeX projects build in TextMate.

It’s worth nothing that the TM_MASTER_FILE works for almost any programming project, not just LaTeX. So, if you’re working on a Python or a Ruby project and have a main file that you want to run, set the TM_PROJECT_MASTER to point to that and save yourself some effort. Here’s a reminder on how to do that.

  1. Open your project file (or create one if you don’t have one).
  2. De-select any selected files in the TextMate drawer by clicking on empty space.
  3. Click on the “i” in the bottom-right corner of the drawer.
  4. Add a variable named TM_PROJECT_MASTER.
  5. Set the value to the name of your main file (in my Ludum Dare game, it was painterscat.py

Now your “run” ⌘r shortcut will always run your main file with minimal hassle!

The Challenges and Rewards of Non-Competitive “Compos”

As I mentioned in my previous posts, I participated in Ludum Dare, a game development “compo”, where you build a video game by yourself, from scratch, in 48 hours (a variation gives 72 hours and a team, but I did the 48-hour version).

A “compo” is a “composition competition”, but I’ve yet to participate in a compo where the competition aspect is what actually gets people energized. If anything, the compo is more community-oriented than it is competition-oriented. I participate weekly at ThaSauce.net One Hour Compo, which is a music compo in which you create a song from scratch in one hour. The competition aspect supposedly is because people vote on their favourites at the end, but in the end I don’t think the votes are what anyone’s really fighting for.

In any case, I feel that compo has probably been one of the top ways for me to improve my music making skills and that doing the Ludum Dare compo was an excellent way for me to simply program for the sheer joy of it.

But, I think one of the greatest benefits of doing these compos is simply being able to succeed, and to feel happy and proud doing it. It’s a real self-esteem booster and it also helps you beef up your skills and the ability for you to work under huge time pressure.

Below I’m going to present the post that I wrote for Ludum Dare 26. Most people there tend to write technical post-mortems, but I thought that the emotional barrier was actually a bigger barrier to cross than the technical ones!

An earlier version of this post below first appeared on my Ludum Dare 26 blog.

I think I’m over my Ludum Dare Adrenaline Rush now.

In my first initial post, I said that I was going to fake Ludum Dare. To my surprise, a few commenters actually wrote in and encouraged me to just enter anyway. I did. And I came out with a game that had some interesting ideas, along with a number of problems.

I’m actually happy I participated and would like to thank the handful of people who encouraged me (some strangers, some friends) to enter anyway. It was a great experience and I want to be around next time, if I have time for it.

But, what led me to go down a road of, “I don’t think I can do it?”

I’ve never designed a game before

Well, technically I did. In my first ever C programming class when I was 15, the final project was a video game. Mine compiled but didn’t work – we had Macs at school, and when I realised that my game wasn’t getting close to finished, I brought my game home, wrote almost all of my code on my PC, and hand-checked it to see if it would work, in theory, when I brought into school the next day.

With some work I made it compile, but it didn’t really work as I wanted it to.

In some respect though, it doesn’t take much to be a game. I’ve seen a lot of things that people recognize as games. Top-down shooters, side-scrollers, role-playing games, adventure games, text-based games, board games, and so forth. But I’ve also seen a lot of creative work as well. A game where the main idea was to walk in a city. A game where  you woke up, experienced a main character’s morning, and looked at all of the objects in his or her room. A game where you planted seeds in a garden and watched them grow. They’re barely games by the standard definition – but they are all welcome in Ludum Dare.

Even if you don’t have a strong idea of what you want to do, build a game archetype anyway and then see what comes out. In some respect, one of the thrills of doing a game in 48 hours is that the first few ideas you get, you have to stick with because there’s no time to really make it better. So you get all of these raw, unrefined concepts that are the pure essence of creativity. And it’s great to see so many of these concepts work.

My Programming Chops

I don’t program a lot. I have a computer science degree so I know how to program, but my work is primarily focused on research activities that don’t require any development. I find a lot of programming boring – especially mathematics riddles. “Compute the least-common denominator of two numbers?” Snooze. “Write an algorithm that will identify is a string is a palindrome?” Ugh.

But then I start building a game and suddenly, everything is fun, even when I groan at thinking about the geometry and trigonometry. It’s because those things suddenly aren’t just mathematics. They’re situated in my game as a core concept now. I don’t need to understand them for the sake of knowing them – I’m understanding them because I know that they’re useful to me, now.

I learned a lot on the fly, and suddenly I realized that programming isn’t just about what I know – but about how fast I can learn what I need to know. I didn’t know PyGame existed until the morning I decided to do Ludum Dare. I didn’t know how to blit a sprite to a screen before reading about it on my lunch break. I had never thought about sprite rectangles, mouse movements and controls, or drawing tiled backgrounds until the hour the competition started – so I learned those things with a lot of help from the Internet. I can’t say that I know all of those things well, even now… but I’ve done them before now and I can only improve from here.

So even if you’re not a hot-shot programmer, it’s not just about how well you program – it’s about how well you can get what you need done by learning what you need to learn.

Ludum Dare and self-esteem

I think a lot of people who post on this site have a lot of confidence – you have to to enter something that is billed (albiet weakly) as a competition. The games that get all of the press are the ones that have the shiniest graphics, the best lighting engines, the cutest artwork, the most thrilling sound. In the end, history remembers the winners, and all of the winners kind of blob up together into this gigantic “super-winner” amoeba where it feels like one guy participated in 30 Ludum Dares and came up with a hundred amazing games along with a procedural level generator and a memory-management allocation system in the span of a week. The secret though is that this mythical superhuman game programmer doesn’t exist. That programmer is really hundreds of individuals

I think one big lesson to learn from this is that very few of us are superhuman, and more importantly, the majority of people who participate in a Ludum Dare are normal people. They’re not all rock-star programmers, hotshot artists, or amazing musicians. They’re regular people and normal people. Just like you, just like me.

The second point to remember is that Ludum Dare isn’t really a competition. Sure, it’s about getting votes and comments and people get into the top list at the end, but in the end there’s no reward and there’s very few bragging rights. This really isn’t a competition.

I think a big outcome of these two points is that Ludum Dare is a showcase. It’s not just “how good your game is”. It’s the fact that you’ve managed to produce a game at all. No where else would I have been able to build almost any program in 48 hours and then, in the span of under a week (so far!) convince 50 people to play and download my game and leave constructive comments.

In that sense, everyone’s a winner. And even though I said above that almost everyone in Ludum Dare is a “normal person”, the fact that we’ve programmed something from absolutely nothing to a working, deliverable product in 48 hours (or in a team in 72 hours) makes every one of us extraordinary.

I hadn’t been as excited about something before as I had right after Ludum Dare – and I think that’s because that, as soon as I had finished, I realized that I had done something extraordinary. A few thousand of us, together, had each accomplished something to be proud of.

Creating CHI Video Previews on the Cheap

Our submission to the ACM Conference on Human Factors of Computing was accepted a while ago. As part of that submission, we were also required to create a video preview for the conference.

This presented to us a few logistical problems. First, none of us had camcorders. We had iPhones, which can record video in a pinch, but that can be rather spotty as far as recording goes. Second, we did not have a lot of time in which to arrange to do principal photography or other setups that would require fieldwork. The CHI video is not particularly long – under one minute – but it still requires us to know what we’re shooting, and to ensure that we can do this all in a clean, professional manner. When you have a week, and when you’re also considering the camera-ready version of a paper, trying to direct a video is a lot of work on top of that.

We decided to take a simpler route and use an animated video instead. This presented its own suite of problems. The first one was that no one on our team had computer-based animation experience in Flash or other art tools. Thus, it was up to us to figure out how we could do this nicely with inexpensive, off-the-shelf software.

First, here’s the video…!

And here’s the preprint of the paper! D. Piorkowski, S. D. Fleming, I. Kwan, M. Burnett, C. Scaffidi, R. Bellamy, J. Jordhal. The Whats and Hows of Programmers’ Foraging Diets, ACM Conference on Human-Computer Interaction (CHI), Paris, France, 2013.

Getting a decent video preview together using inexpensive software

If you want to make an animated video and don’t know other animation tools, you can build something reasonable in Apple Keynote and iMovie! With some high-resolution graphics, transitions and Keynote actions, good builds, and a high-resolution export, we were able to create something that, while it’s not going to win us any awards, serves as a presentable video preview.

I used Apple Keynote 5 because it exports high-frame Quicktime movies. I tried to use PowerPoint on various systems, but it exported movies that were not at a high-enough framerate to animate transitions properly.

The main workflow works like this:

  1. Use Keynote to create an animated presentation, then export it to a MOV file.
  2. Record yourself talking about the slides using a headset and Audacity
  3. Use iMovie (included for free in all Macs) to match the talking to the slides

It should be noted that if you do happen to know how to use a professional animation and video tool like Adobe Flash, Adobe Premiere, Apple FInal Cut Pro, etc., you should use those tools instead! This guide is meant for people who don’t have time to learn a real animation suite or don’t have something to field or screen-record.

When you create your presentation

We decided to use an animated figure doing some actions, some text-based transitions, and a voiceover. These won’t get us the “CHI video preview of the year”, but they’ll communicate the idea across! David, in this case, drew a few initial pictures that I used for the basis of the video.

He gave me static images, so the first thing I did was use an image editor to cut out the hands to “animate” them. I believe that’s the extent of the actual hand-drawn animation in the video. The other main animation that you see is the IFT “magnifying glass”, which is animated using Keynote’s build effects.

Here are some tips:

  • Use the effects for moving, building in, and building out liberally. These make your presentation look like an actual video with movement instead of just a set of still slides. Make sure you set them to fire automatically and after an appropriate delay. Here’s some ideas:
    • Swap two images using a really fast (0.1 second) Dissolve effect to get minor animations going.
    • Use a PNG with a partly-transparent background that moves in front of the scene – this is great for magnifying glasses, speech bubbles, and so forth.
    • Use actions such as “move” and “rotate” at the same time to add more dynamic movements.
  • Be sure that the slides advance automatically. Put a lot of “time” between your slides. Even after exporting the times won’t be accurate, they’ll be off by a few fractions of a second, and that’s enough to mess things up. You’re going to need to fix these manually in iMovie.
  • Break up everything into separate slides. If you can afford to have something not animated on the screen (good for static builds), then you can take a still screenshot and insert that into iMovie – it should seamlessly transition.

Even if you get all of your timings right within the presentation itself, the Quicktime movie that Keynote exports will still not have good timings. This is simply due to limitations with frames per second and how fast you can get transitions to fire in Keynote. You’ll want to edit the resulting file in iMovie.

Editing the Audio

My colleague David recorded the audio. I asked that he use a headset and that he record in a quiet room. Doing so will save you a lot of headaches! If possible, you want to record in a reasonably small room without any noises (closets and bathrooms work great in an emergency!). I don’t know how long it took him to record the video, but it was a reasonably clean recording.

I used Audacity, an open-source program, for my audio editing. I personally sliced up the audio into separate sentences, it made it easier to match the beginning of each sentence to the actual transition. I also took the time to edit out any “ums” or “ers” that were in the reading. His voiceover was pretty good overall but I was able to fine-tune it.

Once that is done, you have to match up the audio with the video in iMovie. This is a reasonably tedious, manual process. iMovie is accurate to something like a tenth of a second, and likes to nudge things to the closest 0.4 seconds, so you do want your video to be liberal enough to not go up against these limitations. Use the “clip adjustments” and “audio adjustments” settings. If necessary, slice up the audio into smaller segments and drag and drop them into iMovie at the right points to fine-tune.

Music

I added music to my video. Be aware of licensing arrangements! When you submit a video to the ACM, they require you to have proof of copyright usage of any media, which includes the video and music. In my case, I asked permission from the original author. (The track, by the way, is called World of Snow by DDRKirby(ISQ)).

One thing you don’t want is for your music to drown out your speaker. iMovie almost automates this process, though! There’s an iMovie feature called “ducking” that reduces the volume of the music while someone is talking – this is a common radio technique. For all of your voiceover tracks, set them to “duck other audio tracks” to a small value, like 8%. If you happen to have any gaps in your voiceover, you may need to insert some silence so that your audio doesn’t duck in and out while your speaker pauses.

In Conclusion

I am by no means a professional video editor. No one on our paper-writing team was! That was what led us down this path to creating a short video on the cheap, but the reality is that a lot of people out there aren’t professionals, and many had not ever edited a video clip or tried creating a movie. I think this just underlines the fact that researchers in any discipline have to have a large number of diverse skills, and require the ability to be resourceful and adaptable. We couldn’t afford the time or energy to go shooting video or learning video-editing software, but we also wanted something that was reasonably engaging and that would stand on its own!

I hope that some of the content on this particular post will help some others out there who are working on brief video clips or previews of their own content, be it research papers or other work. Enjoy!

Reading and Writing just got easier with Markdown

I need to quickly take notes and share them as part of my job. It may be keeping a log during meetings, recording field notes during an observation session, or just doing preliminary notes for a web page I’m posting. However, a lot of the existing tools on computers have limitations.

  • Plain text is easy to write and generally easy to read, but there’s a lack of formatting. You can’t identify headings, create tables, insert images, or easily create hyperlinks. You can keep that information using some kind of markup language…. like HTML.
  • HTML is standard. It’s all over the place, you can format your pages nicely, and it does a reasonably good job at separating information from presentation, especially if you stick with the vanilla tags. Everyone can view HTML on their browser as well, so it’s very potable. Unfortunately, HTML is also really verbose and difficult to write. You can’t easily add linebreaks or headings. Miss a close tag and you’re toast. You have to type a LOT. You can ease this by using a WYSIWYG editor, but then your HTML markup becomes very ugly, and you’re committed to using that editor.
  • LaTeX is also very flexible but is mostly limited to PDF output (yes, you can output to HTML, but that requires a non-trivial amount of commitment to installation and setup).
  • Microsoft Word is easy to use, but is not portable to systems without Word. It exports to HTML but also has reasonably ugly HTML output. It also takes a really long time to launch and is difficult to check into a version control system.

So what is the solution? Well, I’ve discovered Markdown a few months ago, which is a lightweight markup language that is readable as plain text, but allows easy conversion to outputs like HTML. So what this means is that you can write your documents in a plain text editor, read them in a plain text editor, but also convert them easily into a web-viewable format. I’m beginning to take notes and make initial drafts of documents in Markdown because you can easily go from Markdown to almost anything else by either copy-and-pasting it, or by converting it to your target output format.

On Mac OS X, I use a command-line tool called MultiMarkdown by Fletcher Penny which is easily installable if you have Homebrew (http://mxcl.github.com/homebrew/). Then, you can either convert your documents using the command line, or use one of many text editors set up to compile your plain text into something else, like HTML.

I personally use the TextMate bundle that’s supplied by the author of MultiMarkdown. I can easily output my text file as HTML with a keyboard command, and then I can move that onto a website or similar if needed. Just today, I set up TextMate to write a timestamp when I press “ll<tab>” (that’s two lowercase letter Ls followed by a tab) so that I can easily take notes during a user study. Now, I don’t have to watch the time and try to write it in. And, since it’s in Markdown, the time shows up as bold text underneath some nice headers. If I want, I can copy and paste my original notes into Excel, post them online, or just look at them in the plain text editor without seeing all of the ugly HTML associated with it.

I’m not sure what the Windows equivalent is, but there are a lot of Markdown text editors out there and even Javascript client-side applications that allow you to write Markdown and show you a real-time preview of the Markdown in HTML! That is pretty nifty.

There are a lot of Markdown tutorials on the web, but here’s a brief command reference just to emphasize its simplicity.

Writing Headings

# This is a Level 1 heading.

## This is a Level 2 heading.

### This is a Level 3 heading. 

You can also Underline your headings.
===============================

Creating lists

* List item
* List item
    * Nested List Item
1. Numbered item
2. Numbered item

Links

Here is some [text of the link](http://example.com "Example")

You could also use reference-style [labels][1].

[1]: http://example.com "Example"

Images

![alt text](/path/to/image.jpg "Title")

Code spans

This is a Unix command: `find . -type d -exec chmod 755 {} \;`

You can also include larger code blocks by indenting code with 4 spaces or 1 tab.

Bold/Italics

**Bold text** __Also bold text__ *Italic text* _Also Italic text_

MultiMarkdown also has syntax for tables and equations that I haven’t yet had a need for (and therefore haven’t learned), but I suspect that could come in handy as well.

In any case, I am feeling already that Markdown is going to make my life easier because it’s lightweight, you can write and read it anywhere, and it is easily transformed to useful output formats. I like to keep my thinking about formatting separate from content, and this enables me to do so in a lightweight way. While LaTeX is nice for print documents and Word is good for collaborating with others, having a simple system for quick notes is really convenient as well.

Academics: Do You Program a Lot?

I know many Ph.D candidates and professors who can program and do program on a regular basis, but I didn’t really consider how often most of these students spend their time programming.

During an academic job interview, I was asked if I programmed a lot. Yes, I program. Do I do it a lot? Well, not exactly. None of the projects I currently work on rely on my programming skills, but I use programmatic thinking frequently. Like most computer science students, I write short scripts for frequently-used tasks. I build my CS361 web site using a shell script, Mustache and JQuery. I write 50-line Python programs to generate level templates for a research project I’m working on. I fix Javascript bugs here and there. I write R scripts to make my data analysis repeatable. But I don’t program like a programmer working in industry would program. I’m very much an end-user programmer, now. Not a novice programmer – an end user.

These end user programmers are the very people we usually assume have no formal computer science background but need to engage in programmatic thinking. Still – with all of this exploration and discovery, I would be hard-pressed to say that I program 50% of the time at work, even.

Most of my time these days is spent writing and designing materials, as well as assisting other students with analysis of their data; I also spend time preparing materials for the Software Engineering I class that I teach this term. Where in that do I find time to program? Generally, I don’t, so most of my programming is relegated to my free time. Perhaps I am not efficient with my free time. I often try to spend time learning frameworks and toolkits that I know about but haven’t worked with extensively or I try to find tools that may help me immediately or in the future. Lately, I’ve also found that I’ve been programming for the pure fun of it – doing projects in Processing or trying to learn live coding in Clojure.

Thus I come out of this post with two questions. How many of you out there have a programming background, but program now as an “end user”, that is, the software products that you build are not the deliverable, but instead they help you get other deliverables out the door? Second, how many people in academia program “a lot”, perhaps, let’s say, program for more than 40% of their work time and 40% of their free time?

Where’d that go? Losing Items on Amtrak Cascades Trains

I’ve had terrible luck lately and have managed to lose items both coming to and going from Bellevue for CSCW (ACM Conference on Computer supported cooperative work). On the way there, I lost the poster tube with the poster that I was presenting. On the way back, I lost a book. Fortunately I managed to find the poster in time but thus far I haven’t been able to locate the book.

One thing that Amtrak does not do is post the phone numbers for its stations on the web. Normally, I don’t tend to do personal posts like this one but I figured that Amtrak Station information for the Pacific Northwest might come in useful to someone some day and therefore have compiled a partial list of phone numbers for the major stations below.

Amtrak Cascades Train Stations in the Pacific NorthWest

Seattle King Street Station Baggage Claim: 206-382-4128
Seattle King Street Station Lost and Found (M-F only): 206-382-4713
Portland Union Station: 503-273-4871
Eugene-Springfield Station: 541-687-0972

Though the Lost-and-Found in Seattle was closed, I did reach the baggage claim about an hour and a half after I disembarked, gave them the train number and time, car number, and seat number, and they were able to retrieve the poster and hold it in the back for me to get it later that evening.

Also, the trains do tend to turn over quickly, and the route numbers change a lot, so try to call soon. In my experience calling though, they’ve been really nice in trying to actually locate your items – while writing this post I even got a call back from the Seattle station asking for details.

Now that said, since these numbers have been posted, you probably shouldn’t try to book tickets or ask general questions of the station. That’s best handled online or through their ticket agent anyway, which is reachable at Amtrak’s web site or through 1-800-872-7245.