Kinky Solutions Code Chat Beta 1.0

Posted March 5, 2007 at 9:36 AM by Ben Nadel

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.



Reader Comments

Mar 5, 2007 at 10:07 AM // reply »
1 Comments

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

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


Mar 5, 2007 at 10:14 AM // reply »
10,640 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.


Mar 5, 2007 at 3:30 PM // reply »
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...


Mar 5, 2007 at 3:33 PM // reply »
10,640 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.


Mar 5, 2007 at 3:40 PM // reply »
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.


Mar 5, 2007 at 4:04 PM // reply »
10,640 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.


Mar 5, 2007 at 4:11 PM // reply »
33 Comments

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


Mar 5, 2007 at 4:12 PM // reply »
10,640 Comments

He he :)


Mar 6, 2007 at 5:24 AM // reply »
1 Comments

When "plus bug" will be fixed?


Mar 6, 2007 at 8:30 AM // reply »
10,640 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.


Post A Comment

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.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Feb 10, 2012 at 7:21 PM
jQuery AJAX Strips Script Tags And Inserts Them After Parent-Most Elements
Update! Instead of $(eval(options.insertAfter)).after(data['insertData']); I now use: var ajaxNode = document.createElement('span'); var parent = $(eval(options.insertAfter))[0].parentNode; ... read »
Feb 10, 2012 at 6:18 PM
jQuery AJAX Strips Script Tags And Inserts Them After Parent-Most Elements
encountered this same, what I consider, jQuery bug last week. I'm building a site in which I load some content via AJAX. This content contains Linkedin share button placeholders which Linkedin API ne ... read »
Feb 10, 2012 at 11:30 AM
Cross-Origin Resource Sharing (CORS) AJAX Requests Between jQuery And Node.js
After you understand the concepts here, this is an awesome cheatsheet for enabling CORS in just about anything http://enable-cors.org/ ... read »
JM
Feb 10, 2012 at 9:10 AM
My Safari Browser SQLite Database Hello World Example
@Amy, Here is a very good tutorial on how to use JOIN: http://www.sqltutorial.org/sqljoin-innerjoin.aspx ... read »
Feb 10, 2012 at 4:42 AM
Building A Twitter-Inspired RESTful API Architecture In ColdFusion
This is great, very useful Ben. I spotted a small typo in the api.cgm listing: <cfthrow type="Unauthroized" /> Cheers Stefan ... read »
Feb 9, 2012 at 10:35 PM
CFDirectory Filtering Uses Pipe Character For Multiple Filters (Thanks Steve Withington)
I was wondering if there would be a filter you could apply so that you got everything but what you included in the filter. As in show me all docs that are not a .pdf. ... read »
Feb 9, 2012 at 10:29 PM
Learning ColdFusion 9: Application-Specific Data Sources
@Ben, No offence, but if people were really wanting advanced features they would be using a platform like ASP.NET MVC. CFML is so structurally compromised as a tag-based scripting language that ... read »
Feb 9, 2012 at 10:03 PM
Subversion - Cleanup Failed To Process The Following Paths
@Leviaguirre, do you still have problems with this? ... read »