Archive for the 'Computer' category

 | March 20, 2012 11:18 am

I saw this quote on Fountly and quite liked it:

"Life is pretty simple: You do some stuff. Most fails. Some works. You do more of what works. If it works big, others quickly copy it. Then you do something else. The trick is the doing something else."

It’s attributed to Leonardo Da Vinci.*

________________________________

* I’m highly skeptical of this attribution and want to see a reference. Even better would be to see the quote in context. Most of Leonardo’s words of wisdom come via his notebooks, and that’s not usually how he wrote things in his notebooks. For the open source writing book, I’ve spent a fair amount of time with the notebook translations, and this just doesn’t sound like Leo. Mostly because Leo didn’t seem to be that concerned with others copying him. He enjoyed being emulated. With all that said, I still like the quote. (Even though it is an error to map modern sensibilities onto our ancient role models.)

 | March 19, 2012 9:36 pm

XML Parsing with Python, Part 4In Part 2 of this tutorial, we looked at how libxml (through the use of the lxml Python bindings) can be used to parse XML documents. We covered how to load XML files from disk, parse them, look for specific tags and attributes, and generate custom datatypes from the results.

These are the operations that lxml is used most often for and are probably what most developers will need it for. It only scratches the surface of what it is capable of, however.

In Part 2, we talked about three common XML operations: parsing, validation, and transformation. Of these three, parsing is the most important. We touched upon validation and transformation, but didn’t look at how they work.

In this video, we’ll take a look at the last two operation. We’ll cover validation using DocType definitions and XML Schema and transformation, using XSLT style sheets.

Note: The example files used in the video can be downloaded from here.

Show me more… »

 | 1:59 pm

Parsing XML with Python, Part 2As we talked about in Part 1 of this series, XML is one of the most versatile structural languages, which has led it to be used in nearly everything every sort of application imaginable. It serves as the basis of file formats, a way to store financial records, and for communication between web servers. For this reason, programmers and designers should be familiar with not only how to write it, but also how to parse, validate, and transform it.

One of the most powerful tools for working with XML is libxml, an open source parser. Given its versatility, libxml is used in many open source projects, and even commercial products. It can be found at the base of the Gnome desktop and in banking software.

In this video, Part 2 of a series on working with XML from Python, we’ll look at how you can use libxml from Python through the lxml bindings. We’ll show how to load and parse an XML document, iterate through the elements and attributes, test for specific tags, and translate the document structure into a custom object.

Note: The example files used in the video can be downloaded from here.

Show me more… »

 | March 16, 2012 3:01 pm

Parsing XML with Python (Part 1, Installation)XML is one of the most versatile structural languages around. It is used extensively for file formats, storing miscellaneous data, and communicating between different programs. You can find it on the web, on the desktop, and places you might not expect, such as in interactive books.

Given its importance, most programming languages come with a parser that can be used to analyze and decode XML. Examples include MSXML, which is used in Microsoft’s .NET framework and libxml, a popular open source library.

In this series of videos, I’ll show you how to get up and running with libxml, through the lxml Python bindings. We’ll look at how to install the programs (Python, the Python package manager, setuptools, and lxml itself), read and parse an XML document from a file, inspect tags and attributes, validate XML structure, and perform XML transforms.

This first video will focus on the installation of Python, setuptools, and lxml.

Show me more… »

 | March 8, 2012 12:15 am

For many writers, the act of writing (or placing one word after another) is synonymous with the tool that they use to do it. There’s a reason why writers feel so strongly about their moleskin notebooks, fountain pens, and computer software. I’m no different than any other writer. I have my preferred tools, and I love them dearly. They help to focus on my ideas and craft prose that I can be proud of.

When writing on a computer, the tool of choice for many writers (dare I say most?) is Microsoft Word. It’s everywhere and everyone has used it. It comes preinstalled on most computers and is a de-facto standard for exchanging written material with others.

Unfortunately, Word is not part of my preferred toolset. I prefer to write using LyX and an add-on I’ve written for it called LyX-Outline. But while I love my writing program, it makes it difficult to collaborate with other writers who use Word, as LyX doesn’t have a straightforward way to directly import Word files.

This isn’t a new problem and I’ve written about it before. I’ve even proposed a solutions. But while that solution was a good fit for me, it isn’t something that I would recommend to others.

For starters, it required a great deal of software to be installed. You needed a program to convert Microsoft Word documents to Open Office documents. You then had to use a second utility to convert it to HTML or LaTeX. After that, you used to a third utility to clean it up and import the LaTeX code into LyX. Three distinct steps, with a lot of places where things could go wrong.

Over the past few months, I’ve found that I need a better way, a tool that can directly import a Word document and cleanly translate its content. So, I decided to create one.

MSDoc2LyX

Show me more… »

 | 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… »