Archive for the 'Lifehacks' category

 | February 1, 2012 11:06 pm

In this series, we’ve covered a lot of ground. We’ve looked at the basics of Subversion and talked about why you might want to use it for a writing project. We examined some of the advanced features, and how to dive into the history of your work. Then, we detailed how Subversion can be used for collaboration: the way locks help writers to own their ideas, how the log facilitates communication, and the way in which branches help to prepare drafts for review.

There is really only one thing left to talk about: conflicts, errors, and their resolution.

Show me more… »

 | January 30, 2012 2:30 pm

When I started talking about the ways which SVN can enable collaboration, my goal was to show how you can replicate some of the best features of a paper based workflow and then supplement them with the power of digital tools. We’ve already looked at some techniques for doing this, using file locks to promote idea ownership and leveraging the SVN log for communications. In this article, we’ll take a look at one more feature that makes it easier to work with others: using SVN snapshots (or branches) to facilitate the review of your work.

Here, I want to reiterate one important point: creating drafts that can be consumed by others is extremely important. It forces you as an author to find break points where you can send something definitive. Finding these points, where you can draw a line in the sand and say “draft …”,  causes you to solidify your thinking and take an important step toward completion. You may end up throwing the whole thing away because it was ineffectual, but that doesn’t mean the exercise was futile. The process of creating something, a draft, is an enormous step toward completion.  You’ll likely take many such steps, but each one results in a better manuscript.

SVN branches can be a huge help in drawing your lines in the sand.

Show me more… »

 | January 27, 2012 2:30 pm

After reading the previous article, you may have the impression that I think collaborative writing is a bad thing. Nothing, however, could be further from the truth. When you write with others:

  • it’s possible to distribute tasks according to individual strengths, meaning that the finished product will (probably) be more than a sum of the parts
  • brainstorming is more effective, more people means more ideas
  • not only will you have more ideas, but as you discuss, challenge, and research the topic amongst the group, you will have different ideas than you might develop on your own
  • having many people working on a project gives it energy and focus, which is tremendously helpful upon entering the hinterland of any project commonly known as “middle”

Collaboration is good, but it is also complicated. It takes a great deal of work for a collaborative project to be success. You have to balance competing needs against one another. On the one hand, it is really important to provide an author the freedom and space required to own her ideas. At the same time, though, you need to make sure that everyone is clearly communicating about the project and where it is headed.

Making sure that everyone is on the same page and that efforts are coordinated is a complex challenge. It requires meaningful discussion happens; establishing a system for sharing documents and knowledge; and that goals, scope, audience, and purpose of the project are well defined. In many ways it shares much in common with another complex endeavor, coordinating the care of a medical patient.

Show me more… »

 | January 25, 2012 8:21 pm

Though they are wonderful tools that have transformed how we live and work, computers also cause about as many problems as they solve. We can see these problems in the way that work has crept into our private time via email; in the ways teenagers choose to socialize with their peers via text messaging and social networks, often to the exclusion of the world around them (and parents); and in the way that we prepare the written drafts of our work.

In each case, these problems aren’t the result of malicious intent. Rather, they were unforeseen consequences of a transformative technology. When it was originally developed, email was a great way to quickly exchange letters with friends and colleagues. Its original designers never intended it to become the way in which a large number of people organize their daily lives. Nor was the introduction of text messaging or social networks meant to cause teenagers (or adults) to socially withdraw into an online world, but to provide an efficient and convenient way to keep people connected. This is also true in the changes that word processors and communications software have brought to the process of writing.

Show me more… »

 | January 24, 2012 7:00 pm

If you’ve read parts one and two of this series, you should now have a pretty good understanding as to what version control is and how it can benefit you. You’ve seen how it can be used to keep a backup of your files, synchronize your work between computers, and ensure that you will never suffer the panic of losing your work.

But that’s really only the beginning. Hopefully, you’ve taken things to the next level and feel comfortable digging into the revision history to look at past drafts, make comparisons between documents, or to see how your work has evolved.

Mastering the basics of version control, followed by the finer points, is a fantastic way to be more productive as a writer. By relegating the job of backup and synchronization to a tool, you can spend more time actually writing (and who doesn’t want that). Having the ability to look at how you’re writing has evolved can make you more thoughtful. Both are powerful additions to the scrivener’s arsenal. If you can believe, it though, there is yet another level which allows Subversion to be even more helpful: using it to work collaboratively.

