Do Not Reply (.com)

You know all of those emails that you get from companies that say “DO NOT REPLY”? As it turns out, some genius programmers really like to go the extra mile to make sure that their users do not reply…to them. These geniuses program the emails they send to have a reply-to address in the form of something@donotreply.com. You know, so they don’t get the replies (or bounce-backs).

Trouble is, donotreply.com is actually a real domain. And, any email sent to that domain, will be received by someone. In fact, Chet Faliszek will probably get the email, because he owns the domain donotreply.com. He also likes to post the best of the embarrassing mistakes.

Via Coding Horror.

Multi Columns in websites

For the past couple of months I’ve been working on creating a new website that uses WordPress as a CMS for the organization Girls Get Connected (That’s the old site, because the new one isn’t quite done yet). The project has been a great one to work on because I’ve gotten to do everything including the design of the site and development of the WordPress back-end and templates.

Early on in the project, after the design mockup had been approved, I knew there were going to be some difficulties implementing it. One of the things that I knew would be a problem was the fact that I had designed a rather prominent section on the home page of the site which called for an article to be split into multiple columns. This being a content managed site, I also knew it wasn’t really going to be an option to ask the end users to break up their articles into two even sections so that it would make nice and pretty columns. Also, CSS3 really wasn’t an option, since this site would have to work on all current browsers. Something else would have to be done.

The solution I ended up using was a very elegant JavaScript program written by Randy Simons. The script is called Multi-Column Text and is pretty easy to implement. It automatically splits the text into multiple columns (you chose how many), and includes support for liquid layouts. This means that the content and columns aren’t static; they will automatically adjust as the page is resized. Check out the demonstration page to see what I mean. This script is also works on enough old browsers to actually be usable.

What impressed me most about the script was that it requires very little extra markup. Assuming all of your markup is in some sort of standards compliant state, all that is required is one (or possibly two) extra div tags. Say you wanted to make the following code segment use the multicolumn script:

<h2>Maecenas</h2>
<p>Pellentesque mi. In lacinia iaculis ante.</p>
<h1>Ut dapibus</h1>
<p><em>Nunc non dui.</em> Maecenas quis lacus sed dui commodo elementum.</p>
<p><strong>Pellentesque rhoncus sollicitudin libero. Phasellus nunc risus, tincidunt vel, bibendum eu, molestie ac, tortor. Etiam in felis.</strong></p>
<p><strong><em>Pellentesque id erat. Mauris condimentum pharetra nibh. Fusce sollicitudin auctor tortor. Aliquam placerat,</em></strong></p>

All that needs to be added are two div tags to wrap the content. The first div must also include an id or class name for the JavaScript to hook to. You can use whatever class or id name you want when you implement it. I chose to use id=multicolumn. The finished markup would look like this:

<div class="multicolumn">
  <div>
    <h2>Maecenas</h2>
    <p>Pellentesque mi. In lacinia iaculis ante.</p>
    <h1>Ut dapibus</h1>
    <p><em>Nunc non dui.</em> Maecenas quis lacus sed dui commodo elementum.</p>
    <p><strong>Pellentesque rhoncus sollicitudin libero. Phasellus nunc risus, tincidunt vel, bibendum eu, molestie ac, tortor. Etiam in felis.</strong></p>
    <p><strong><em>Pellentesque id erat. Mauris condimentum pharetra nibh. Fusce sollicitudin auctor tortor. Aliquam placerat,</em></strong></p>
  </div>
</div>

I like the way that looks: clean and simple. You can even use this in in a WordPress template with PHP tags included and everything still works. This is what is actually coded into one of my WordPress template files:

<div class="multicolumn">
  <div>
    <?php ggc_the_long_excerpt(); ?>
    <p class="readmore"><a href="<?php the_permalink() ?>" rel="bookmark" title="Continue Reading <?php the_title_attribute(); ?>">Read More &raquo;</a></p>
  </div>
</div>

My favorite part is what happens when Javascript is not available. In my case, the page still works fine and no content is lost. Sure, there are some rather long line lengths, but everything still works.

JavaScript getElementsByClassName

Today I found myself writing a little bit of JavaScript to isolate an element on a page. The element in question looked something like this:

<div class="mulitcolumn">
    <p>Some text...</p>
    <p>Some more text</p>
<div>

I wanted to get the div element by searching for the class name multicolulmn. Without thinking, I began writing the code to grab the div using the getElementByClassName function. Then I remembered that getElementByClassName isn’t actually a built-in function. Oh well, Google to the rescue.

I was able to quickly find Robert Nyman’s elegant getElementsByClassName function in The Ultimate GetElementsByClassName.

Using this function, you can get elements like so (examples pulled from Nyman’s site):

// To get all a elements in the document with a “info-links” class.
getElementsByClassName(document, "a", "info-links");

// To get all div elements within the element named “container”, with a “col” and a “left” class.
getElementsByClassName(document.getElementById("container"), "div", ["col", "left"]);

I love it when I don’t have to write my own JavaScript.

Take Screenshots From the Command Line

There is a command for Terminal in OS X which allows you to take screenshots from the command line. Creepy creepy. Here is the format:

screencapture -x FileToSaveAs

The -x option tells it not to make the shutter click sound. There is also an -i option which triggers an interactive mode, although I’m not sure why you would use the Terminal to do that.

There is also a cute little tidbit in the man page for screencapture:

Screencapture bug in man page

Finding a Good CMS Solution

There is a pretty good discussion going on over at 456 Berea Street about “Looking for open source CMS and portal software options“.

I’ve been thinking a lot about this for the last couple of months. I’ve worked extensively with WordPress (for this blog and a few others) and I really feel comfortable with it. I am confident that I can work with it and bend it to do most things I want with a little effort.

Currently I’m using WordPress for a contract job to create a smallish website managed by a CMS. The client wanted to use WordPress, and I am reasonably confident that it will achieve their goals. That said, I think they’re getting uncomfortably close to WordPress’s limits. There’s always a point when you are extending software that you have to stop and consider, “Am I really using the right tool for this job?”

I’d really like to branch out and learn some other content management systems that are more powerful than WordPress and also more geared towards CMS rather than blogging out of the box. I tried using Drupal a few months ago, and like many of the peopling commenting on 456 Berea Street, I found the admin interface to be absolutly overwhelming. It’s definitely designed with the mentality that more is better. I had a very clear vision in mind for what I wanted to accomplish with my Drupal site, but I ended up stumbling on some key things that felt like they should be very easy. Primarily dealing with attachment links.

That said, I was very impressed in general with Drupal. It seemed liked the sky was the limit as far what could be accomplished with it. The user roles were also a welcome departure from more restrictive systems like WordPress.

In the end, I was left with the impression that given a lot of time and energy (to learn Drupal) I could make some very cool sites. I wonder, are there other solutions that are better?



appointive
appointive
appointive
appointive