The Writing Confederation

Computers, anime, and writing – A confederation of topics

Two commas, not one: Comma-Delimited Lists in Writing

Recently I’ve been reading more articles than I normally do, and besides the underlying thread of technology there is another common aspect I have realized when reading these articles: (relatively) poor grammar. And it’s not just on some of the out-of-the-way blogs that I’ve seen this, but on blogs like sofaMoola—a great blog about making money on the internet and the authors’ stories of doing so—and even some of the more popular blogs like Lifehacker.com. It’s not a big deal, but it’s enough to annoy me. The common mistake: a single comma.

So a little background. I would say the split is around 50-50, so it won’t be something you see on most blogs, nor will it be something you see infrequently. However, it is fairly common to see a sentence formed like this: “I like milk, cheese and eggs,” with the author thinking that this is perfectly acceptable. Well, it isn’t. Think of it this way: every item in the list, for that is what that is: a list of items that our hypothetical person likes, is separated by a comma. For lists of two items, a simple “and” goes between the two items. Example: “I like apples and oranges.” However, when three or more items are part of the list, a comma is introduced between the first and second item, and before the “and” preceding the last item. Example: “I like milk, cheese, and eggs.” Notice that this sentence can be differentiated from the similar sentence at the beginning of this paragraph by the comma between “cheese” and “and eggs”. So why the third comma? There are two explanations to this: the easy one, and the more complicated and comprehensive explanation. First, then, the simple explanation.

Simply put, a comma-delimited list such as the one above—“I like milk, cheese and eggs.”—(this is the incorrectly formatted sentence) actually consists of two items, not three. In actuality, our hypothetical person is saying, in this sentence, that he or she likes milk, and that he or she also likes cheese and eggs mixed together. The second, correctly formatted sentence—“I like milk, cheese, and eggs.”—explains how our hypothetical person likes three different things: milk, cheese, and eggs—each a separate food item. Think of it this way: the number of things this person likes is the number of commas +1, so in the first sentence there is only one comma, so therefore there can only be two things that he or she likes; however, in the second sentence there are two commas, and therefore there are three things that he or she likes.

Take another sentence to help solidify this example: “I would like a milkshake with fudge on the bottom, vanilla in the middle and chocolate on top.” This sentence sounds fine if you say it and even when you read it, although it is, in fact, incorrect. Our newfound milkshake sentence implies that the person asking for the milkshake wants one with fudge in the bottom, vanilla in the middle, and chocolate on top of the vanilla middle, not actually on the top of the milkshake—the top of the milkshake is left undefined. For example, you could say this: “I would like a milkshake with fudge on the bottom, vanilla in the middle, and chocolate on top.” This second sentence asks for a milkshake with fudge on the bottom, vanilla in the middle, and chocolate as a topping to the milkshake. In this sentence, all aspects of our milkshake are defined, and those of us with a programmer’s mindset can walk away from the window happy.

Now then, the more in-depth explanation. To really understand this, you must think back to something I’m sure many of you have blocked from your memory: sentence diagramming. Sentence #1 is going to be “I would like a milkshake with fudge on the bottom, vanilla in the middle and chocolate on top.” Sentence #2 will be “I would like a milkshake with fudge on the bottom, vanilla in the middle, and chocolate on top.” For brevities sake—and mine—I am only going to include the part that describes the milkshake—in the first sentence, this would be “…fudge on the bottom, vanilla in the middle and chocolate on top.” and in the second this would be “fudge on the bottom, vanilla in the middle, and chocolate on top.”

The first sentence diagrammed:

complicated_sentence

And the second sentence:

simpler_sentence

Technically, in each case there should be an “and” connecting the branches of the diagram, but I have simplified this example in order to focus on only the aspects relating to this article.

Notice that in each diagram, there are a few different branches. In the first diagram, there are two main branches in red, with three spaces for words atop the gray branches. In the second sentence, there are three main branches again in red, with the three spaces for what are in this case adjectives atop the gray lines. Think of each red line—main branch—as a separate item. When thought of this way, it is easy to see that in the first sentence that only features a single comma—“…fudge on the bottom, vanilla in the middle and chocolate on top.”—only has two separate items, whereas the second sentence with the two commas actually features three separate items.

Like I said earlier, you can use this little cheat to help with deciding how many commas you should be using: “the number of things this person likes is the number of commas +1,” or in a more general way: for a list of x items so that x > 2, you should have x-1 commas. A few final examples:

  • Two items: I like eggs and cheese. (No commas because there are only two items)
  • Three items: I like apples, oranges, and grapes. (Two commas since there are three items: 3 > 2 and 3-1=2)

Pragmatic: Writing – Newest Post From Pragmatic *

So the other day I decided to register a new blog with WordPress, adding to the growing list of “vanity domains” I have registered through WordPress. I can’t say for sure what made me choose Pragmatic * as the name for my blog, but here was my reasoning: the word pragmatic means “of or related to the concept of something, not necessarily that thing in practice”, or something to that affect anyways. By naming the blog “Pragmatic *” I thought I would write about the theory behind things, as well as give tips and tricks regarding them, rather than provide specific examples. The * (star, splat) symbol in the name is a bit of a reference for programmers. In programming, the * sign matches everything, so by naming the blog “Pragmatic *” I figured I would write about pretty much everything, in a pragmatic way. That said, here is the first post from Pragmatic *, from which I hope to be posting many more. Check out the original post here.


“Life, like writing, is a constant revision process.” -Charter College pamphlette.

There really is no secret to writing, it’s just something you have to sit down and do. To write, you simply have to write. That’s all there is to it. As Merlin Mann said in the first episode of Back to Work–one of the many great podcasts on the 5by5 network–: “If you ever want to step back on the path, all you have to do is step back on the path.” There are a few different ways that you can improve your writing though, as there are a few different ways that you can make the process easier. That is what this article is about: basically, a tips-and-tricks post about how to, pragmatically, write.

The general writing process varies greatly from person to person. Some people, like John Siracusa, prefer to write and get it “correct” on the first try. Other people like Merlin Mann and myself prefer to write, iterate, and repeat those two steps until we feel the paper is finished, or in my case get tired of revising. These are not the only two ways to write though, in fact you must develope your own process. Once you have done this, regardless of what you started with, your process will be different from everyone else’s writing process. I said “the general writing process” in the beginning of this paragraph for a reason: the general process can be much the same, but the specifics will vary greatly from writer to writer. For example, my writing process generally goes something like this:

1. Write something. This could be the entire post or a single sentence–I write until I run out of thoughts to write about.
2. Proofread what I just wrote and edit if needed. Again, regardless of whether this is a sentence or a paragraph, I do this every time I pause in my writing.
3. Repeat.

Your writing process might look similar to this, but chances are it is slightly different. Whether that difference is that you revise only after writing a full paragraph, or possibly only after two, is inconsequential. The first step, then, to becomming a better writer is to either recognize your current writing process as an actual writing process, or to develope your own writing process. By recognizing or developing your writing process you will be able to write more easily, more effectively, and produce better writing than you would otherwise produce by using much more effort. Additionally, by having a set of steps that you can constantly refer back to, you can save yourself from the agonizing hours of staring at your screen wondering what to write about next, or how to proceed.

If you already write fairly often, identifying your writing process will be fairly easy: simply pay close attention to what you are doing next time you write something, make a note of everything you do (and by everything, I mean literally everything), and then revise that list when you are finished. Once you have taken out entries like “Took a break and watched YouTube for an hour” you’ll have your writing process, down in writing, for you to refer to any time you are stuck.
If you do not write often, however, it will be a bit harder to identify your writing process. For this case, I suggest that you adopt either the method utilized by Merlin Mann or John Siracusa; that is, try writing, revising, and repeating the process, or try writing and paying close attention to everything you are writing as you write it, respectively. Eventually you will develope something that works for you as you come to like or dislike a certain process and make slight changes to it as time goes on. Only after that will you be able to follow the steps outlined for someone that writes fairly often.

Identifying your writing process is not the only thing, or even the thing that will yield the most results, that will improve your writing though, or make the process more enjyable for you. The next tip I have for you is to write only about things that you are interested in, and only about things that you feel you can write a very, very long article about. Here’s why: writing about topics that do not pique your interest and compell you to go the extra mile and do the research, for example, quickly becomes more work than fun, and writing should be about 99% fun. If you ever sit down to write because you don’t want to, stand back up and walk away–writing is not for you.
My second point, to only write about things that you feel you can write a very, very long article about, may seem a bit extreme at first. However, think of it this way: every article, paragraph, and sentence begins with a thought. In your head, you can have lots of different thoughts on any one topic, and therefore might think writing some of those thoughts down and sharing them with others is a good idea. When you begin to write, though, you may find that your article turns out to be much, much shorter than you invisioned it in your head. That’s because, generally, you write much more formally than you think and speak, and therefore certain things that sounded good in your head either do not deserve a place in your article, or sound completely moronic when put to “paper”, so to speak. Therefore, I recommend that you only write about things that you feel you can talk about at great length so that once your article length has been trimmed down you will still have something publishable, and to always start out with an outline.

An outline? WTF? An outline, for those that have just asked either or both of the two questions at the beginning of this paragraph, is a general set of topics or points that you plan to cover in your article. An outline is important for a few reasons: to help keep you on track, to help keep you writing, and to keep the ideas you started out with fresh in your mind. To help illustrate this point, take a look at an example outline for a post I am working on concerning programming:

-Introduction
-Why think of programming pragmatically
-Examples
–Defining variables
–Functional programming
–Taking user input
–Giving the user input

Let’s tear this exampel apart. The first thing I have in my outline is telling me that I need to have an introduction as the first thing in my post–this makes sense. Next, I need to have an explanation of why this article is relevant and why I think it should be read, as well as why it is a good idea to take what would be written in that article seriously. After that I list some examples I might want to go over as part of the article, including defining variables, functional programming, taking user input, and giving the user feedback. The introcution, “Why think of programming pragmatically”, and the examples section would most likely all be seperate paragraphs, although the introduction and “Why think of programming pragmatically” sections might be combined–this outline is not set in stone, so to speak, and neither should yours be. The four example points could all be their own paragraph, or be incorporated into a single paragaph–or any combination of the two! To summarize this section, an outline is important because it will not only help keep you on track, but will also help you keep ideas fresh in your mind, and give your writing some good structure. And remember, your outline is not the final say in the structure of your article–there have been times when I have painstakingly created an outline for an article only to throw it out once I started writing.

So now that you have begun to get a feel for some of the more general writing tips I have to offer, let’s move right in to the specifics. The next tip I have for you is this: ingrain the rules. By ingrain the rules I mean to make grammer (yes, that was on purpose), punctuation, and style rules second-nature. In doing so, you will become not only a better writer able to mroe effectively convey your thoughts and ideas, but this will also cut down on the time you will spend revising. On top of that, your writing will come across as more professional and will be more likely to be read by professionals and, in general, more people. So make the rules second nature–pick up a grammar book (or five, if you’re like me) next time your at Barnes & Noble and keep them near your writing spot.

So we’ve covered quite a bit of ground so far. I’ve talked about developing your writing process to make writing both more fun and to end up with a better, more polished end result; about using an outline to stay on track and to help you through the writing process; and I’ve suggested that you make those pesky grammar rules second nature in order to make your writing more effective and professional, as well as to cut down on the time you will need to spend editing your writing once you think you are finished. That’s not all I’m going to cover though–welcoem to the misc section. In this section I’m going to cover some different tips and tricks that will serve to, as the other tips have, make your writing more fun and productive.

The first tip is not to write until you drop, or not to write until you feel you cannot write any more. Even if this means only writing, say, 500 words and then closing your editor, so be it. If you continually write until you either get too frustrated to go on or until you simply cannot continue for whatever reason, you will subconsciously assign that negative feelind with the writing process and therefore will be less likely to write in the future. Therefore, set a goal at the beginning of the day as to how much you would like to write–make it a realistic goal–and do your best to stick to it.

As a bit of a side topic to the “don’t write untul you drop” subject, be okay with distractions. Many people like to write when it’s quiet or when there are few distractions around them–that’s fine, if you feel you must have peace and quiet to write, so be it. However, don’t make that the only way you can write, and don’t make it so that you feel you cannot take a break midway through your designated writing time. (For example, while writing this article I decided to stop mid-sentence and go play a videogame for a few minutes before continuing on.) Breaks are perfectly fine, so if you feel you need to take five minutes to check your email and watch a video on YouTube, go ahead, go do that, but come back to your work after those five minutes prepared to write once more. Just like writing until you can write no more, feeling guilty about these breaks can affect your overall subconscious feelings on writing, so try to avoid that.

Without trying to go in to the topic of procrastination too much, which is a topic an entire blog could be devoted to, I would just like to say that you should be aware of it, and practice recognizing when you are procrastinating for whatever reason. If you find yourself continually making excuses as to why you cannot sit down and write 500 words today, maybe writing isn’t for you. If that’s that case, take a step back and either re-evaluate your motives for writing, or decide that you will take a break from writing (not that you were doing any in the first place) for, say, two days. At the end of those two days, re-evaluate your motives for writing and ask yourself this question: “Is this what I really want to be doing?” As I said earlier, “If you ever sit down to write because you don’t want to, stand back up and walk away–writing is not for you.”

My final tip is to find a good editor to write in, and stick with it. A common excuse as to why someone cannot write is that he or she does not have a good editor–”I need Microsoft Word to write that.” That is, simply, nothing more than a lame excuse and feeble a reason to procrastinate. If you really want to write, you could write on the corner of a napkin while out to dinner, and some of you will. Others will feel that they need Microsoft Word in order to be able to write, which is just that person kidding himself into thinking that is true, and using that as an excuse not to write. This point is related to the feeling of the overall writing experience, which I touched on in my last few paragraphs. If you do not enjoy your writing process you will be less likely to continue to write. If it takes buying a new notepad every week or downloading a new text editor every week to try and get to having fun while writing, then so be it; just don’t use that as an excuse not to write, and be able to recognize when you are.

And finally, writing is hard–I’m not going to sugarcoat it. A lot of people write, less write well, and the majority of people wish they could write. Writing is not for everyone, and everyone cannot write. If you find you don’t enjoy, or can’t, write blog posts, try your hand at fiction or whatever, just don’t give up. Writing might be the hardest thing you ever do, but it should also be one of the few things you never give up on.

An Introduction to Python and Perl, and Running them in Windows

In my last article, I went through how to install the tools needed to create, edit, debug, and run Perl and Python, specifically CGI files, in Windows. As a brief recap of Running Perl and CGI files on Windows, here’s what I went over:

  • Download and install XAMPP. XAMPP gives you the ability to run Perl and PHP scripts natively in your browser as if they were on a web server.
  • Download and install Python. By installing Python, and combining it with XAMPP, you can not only create CGI files, but also run them on your computer.
  • Download and install Cygwin. Cygwin offers some of the tools available to those that have access to a Unix terminal, as well as provides the ability to create, edit, debug, and run virtually every type of program.

By downloading and installing those three programs and following my guide, you can attain the ability to easily create, run, edit, and debug programs of any kind. But what if you don’t know how to write, say, a CGI file to make a webpage? What if you’re not an expert, or even a beginner, in Perl? If you aren’t a programmer yet, then this guide is for you: in the rest of this post, I will go over what you need to know to be able to create web-ready CGI and Perl files, as well as some basics of each language.

