A good example of an event emitter needs three things:

  • A thing that emits events
  • A thing that listens to, and handles, those events
  • Something that drives the two, causing events to be emitted.

Using node v0.4.11-pre, here is a small example illustrating custom event handling using EventEmitter.

I have much more experience with ExtJS than I do with Dojo, so I can’t help but to compare the two.  I try not to say that ExtJS is better because I’m likely biased by my familiarity.  It’s just different.


The latest turn in the computer science industry is a new development process called “Marketing Driven Programming.”

It is designed to make it easier for people who don’t have programming experience, but who do work in the Marketing Department, to develop applications independently of a technology or programming staff.

Marketing Driven Programming requires a voice-recognition element, because people from Marketing Department are (seemingly) much clearer when speaking, but the meaning of their thoughts are completely lost when committed to the written word and are able to be systematically analyzed.

The process amounts to a Marketing Expert speaking into a microphone, or to an individual that the Marketing Expert will treat as a microphone. For example, he might say, “I need a robust, multi-tiered, fault-tolerant, enterprise-class, innovative, xml, j2ee, turn-key, hands-off solution ASAP.”

At this point, the Marketing Driven Programming process begins.

  • Step 1: BLORK!
  • Step 2: Marketing Expert double-clicks on the setup.exe icon to receive and implement the solution.

NOTE: Step 1 may take a while. Please be patient. The process will initially report the completion time to be 3 months, but it may eventually take 9 months to 2 years to complete.

There are two main libraries for using websockets on a NodeJS server:

Both are in an interim state right node as the web socket standard continues to evolve.  Draft-10 is the latest specification and it was is supported by the Chrome browser. But the libraries don’t support draft-10 yet.

Miksago, the developer of the Node Websocket Server, is working in implementing draft-10 support. See the Support draft-10 (chrome 14-dev+) issue on github.

Socket.IO has an open issue at Chrome Dev (14.0.835.8): “WebSocket is closed before the connection is established.”

I’m still mulling where to take this NoDoJo project. Do I make it use Ajax instead of the websockets? Not sure yet.

Here is a brief bullet list of requirements for nodojo

  • messages beginning with ‘/’ are server commands
  • /help – show available commands
  • /motd – show message of the day
  • /join <channel> joins or subscribes to a room of the specified name
  • /part <channel> leaves or unsubscribes from a room of the specified name
  • /who <user> show information of the specified user (username, connection time, last message time, room subscriptions)
  • /topic [channel] [text] set the topic of the specified room
  • /list list of existing rooms with the number of users in the room
  • /msg <user> sends a private message to user
  • /nick <new user> sets your name to new user name
  • the message of the day can be set in a text or config file
  • when connecting to the server, the client must provide a username for the user
  • username must be globally unique
  • if the submitted username is already in use, the connection is terminated with an error message
  • usernames must be alphanumeric, beginning with an alpha, and 32 characters or less
  • during initial connection, the client receives the message of the day
  • during initial connection, the client receives the help message
  • the client can get a list of available rooms
  • the client can join an any room
  • if the client joins a room that doesn’t exist, it is created
  • when a room has zero users, it is destroyed.
  • a client can be in any number of room at the same time
  • room names must be alphanumeric, beginning with an alpha, and 32 characters or less
  • room names are designated by a ‘#’ pre-pended to the name
  • when a client joins a room, they subscribe to all messages and notices sent to that room
  • when a client joins a room, they get list of all other room subscriber’s usernames
  • while a client is subscribed to a room, it is notified of all joins and parts of other subscribers
  • while a client is subscribed to a room, it is notified if a subscriber changes it’s user nick
  • messages come from users/clients, and contain the text of the message and the intended room to receive the message
  • when sending messages to clients message contain the text of the message, the indended room to receive the message, and the username of the client that sent the message.
  • clients must be subscribed to the room to send a message to the room
  • notices are server-originated messages sent to the client, like help text, and not from a user

It’s very IRC-like


Here is a Balsamiq mockup of a potential Nodojo client, keeping with the IRC theme. Click to see it full size (1024x768)

