And that lil ditty of code takes care of all the display. I opted to stick
it into a table, and that way can enforce wrapping. However, as a note, you
might want to be careful if someone sticks a whole globule of text in there,
such as 80 letter a's without any spaces in there. That can drastically
affect the look.
As for sending messages, it's simply hooking the form together with the ASP,
having the form submit into itself, and that way it empties out each time.
Now, everyone's favorite time, in which I challenge you to come up with your
own variants, many of which I myself would like to work on, but have other
pressing matters. Possibilities include:
- Displaying how long a user is online. You can adapt that to search for a user
based on user name, find when they logged on, and do a
DateDiff on it.
- Have OffLine messages, or messages that were in the application variable
that the user never received, that they receive the next time they log in
- Pop up a window from another user if they have messages waiting (I did
implement this, through a very crude method. I created a very small
recordset (though is anything small in application scope?), and have it
simply state a
FromID, and the user checked if
their ID was in the
user with the
- Detect if the user is offline, and if so, make the user aware. I do this
also through keeping an array of users online, and then iterating through
the array to search for a
UserName pattern, and
if it fails, then
- Group Chat. This would be a case of changing the
ToID to be impossible
to naturally obtain, such as the inclusion of an "a" prior to it, where the
number following the text represents what chat channel. This would be much
more of a project, because then you would have to find a method of
displaying which users are in the chat room chatting, if the user can have
multiple chat rooms, et cetera. It is something I plan to do though, darn it
- Optimize the code to be memory friendly. I know that objects in
Application AND Session scope is very UN-memory friendly, as well as makes
it hard to scale across multiple servers in a cluster balanced situation.
Perhaps some friendly VB programmer would like to write a COM/COM+ component
to handle this.
Anyways, I hope this article has been an interesting read for you. The live
version of this chat application will be available at
http://www.tupponline.com when I set it live,
however, if any of you are
curious to see a beta version, http://beta.tupponline.com
Also, if you were wondering why I fail to close the objects, is because that
would ruin the custom nature of them, so please take note of that. You may
also which to implement code in the
properly takes care of the necessity of cleaning up your variables, such as
and then setting them equal to nothing.
And finally, if any of you programmers had lives before you were sucked into
this little "hobby" of programming, and got married and had daughters, then
it should be about time for them to be inundated with Teen-Bop. A certain
girl quartet was the inspiration for this article, as well as many other fun
features, so I'm sure you should have your daughters (or sons, but you know
how boys can be =P) check out the group. Their called P.Y.T., signed w/ Epic
Records, and have toured w/ Britney Spears & N'Sync last summer. They are
about to release their CD in May, and it's no doubt going to be awesome, so
it would make a great gift, dads. =) Ok, enough free promotion for "my"
girls (I call them that because they are good friends of mine =P)
Read Part 2
Read Read Part 1
Copyright 2017 QuinStreet Inc. All Rights Reserved.
Advertise | Newsletters | E-mail Offers