The first thing I will cover is creating the basic template for a webpage in both Python and Perl. Since the main focus of this article is to give you the knowledge to create a webpage with Python and Perl, that is what I will focus on most; basics of both language, while you will learn them throughout this article, will not be focused on very much.

Alright then, the first template we’re going to go over is a webpage created with Python. In order for a Python file to be opened in a browser and displayed as a webpage, it must be saved with the .cgi file extension, and therefore I will refer to webpages created in Python as CGI files from here on out.

Anyone that has created a Python program in the past will know that the shebang statement (pronounced she-bang statement) is the first line of any Python file. Normally, it looks like this:

 1: #!/usr/bin/python

The shebang statement tells the computer that this file is, in fact, a Python file, and that the computer should look for Python in the folder /usr/bin/python. /usr/bin/python is the default Python installation folder on Unix systems. But you aren’t running Unix, are you? At least, as far as I am concerned in this tutorial, you are running Windows, and if you are running Windows you’re going to need to change that shebang statement a bit. If you are running a Unix-based system, the shebang statement above will work. The new shebang statement that will work on Windows, assuming you installed Python 2.7 and installed it to C:/Python27, will look like this:

 1: #!C:\Python27\python.exe

If your version of Python is not 2.7, replace “27” with your version number, but strip off the periods. For example, if your version was 3.1.4, your Python installation folder would probably be named Python314, although since I am not sure of this, check by opening up your C: drive and checking the folder name.

The shebang statement for a Perl file is pretty much the same as the shebang statement for Python on Unix systems:

 1: #!/usr/bin/perl

However, to be able to run the Perl files in Windows with XAMPP, you must change the shebang statement to look like this:

 1: #!C:\xampp\perl\bin\perl.exe

In each case, whether with a CGI file or a Perl file, the shebang statement needs to point to the location of python.exe or perl.exe, respectively.

Alright then, now that you have the shebang statement down, let’s move on to making a basic webpage with Python and Perl. For both Perl and CGI files, the process for creating a file that will cause (X)HTML code to be displayed to the screen is very much the same, so I will go through both at the same time.

In order to create a displayable webpage either in Perl or Python, you will need your file to look like, at the bare minimum, this:

 1: #!C:\Python27\python.exe
 2:
 3: print "content-type:text/html"
 4: print """\
 5: <html>
 6:     <head>
 7:         <title>
 8:             Page Title
 9:         </title>
 10:     </head>
 11:     <body>
 12:         Page content
 13:     </body>
 14: </html>
 15: """

Obviously, “Page Title” and “Page Content” would be changed to whatever you wanted them to be changed to, and the shebang statement would be changed if you were creating a Perl file. This is the basic file for creating a webpage that will be displayed to the screen from either a CGI file or Perl file, depending on the shebang statement you include. Before moving on to test out this file though, let’s run through a little bit about this program. If you are new to programming, pay attention to this. Otherwise, feel free to skip over this paragraph.

  1. Line 1 is, as you know, the shebang statement.
  2. Line 2 is left blank to make the file a bit easier to read. Remember that the computer ignores whitespace like this, so you could have anywhere between one and 100 lines after the shebang statement and it would not matter. This rule is applicable for almost any part of a program, and is a great way to make the program more readable.
  3. Line 3 is critical to this program: it tells the browser that the, in this case, CGI file is displaying text and HTML code, and to treat it as such. If you do not include this line, an error will be thrown when you try to open this file in the browser.
  4. Line 4 begins the XHTML code. In Perl and CGI files, (X)HTML code is handed to the browser via the printstatement. Something you might not know about, though, is the rest of line 4: notice the three double-quotes, followed by a backslash ( \ ). Three double-quotes followed by a backslash tells the program that 1) to continue the contents of the print statement until it encounters another set of three double-quotes, and 2) that the text, or in this case the code, to be printed begins on the next line.
  5. Lines 5-14 contain the XHTML code that is to be printed to the browser, finishing on line 15 with the three double-quotes that denote the end of the print statement.

Depending on the type of file you are creating, whether a CGI file or a Perl file, save this file as index.cgi or index.pl, respectively. As I said in my last article, you will need to save this file in the cgi-bin directory, which is within the XAMPP root directory. The default XAMPP root directory is C:/xampp, and by default the cgi-bin folder will be located at C:/xampp/cgi-bin. Save the file in the cgi-bin directory, otherwise it will not execute when opened in the browser. Once the file is saved to the cgi-bin directory, open up your browser but don’t navigate to any any webpage or open a file.

From your browser, you can go to http://localhost/ in order to make sure that XAMPP installed successfully. If you see a webpage come up and not an error message, XAMPP was installed correctly. Note that instead of being at http://localhost/ or localhost/, you were redirected to localhost/xampp (or http://localhost/xampp). In order to be able to view the CGI or Perl file you created just a minute ago, go to http://localhost/cgi-bin/index.cgi, or http://localhost/cgi-bin/index.pl for a Perl file, where index.cgi (or index.pl) can be replaced with the file name of any file you wish to execute. If you received an error, don’t worry about it—”It’s all… part of the plan.”

So you got an error, no big deal—if you plan to program regularly, or even just every once in awhile, get used to having errors. In my previous article I suggested that you install Cygwin in order to be able to more easily debug programs. Assuming that you installed Cygwin, fire it up. If you did not, I recommend that you do so now.

Once Cygwin, or rxvt if that is your preferred editor, loads, you’re going to need to navigate to the cgi-bin folder. If you read my post, Installing Cygwin, you should know how to do this. If you need a bit of help with it though, the command will look like this assuming you installed XAMPP in the default directory:

cd "C:/xampp/cgi-bin"

Unless you installed XAMPP in a different folder other than the default, which is C:/xampp, this will take you directly to the cgi-bin folder. Once there, you are going to want to do a one thing before everything else: change the file permissions of your file. This is just good practice and can save you some time later on. It could also be the source of your problems on occasion, if the browser does not have permission to execute the file, for example. For brevities sake, I will assume that you created a CGI file and named it index.cgi. In order to change the file permissions of index.cgi, use the following command:

chmod 755 index.cgi

This command changes the permissions of index.cgi to 755, which means that everyone can read and execute the file, and the owner of the file has write permissions—he or she can make changes to the file and save it. Alternatively, you can also use this command to change the permissions of all the files in the current directory:

chmod 755 *

For more information on permissions and setting them with Cygwin, check out UNIX Permissions Help from zzee.com.

Next, let’s take a look at the file by using the cat command. The cat command prints the contents of the file it is supplied with to the standard output, which is the screen (or the terminal window).

cat index.cgi

You should now see the contents of index.cgi printed to the screen. Everything look good? Unless you notice any obvious errors in the syntax of your program, proceed to the next step. If you do notice something wrong, make the change to your file, save it, and try to open it again in the browser. It should fail. Once you’ve finished testing and reviewing it, proceed to the next step. If it works, though, I still recommend that you continue reading the next section so that you will have some knowledge on how to debug one of the most common issues of creating programs on Windows.

Now that you are thoroughly confused, I will tell you what is wrong with your program: most text editors for Windows add a little something onto the end of each line that is incompatible with Unix systems and shows up in files read by them. That something is a ^n character and must be removed in order for your files to be successfully run. If you want to see them, use the following command:

cat -v index.cgi

The cat –v command will show all the hidden formatting that is otherwise invisible in your program. To remove those annoying ^n’s from your program, run this command in Cygwin:

dos2unix index.cgi

Just like with the chmod command, using a splat (star) instead of the file name will cause the command to be applied to all files in the current directory. To check to see if all those ^n’s were removed from your program, run the cat –v command again. You should’ve see any. Now open your browser once again and refresh the page—voila, it should work just fine. Don’t worry about having to do this every time though: once you’ve used the dos2unix command on a file, the extra formatting characters tend to stay off your file regardless of the editor you use, so long as it isn’t Microsoft Word or something similar.

