Too Many Unproductive Comments

It seems as though there is an epidemic across the web. Bad comments. Not spam, not flames, not even rude remarks… just plain drivel. I spent the last few weeks reading all the comments (or as many as I could stand) on the hundreds of blog articles I read every week. They fall into two major categories, which I’ll discuss below.

I’ve linked to this in the past but I’ve really taken it to heart: Your Shit Does Stink — Good Friends Are Hard to Find.

What the gentlemen at Less Everything were saying has just continually amplified in my mind over these last few (dare I say “trying”) weeks. Their article is short, and worth the jump, but to put it in context:

It’s easier to just smile and nod and say, “that’s great,” and that’s what most of us do. But a true friend will tell you to polish it up or go make changes or start again.

The same applies to comments on a blog post. The idea is to inspire discussion, clarify points, etc. eventually enriching the value of the article itself. Instead, in a number of sites I’m seeing “fluff” comments, which just make the entire experience of reading comments a downright drag when I’m actually interested in the content. So, I counted…

I took a well written article with over 100 comments and counted more then 50% of the comments were of this “fluff” nature. Although not directly from the article where I calculated my statistics, I pulled this paragon of an example:

Useless Comment

I made little effort to hide the identity of the user and the website (which I have the highest respect for). The fact of the matter is that this comment is not only worthless, it pollutes the pot of potentially worthy comments and thus detracts from the value of the article itself. In this particular example the commenter actually admits to not reading the article but then claims he knows it will be awesome?!?! Give me a break. Hell, if I was the author of the article I would be upset at such an ignominious comment (yah, I looked that one up).

I’ve gone years on this blog without making a rant. This is my first. So, admittedly, I did not hold back. However, eventually I calmed down and tried to really think about this “problem.”

From the author’s perspective this simple “praise” is uplifting. For those offering the praise its quite simply that… many want to portray honest thanks and support to the author. This is all well and good. However, there are still many reading the article intending to engage in discussion. Undoubtably the author should both encourage and look forward to this kind of discussion; even more so then the praise!! Why? Because its in our nature. We write so that others can read. We enable comments so others can tell us what they think. If we didn’t care for other’s opinions or views then comments could just as easily be disabled.

So, essentially there are two categories of comments, Praise and Discussion. So, I think that this should become a model. The more recent up/down voting scheme is not the model to use for most blog articles. It works well on ranking sites like StackOverflow and Reddit where correctness or opinion influences the votes. However in this case there is:

  • Praise – essentially always an “up-vote.”

  • Discussion – a level playing field likely to contain constructive criticism as well as support for the article.

Both avenues should be available so that the author and all the commenters have the freedom to interact with whichever degree they feel is appropriate. In the end the discussion is separated from the “fluff” and everyone wins.

I’m thinking of the current system of WordPress with comments and trackbacks/pings. They are handled separately, but that is because fundamentally they are different. To make a system like I’ve suggested work would either require user action, moderation, or a (likely) sophisticated action. Two of those don’t scale and the last is probably too complex to be reliable. If I’ve learned anything from StackOverflow its that they have actively crafted and trained their community of users to “do good” and do all of this low level work willingly and it has paid off very well.

For starters “commenters” must at least be given the choice: to contribute to a discussion, or to thank the author for a well written article. I don’t intend on building this system yet, because I personally don’t have the influence or the popularity to make an impact. Yet.

Just keep this in mind the next time you comment. Actually try to “add value.” To rip off the Army… The whole world can read what you’re writing. Is it worth reading?

Cheers?

Visualize the Directory Tree

Ever have to work with a new directory and you have no idea what its structure is? Or maybe you have a few files laying around but you’re not sure which sub-directory they are in? Or maybe you’re showing someone else a project and you want to show them the directory hierarchy. The bare bones solutions of `ls -R` or `find .` are just too archaic and offer no visualization of the structure. To solve this problem, people have built their own “tree” scripts.

There are a few tree scripts available online. Some as simple as find | sed and others are slightly more advanced like a python script. I wasn’t pleased with the existing solutions, so I wrote my own. To get an idea of what I’m talking about take a look at this screenshot showing the listing of a Rails project:

tree

Its a simple, clean listing of the directory tree. I will admit, the style is based off of another tree script that I’ve seen that I liked. Also, this isn’t really production quality code. I take the lazy way out and first get a directory listing and then work from there. This means that for large directories there may be an initial pause before it starts outputting. I wouldn’t suggest running this on your home directory. Although I can think of better algorithms its unlikely that I would want to run this on huge directories so I’m more then happy right now.

The usage is pretty bare bones:

tree usage

This is one more script I’ve added to my ~/bin and its completely open source on GitHub. Its just straight Ruby, no extra packages, works with 1.8 and 1.9. Oh and did I mention its customizable?

I hope you like it.

Shell Brace Expansion

I would say that most developers that I know are comfortable with a shell/terminal but they are not proficient with the shell. I, for one, am constantly striving to improve my knowledge of the shell, customizing my environment, and trying to maximize my productivity with it. Even after years of constant usage I am always learning new tricks and techniques. It also doesn’t help that there are thousands of command line applications out there waiting to be absorbed.

My shell of choice, like most people I know, is bash. Most developers only use the basic features available in shells such as launching programs, command history, auto-completion, and the like. However, most shells have functionality people don’t even know about and could probably benefit from. Who knows, you might even be able to multitask and partake in foxy bingo online or pogo games while programming simultaneously. One such feature is Brace Expansion.

Take a look:

Brace Expansion

Its a little hard to see from the image so I’ll run down the examples here:

shell> echo hello{world,goodbye}
helloworld hellogoodbye

This example shows exactly what Brace Expansion is doing. Its taking the input line “hello{}” and replacing the “{}” section with each of the comma separated values, producing “helloworld” and “hellogoodbye.”

Its important to note that there is no space between “hello” and the opening brace. This is called the preamble and therefore it gets prepended to the front of both “world” and “goodbye.” Also, there is no space around the comma inside the braces. If there were a space then brace expansion doesn’t take place at all! The output itself will separate each expansion with a space, just like any other built-in shell expansion. If you really want spaces in the expansion portions you can escape them as you normally would and it will respect that.

shell> echo file.{txt,rb}
file.txt file.rb

This points out a couple things. First of all, I’m using echo to debug the brace expansion so you can see what it produced. What seemingly happens, like in the previous case, is that it ran the brace expansion when it parsed the input line, and turned it into the following:

shell> echo file.txt file.rb

Now some simple usages pop to mind. Need to rename a file? How about “mv filename.{txt,rb}.” Want to quickly backup a file, how about “cp filename.{txt,save}.” Whenever you feel yourself typing the same thing twice in a row that is a perfect candidate for brace expansion! Save yourself some keystrokes, some time, and potential errors by reusing what you’ve already typed in already!

The third usage is combining two separate but connected brace expansions “{}{}.” This works differently then two completely disjoint sets “{} … {}” and is still different then nested sets “{…{}…}.” Rather then discuss the semantics of those, which you can easily find out yourself by just trying them out, I’ll give you a glimpse of another trick you can do with brace expansion.

Here is a simple example of Sequences:

Brace Expansion Sequences

The syntax for sequences is “{#..#}.” You can even do simple character sequences like “{a..z}.” The second example from the picture shows a postscript, the opposite of the preamble. Its text that comes immediately after the braces (no space) and is thus appended to the end of each expansion.

I hope you give it try, you might end up liking it. I actually do some real neat tricks with it in one of my scripts. If you want to explore it further you should check out some of the more technical documentation:

Until next time, wrap your head around this crazy line. And no, there is no typo, its running a brace expansion once, which then outputs a very long command which includes brace expansion, and then runs that command with bash:

shell> echo echo {A..Z}\{0..{1..4}\} | bash

Markdown => Tutorial in 1 Step

When I wrote my Ruby Readline tutorial I felt I came up with a cool concept. I started with a Markdown file, translated it to html, and I used the headers to generate a Table of Contents on the fly.

table of contents

It didn’t take me long to realize that I could turn this into a framework where I could turn any Markdown file into a tutorial exactly like this one. So with surprisingly little work I modified the scripts to work with any markdown file and the html automatically generated from the standard Markdown.pl script.

I called this markdownorial. Laugh all you want at the name, but I still think the concept is very cool. I’ll probably be using this more and more to automatically generate and format a pretty cool looking tutorial from a single markdown file. The start to finish time for a project like this has instantly dropped to just the raw content part, no design or coding needed!

Advantages include:

  • Writing Markdown is very fast and efficient.

  • Time is spent writing the content. Not messing with design,

  • Table of Contents is automatically built for you.

  • Useful permalinks are automatically generated. Very useful when passing around links.

  • Clean user interface that focuses entirely on the content but the Table of Contents is always available!

  • Git Repository means if I update the design its just a `git pull` away to get the update.

Right now the tutorials shows up elegantly in all standards compliant browsers. Safari/Webkit and Chrome display it perfectly. Opera has some very minor Unicode issues but displays everything perfectly. Firefox has some separate Unicode issues and if you don’t have the latest version it has some working but slow animation. Overall, its entirely usable for people using decent browsers.

Let me know what you think. Feel free to use it and improve it. Its all up on Github.

First Nettuts Tutorial – .htaccess

My First Nettuts Tutorial was published today! For those who follow my blog every week, this is the reason why I haven’t been able to post the last few weeks… because I’ve been putting all the time I would normally be blogging into a series of Nettuts tutorials.


htaccess examples

This tutorial covers the basics of .htaccess, Apache’s Per Directory Configuration Files. Fortunately, with the basics out of the way, I can move on to the cooler features such as GZip encoding and mod_rewrite for the next article.

Also the examples can be viewed here:
http://bogojoker.com/htaccess/part1/

And the examples can be downloaded here:
http://bogojoker.com/htaccess/part1_examples.zip

Enjoy!

Mac OS X – Moving Windows Quick Tip

If your Mac won’t let you move a window because of a dialog or something, but you really want to move the window, just open Spaces and move the window from there! This seems to work every time. Its made working with some poorly developed applications a little easier.

Now if I could just make some dialogs stay in front of the actual application window I would be completely happy!

Favorite Quotes (Alpha Release)

Much like my ~/bin page that keeps track of shell scripts I’ve written I took the time to make a small site to host my favorite quotes. Again, this lets me experiment with some things. This is an alpha version showing some progress. Its just 2 hours of PHP, a text file backend, some CSS, and a bunch of minute JS animation. But its a neat site that I hope can become useful to me:

quotes

Some semi-novel concepts are that when you scroll 75% down the page the next 10 quotes are automatically loaded and added to the DOM in the background. This way you can continuously scroll forever and load quotes without ever noticing! Well, unfortunately you can’t quite test that yet, because there are only 10 quotes, and 75% is not perfect, it should really have a fixed size from the bottom. Minor details!

Also, this project allowed my to test my new auto-project-setup shell script. It worked great. it got me up and running in a matter of seconds!

search