Show me more… »

 | January 20, 2012 4:30 pm

In the last article in this series, we looked at a few of the features that version control (specifically Subversion) offers to a writer, coder, or editor. These benefits include the ability to track all of the changes made to a file in a project, synchronize your work between different computers, and automatically ensure that everything is backed up. But though these are invaluable contributions to a writer’s workflow, they only scratch the surface of what Subversion is capable of doing.

In the next few posts, I would like to dive a bit deeper and take a look at a few of Subversion’s more advanced features, such as:

  • How to compare newer changes to older versions of a file
  • How to use Subversion’s collaboration features to work with others
  • How you can resolve errors that might arise from incompatible changes made to the same file

Though Subversion’s basic features are tremendously powerful, it’s the advanced options that make it indispensible. You know, the little things that live in the background most of the time, except when you really need them. This rest of this series is about how to leverage those. The first of those features we will look at is the revision history.

Show me more… »

 | October 20, 2011 3:23 pm

For the past few weeks, I’ve been teaching a course on Windows Server 2008. As part of the course, it’s pretty common that I need to create (and delete) a large number of Windows Server 2008 machines. Because of all the different configurations (and the fact that installing from a CD or DVD takes a lot of time), I’ve found it very helpful to create ISOs for the installation of the operating system.

On Windows 7, this is really easy. There is a nifty plugin called ISO recorder which automates the process of creating an ISO file from disk. To get started with it, you download the applet, install it, and right click on the disk that you wish to capture. Out comes an ISO that you can mount in VMware or VirtualBox.

But as much as I like Windows 7, I don’t actually use it very often. Most of the time, I’m doing things with Linux or Mac OS X. Luckily, it’s pretty easy to create disk images on Mac OS X, as well.

Disk Utility (available under Applications > Utilities) can be used to create disk image files. To do so, open the program, click on the disk that you want to make an image of, then click on the “New Image” button.


Type in a  name for the image and specify where you would like for it to be saved.

Finally, before clicking on the “Save” button, set the the “Image Format” option to “DVD/CD Master.”


Voila! After a few short minutes, you have a copy of the disk that you can burn to CD/DVD (for students), or to keep as a backup.

Unfortunately, though, the format that the Mac uses for the disk image is .CDR. The most common format for CDs and DVDs is .ISO (and sometimes .IMG). ISO and IMG can be directly mounted in a VMware or VirtualBox, CDR cannot be.

Luckily, it’s also pretty easy to convert a CDR image to ISO. You can do this with “hdiutil”, a command line program. Here’s how:

hdiutil makehybrid -iso -joliet -o [filename].iso [filename].cdr

Note: You do have to create a .cdr image before you can use it.

 | September 21, 2011 7:57 pm

For the past year and a half, I’ve been using DreamHost, a company based out of California, to host this website. In most ways, it’s been a fantastic experience. The customer service is prompt and knowledgeable [1], they go out of their way to use renewable energy, and they give you all sorts of additional goodies when you sign up for an account [2].

But even though the experience has been mostly fantastic, I have one serious gripe: the actual hosting experience is terrible.

Let me see if I can explain why. With my previous host, Brinkster, it was rare to have a website outage. Things, for the most part, Just Worked ™. The website was up and people came to read it. That’s generally all you can ask from a hosting company. (To be clear, the hosting experience with Brinkster was great, everything else was middling to awful.)

With DreamHost, though, it’s another story. If you’ve come to this site lately (especially in the mornings or late evenings) it will be unresponsive. At other times, you might see a strange message in your browser, saying “Error 500: Internal Server Error.”

As the person paying for the hosting space, this is somewhat frightening.  HTTP errors (of which 500 is one) can be cryptic, and figuring out why your website (which was working five minutes ago and costing you money) is broken problem can require some serious time.

Wait, I've Almost Got It

500 Errors in General

The 500 error, in particular, is a true terror. It means that the web server encountered an unexpected condition and can’t return the web page to you. It’s a sort of catch-all error that gets generated when nothing more detailed is available. If you want additional information (something which might actually be helpful to fix the problem), you have to work your way through cryptic error logs and pray that some divinity is listening to your pleas. It’s not fun.