"first nodojo mockup"

In my spare time, such as it is, I’m going to build a feature-rich javascript chat system. There are other javascript-based chat systems, but this one is mine. The server component will be written in NodeJS, and the client will be a rich internet application in javascript using the Dojo toolkit. Communication will be done using websockets.

In terms of javascript proficiency, I’m probably a 7 on a scale of 1 to 10. I mainly use the ExtJS framework at my day job, but until now I’ve not used NodeJS or Dojo at all. This project is primarily for self-education.

In the past day or so, I’ve watched the hour-long presentation on the NodeJS home page, and managed to get it installed.  I’ve read a few of the Dojo tutorials and did some hello world type stuff.

This chat system will be called Nodojo, because I couldn’t think of anything more clever than just mashing the names of the two underlying projects together,  and the word had limited matches on Google.  So, unless you’re in Japan, it should be easy to find on the tubes.

Today, I created two projects on github: nodojo-server and nodojo-client. They are mainly just place holders for now.

I usually have just a couple hours in the evenings to work on things like this. Mostly, it’ll be about 8 to 10 hours per week for this project, so progress might be slow. And, now I have a really good reason to go the TriangleJS hack nights.

I  plan on making posts about my progress and what I’ve learned so far about once or twice per week. If you’re new to javascript or node or dojo, we can learn together.

Feedback is welcome and deeply appreciated, either here or on github,  but don’t send me any pull requests because  I want to write all the code myself.

One decision I feel strongly about is using the Dojo “programmatic” style for the client, emphasizing more code and less markup.  I don’t know if the dojo community leans one way or the other, so I may be helping or hurting myself when it comes to looking up tips in the dojo support systems, but we’ll see what happens.

I’ll be using the IntelliJ IDEA IDE for development, using the new, beta NodeJS plugin.  All development will be on my Ubuntu Maverick laptop.

Tomorrow, I want to

  • Capture a written  list of functional requirements
  • Create one or two mockups of what I think the client UI might look like
  • Create meaningful README files for projects so github will have something to show.

I also want to investigate unit testing for node and for dojo, but that will probably be this weekend.  I have not done any unit testing for javascript code yet.

See you in a day or two.

  • mshiltonj

There are two types of media. One I’m willing to pay for. One I’m not.

The kind of media I’m NOT willing to pay for: Fluff. This includes:

  • Sports News
  • Entertainment News
  • Product Reviews
  • Press Releases
  • TV Listings
  • Etc

There is so much information out there that I’m interested in knowing about, and the people who have that information want me to know about it. But I’m not going to pay to be marketed to.

I’m ultimately a customer of the sports and entertainment and gadget industries, and it’s in the interests of those industries that I be as informed about them as possible. This type of information is facilitated by press releases and public relations departments and marketing budgets. Getting this information to me is not journalism.

Example: I read The Road a couple weeks ago. I don’t know how I found out about the book and the movie. It just washed over me in the stream of information that I’m immersed in and I plucked out that nugget. I also paid money for the book – not used and not online, but new and from an actual brick and mortar bookstore. How quaint. But that purchase, and others like it, is all the fee I should have have to pay to have that information come to me. It’s your job, on your dime, to get information to me.

I’m not going to pay for information that marketers and public relations hacks are trying to get into my head. Ultimately I could live without it and the various industries would suffer because of my ignorance.

A “journalistic” endeavor focused on this type of information better be free to me – even though I, after a fashion, still want it. I ain’t payin.

The kind of media I AM willing to pay for: Ass Kicking.

  • Investigative journalism
  • Exposing corruption and hypocracy
  •  Telling me how I’m getting screwed over.

There’s a whole class of information that I want to know about, and the people who have that information desperately DON’T want me to know about it. This includes, but it not limited to, politicians and corporations. My assumption is that, with rare exception, they are corrupt, greedy, dishonest slime balls that want to poison me and steal my wallet.

I want to know about the cover-ups, the kickbacks, the backroom deals, the collusion, the illegal dumping, the lying and intimidation, the crimes, the drugs, the exploitation.

