|
Hi,
I have a requirement where I need to lock a object to get data from service. If service takes more time to response due to some reason, after 2 mins of timeout period it gets timed out and then lock gets released. Till that time all the other requests has to wait. In this way, During this abnormal service behavior, all the request has to be in waiting stage. First request will take 2 mins to release the lock and second one would then take 2 more mins (total 4 mins idle time) and third will take another 2 mins and so on. After some time, due to this, application will be hanged.
Now I want a technique where first request will acquire lock and get the response. All the other request should be waiting for this and once first request release the lock, this response should be assigned to all other pending request (as the output response will be same) and make them all released at the same time.So ultimately, all request will get a response in two mins and only one service hit will happen.
Do we have any technique in C# to achieve this?Anybody can help me to fix this?
Cheers
A.M.Jegan
|
|
|
|
|
Sounds like a Queue<Request> , with a loop handling a request. Execute the method that handles the request async, wait until it returns or two minutes pass. When done, fetch next and repeat.
amjegan wrote: all request will get a response in two mins and only one service hit will happen. Not if it works as you described; if there's three items in the pipeline that will timeout, total waiting-time for the next request will be >6 minutes.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
amjegan wrote: Now I want a technique where first request will acquire lock and get the
response. All the other request should be waiting for this and once first
request release the lock, this response should be assigned to all other pending
request (as the output response will be same) and make them all released at the
same time.So ultimately, all request will get a response in two mins and only
one service hit will happen.
And then what happens in the following scenario?
- First request times out.
- Second request succeeds.
|
|
|
|
|
We don't worry about whether it succeed or failed as the data we are pulling is not affect the mainstream of the application. Application can still be running. Only thing is it should not be waited long time to get response. Thanks!
Cheers
A.M.Jegan
|
|
|
|
|
Have you considered reducing the timeout significantly.
|
|
|
|
|
Hi,
I want to read data from MMF File in c#.net framework 3.5
|
|
|
|
|
Same question applies to the NSF question, what is an MMF file, if it is a notes specific file then the same answer applies as well.
For any file type that is proprietary you will need to get the format/api from the owner and some types are just not available.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I want to read content from NSF File c#.net framework 3.5.
|
|
|
|
|
you might want to explain
a) what a NSF file is/what produces it and
b) what you've tried so far
|
|
|
|
|
a) A Lotus Notes database .NSF file stores Lotus Notes information. That information consists of user data, metadata and also design information. There are many different types of Lotus Notes databases, the most common being mailbox databases used to store Lotus Notes mail, usually on a Domino server, or address book databases which are usually stored on a users PC and contain multiple contact records.
b) I am still searching
|
|
|
|
|
cool - the obvious answer, is, does Lotus Notes have an API to do this ? or do you need to do it standalone/where Lotus isnt installed, for some (possibly perverse) reason
|
|
|
|
|
Yes, I need stand alone where lotus isn't installed.
|
|
|
|
|
Good Luck! Without the Notes API, you're pretty much screwed because you'll have to parse a LOT of information. Also hampering your efforts will be that some NSF databases can be encrypted and virtually impossible to read without the Notes API and the fact that IBM keeps changing the damn format of the database files further complicating the crap out of what you're trying to do.
About the only document I ever found on the NSF format was here[^].
|
|
|
|
|
Poor bastard - NSF will almost be a proprietary format coming from Notes, probably some flavour of xml, I would approach IBM with a f***ing big gun and see if they have the format/api available as Garth suggested.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I want to Update the particular column...but once i give update only the edited column is present in the database..others are absent..
try
{
con.Open();
String q3 = "update testreport set patientname='" + textBox2.Text + "',address='" + textBox3.Text + "',testreports='" +textBox5.Text + "',reportno='" + textBox6.Text + "',date='" + dateTimePicker1.Value.ToString("dd-MMM-yyyy") + "',takentest='" + textBox4.Text + "'where patientid='" + textBox1.Text + "' ";
cmd = new SqlCommand(q3, con);
cmd.ExecuteNonQuery();
MessageBox.Show("details updated successfully");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "details not updated");
}
con.Close();
|
|
|
|
|
Start by fixing the SQL Injection[^] vulnerability in your code.
using (var con = new SqlConnection("<YOUR CONNECTION STRING HERE>"))
using (var cmd = new SqlCommand("update testreport set patientname = @patientname, address = @address, testreports = @testreports, reportno = @reportno, date = @date, takentest = @takentest where patientid = @patientid", con))
{
cmd.Parameters.AddWithValue("@patientname", textBox2.Text);
cmd.Parameters.AddWithValue("@address", textBox3.Text);
cmd.Parameters.AddWithValue("@testreports", textBox5.Text);
cmd.Parameters.AddWithValue("@reportno", textBox6.Text);
cmd.Parameters.AddWithValue("@date", dateTimePicker1.Value);
cmd.Parameters.AddWithValue("@takentest", textBox4.Text);
cmd.Parameters.AddWithValue("@patientid", textBox1.Text);
con.Open();
cmd.ExecuteNonQuery();
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Handle the OnTextChanged event of your textboxes to save wath field was changed and build the update string based on this data.
|
|
|
|
|
Better yet, don't do updates; do versioning instead. Updates are code smell.
And definitely use a parameterized query as Richard demonstrates.
|
|
|
|
|
Why do you care which field was changed, presumably you populate the control with the existing data and therefore you are just writing back the same information. Save the entire record!
Implement and audit system that records the before and after of each field.
And fix the sql injection exposure highlighted by Richard!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello
I want to find a way to control video files in my C# application. I want to open video files of various formats and then control them in frame level, going forward\backward few frames, jumping to an specific frame and things related. Thus far I haven't been able to find anything useful. Also I don't want any additional components being shown in my application (like the Windows Media Player COM). Also video scaling is needed.
Thanks in advance
|
|
|
|
|
Look at ffmpeg[^], OpenCV[^] etc. Not sure if there is a C# port available. But it won't be hard to call these libraries from C#.
|
|
|
|
|
http://www.c-sharpcorner.com/uploadfile/mgold/playingvideo11242005002218am/playingvideo.aspx?articleid=3d1c3b81-1a12-48e7-ad5e-758f96525409
i think this one is useful for you just refer it
|
|
|
|
|
Hi Team, i have aspx page with code behind in c#,the page has checkbox list which gets pulled dynamically(not static checkbox list), now my concern is once i do the check/uncheck of checkboxes and if i left mouse button then callback is happening which is not required i have verified the code base and there is no activation of callback event from code, check box unselect/selection is fine but if you click left mouse button on any part of the aspx page callback is happening which i dont want to happen.
i do not want to raise callback event if i do mouse click on the form, i tried different options to prevent but could not succeed, can some one guide on this
Thanks
msr
|
|
|
|
|
|
are you put postback property "true" for that control? I am not getting how these been made
|
|
|
|