Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at CFUNITED 2010 (Landsdown, VA) with:

Kinky Solutions Code Chat Beta 1.0

By Ben Nadel on
Tags: ColdFusion

Last week, I tried to help three people debug code over AIM (Trillian). If anyone out there has tried to do this, you know that it is a NIGHTMARE! Instant messaging was just not built for programmer-talk. I love helping people debug their code though (as it helps me learn / think as well). And, I don't want to stop doing that. To help come up with a better way to get involved, I have quickly thrown together (thursday / friday night) something I am calling Kinky Solutions Code Chat Beta 1.0.

Code Chat is an AJAX powered web-based IM "client" that has a box for standard "text" messages but the real magic is that it has a box for "code" messages as well. These code messages handle standard "Tabbing" and display quite nicely in the chat history. Take a look at this screen shot:


 
 
 

 
Kinky Solutions Code Chat Beta 1.0  
 
 
 

As you can see, the text and code chat items are formatting specifically for their "type." The code item is actually a PRE tag so that it keeps all the formatting. The code textarea at the bottom of the IM client will actually let you "Tab" characters. It uses JavaScript to catch the TAB key and inserts it rather than tabbing away from the textarea input. I have tested this on IE, FireFox, and Safari (not extensively) and they all seem to handle this nicely.

I am NOT great at AJAX, so I am not sure if the algorithm here is working nicely. I don't know about memory leaks or any of that stuff, so who knows how this will function after being left open for some time.

Right now, you only get to see the chat items that are there for the page load. However, all chat items are getting stored in my database. I have plans to allow search as well as full-transcript downloads. Of course, that is if this thing seems to be useful. If it's just a load of horse poop, then I will just abandon the project and chalk it up to a good AJAX learning experience.

I am not going to sit at my desk with this open (at least not most of the time), as I don't feel the need to hit my server 30 times a minute (AJAX) if no one is there. If you want me to help you debug some code, just hit me up on regular IM and we can open up the Code Chat beta (if you want). But for today, I might leave it open, just to see if anyone has any feedback.

To see it in action, go to:

http://www.bennadel.com/index.cfm?dax=chat

KNOWN BUGS:

  1. Double submit (sometimes).
  2. "+" symbol not showing up.
  3. Focus lost when chat history is updated.
Tweet This Groovy post by @BenNadel - Kinky Solutions Code Chat Beta 1.0 Thanks my man — you rock the party that rocks the body!



Reader Comments

Looks great. Only thing is that plus signs don't get rendered.

I need one of these to work with my partners abroad ;)

Reply to this Comment

That is so freakin strange! I just tried it and you are right... what the heck is that about?

Maybe that is a URLDecode() issue.

Reply to this Comment

This is a nice touch. One question, did you build this on top of a database? I built an IM client once to chat with my girlfriend because all IM clients were blocked at her work, and I just ran it through the application scope. It worked beautifully. I actually made the code into a reusable Javascript API, although I never tested it much...

Reply to this Comment

@Thomas,

I built it on top of a simple DB table (chat_code). I had thought about running it off of the APPLICATION scope or maybe even XML files... but the DB just felt like the simplest answer.

How did you flush the App variables so they didn't get too big? Just curious.

Reply to this Comment

The moment a message was received by the person it was addressed to it was removed from the app scope. In your case it's more difficult because you have a chat room, not an IM program. To be able to remove from the app scope, you'd need to have a mechanism to track if the message has been retrieved by everybody in the room, then you could delete it. But you're fine with the DB table anyway.

Reply to this Comment

@Thomas,

Technically, nothing in the DB chat should last longer than a minute (very generous). I could always work that way. But, one thing I want to do is make it searchable... which will be great with the DB.

Reply to this Comment

No way dude. Searching the application scope would be totally awesome and super practical. Forget the DB! *end of sarcasm* hehehe

Reply to this Comment

@Sailor,

The "+" bug has been fixed using the encodeURIComponent() method. The "+" was being decoded as a space in the URL on the ColdFusion side of things.

Reply to this Comment

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Oops!
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.