|
That depends on what you really need.
In my case I created a class (ActionRunner... and later a RunnableRunner). I use a Thread from my own pool of threads. It waits for a new Action (using a ManagedAutoResetEvent) and uses a Queue to effectively queue the Actions.
So, while there are items in the queue they are executed. When there are no more, an wait is done. My own ActionRunner is disposable, but that's to guarantee that I free the thread at the right moment. I consider it the best solution as it does not creates an unnecessary window and because the messages are real .Net actions (and not some number that must be processed by a switch).
|
|
|
|
|
Depends on what you need.
If you want to respond to messages and spawn parallel tasks that don't depend on each other, then check out the Task Parallel Library, or BackgroundWorker.
If you want a queue of messages that a thread works through one by one, then I'd implement a background thread class (i.e. wrap a Thread) with a Queue<Message>, and do the queue pumping myself.
|
|
|
|
|
Hi! How to end session after logging out? I am facing a problem that when clicking on logout session ends. After clicking on back button, previous page repeats again. This happens in all the pages of my project.
Here is the code for logout link..
protected void linklogout_Click(object sender, EventArgs e)
{
if (linklogout.Text == "Log Out")
{
Session["username"] = null;
Session["userid"] = null;
Session.Abandon();
Response.Redirect("~/index.aspx");
}
}
Can any one help me?
|
|
|
|
|
I would have a read of this
how do you programatically end a session in asp net[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
<script language="JavaScript">
javascript:window.history.forward(-1);
</script>
this is how i ends in asp.net
|
|
|
|
|
You are successfully killing the session there, so the previous page should no longer be active. (That is, nothing on it should work, because there will be no valid session for any action, and F5ing it should result in a failed authorisation and a return to the login page.)
What you need to do if you don't want browsers to show the page is make all your secure pages uncacheable. To do this in all browsers I think you need to set Pragma: no-cache, Cache-Control: none and also Expires: to a date in the past.
|
|
|
|
|
Hey this problem is solved as I use:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
But today another problem came..
I have two links in my home page namely Register & Login. They are kept in a panel control and when I press enter from login popup it should be login. Till now every thing works.
When clicking on them(links) individually two modalpopups shown. When I press esc button they should be closed. But it is not working in a panel if I give BehaviorID to popup. Can any one help me?
Here is the asp.net code....
<script type="text/javascript">
//closes the popup by pressing the esc button on the keyboard
document.onkeyup = Escape;
function Escape()
{
var KeyID = event.keyCode;
if (KeyID == 27)
{
if ($find("MPEregisterescclose"))
{
$find("MPEregisterescclose").hide();
}
else if ($find("MPEloginescclose"))
{
$find("MPEloginescclose").hide();
}
}
}
</script>
|
|
|
|
|
ofter XML generate how will send XML file in Tally 9.0
|
|
|
|
|
May I suggest that you should really ask this question here[^].
|
|
|
|
|
I would like to know haw to check if a record exists before the record is deleted
|
|
|
|
|
I am not sure why you need that. If you just want to display number of deleted records in screen you may use ExecuteNonQuery method. It returns number of rows that were affected by the command.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
What sort of record? Where does it exist: database, flat file, jukebox? Try providing some proper detail to your question.
|
|
|
|
|
Don't. If you have a recordId, assume it exists and delete it - catch the exception if it did not. Adding checks like the one you proposed might say it exist, and still be deleted (by someone else) an instance later (unless it's an atomic operation, which I doubt).
|
|
|
|
|
if you delete it while it doesn't exist SQL will return something like: "0 rows deleted".
Delete from tableX where myconstraint='Myconstraint';
If you do it in code you can get that by reading out the NrOfRowsAffected property when doing an ExecuteNonQuery statement. Same goes for Insert and Update queries eg.
as someone already replied, checking if it exists is inaccurate at best and doesn't add any functional advantage.
if you really, really must check it. Perform a select query perhaps with a count.
Select count(id) from tableX where myconstraint='Myconstraint'
if count > 0 , the record exists.
hope this helps.
|
|
|
|
|
If it's a database, then the system will do that for you.
|
|
|
|
|
I presume we're talking about database records.
In which case, why do you care whether it exists? Delete it anyway - you're not going to get an error saying that 'this record you don't want doesn't exist'.
Strange question.
|
|
|
|
|
develop the project in microsoft.net through C# on topic window based simulator using backpropogation algorithm.
|
|
|
|
|
You need to post your full assignment so we can really mock you.
|
|
|
|
|
This is your project to do. What's the point of us writing your code for you, as you learn nothing and you will be ill suited to becoming a professional developer. The trick is to research the algorithm yourself, and break it down little bit by little bit. A trick I sometimes use to help is to talk an algorithm through with someone - once you try and explain it, you see where the gaps are in your knowledge and it becomes easier to tackle those areas.
|
|
|
|
|
Is that some sort of a question?
Or an order???
|
|
|
|
|
My design is simple,
My application constructs a message with a header class and a Datastream in the body, it queues it for a central message distribution service which inturn queues it for other applications of mine to read - all via MSMQ with security set to None.
The CMDS is perfectly able to read the message from App 0, but it repeatedly fails to requeue it for App 1 etc.
But not consistently! Sometimes after clearing / deleting the queues it will work for a couple of times and then fails again.
The logic to queue form App 0 to the CMDS which rarely fails is replicated almost exactly in the CMDS to queue to the other Applications - but it hardly ever works!
I need to revisit the code to improve transaction handling but if that resolves the matter it will be accidental!
Any thoughts / experiences that might assist?
Ger
|
|
|
|
|
Make sure your queue is not clogged with messages and that there is no size limit on the queue.
|
|
|
|
|
Queue deleted and recreated to ensure that there is no clogging. I need to recheck sizings.
Ger
|
|
|
|
|
Permissions, it must be permissions, even a single integer message won't queue from that point in the code!
Ger
|
|
|
|
|
Ger Hayden wrote: The CMDS is perfectly able to read the message from App 0, but it repeatedly
fails to requeue it for App 1 etc.
Different boxes?
Then note that MSMQ has a convoluted routing strategy which is not visible to the sender. So messages can take hours to arrive at their destination. Presuming the keep alive time is that long.
|
|
|
|