473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

application scope objects

i use an application scope recordset object for holding the list of
online users. i am not sure that if i have to handle concurrency issues

like one user is looping through the recordset for getting the list of
online users while another one is getting online so adding a new
record. ado recordset has a free and apartment threading model(marked
ThreadingModel = Both in the registry) so i think it should handle the
concurrency issues and recordset access will not be conflicted.

otherwise, if it could not handle the concurrency i think
- i should put that application scoped recordset into application
collection and use application.lock/unlock methods.
- or serializing the recordset access by an application variable and

locking/unlocking the application for synchronization.
what do you think about these ones?
on the other hand, i know that there are different ways to hold and
provide the list of online users using application variables, database
etc. but i want to clarify the concept of application scope objects to
myself. thus, is there be any concurrency problems with this method? if

so what could
be it done? also what about the efficiency of it?
thanks
--- global.asa ---
<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>
<script language="VBScript" runat="Server">
Sub Application_OnStart
Const adInteger = 3
Const adVarChar = 200
rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "nick", adVarChar, 50
rstActiveUsers.Open
End Sub
Sub Session_OnEnd
Const adSearchForward = 1
Const adBookmarkFirst = 1
Const adAffectCurrent = 1
rstActiveUsers.Find "id = " & Session.SessionID, _
0, adSearchForward, adBookmarkFirst
If Not rstActiveUsers.EOF Then
rstActiveUsers.Delete adAffectCurrent
End If
End Sub
</script>
-- newuser.asp --
rstActiveUsers.AddNew
rstActiveUsers.Fields("id").Value = Session.SessionID
rstActiveUsers.Fields("nick").Value = RsUser("nick")
rstActiveUsers.Update
-- onlineusers.asp --
Dim fNick
Set fNick = rstActiveUsers.Fields("nick")
If Not rstActiveUsers.EOF Then rstActiveUsers.MoveFirst
While Not rstActiveUsers.EOF
Response.Write(fNick)
rstActiveUsers.MoveNext
If Not rstActiveUsers.EOF Then
Response.Write(",")
End If
Wend
----

Oct 4 '06 #1
1 2990

"spolsky" <sp*********@hotmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>i use an application scope recordset
Don't do that!
http://www.aspfaq.com/show.asp?id=2053

like one user is looping through the recordset for getting the list of
online users while another one is getting online so adding a new
record. ado recordset has a free and apartment threading model(marked
ThreadingModel = Both in the registry) so i think it should handle the
concurrency issues and recordset access will not be conflicted.
See above.

otherwise, if it could not handle the concurrency i think
- i should put that application scoped recordset into application
collection and use application.lock/unlock methods.
- or serializing the recordset access by an application variable and

locking/unlocking the application for synchronization.
what do you think about these ones?
SEE ABOVE!

on the other hand, i know that there are different ways to hold and
provide the list of online users using application variables, database
etc. but i want to clarify the concept of application scope objects to
myself. thus, is there be any concurrency problems with this method? if

so what could
be it done? also what about the efficiency of it?
SEE ABOVE!

Ray at work
Oct 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: aa | last post by:
I am migrating to PHP from ASP where there are the Application Scope variables which are accessible from any page on a website and which are used, in particular, for hit counters. Is there a similar...
3
by: OsD | last post by:
I'm having trouble with the workflow described bellow: 1. Asp page 1 on server A contains an iframe. 2. Asp page 1 submits a form targeted to the iframe, to Asp page 2 on server B. 3. Asp page...
5
by: pembed2003 | last post by:
Hi all, I am reading the book "C How to Program" and in the chapter where it discuss scope rule, it says there are four scopes for a variable: function scope file scope block scope...
8
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an...
5
by: RP | last post by:
Hi all, I wanted to know if there are any limitations to storing some custom objects I have written at application level to avoid having to create/destroy with every request. These are not ado...
4
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
6
by: spacehopper_man | last post by:
I'm considering ditching all use of Session state in favour of Application state. This is because - from what I can work out - it will be more memory efficient for me. I have three questions:...
7
by: Christian Christmann | last post by:
Hi, I've a a question on the specifier extern. Code example: void func( void ) { extern int e; //...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.