I want to know about the dark secrets that are not included in the marketing department’s glossy brochure.

I want to know about the creative budgeting that the government report used to fake up a result.

If you promise to focus on keeping informed with that type of information, I’ll gladly pay you for it.

I’m not really looking for ‘objectivity’ here, either. This information is not given freely. This information has to pulled from the sources like rotten teeth.

For this type of reporting, I want you to view the objects of your investigation as The Enemy. They are not the good guys. There should be no professional partnerships or revolving doors. Your targets should hate you, because you are exposing them for the lying corrupt bastards they are.

People in the echelons of power should dread reading the news every morning, for fear of having their secrets splashed across the home page of your site.

This, I would pay for.

Note: I originally wrote this on July 7 or 8, 2008. The original url is: http://mcclatchynext.pbworks.com/w/page/20627218/An-abrupt-and-drastic-change-is-needed. I am posting it here so I’ll have my own copy…

I’m afraid the newspaper industry will keep falling apart if it doesn’t do an abrupt and drastic change very soon. Something different. I don’t mean better, faster or cheaper. I don’t mean harnessing new technologies to improve the way we do things. I mean substantively, fundamentally different.

But different how?

Assume universal and ubiquitous Internet access

This is where the the world is going. We need to be ready for it. Start dropping print editions.

If you can read the news on your iPod or some other wireless device while sitting on the toilet, waiting in a doctor’s office or on the bus, you will not read the print edition. Make plans now for online-only news operations. Not where the print and online editions fit hand-in-glove, but where the print side does not exist.

Don’t wait for this to happen and react, be proactive and take steps to make it happen. We need some creative destruction.

Don’t try to keep print alive. If it’s still bringing in money, fine, but don’t try to “re-invent the newspaper”. Use the print world to underwrite the building of the online world while you can. But at some point, it’s not going to be worth all the paper, ink, gas, trucks and bodies to haul the news around every 24 hours. At some point, the printing press will cost too much.

Stop repackaging content we don’t own

The time when the local newspaper was a person’s primary window into the wider world beyond the community is gone.

Unless you are one of the top three or four newsapers in the country and you have dedicated staff writing original content on the subject, realize that people aren’t reading your local newspaper site to learn about what’s going on in the Middle East. You are not the original sources. Stories you get from the wire are the same stories everyone else gets from the wire.

The exact same story will show up 100 or 1000 times on a Google News search at roughly the same time. There is no added value here. Do not waste print or revenue or editorial resources schlepping around content that does not add some unique value to our sites for users.

This includes all content, not just news: Movies, stocks, weather, etc. If someone else owns the data and is selling it to you, they are selling it as a commodity on the Internet.

I can go to dozens of sites on the Internet to get my weather. In fact, I don’t even know who gives me my weather information. I have a little weather applet on my desktop that has current conditions. If I click on it, I get the forecast. 99% of the time, that’s all I need. I have a weather.com bookmark for my zipcode if I need anything more detailed. Why weather.com? Because that’s what they do. They own that data. They are focused on that data. I searched and clicked around and liked their page best. I almost never look anywhere else for weather.

Movies? I use a google bookmark for “movies + ” That links to theaters, show times and reviews. The reviews are links from dozens of different sources. That’s just when I’m about to go to the movies. For movies in general, I go to Rotten Tomatoes or IMDB. Why? They own the space. They create the original data.

For any given type of content, there are a few sites that have cornered the market for it, because they specialize in that content. It will be increasingly difficult for newspapers to compete in those areas. We don’t specialize in, say, movies, and we don’t have enough of our own movie-related content to beat those who do specialize in it.

Most of the newspaper industry has partially conceded this point when it comes to daily stock listings. We know it’s a waste of ink and money to put it in print.

If you don’t own the content, you can’t own the eyeballs that want to see that content. You may have some eyeballs now, but that’s not a sustainable model. In the online world, wire services and redistribution of content are obsolete, and that model won’t last.

This means the Associated Press will eventually go away, or change significantly.

Don’t lean on classifieds for revenue

