• code

    Object-Oriented JavaScript

    First a caveat: JavaScript is a prototype-based language, not an object-oriented language.  Now that we have an understanding of that very important fact, let’s learn how to use JavaScript as if it were object-oriented. A few weeks ago, I was asked to teach a couple of my colleagues how to code with JavaScript.  We’re building…
    Read More


    WordPress Weekly

    Last night, I had the opportunity to talk with Jeff Chandler on the weekly podcast WordPress Weekly.  We talked about a lot of things: should automatic WordPress updates be opt-in or opt out? Will/should Automattic ever be acquired by another organization?  Does it matter how many plugins your site runs?

    It was a fun chat, and I hope to call in to the show sometime again soon.  For now, you can listen to the show yourself:

    Or you can download the show from iTunes.


    It’s Not My Job

    It’s Always Your Job

    One of the coolest eras of my life was when I worked for the Boy Scouts.  I took 6-8 weeks every summer and lived out of a tent in the middle of nowhere.  No electricity.  No Internet.  No cell phones.  No television.

    It was heavenly.

    Working for the Scouts also taught me some great work ethics.  The first rule has defined my attitude towards work ever since:

    Work until you think you can’t.  Then keep working until someone tells you to stop.

    Having that voice in my head helps me work all night to close out client projects, fight to finish difficult – sometimes messy – cleanup jobs, and run long distances despite being tired.  It’s a rare sentiment among many people in my age group, and rarer still among those in my industry.

    The second rule we learned was that everything is your job.  At camp, we used outhouses.  They’d frequently run out of supplies or get … um … messy and a Scout or Scouter would come and ask for help from the staff.  The one thing you were never to say is “it’s not my job.”

    Everyone, from the trainees to the area directors to the business manager to the camp cook was expected to immediately stop whatever they were doing and help whenever a Scout asked a question.  If you were on your way to take a break, you’d detour to stock the TP or hose out a mess.  It didn’t matter who you were, what your jot title was, or how much you were paid.  It was never not your job.

    As a result, we built an incredibly coherent unit.  I’m still close friends with many of the staff, and we’ll be trekking back up to camp in two weeks to labor away in the mud and rain (that’s what we do for fun, after all).  We haven’t worked together as a camp staff in over 6 years, but there’s still a deep meaning to what it means to be a “Cooper Staffer.”

    Every organization has a brand, and it is the responsibility of each and every person in that company to live up to the brand.  The intern should be encouraged to learn the jobs of the people above him.  The CEO should be willing to offer her time to customer support when call loads are high.  Every member of the brand has a hand in shaping it – no matter what their job title might be.

    WPMU.org … A Great Bad Example

    Yesterday, I was alerted to a blog post on WPMU.org about plugin localization.  I don’t normally read that site, but figured it was worth a look based on who’d sent out the link via Twitter.  Frankly, I wasn’t happy. [Read more...]


    The “Great” Recession

    I hate to say it, but I told you so.

    In June of 2008, I told everyone that we were well on our way to a new depression in the market.  At the time, I called it a market malestrom, and yesterday I heard it referred to as “the great recession.”

    Despite the horrific downturn in the economy over the past few years, reports today indicate that we’re about to dip even further into the recession.

    I listen to the doomsayers on TV, I read the negative reports in the newspaper, and I hear people talking about “tough times” every day.  But the other day, something my brother said made me stop and reflect on the prediction I made 3 years ago.

    “I’m so glad I didn’t take that job. Look at their stock prices!” [Read more...]


    Live Blogging – AJAX Polling

    Gizmodo's AJAX polling method results in repeated 404 Not Found errors.

    I’m in the midst of developing a real-time publishing system, and I wanted to give an example of what it is and why I want to do it.

    Gizmodo’s live blog

    Today, Apple is promoting a live press event, and Gizmodo is live blogging their coverage on http://live.gizmodo.com/.  It’s a really basic page, but it updates automatically as new changes are available.  Their update engine is also pretty basic, but illustrates exactly what I want to do … just in a very inefficient fashion.

    The core of their code (I’m summarizing it) is written in JavaScript

    function update( version ) {
      var entries = jQuery('#entries .entry');
      var lastPostId = entries.size() ? parseInt( jQuery('#entries .entry').eq(0).attr( 'id' ).substr( 6 ), 10 ) : 0;

        if ( typeof lastPostId == 'number' && !isNaN( lastPostId ) ) {
          jQuery.get( version + 'update_' + lastPostId + '.html', function( data ) {

            if ( typeof data != 'undefined' && data != '' ) {

            // Process data

            clearTimeout( timeoutId );
            timeoutId = setTimeout( function() { update() }, 10 );


        } );
      timeoutId = setTimeout( function() { update() }, 10000 );

    How this works

    Essentially, this script will automatically fetch “update_XXX.htm” from the server every so often. XXX in this case is the update number (they were on update 408 at the time of this writing). [Read more...]


    Installing a New Engine – Nginx

    Nginix Home

    I originally started blogging with WordPress via the one-click installer that came standard with a basic Network Solutions website.  It’s been several years since then, and I definitely advise against getting started that way.  There are better hosts out there, and better server systems.  Take your pick.

    For the past year, I’ve been running my blogs on a VPS that I manage myself.  I got started with the basic LAMP (Linux-Apache-MySql-PHP) stack that just about everyone else has.  And it worked … for the most part.

    Unfortunately, Apache is a bit slow on the VPS I have.  And to handle some more experimental projects I’m working on, I felt the need to upgrade from the standard to something a bit beefier.

    Some developers recommended Nginx.  It’s an event-driven web server that can handle several concurrent connections, has a might lighter footprint than Apache, and can handle the new HTML5 websockets that I plan to play with.

    I was sold!

    Except for one tiny detail.  All of the “how to install WordPress” tutorials out there detail installation with Apache … not with Nginx.  So I was mostly on my own, but if you’re reading this, it means I managed to pull it off! [Read more...]


    One Time Password Security

    My day job has primarily consisted of migrating an old-school ASP.Net WebForms website to a new ASP.Net MVC application.  This has involved a massive layout/structure redesign, database overhaul, and a lot of custom coding.

    I’m mostly happy with how I structured the MVC-based content management system.  It’s very similar to WordPress … only written in C# and using a MS SQL database for the back end.  It also borrows heavily from designs found in DotNetNuke, BlogEngine.NET, and just about every other CMS I’ve ever used.

    But the trickiest – and coolest – part came when my boss asked that it be fully backwards compatible.

    Our flagship software application is heavily integrated with the web.  Users update their subscriptions through a web service.  Documents are downloaded from a webs service.  System updates are delivered through a web service.

    Unfortunately, all of this was set up on a legacy server that was physically in our office.  Since we’re moving to a distributed content hosting system, we needed an easy way not just to retrieve the data (that’s handled already) but to send updates to these webservices.

    It had to be secure.

    It had to be fast.

    It had to not be FTP. [Read more...]