Your screen should be, for the most part, empty right now except for two words: “Page Content”. Those two words are exactly what you told the CGI file to print to the screen. You may be wondering what happened to all the XHTML code though: it was read by the browser and then parsed as XHTML code. To make this a bit easier to understand, think of it this way: the CGI file is executed by the browser when you open it. The CGI file is opened by navigating to it in the browser. Upon being executed, the CGI file sort of hands the browser everything it is told to have printed. In this case, you can think of everything printed to the screen except the first print statement, the one proclaiming the content of the document as text and HTML code, as an XHTML file. When thought of this way, it makes sense that the only text printed to the screen is the single line within the <body></body> tag: Page Content.

Now that you’re thinking of the code within the print statements as a sort of HTML file, here’s your first tip: write your basic webpage in an HTML editor, then copy and paste it between the print statement. Doing this will make editing and creating the basic webpage much, much easier since HTML files can be quickly run and then debugged using tools like Firebug and Web Developer Toolbar, whereas with a CGI file you will also need to debug the Python code and not only the code rendering the webpage. Supposing you take my advice and decide to edit your (X)HTML code in an HTML editor, what editor will you use? There are a host of different editors available, but my favorite is Notepad++. In Running Perl and CGI files on Windows I recommended that you download and install Notepad++ to create and edit programs, and I will recommend it once again now: Notepad++ not only is a nice editor for Python and Perl programs, but also works well with (X)HTML code as well. To download Notepad++, visit their website here: Notepad++ home page.

So now you’ve got the basic code for a webpage working, you have a basic webpage, and an editor to edit both the CGI file and the HTML code. On top of that, you know that simply copying and then pasting the HTML code into the CGI file between the first three double-quotes and the last three double-quotes will cause that HTML code to be read by the browser as if it was an HTML file, and therefore you can easily edit and create basic webpages separately from your CGI file, then stick it in there when you’ve finished. Now that you know all this, what’s next? Let’s go over some basics of Python and Perl. First, I will go over some Python basics:

Declaring variables in Python

This is such an easy thing to do, it hardly warrants its own section. Nevertheless, it is a necessary topic and will therefore be covered, even if briefly. Programmers coming over from languages like C where you must define variables by type, and once a variable is defined as, say, an integer it cannot be a string or even a float later on may find the manner in which Python uses variables strange. Rather than explain this, check out the code example below, as well as the screenshot showing the results:

 1: #!C:/Python27/python.exe
 2:
 3: hello = "hey"
 4: print hello
 5: print
 6:
 7: hello = 1
 8: print hello
 9: print
 10:
 11: hello = ["hello", "hey", "hiya"]
 12: print hello
 13: print hello[0]
 14: print hello[1]
 15: print hello[2]
 16: print
 17:
 18: hello = {"first" : "hello", "second" : "hey", "third" : "hiya"}
 19: print hello
 20: print hello["first"]
 21: print hello["second"]
 22: print hello["third"]
 23: print

And the result:

defining_variables

So here, you can see that the first time I define the variable hello I fill it with the text “hey”. Using the print command, I can print the contents of the variable hello, resulting in the text “hey” being printed to the screen. Next, I using a single print command. This causes a blank line to be printed to the screen, giving some space before the next print statement.

The next time the variable hello is defined, it is defined as an integer. Unlike in a programming language like C, re-defining a variable like this, moving from one type to another, is perfectly acceptable. This time, hello is given the contents of the number 1, and using the print statement will print a 1 to the screen. In case you are wondering, the 1 is actually an integer even though the variable hello was previously a string variable. That is, I could add a 1 to hello and get 2, not 11 as it would be if I added “1” and “1” (both being strings).

The second time hello is redefined, it is defined as something called a tuple. A tuple is a number of values separated by commas and accessed by using the index; that is, the item at the 0th index is actually the first item in the tuple since tuples begin counting at 0, the item at the 1st index is actually the second item in the tuple, and so on. Here we have re-defined the variable hello once again, and once again have changed its date type.

The fourth and final re-definition of hello defines it as something called a dictionary. A dictionary can be thought of sort of like a tuple, except instead of using numbers as the index, a dictionary uses a string as the index for each of the elements. If you look back up at the code example, different items in the tuple are accessed by using the indexs 0, 1, and 2, whereas the different items in the dictionary are accessed by using the strings assigned to each element:

dict = {"item one index" : "contents of item 1", "item two index" : "contents of item 2"}
Declaring variables in Perl

Rather than do all the basics of Python at once, I’m going to do each topic of each language together. Therefore, this section will be devoted to explaining variable definition in Perl. Perl variables, like Python variables, determine their type from the contents given to them, which means that a variable can be an integer for a while in a Perl program, then a string, then a list—just like in Python. Here’s a code example, as well as a screenshot of the result:

 1: #!C:/xampp/perl/bin/perl.exe -w
 2:
 3: $myvar = "hey";
 4: print $myvar . "\n\n";
 5:
 6: my $myvar = 1;
 7: print $myvar . "\n\n";
 8:
 9: @myvar = ("hello", "hey", "hiya");
 10: print @myvar . "\n";
 11: print $myvar[0] . "\n";
 12: print $myvar[1] . "\n";
 13: print $myvar[2] . "\n\n";
 14:
 15: %myvar = (mon => "Monday", tue => "Tuesday", wed => "Wednesday", thur => "Thursday");
 16: print %myvar . "\n";
 17: print $myvar{"mon"} . "\n";
 18: print $myvar{"tue"} . "\n";
 19: print $myvar{"wed"} . "\n";
 20: print $myvar{"thur"} . "\n\n";

And the result:

defining_variables_perl

Alright then, let’s talk about this example: the first line is, as I’m sure you know, the shebang statement. Because I wrote this example in Ubuntu, the shebang statement was as you see it in the example rather than how I told you to write it on Windows. The first line is followed by some whitespace, which is good programming practice and makes the file a bit easier to read.

Line 3 begins the variable definitions. First, the variable myvar is defined as a string with the contents of “hey”. Notice the dollar sign ( $ ) before myvar: this declares the following variable, in this case myvar, as something called a scalar. A scalar is a data type that is like a normal variable and can contain any sort of data—any sort of number or string, or both, but not an array (a tuple in Python) or a hash (a dictionary in Python). The declaration of myvar is followed by a print statement, which prints the contents of the scalar myvar to the screen. Notice the space after the name of the variable to be printed, followed by a period ( . ), with “\n\n” following the period. By default, Perl does not print each print statement on a new line (whereas Python does), so if you wish to print each print statement on a new line, you must include a period after the variable name—the period is the Perl concatenation operator—and then the newline character, which is \n.

The next time myvar has its value changed doesn’t actually change its data type: it is still a scalar. However, the value of myvar is changed from a string to an integer. myvar is then printed to the screen in the same manner as it was printed to the screen when it had a string value, and is followed by two newline characters concatenated to the print statement with the period as with the previous print statement.

Next, myvar finally has its data type changed: myvar goes from a scalar to something called an array. An array in Perl is almost exactly the same as a tuple in Python, and is accessed in the same manner through indices. Check the code example for syntax help.

On line 15, myvar is once again re-defined, and this time as something called a hash. A hash in Perl is very similar to a dictionary in Python, and is accessed almost the same way: by using a string as an index. Check the code example for syntax help.

So that’s defining variables in Python and Perl. Defining variables in both language is pretty easy, but I still suggest you take some time to memorize the syntax of each: whether you need curly braces or square brackets to define a tuple in Python, or if you need to use the @ sign before a list or the percent sign ( % ) before a hash in Perl, for example.

Variable substitution in Python