It’s gone and it’s not coming back. Ever. The sub-prime debacle accelerated the decline (over a cliff), but don’t fool yourself into thinking it’s coming back. It might tick up a bit, but that world is gone. Why? Two reasons.

I’ll let Robert Cringely tell the first reason, from his recent (online!) column:

My young and lovely wife, showing what might be overoptimism or maybe artful timing given the economy but more likely just general disappointment with me, has decided to embark on a career in real estate sales. She has taken classes and passed tests, joined one of the very best local firms, and hurled herself into the business of selling historic Charleston homes while they still have some value and the termites haven’t finished their work. And along the way, while mastering the Multiple Listing Service, she learned an important fact that was news to us both: people no longer find houses for sale by looking in the local newspaper. They use the Internet, instead.

The irony here is that – at least in these parts – the local paper seems chock-full of real estate ads. But according to her teachers down at the MLS university, those listings are simply vestigial, like little toes we all have but probably don’t need for balance or, indeed, for anything at all. Real estate brokers put ads in local newspapers because their customers expect them to do so, not because they actually help sell houses.

I’m sure there are exceptions to this rule, but if 80 percent of all houses for sale in the U.S. are eventually sold NOT because of any newspaper listing, tradition or professional pride aside, at some point we can expect real estate newspaper advertising to eventually disappear.

The toothpaste is out of the tube.

The second reason is that in the online world, anyone can compete is the classifieds space. And of course, the competition is out in force, which is something the newspaper industry hasn’t had to deal with for a while. In the classifieds space, we are at a distinct disadvantage.

There is a lot of money here so there are lots of competitors. Most of them won’t have to carve out a signifant portion of their revenue to underwrite an unrelated news operation, and they will out-compete those that do. In a sense, “news” is a parasite on the classifieds revenue machine.

How much money does autotrader get to reinvest in their core competency, where cars.com has to send the money to its media corporation owers to subsidize their interactive divisions?

This imbalance is not sustainable over the long-term.

Don’t think web 2.0 / social networking / user generated content / multimedia will save us

It’s a failure on our part that we don’t already have all these things. But adding them won’t fundamentally change our conditions. We will get a few more page views from the extra content, but there will be no drastic change.

Why? Because digg and reddit and newsvine and delicous already exist. Youtube and hulu already exist. They are focused exclusively on the developing communities around user generated content. Can we successfully compete with them? Unlikely.

Most experienced users are starting to expect comments and tags and ratings on content sites. When we finally get them integrated into all of our sites, it’s not going to be revolutionary.

Just because it’s new to us doesn’t mean it’s new.

Learn how to make money on our content

Not our sites – our content. The stuff we create and own. You know: the news. However it gets delivered to users.

This is the crux of the problem. And I don’t think we know how to do it.

But let’s not fool ourselves – if we can’t make money on news reporting and journalistic endeavors directly, then none of this really matters. If news operations can’t make money then it’ll eventually and officially become a non-profit or philanthropic activity, not a business. The money will have to come from somewhere else. “Somewhere else,” if it comes to that, can be anything at all, or any combination of things. But if we can’t make money with news, then let’s not expect to, and go non-profit.

News will continue to get created either way, of course, but it would be good if we can answer this question sooner rather than later. Is news, by itself, a for-profit or non-profit activity? Let’s hope good journalism really is good business.

(Note that by “news operations” I don’t mean that editors and reporters will be selling the ads. News operations will have sales and marketing arms).

I know there are only a few ways to make money online: ads, sponsorships, subscriptions, e-commerce. It must be possible to find some combination of these revenue models that can pay for an office full of editors, designers, reporters and photographers.

We are going to be smaller

All that classifieds money is going away. All that wire content used to fill up the news hole is uneeded. And the “news hole” is either gone or infinitely large, depending on how you look at it. There are no more printing presses. That means we are going to be much, much smaller. This will not be an easy transition to make.

What now?

This post focused mainly on what not to do, or what I think we’re doing wrong. But what are we supposed to actually do? I have ideas, but that’ll have to be the subject of another post,