When hosting with Brinkster, I never had 500 errors. Not once. Occasionally there would be an outage, but these were repaired quickly and with little fuss. WIth Dreamhost, though, 500 errors happen all the time: at least daily, and sometimes hourly. They crop up when trying to do administrative tasks, when making posts, when trying to load the home page for the website, or when uploading files. The errors can be intermittent, or they might last for hours. It’s all very frustrating.

Lately, they’ve been so bad that I had essentially convinced myself to move away from DreamHost to another provider. Something I consider a true shame. It would mean giving up the goodies [3], probably paying more money, and losing shell access to the server. So, before I decided to move away forever, I decided to get in touch with DreamHost support (again) and work out the problems with my website.

Happily, after a protracted email message thread and a great deal of searching online, I’ve I’ve learned a few things about optimizing websites for DreamHost. I’ve also found a strategy (I think) for solving the dreaded “Internal server error” problem.

Show me more… »

 | September 20, 2011 8:46 pm

Note: Whenever I come across an interesting or potentially useful piece of source code, I like to make a copy and file it away. I post some of them here in the hope that they will be useful to others as well.

In my recent coding adventures, I needed to create a function to monitor the up-time of one of my Linux servers. A very simple thing (you would think), and yet, I wasn’t able to find a function in the standard library which would give me this piece of information. So … I decided to write my own.

The script below makes use of the “uptime” command (common in many Unix operating systems) to see how long the machine has been turned on. It works on both Linux and OS X computers. If I have time, I will add code for Windows as well.


def uptime(format = FORMAT_SEC):
  """Determine how long the system has been running. Options:
  FORMAT_SEC returns uptime in seconds, FORMAT_MIN returns minutes,
  FORMAT_HOUR returns hours, FORMAT_DAY returns uptime in days."""

  def checkuptime():
    """OS specific ways of checking and returning
    the system uptime."""

    # For Linux and Mac, use "uptime" command and parse results
    if (sys.platform == 'linux2') | (sys.platform == 'darwin'):
      raw = subprocess.Popen('uptime',
      up_days = int(raw.split()[2])

      if 'min' in raw:
        up_hours = 0
        up_min = int(raw[4])
        up_hours, up_min = map(int,raw.split()[4].split(':'))

      # Calculate the total seconds that the system has been working
      up_sec = up_days*24*60*60 + up_hours*60*60 + up_min*60
      return up_sec

  total_sec = checkuptime()

  # Get the days, hours, etc.
  if format == FORMAT_SEC: # Return seconds
    return total_sec
  if format == FORMAT_MIN: # Return minutes
    minutes = (total_sec)/(60)
    return minutes

  if format == FORMAT_HOUR: # Return hours
    hours = (total_sec)/(60*60)
    return hours

  if format == FORMAT_DAY: # Return days
    days = (total_sec)/(60*60*24)
    return days

  return -1 # If invalid option specified, return false.

 | 8:30 pm

Note: Whenever I come across an interesting or potentially useful piece of source code, I like to make a copy and file it away. I post some of them here in the hope that they will be useful to others as well.

For the past couple of days, I have been working on scripts to automate the administration of some of my computers. Because they’ve been running  big jobs that often take hours to complete, I’ve been leaving them unattended. But since I need to know as soon as the job is completed, it’s nice to receive some sort of alert. For that reason, I wrote a simple script that will send an email when the job is finished. It uses the string and smtplib modules from the standard library. Here’s the code:

import string, smtplib

# Email Settings
HOST = "" # SMTP Server to Send Message From
PORT = 587 # Port you wish to communicate on
USER = "" # Email Username
PASSWORD = "PASSWORD" # Email Password

FROM = ""
TO = ""

SUBJECT = "Server Notification from " + AMAZON_EC2
TEXT = "Server " + AMAZON_EC2 + " is shutting down.\n" + 'Timestamp: ' +

def sendmessage():
  """Send email notification to the specified email address."""
  server = smtplib.SMTP(HOST, PORT)
  server.starttls() # Use Encryption
  server.login(USER, PASSWORD)
  BODY = string.join((
    "From: %s" % FROM,
    "To: %s" % TO,
    "Subject: %s" % SUBJECT ,
    ), "\r\n")
  server.sendmail(FROM, TO, BODY)

In general, it’s pretty straightforward. You specify what host you want to connect to and the port, then you construct your message. Finally, you send it. In this example, I’ve added a few other things, like a line to log-on to the server and encryption.The actual connection and sending of the email is only two lines of code. The rest is setting up the message.

Pretty cool, huh?