473,614 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ahh, getting crazy over this.

Same problem that I had before, diffrent approach..

In my application at order-creation, the user might encounter that the item
he is trying to order is locked by another user, and he have to wait up to
45 seconds for it to release.
Now, In my windows application that is no problem, I simply call a dialog
box in a new thread, that show the information, everything works great.

Ok, for a ASP.NET application the problem starts, because the new thread
created does not have access the context, and therefor cannot write any
"waiting" information to the user.

What I need to do is, somehow send in a reference to the Lock object of the
"wait handler function", so it will call it in a new thread, but the actual
function is made by the ASP.NET page.

Delegates huh?

In other words:

You have the lock object, it knows it will call "Wait" function, but it dont
know where the wait method is created, if no-one sending a reference to a
wait method to the lock object, it will generate an error (or just simply
skip the wait information stage)

So I need to send in a "Address Of" to the lock object, and it will then
start that procedure in a new thread.

All delegates samples Ive seen, you have the caller of the function in the
same class as the function that does the delegated procedure, but can it be
done the way I describe above?
Or am I on the wrong road? (maybe even in the wrong city :-/ )

Regards
Fredrik Melin
Nov 20 '05 #1
3 1182
Hi,

There are two approaches:

1. A simple one.

Do a quick test whether the order is locked and render a simple page saying
"Please try again in a few minutes" if the order is indeed locked.

2. A more complex one.

Do a quick test whether the order is locked. If this is true, render a page
saying, "Please wait while the order is released...." which would refresh
itself, say, every 10 seconds or so through the <META NAME="Refresh"> HTML
tag. Once the order has been released, process it and render another page
saying "Processing complete".

No need for threads and delegates :-)

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Fredrik Melin" <me*@n.o.spam.d acsa.net.remove .as.needed> wrote in message
news:nL******** ************@gi ganews.com...
Same problem that I had before, diffrent approach..

In my application at order-creation, the user might encounter that the item he is trying to order is locked by another user, and he have to wait up to
45 seconds for it to release.
Now, In my windows application that is no problem, I simply call a dialog
box in a new thread, that show the information, everything works great.

Ok, for a ASP.NET application the problem starts, because the new thread
created does not have access the context, and therefor cannot write any
"waiting" information to the user.

What I need to do is, somehow send in a reference to the Lock object of the "wait handler function", so it will call it in a new thread, but the actual function is made by the ASP.NET page.

Delegates huh?

In other words:

You have the lock object, it knows it will call "Wait" function, but it dont know where the wait method is created, if no-one sending a reference to a
wait method to the lock object, it will generate an error (or just simply
skip the wait information stage)

So I need to send in a "Address Of" to the lock object, and it will then
start that procedure in a new thread.

All delegates samples Ive seen, you have the caller of the function in the
same class as the function that does the delegated procedure, but can it be done the way I describe above?
Or am I on the wrong road? (maybe even in the wrong city :-/ )

Regards
Fredrik Melin


Nov 20 '05 #2
The threads are already there, because in the Windows environment, the user
get options to cancel or add more wait time, so the functionallity is
already there, thats why I wanted the nice display for the web as well,
simular to what I already have in the Windows enviroment.

So, I really want to get it to work with the ASP.NET via a delegate or some
other callback method.

- Fredrik

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:uG******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

There are two approaches:

1. A simple one.

Do a quick test whether the order is locked and render a simple page saying "Please try again in a few minutes" if the order is indeed locked.

2. A more complex one.

Do a quick test whether the order is locked. If this is true, render a page saying, "Please wait while the order is released...." which would refresh
itself, say, every 10 seconds or so through the <META NAME="Refresh"> HTML
tag. Once the order has been released, process it and render another page
saying "Processing complete".

No need for threads and delegates :-)

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Fredrik Melin" <me*@n.o.spam.d acsa.net.remove .as.needed> wrote in message
news:nL******** ************@gi ganews.com...
Same problem that I had before, diffrent approach..

In my application at order-creation, the user might encounter that the

item
he is trying to order is locked by another user, and he have to wait up to 45 seconds for it to release.
Now, In my windows application that is no problem, I simply call a dialog box in a new thread, that show the information, everything works great.

Ok, for a ASP.NET application the problem starts, because the new thread
created does not have access the context, and therefor cannot write any
"waiting" information to the user.

What I need to do is, somehow send in a reference to the Lock object of

the
"wait handler function", so it will call it in a new thread, but the

actual
function is made by the ASP.NET page.

Delegates huh?

In other words:

You have the lock object, it knows it will call "Wait" function, but it

dont
know where the wait method is created, if no-one sending a reference to a wait method to the lock object, it will generate an error (or just simply skip the wait information stage)

So I need to send in a "Address Of" to the lock object, and it will then
start that procedure in a new thread.

All delegates samples Ive seen, you have the caller of the function in the same class as the function that does the delegated procedure, but can it

be
done the way I describe above?
Or am I on the wrong road? (maybe even in the wrong city :-/ )

Regards
Fredrik Melin

Nov 20 '05 #3
Solved this.

Using the "ugly" way, but it works.

I let the Lock object in my support library take a optional parameter of the
HttpContext
Then the ASP.NET sends in the HttpContext, which then is sent to the routine
that shows waiting information, now I can send text information back to the
user.

Windows application isnt affected because it will not have any Httpcontext
to send into the function.

- Fredrik
"Fredrik Melin" <me*@n.o.spam.d acsa.net.remove .as.needed> wrote in message
news:aZ******** ************@gi ganews.com...
The threads are already there, because in the Windows environment, the user get options to cancel or add more wait time, so the functionallity is
already there, thats why I wanted the nice display for the web as well,
simular to what I already have in the Windows enviroment.

So, I really want to get it to work with the ASP.NET via a delegate or some other callback method.

- Fredrik

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:uG******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

There are two approaches:

1. A simple one.

Do a quick test whether the order is locked and render a simple page saying
"Please try again in a few minutes" if the order is indeed locked.

2. A more complex one.

Do a quick test whether the order is locked. If this is true, render a

page
saying, "Please wait while the order is released...." which would refresh
itself, say, every 10 seconds or so through the <META NAME="Refresh"> HTML tag. Once the order has been released, process it and render another page saying "Processing complete".

No need for threads and delegates :-)

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Fredrik Melin" <me*@n.o.spam.d acsa.net.remove .as.needed> wrote in message news:nL******** ************@gi ganews.com...
Same problem that I had before, diffrent approach..

In my application at order-creation, the user might encounter that the

item
he is trying to order is locked by another user, and he have to wait up to 45 seconds for it to release.
Now, In my windows application that is no problem, I simply call a dialog box in a new thread, that show the information, everything works
great.
Ok, for a ASP.NET application the problem starts, because the new thread created does not have access the context, and therefor cannot write any "waiting" information to the user.

What I need to do is, somehow send in a reference to the Lock object of
the
"wait handler function", so it will call it in a new thread, but the actual
function is made by the ASP.NET page.

Delegates huh?

In other words:

You have the lock object, it knows it will call "Wait" function, but
it dont
know where the wait method is created, if no-one sending a reference
to a wait method to the lock object, it will generate an error (or just simply skip the wait information stage)

So I need to send in a "Address Of" to the lock object, and it will
then start that procedure in a new thread.

All delegates samples Ive seen, you have the caller of the function in

the same class as the function that does the delegated procedure, but can

it be
done the way I describe above?
Or am I on the wrong road? (maybe even in the wrong city :-/ )

Regards
Fredrik Melin


Nov 20 '05 #4

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

Similar topics

303
17567
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
11
3341
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option Explicit and Response.Expires=-1,
12
2678
by: Gnolen | last post by:
Hi, I am really getting crazy here! I just do not get why this happens with the borders of the td/tr! I just want a border on the bottom of the rows(or td) but I just can't do it!!! I have tried so many different ways but I just thought this would do it: td {border-bottom: #000000 1px solid;} But no! What am I doing wrong? Because I can have a border of a td or tr in FF, right?! Thankful for any help here! Table and CSS is below..
3
1470
by: Larry Tate | last post by:
I have had a monstrous time getting any good debugging info out of the .net platform. Using ... ..NET Framework 1.1 Windows 2K Server VB.NET <- is this the problem? error handling in the global.asax file. I am seeing articles that say line numbers are in the ..
2
5276
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make sure that the extensions for .asmx file etc are in place. I am getting http 404 when I give the url for the asmx file. the http error code is wrong because I am dead sure that the file is there. could you please let me know what else needs to be...
4
4390
by: sugoi.sama | last post by:
hi, i'm having a hellish adventure with PHP5 i hope someone just can help me out on this... i'm desperate All i want to do, is to get the index of the returned elements, so i can acess them and change them (i'm guessing this is the only way to do this, as i can't change the element on-the-fly in XPath )
3
1169
by: David Murmann | last post by:
Hi all! i just had this crazy idea: instead of while cond(): pass write
3
1765
by: squash | last post by:
I have spent two hours trying to make sense of this script, called crazy.php. The output should be nothing because $cookie_password is nowhere defined in this script, correct? But it actually outputs the value that other scripts i have running set it to. Why should crazy.php care what other scripts are running that use that variable name?? <?php crazy();
5
2913
by: Pekeika | last post by:
Good morning group, When I open my Python window, this is appearing instead of the command line >>>. (I'm somehow new to Python). File "boot_com_servers.py", line 21, in <module> File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in <module> pywintypes.__import_pywin32_system_module__("pythoncom", globals ())
0
8130
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8623
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8429
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4050
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4121
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1423
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.