This is pretty easy, but extremely powerful and unbelievably useful, and especially so when creating webpages in Python. When I say variable substitution, I mean substituting for example, the value of a variable into a webpage. For example, take a look at the code example below, as well as the output screenshot:

 1: #!/C:/Python27/python.exe
 2:
 3: #DEFINE THE VARIABLES
 4: page = "Home"
 5: content = "Home page!"
 6: #END DEFINE VARIABLES
 7:
 8: #PRINT THE PAGE
 9: print "content-type:text/html"
 10: print """\
 11: <html>
 12:     <head>
 13:         <title>
 14:             %s
 15:         </title>
 16:     </head>
 17:     <body>
 18:         %s
 19:     </body>
 20: </html>
 21: """ % (page, content)
 22: #FINISHED PRINTING THE PAGE

Before going to the output, what do you think will happen? Notice the %s operators in the code example: There are two, one between the opening and closing <title> tags, and one between the opening and closing <body> tags. Also notice that I have defined two sting variables at the beginning of the program; one named page, and the other named content. You can read the content of both of these variables by checking out the program. Finally, notice that at the end of the program, rather than simply having the three double-quotes denoting the end of the XHTML document, there are a few extra things on the end of the line: the percent sign ( % ) followed by the name of both variables in parenthesis. When this code is run, here’s the output:

variable_substitution_output

Notice that both %s’s were replaced with the contents of the variable page and the contents of the variable content, respectively. Here’s why: the %s operator means to substitute a variable’s contents in at that point. The variable whose content is to be placed in the print statement is decided upon by the order of the variables listed at the end of the print statement, within the parenthesis: the first %s in the program is replaced by the first variable inside the parenthesis, the second %s in the program is replaced by the second variable inside the parenthesis, and so on.

Variable substitution is extremely useful in general Python programming, but especially useful when creating webpages. For example, with variable substitution it is possible to have a basic page layout and change only certain things, such as the page title and the body content, by changing the required variable’s contents. Take a look at this code snippet for a better example of the power of variable substitution:

 1: #!C:/Python27/python.exe
 2:
 3: #DEFINE VARIABLES
 4: page = "Home"
 5:
 6: content = """\
 7: This is a multi-line text example.
 8: Somehting like a menu could be placed here, and then substituted into the program later on.
 9: A menu created in this manner would be much easier to manage because it could be changed in a single place rather than on every page.
 10: So that's pretty much it!
 11: """
 12:
 13: #END DEFINE VARIABLES
 14:
 15: #PRINT PAGE CONTENT
 16: print "content-type:text/html"
 17: print """\
 18: <html>
 19:     <head>
 20:         <title>
 21:             %s
 22:         </title>
 23:      <head>
 24:      <body>
 25:          %s
 26:      </body>
 27: </html>
 28: """ % (page, content)
 29: #END PRINT PAGE CONTENT

The output would look like this:

variable_testing_output

This example demonstrates the power of variable substitution in Python, and why it is so useful creating webpages. I recommend that you try this out a couple times, and just play around with some different variable substitution programs of your own creation in order to get better at this. You’ll be happy you did later on.

Variable substitution in Perl

Unlike Python, Perl does not have a easy-to-use operator to substitute in the contents of variables. If I am incorrect here, which is very possible as I have used Perl very little, please comment and correct me. Anyways, the fact of the matter is that you must manually insert variables one at a time, rather than all at once like Python does. Here’s a code example that would produce the same results as the above output screenshot generated after running the Python example code:

 1: #!/usr/bin/perl -w
 2:
 3: $content = <<BODY_CONTENT;
 4: This is a multi-line text example.
 5: Somehting like a menu could be placed here, and then substituted into the program later on.
 6: A menu created in this manner would be much easier to manage because it could be changed in a single place rather than on every page.
 7: So that's pretty much it!
 8: BODY_CONTENT
 9: $page = "Home\n";
 10:
 11: print "content-type:text/html";
 12: print <<HTML;
 13: <html>
 14:     <head>
 15:         <title>
 16: $page
 17:         </title>
 18:      <head>
 19:      <body>
 20: $content
 21:      </body>
 22: </html>
 23: HTML

This code definitely needs some explaining! I’ll go through it line-by-line:

1. You’re probably tired of me saying this by now, but I’ll say it again anyway: the first line here is, as always, the shebang statement.
2. The second line is, again, as usual, a blank space to give us a bit of room between the beginning of the file and the actual good. As I have said before, this is simply good programming practice.
3 – 8. Line three defines a variable named content as a scalar—that’s easy enough to see. However, what’s that weird <<BODY_CONTENT; line after the variable definition? <<BODY_CONTENT; is something called a here-doc. A here-doc (which is in this case BODY_CONTENT) allows for multi-line strings without worrying about quotation marks and the like. It is very similar to Python’s usage of three double-quotes ( “”" ) and works exactly the same way. In order to end a here-doc, you must use the same words that were used in the initialization of the here-doc; that is, if you initialized a here-doc with the words BODY_CONTENT, then the here-doc will not end until you type the words BODY_CONTENT. The two less-than symbols ( << ) merely declare that the following word (or words connected by an underscore) define a here-doc. To help solidify the here-doc, here’s a quick example:

#!C:/xampp/perl/bin/perlexe -w$multi_line_string = <<MANY_LINES;
This is part of the scalar variable multie_line_string,
As is this,
And this,
And this, too.
This is the end:
MANY_LINES

You can also go to About.com’s here-doc page for more information on the here-doc: Perl Here-Doc Tutorial.

9. The ninth line in the example code above defines a scalar variable named page and gives it the value “Home”. This variable is used to specify which page is currently open, and as you will see later is incorporated into the XHTML code.
10. Line 10 is another empty line to separate the variable definitions from the code that actually prints the XHTML markup to the browser. Again, simply good programming practice.
12-22. Line 12 begins the printing of the XHTML code. Notice that instead of a regular print statement, this print statement uses a here-doc so that the XHTML code can be typed out as it would appear in the browser; that is to say, on multiple lines without the use of multiple print statements. This here-doc print statement spans lines 13 through 22 and ends with the name of the here-doc: HTML.
Line 16 and Line 20. Instead of using the %s operator like we did in Python, Perl requires that the variable name by typed out in the code in order for it to be displayed. Therefore, on line 16 the page variable is included in the print statement that prints the XHTML code to the screen, and on line 20 the content variable is included in the print statement which prints the XHTML code to the screen. If you would like to print “$page” instead of the contents of a scalar variable named page, you would simply add a backslash before the dollar-sign, so it would instead look like this: \$page.

Quick tip: the backslash “escapes” the character it precedes. For example, if you use the line of code below in a Perl program, you will end up printing “Hello, world!” to the screen:

$myvar = "Hello, world!";
print $myvar;

However, if you were to use the code below in your program, you would end up printing “$myvar” to the screen—the actual text “$myvar”, not what is inside the scalar variable named myvar.

$myvar = "Hello, world!";
print "\$myvar"

The same goes for Python: if you want to escape a character, such as a double-quote inside a string, use the backslash:

hello = "Hello, world! I'm \"Bob\"."
print hello

This would cause this line to be printed to standard output—the screen: Hello, world! I’m “Bob”. If the two backslashes were omitted, an error would be thrown when the Python program was run since there would be incorrect formatting.


That concludes my basic introduction to Python and Perl. Since I went through all the steps to give you the ability to create, edit, debug, and run Python and Perl programs (as well as CGI files) in my last post, Running Perl and CGI files in Windows, I will not go through them in too much depth again. However, I will go through them briefly. For a more detailed guide and explanation, check out my last post.

In my last post I recommended that you install the following programs:

  • XAMPP. XAMPP allows you to run Perl, Python (CGI), and PHP scripts as if they were hosted on a server. Without this ability, you can only run your webpages created with Perl and Python and see the resulting (X)HTML code—not very helpful when designing a website. Additionally, XAMPP also automatically installs Perl, so you don’t have to do that separately as you have to do Python.
  • Python. If you wish to create CGI files, you must have Python installed. XAMPP does not come with an option to install Python, so unless you install Python manually you will not be able to run CGI files through XAMPP.
  • Cygwin. This is probably the most important programming tool for anyone what is planning on programming very much. Cygwin allows you to run and debug Perl, Python, C, and many other kinds of programs right from the terminal. Additionally, Cygwin also gives you the ability to use Unix terminal commands, which makes a lot of programming tasks much easier.
  • Notepad++. Notepad++ is my favorite free editor for programming. Notepad++ features syntax highlighting, which is extremely helpful when programming, as well as a host of other features that just make programming much easier.

Once you have these four programs installed, you can create, run, debug, and deploy programs written in Perl, C, Python, and even Shell—just to name a few, and all from Windows.

Running Perl and CGI Files in Windows

A comprehensive guide to installing and running the programs necessary to create and run Perl and CGI files on Windows.

Lately I’ve been listening to Build & Analyze quite often, and one of the things that Dan Benjamin and Marco Arment have talked about recently (in episodes 18-21—I’m listening to Build & Analyze from the first episode on) is building a special kind of CMS, or Content Management System. I will not go into the details of their CMS design here, for brevities sake, but I will say that it has inspired me to do some programming recently. Since Python is my favorite language to create webpages with, I began looking for a way to be able to run CGI files—which are files that are written in Python, suffixed with .cgi instead of .py, and are executable by browsers—on my computer in order to work on designing my own site and with a CMS of my own design.

By far the most popular solution to the problem of being able to run CGI files, as well as Perl and PHP files, natively is to use a program from the Apache Software Foundation called Apache. Apache is a web server that can be installed on Windows, Mac, and Linux machines, thus giving programmers the ability to run programs as if they were hosted on a web server natively and without an internet connection. Apache, if configured correctly, solves this problem very well and works for many people. However, it is not exactly simple to configure Apache and make it work consistently, so after trying to work with Apache for quite some time I decided to look for an alternative. While researching some of the problems I was having with Apache, I heard various mentions of something called XAMPP. I had used XAMPP in the past, but could not remember exactly what it did, so it was not until I got tired of trying to work out Apache’s bugs that I looked into it. XAMPP is made by a group called Apache Friends, which is a group created in 2002 in order to promote Apache and make it easier to use. The XAMPP website describes XAMPP as “…an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start.” You can check out the Apache Friends website here: Apache Friends home page. After reading a bit about XAMPP, I decided to give it a try since I could not find anything else that looked as promising. The rest of this article will be devoted to going through the process of installing XAMPP and giving you the ability to not only run Perl and PHP scripts natively, which is an ability that comes from installing XAMPP alone, but also to give you the ability to write, edit, debug, and run not only Python programs, but also C programs as well as many others.

Here’s a list of programs I will recommend that you download throughout this article:

You can choose either to download them now, wait and see what I recommend them for and then download them, or not download them at all; however, I do strongly recommend that you download each of the programs I specified if you are planning on programming regularly.

Alright then, the first step is to download the XAMPP installer. I have a link in my list of recommended software, so go to the download page and download the XAMPP installer for your particular operating system: Windows, Max, Linux, or Solaris. Once the installer has finished downloading, proceed to the next step. Note that I am running Windows though, so this guide will be tailored to those running Windows as well. However, the programming concepts and example code presented throughout this article are applicable regardless of the operating system you are running.

Now that the XAMPP installer has been downloaded, open it up. Note: if you are running Windows Vista (or Windows 7) it would be wise to install XAMPP in a different folder than Program Files or Program Files (x86) as doing so can cause problems with file permissions and such. I recommend that you install XAMPP in C:/xampp, which is the default installation folder. Once you have chosen the installation folder, click Next and choose where icons for XAMPP will be placed. Due to my personal fetish of having my desktop cluttered, I only chose to place an icon in my start menu. Once you are finished in this screen, click Next again. When prompted to choose which programs you would like to install (You will have the choices of Apache, MySql, FileZilla, and Mercury) un-check all but Apache unless you know for sure that you want to install another one of the programs. After choosing, click Next and the installation process will begin.

The XAMPP installation process could take a few minutes here, so now would be a great time to get a head-start on the second step of this tutorial. If you are not planning on running CGI files, you can skip this step and move ahead; however, if you wish to be able to run CGI files natively, you must follow these steps:

  1. Go to python.organd download the latest version of Python (currently 3.1.4). When I installed Python earlier today, I opted for version 2.7 instead of the latest version simply because it is what I had used before. The version you choose is all up to you, and both will work equally as well.
  2. Once the Python installer has finished downloading, open it. Follow the on-screen prompts and install Python with the default preferences. If prompted, be sure to install the Python IDE as it can be very helpful when working with Python files. Once the installation of Python is completed, or during the installation, check back on your XAMPP installation to see how it’s going.

Once the XAMPP installation is finished, click the Finish button. A pop-up dialog box should come up asking you whether you want to start the XAMPP control panel now, or do it later. Start it now by clicking the “Yes” button. After clicking Yes, another dialog box will come up, this time with a warning telling you to be sure only to run the XAMPP Control Panel from the XAMPP root directory, which it lists underneath the warning. Make a note of the XAMPP root directory—it should be C:/xampp—as you will need to run the XAMPP Control Panel from this directory in the future. Upon clicking OK, the XAMPP Control Panel will open. It should look like this, or pretty close:

xampp_control_panel

The XAMPP Control Panel can be somewhat confusing at first, so here’s a quick rundown of what you should be seeing: Apache, MySql, FileZilla, and Mercury are names of programs that you could have installed during the XAMPP installation process. I installed both Apache and MySql, and as you can see from the picture above, both are running—running programs are denoted by highlighted text reading “Running” next to the program. If I were to stop one of those programs, the text would disappear. For the most part, you will not be using this window a whole lot: the XAMPP Control Panel is most useful for making sure that programs you installed through XAMPP are running, and to open the XAMPP root directory, which can be done by clicking the button labeled “Explore…”.

Once you have finished exploring the XAMPP Control Panel, you can either close it or minimize it, either way you will still be able to run you Perl or PHP files.

Before going on to my explanation of how to run CGI files with XAMPP, I am going to run through an option step. Even though this step is optional, I highly recommend that you follow it if you are planning on doing very much programming, regardless of the language, on a system with Windows installed. This option recommendation is to install Cygwin. Now for those of you that do not know what Cygwin is or what it does, check out my post Installing Cygwin for more information on it, as well as an installation guide and some basic usage instructions. I recommend that you install Cygwin because you can run, debug, and edit your files, regardless of the language, in it. If you do not have Cygwin installed, it will not be possible to debug CGI or Perl files very easily, if at all. Note, though, that the Python IDE will give you the same ability to run CGI (but not Perl or other types of programs) files before testing them out in your browser. However, I recommend that you download Cygwin to do this instead of using the Python IDE for these reasons: Cygwin will give you access to a Unix-like terminal and quite a few of the Unix terminal commands as well, and because Cygwin will allow you to compile (if needed) and run quite a a number of different kinds of files, including Python, Perl, C, and many others natively. These two abilities provided by Cygwin make debugging much easier and streamlines the entire development process in general. For the rest of this article, I will assume that you have installed Cygwin. Again, for a guide on installing Cygwin, as well as a basic usage guide, check out my article Installing Cygwin.

The next step in this process is to open an existing CGI file, or create a new one. I prefer Notepad++ on Windows, and gedit on Linux, but you can use any program you want to do this. First, then, open a new file. Before typing anything into it, save it. The location that you save it to is extremely important: you must save it to the folder named cgi-bin within the XAMPP root folder (the XAMPP root directory is C:/xampp by default, so the cgi-bin folder is, by default, C:/xampp/cgi-bin. If you chose to install XAMPP in a folder other than the default, this does not apply to you.) If you do not save the CGI (or Perl) file in the cgi-bin folder within the XAMPP root folder, the file will not execute. Once you have saved the file to the cgi-bin folder, you are now ready to start making your first program.

This concludes the first part of this article, the purpose of which was to provide you with the tools and the knowledge to obtain the necessary programs and run them correctly in order to be able to run CGI and Perl programs natively. The second part of this article will walk you through the basics of both Perl and Python, as well as show you how to run them natively with your XAMPP installation.

Best BitTorrent Applications

This morning Lifehacker posted an article called Five Best BitTorrent Applications in which, as you may have guessed, editor Alan Henry reported on his five favorite BitTorrent clients for Windows, Mac, and Linux. The list is as follows:

Deluge. Now this one came as a surprise to me: I had never heard of Deluge before reading Alan Henry’s recommendation of it, so for it to be his #1 pick was unexpected, and especially so since he described it as “one of the most lightweight BitTorrent clients available.”

Transmission. No surprise here—I’ve heard only good things about the #1 BitTorrent client for Max/Linux since I started out in the BitTorrent world.

uTorrent. I expected uTorrent to be #1 on the list, not #3. I was very surprised to see Deluge, which I had never even heard of, take the place of uTorrent in the #1 spot, especially since Deluge was described with the exact words I would use to describe uTorrent: “one of the most lightweight BitTorrent clients available.”

rTorrent/ruTorrent. This BitTorrent client is for Linux only and came as a bit of a shock to me: it has no GUI; rTorrent is a terminal BitTorrent client. As Alan Henry states in his description of rTorrent, “…if you’re managing your torrents remotely on a Linux box on your network, rTorrent lets you log in and manage them easily [with SSG] without firing up an app to do it.”

Vuze. Had Vuze not been on the list, Alan Henry would have surely received hundreds, if not thousands, of emails about Vuze. Vuze is one of my favorite BitTorrent clients and works, in my opinion, the best BitTorrent client on the list.

My thoughts:

It’s difficult to give my opinion of clients that I have not used—namely Deluge, Transmission, rTorrent—but I can certainly speak for the two clients that I have used: Vuze and uTorrent. Vuze is my go-to BitTorrent client for any torrent downloads because it has a great, easy-to-use interface, handles downloads more quickly than any other BitTorrent client I have ever used, and allows me to manage torrents that I have downloaded or are in the process of being downloaded much more easily than other clients. That said though, uTorrent is great because it’s just so fast and lightweight, runs on all my computers, and makes creating a torrent and sharing it with others extremely easy. Both clients do their job well and have some great features, so I have both installed on my system: between Vuze and uTorrent I can handle any torrenting job I’m presented with.

iCloud and iTunes Match

itunes_match-580x327

Last week at WWDC (the World Wide Developer Conference put on by Apple), iCloud and iTunes Match were announced. There were some rumors floating around before the announcement, as there always will be before any announcement from Apple, about these two services, and it turns out that the rumors were correct: In a nutshell, iTunes Match and iCloud combine to first scan through, and then make available all the music in a user’s iTunes library in the iCloud. The purpose of this scan, which will be done by iTunes Match, is to attempt to match as many songs in a user’s iTunes library as possible with those available in the iTunes store. If a match is found, the matched song will be replaced with the high-quality, 256kbps, AAC, DRM-free version from the iTunes Store—for free. Once the scan is complete, which should, as pointed out at the keynote featured in the picture above, take a few minutes, all the music will not only be replaced by high-quality versions, but those songs will also become available to stream to a PC or Mac through iCloud. Additionally, any songs that do not get matched to the iTunes collection of approximately 18 million songs will be uploaded to the iCloud and will be accessible from any machine through iCloud just as the songs that were matched using iTunes Match. And this is all for a little more than $2.00 a month—$25 a year.

After the announcement, many writers sat down and pooled their creative juices, resulting in many articles explaining the controversial nature of this service being published. They all ask pretty much the same question though: on MSN Money: Apple’s new music laundering service?; and on the Huffington Post: Apple’s iCloud – Amnesty for Music Pirates? An article from PlaigurismToday links to both the previously mentioned articles, as well as explains the service, and the controversy, in an excellent manner: What iCloud and Music Match Mean for the Piracy Fight:

Of particular interest to those interested in copyright is how iCloud works, or will work, with iTunes and music and music. On that front, Apple made two announcements, the first was that iCloud would make it easy to sync and download purchased music on all devices with the same iTunes account, a feature widely expected and non-controversial.

The second, however, was regarding its paid iTunes Match service which, for $25 per year, will allow users to match non-iTunes music they have in their library, including tracks ripped from CD, purchased from other vendors or downloaded illegally, and have that music replaced with high-quality official versions from the iTunes store that are also synced via iCloud.

As a result of this, iTunes Match has been called everything from amnesty for pirates, a laundering service for pirated music and even a surrender by the record labels on the issue of piracy.

An article by Fast Company, iTunes Match Not Laundering Pirated Music, It’s Driving A Subscription Future, explains the reaction many had to the announcement:

The knee-jerk reaction from some was to say Apple had effectively created a way for users to pirate songs from wherever and have Apple launder their files, exchanging them for for clean ones. “This puts together a model that allows people to make money off of pirated music,” Jeff Price, founder and CEO of digital music hub TuneCore told Mashable.

Basically, a lot of people are wondering—and rightly so—if iTunes Match and iCloud will make it easy for music pirates to exchange music obtained illegally or through dubious means, for legitimate versions through iTunes Match, and then have those songs available to stream anywhere through iCloud. Personally, I think there is no question that iTunes Match will be used for this purpose. So why, since Apple must have considered this possibility, are they still moving forward with this project? The next three paragraphs in Fast Company’s article (iTunes Match Not Laundering Pirated Music, It’s Driving A Subscription Future) explains this reasoning:

The service will cost $24.99 a year, and Apple is reportedly doing deals with labels and publishers to sanction this service. What the knee-jerk reaction neglects to consider is that Apple will reportedly pay labels royalty-style installments every time one of their tracks gets moved through the iTunes Match system. And since it appears that Apple is not going to distinguish between authorized and unauthorized tunes, the music industry might finally earn some money on illegally downloaded tunes that were previously pure loss.

Not to break the flow of this excellent excerpt, but clarification on the implications of this is necessary: “It appears that Apple will not distinguish between authorized and unauthorized tunes,” (the definition of authorized versus unauthorized in this case is sketchy—authorized as in music purchased through the iTunes Store? or authorized as in legitimate copies that were not pirated?). Basically, this means that Apple will pay the music labels X amount of money each time a certain song goes through iTunes Match and iCloud, regardless of whether or not that song was purchased through the iTunes Store, ripped from a CD, or downloaded from LimeWire (how the songs obtained from different sources will be distinguished from each other, if at all, remains to be seen). In doing so, the music labels are hoping to gain back some of the money lost on pirated music. However, as the article goes on to say in the next excerpt, the “amount that gets recouped will be negligible”:

But industry executives Fast Company spoke with, who asked not to be named due to the amount of power Apple now wields in their business (and Apple is still cutting deals with some labels), said the amount that gets recouped will be negligible, compared to the size of the losses. More important to them were the insights they’d be getting into which songs consumers liked–information they’d lost access to in the piracy world.

More important still, the executives said, is that iTunes Match will help get people back in the habit of paying for music. Even though, technically, of course, iTunes Match isn’t charging consumers for the music per se, just for the syncing. Still, the executives said, after a decade of treating music like it should be free, consumers will now start (or restart, really) to associate costs with the product.

Big changes are coming to the music industry again, once more brought about by Apple. Will iCloud and iTunes Match be what iTunes was to the music industry a decade ago when it was released? Obviously, that remains to be seen, but if I had to venture a guess it would be a definite “Yes”.

 

Sources (articles referenced and linked to throughout this post):

Three of the Best Podcasts On the Internet

Awhile back I wrote a post called 5by5 in which I talked about the 5by5 network. Without going into too much detail, the 5by5  network was created by a man named Dan Benjamin in 2009 and produces the best podcasts I have ever listened to, which is the topic of this post. Throughout the rest of this article, I will talk about what are in my opinion the best podcasts available to date.

Hypercritical

Hypercritical is a weekly podcast hosted by Dan Benjamin and John HypercriticalSiracusa. Each week, after a minimum of 35 minutes of F-U (Follow-Up), John Siracusa and Dan Benjamin discuss various topics selected from a mysterious list created and known only by John Siracusa. For the most part though, the topics are related to Apple and similar technologies. Regardless of the topic, John Siricusa always seems to know virtually everything there is to know about it and does a great job conveying that knowledge in such a small amount of time. As the podcast description states, “Nothing is so perfect that it can’t be complained about.” Some of the best Hypercritical episodes are #1, #2, and #13, although each and every episode is infused a depth that is both amazing and refreshing.

Build & Analyze

Build & Analyze is another weekly podcasts, this time hosted by Dan Benjamin and Marco Arment. Despite the Build_and_Analyzedescription claiming that Build & Analyze is “A weekly news and discussion show about the world of iPhone, iPad, iOS, and mobile web development.”, Marco Arment frequently talks about coffee and, more often in earlier episodes, politics and Fox News (check the first few episodes out to understand the joke). When not talking about Fox News, politics, and coffee though, Marco shares excellent advice concerning development in general–and specifically for iOS–, as well as his thoughts on recent happenings in the world of Apple and related technologies.

Back to Work

Back to Work is, just like Hypercritical and Build & Analyze, a weekly podcast. The release frequency and high-quality of Back to Work are the only two aspects this show shares with the other two podcasts previously mentioned though, as Back to Work focuses onBack to Work, as the description says, “productivity, communication, work, barriers, constraints, tools, and more.” Each week Merlin Mann tackles a different topic or elaborates on something discussed in a previous episode, in addition to sharing helpful advice for anyone struggling with things like procrastination and barriers. Back to Work is one of the best podcasts available on the 5by5 network and is a nice change from the technology-oriented podcasts previously mentioned.

Ninite vs Allmyapps

Windows/Linux: Whether for fun or to clean up old, leftover files and settings, reinstalling your operating system is inevitable. And just as having to eventually reinstall your operating system is inevitable, so is the drudgery of locating, downloading, and finally installing your favorite applications once again, and especially so if you have a lot of programs on your computer. Various solutions exist to combat this problem, but none as good as Allmyapps and Ninite. Allmyapps not only features an extensive library of applications to choose from, but also makes installing numerous programs seamless and headache-free through the Allmyapps installer, as well as gives users the ability to create an save multiple lists of applications to install later. Similarly, Ninite offers a nice selection of essential software, in addition to making the process of selecting and bundling that software into a single installer painless. On top of that, Ninite also makes installing and updating that software incredibly easy with their one-click installer.

First, then, the software libraries of Ninite vs Allmyapps. Ninite offers approximately 100 different programs on their website that can be bundled together into a single installer. Similarly, Allmyapps also offers a broad range of software. However, Allmyapps offers thousands of programs on its website, if not ten-thousand or more. That said though, Ninite offers mostly programs that can be said to be essential, whereas Allmyapps, while it does provide all the apps available on Ninite, also hosts many, in my opinion, useless programs.

The next thing to be considered is the ease of use in installing applications. Having established that Allmyapps provides the better selection of software, even is that selection does include a few useless programs, ease of use must be considered next. Ninite works by allowing its users to select applications from a webpage by checking a checkbox next to the application. Once finished selecting the desired software, clicking the green “Get Installer” button will bundle the selected software into a single installer and prompt the user to select a location for and download the bundled .exe file. The process is very different for Allmyapps. On the Allmyapps website, users are able to either download certain applications alone or add them to a list. Downloading the application alone brings a prompt up asking for a location to save the file to, whereas clicking the + sign next to the download button adds the application to a list. Once an application is on a user’s list, it can be found on the Allmyapps website and downloaded from its page. However, that is not the only thing lists do on Allmyapps: by installing the Allmyapps program, users can login to their account via the Allmyapps program and gain access to their saved lists. From the Allmyapps list view, it is possible to download all the programs within the list at once and with a single click.

So whether you need to install a few essential programs or want to find every single program on your computer and download them all at once, either Ninite or Allmyapps will solve the problem for you. Go check them out: Allmyapps, Ninite, and Ninite for Linux.

First Look: Ubuntu 11.10 “Oneiric Ocelot”

Rather than write an entire article on this subject, let me refer you to an excellent YouTube video review of Ubuntu 10.10 “Oneiric Ocelot”. The video runs through all the changes (and all the things that haven’t changed) in the first alpha release of the new version of Ubuntu.

Video review of Ubuntu 11.10 Alpha 1

Followup on Windows 8 Preview

So yesterday I posted my article First Look: Windows 8 – Thoughts, questions, and concerns in response to Lifehacker’s article First Look at Windows 8’s New Interface for Tablets and PCs as well as Microsoft’s video called Building “Windows 8” – Video #1 in which Jensen Harris, the director of program management on the Windows user experience team, demonstrated some new features of Windows 8. Well, this morning Lifehacker posted another article: Windows 8’s New Interface: Love it or Lump it? While I think the title is a little strange—”lump it”? what?—the fact that they—Lifehacker, not Microsoft!—are looking for some feedback on the early preview of Windows 8 is interesting, as is the feedback that ensued. The article features a poll at which anyone can cast their vote as to whether or not they like the new Windows 8 interface so far by choosing on of these options: Love what I’ve seen so far; Hate what I’ve seen so far; Undecided—I’m waiting to see more/use it before I pass judgement; Other. Not quite hating the interface myself, I voted for the third option.

After voting, I read the rest of the article. Towards the bottom, Adam Pash, the author of the article, included a quote from Will Smith: “If the iPhone has taught me anything, it’s that spending 5 seconds with a device is more revealing than overanalyzing a few frames of video.” I have to say, I totally agree with this, and would recommend that others take this into consideration: no matter how many videos Microsoft makes, there will always be some question that does not get answered, something that is not quite communicated correctly, and a feature that just doesn’t get enough focus. That said, I would also like to highlight a few comments, the first made by a user named Phoshi:

For the love of god, please no. A touch-centric UI is the best option for a smartphone, where you have highly limited input, but keep it the heck away from my PC. I have proper input devices here. They’re called a mouse and keyboard. My mouse is more accurate and less likely to be misinterpreted, and certain not to smudge. So don’t design the UI around a paradigm I do not follow.
Needless to say, my favourite part of the video was the bit where they showed a proper desktop and taskbar.

And another comment by a user named JCulp:

I think that it is a very interesting UI and there is a lot of development that should happen but I feel like they should be working on perfecting a UI for desktops and production. This seems more like a casual recreational computer/tablet user. I used the Omnimo desktop for a little while and this looks like a fantastic updated version built into windows. I can’t see myself utilizing this UI… There are many features that I would like to see implemented in the windows 7esque UI. I would love to see windows version of spaces. I use Ubuntu and love that feature but I need it in windows and no app seems to work that well. I used to be hardcore windows fanatic and lately I have seen my eyes drift to other OSes. Lion’s new features look like they streamline the workflow, Ubuntu’s Unity surprised me and is making me question windows. If you asked me in October 22, 2010 I would have been one of the most avid Windows supporters… now with the use of Ubuntu and Snow Leopard I feel there are a few features that are needed in Win7 UI. Best of Luck Win8 I will end up updating because I am a student and it costs hardly anything plus I have to use Windows for my Architectural programs.

Both make basically the same point: Windows 8 looks like it will be a touch-style desktop, and both ask the same question: Why?

Follow

Get every new post delivered to your Inbox.