Skip to main content
Ben Nadel at CFinNC 2009 (Raleigh, North Carolina) with: Phil Molaro and Andy Matthews
Ben Nadel at CFinNC 2009 (Raleigh, North Carolina) with: Phil Molaro Andy Matthews

Kinky Solutions Code Chat Beta 1.0

By
Published in Comments (10)

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.

Reader Comments

15,902 Comments

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.

33 Comments

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...

15,902 Comments

@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.

33 Comments

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.

15,902 Comments

@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.

15,902 Comments

@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.

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel