|
This post is all about limiting bandwith... like the bandwith of my brain - whih is currently peaking at 3 Bytes an hour... what a head rush
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Had to bust out a dictionary, damn my failing RAM.
|
|
|
|
|
I have recently had an upgrade... (CLEAR MEMORY)
I can form sentances of upto 64 characters at a time, way more t (CLEAR MEMORY)
han my previous limits.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Assuming that this sort of thing is within the purview of your job description, you should already know how to do it.
And in any event it is not a C# question, is it?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Applying a pair of shears to the offending user's lan cable will solve the excess use problem.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Really Thanks For Ur kind answerts! i won't forget them
|
|
|
|
|
Hello,
I have created an application that adds items to the registry. I've published it and it installs and works fine on other machines.
Although it does appear within the add / remove programs the uninstall does not remove the registry entries.
Any suggestions how this could be done?
Thanks.
|
|
|
|
|
Have you used a Visual Studio setup project to build the installer for your application? If yes, make sure to mark the registry key(s) you want to be removed at unistall as DeleteAtUninstall.
|
|
|
|
|
Developing a web application that will need to perform actions on a regular basis. Can anyone recommend a methodolgy that assists in setting up and running scheduled events.
For instance on every third friday at 1:00 pm I need to do "x"
or Weekly I want to do "y"
stuff like that.
|
|
|
|
|
dwolver wrote: Developing a web application that will need to perform actions on a regular basis
You can not do it using web application. You can either write Windows Service and let it run based on your schedule (you need to write the schedule code) or, have windows application use Task Scheduler (in the Control Panel)
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
dwolver wrote: Developing a web application that will need to perform actions on a regular basis.
I'm not sure I agree with your conclusion since it is orthogonal to the concept, purpose and design of web technology. This indicates you need to rework your problem/goal analysis. Yes, I am aware using the word "rework" assumes you initially did that work.
|
|
|
|
|
This is a C# forum.
Yours ain't a C# question.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello. I'm new to C# (switched from Java) and I am trying to see if there is a way to keep a thread running indefinitely, with no timeout. I have a console application written, but I need it to run more like a windows service in that I want all threads to run until they are told to stop. Is there a special class that will help with this, or does anyone know of a good resource that I can learn more about this specifically??
|
|
|
|
|
You can use the namespace System.Threading for this.
The same as you use threading in java, you can use it in C#.
class ThreadTest
{
static void Main()
{
Thread t = new Thread (WriteY);
t.Start();
while (true) Console.Write ("x");
static void WriteY()
{
while (true) Console.Write ("y");
}
}
To stop the thread, use t.Stop(); Or you can sleep inside the thread with Thread.Sleep(1000);//one second
Good luck
|
|
|
|
|
Thanks SO much... I don't know why it didn't dawn on me to use a while(true) statement... silly me! But thank you, that helps a lot!!
|
|
|
|
|
A better way to wait is to use the Thread.Join[^] method. That way
1. You don't need additional logic to have the main method break out of the loop when the thread(s) exit.
2. Infinite looping uses CPU cycles, whereas Join tells the OS scheduler to not schedule the current thread until the thread passed as the parameter completes.
|
|
|
|
|
Hi,
I am developing a location based service on windows mobile using c#, I plan to use assisted gps (AGPS) but I can’t find any resource regarding
1. how to query the AGPS server
2. by my understand of the agps architecture every mobile server provider will have its own specific agps server, is there any standard defined for querying and getting the response
3. what kind of response will I get back from the agps server
Any kind of help would be really helpful
hamid
|
|
|
|
|
Hi Folks,
since 3 days I am reading and thinking about how to implement (.NET 2.0) an asynchronous output stream of a process with making sure, that I can kill the process after a timeout AND that I have read everything from the output buffer?
some code (better than 1000 words :
cmdProcess.StartInfo.FileName = cmd;
cmdProcess.StartInfo.UseShellExecute = false;
cmdProcess.StartInfo.ErrorDialog = false;
cmdProcess.StartInfo.RedirectStandardOutput = true;
cmdProcess.StartInfo.RedirectStandardError = true;
cmdProcess.StartInfo.CreateNoWindow = true;
cmdProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
cmdProcess.OutputDataReceived += new DataReceivedEventHandler(cmdProcess_OutputDataReceived);
cmdProcess.ErrorDataReceived += new DataReceivedEventHandler(cmdProcess_ErrorDataReceived);
cmdProcess.Start();
cmdProcess.BeginErrorReadLine();
cmdProcess.BeginOutputReadLine();
cmdProcess.WaitForExit(_timeoutForWZZipOperation);
if (cmdProcess.HasExited)
{
(A)
[...]
}
else
{
cmdProcess.Kill();
[...]
}
In point (A) I want to be sure, that the complete output buffer has been proceeded.
Some additional thoughts and explanations:
I am starting WZZip (winzip command line) to display the content of a zip file (I HAVE to use wzzip, so I cannot switch to .net zipper etc.). The output is longer than the buffer, therefore I have to read asynchronous when I want to write the output as soon as possible in a log file. Additionally I have to use WaitForExit, because the security policies for this program are quite high and I need to continue with program, even if wzzip hangs (another reason to use asynchronous output, otherwise the program would not continue, because nobody is closing the outputstream).
I hope my explanation is understandable In short words, I have following requirements:
- Log output to file as soon as possible
- Timeout for process to handle crashes/hangs
- when process has exited, I have to be sure, that the output (and error) stream is empty before I continue with my program
- Thread.Sleep (x); is no option, because I have > 100.000 files to scan (I need the quickest way)
Sine 3 days I am climbing up walls, because whenever I have read something nice, some of the other requirements are not fulfilled... I really hope you can give me a hint (or maybe I am just thingink in the wrong direction)!
Thanks a lot!!!
Brgds,
Michael
|
|
|
|
|
Hi,
IMO you need extra threads to do it properly.
Three of them for a process that generates output at stdout and stderr, where you want to get that output in a timely fashion, and keep full control over the process:
- one where you launch the Process and can wait for exit, sleep and check/kill, or sleep and test for exit in a loop; this could be your main thread;
- a background one to read and process what is available on stdout (not using ReadToEnd of course)
- a background one to read and process what is available on stderr (not using ReadToEnd of course)
BTW: when the first thread detects the process is done, I give it one more second before I tell the other two threads to call it quits.
Unfortunately the MSDN examples are way too simple. Having no extra threads implies you can't intertwine stdout and stderr output, and you are unlikely to get any output until either the process is done, or a lot of output has been generated.
BTW: if you were to try it on .NET 1.0 or 1.1 it would be harder, since those didn't handle things well. I have not been able to pinpoint the exact problem a that time, but I have abandoned them long ago anyway.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Thursday, March 26, 2009 11:40 AM
|
|
|
|
|
Hi Luc,
thanks for your quick reply. Unfortunately I have a problem with your BTW
The reason is that I have to execute a lot of commands one after the other and cannot wait a second for being sure, that the streams are empty (with 1000 files it would take 17 minutes just waiting).
But nevertheless to 'move' the output to separate threads sounds good. The only thing what I then still not have is an option to check if the process output/error stream has been terminated. This would be a perfect solution/trigger to go on with the normal program. Unfortunately (again) the options from the process class are not sufficient to do this with asynchronous outputs (at least what I found).
Again Thanks a lot! In worst case I have to check for a good 'waiting' time (maybe 100ms are enough) and parallelise something else to come back to acceptable values.
Brgds,
Michael
|
|
|
|
|
Hi Michael,
some more remarks and ideas:
1.
if the process outputs to stdout(stderr) without explicitly closing it, the stream will remain open for as long as the process lasts, so there is no way to predict the end of the stream anyway.
2.
if you are dealing with several commands/processes, then you can reuse the stdout/stderr handling threads.
3.
When I said 1 second, you can modify that time span and make it suit your situation. I would not hope and get it below 0.1 second though.
4.
and you don't need to waste 1 second every time, you could simply create a "phase shift", i.e. launch the next process immediately while still listening to the output of the previous one for one second, and then start listening to the next process (which could already be running for 1 second by then).
5.
You might, depends on the circumstances, create a batch file that executes all 1000 necessary commands, and launch that as a single process (which obviously would spawn 1000 processes one after another). Doing so you only need a single 1 second wait, however you would get all output in one large streams. Obviously you could create the batch file by hand or by program.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Luc,
thank you very much for your suggestions. Sometimes the easy solutions do not come into my mind when thinking too hard about a problem
A little bit code refactoring and i am on my way again.
thank you very much again and have a nice weekend!
Brgds,
Michael
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I have an app where I display a list of link buttons (determined by variable number or records returned from a db). I create the link buttons dynamically but the click/command event(s) do not fire when the button is selected.
Also, this is in an <asp:panel xmlns:asp="#unknown"> which is in the content section of a master page.
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!Page.IsPostBack)<br />
{<br />
}<br />
BuildLinkButtons();<br />
}<br />
<br />
protected void BuildLinkButtons()<br />
{<br />
Label lblNew = new Label();<br />
<br />
lblNew.ID = "weekLabel";<br />
lblNew.Text = "Select A Week:";<br />
lblNew.Font.Bold = true;<br />
weekPanel.Controls.AddAt(0, lblNew);<br />
weekPanel.Controls.AddAt(1, new LiteralControl(" "));<br />
<br />
int iPos = 2;
for (int i = 1; i < 10; i++)
{
LinkButton lnkBtn = new LinkButton();
lnkBtn.ID = "lnk1:" + i.ToString();
lnkBtn.Text = i.ToString();
lnkBtn.Click += new EventHandler(lnkBtn_Click);
lnkBtn.CommandName = i.ToString();
lnkBtn.Command += new CommandEventHandler(lnkBtn_Command);
weekPanel.Controls.AddAt(iPos++, lnkBtn);
weekPanel.Controls.AddAt(iPos++, new LiteralControl(" "));
}
}
void lnkBtn_Command(object sender, CommandEventArgs e)
{
// do some stuff here
}
void lnkBtn_Click(object sender, EventArgs e)
{
// do some stuff here
}
|
|
|
|
|
hello.. actually the problen is that i have added an msaccess database to my project and have buitl about 10 queries and contains 3 tables in it.
now i want to add a new table or modify an existing table in the database and when i modify the tables its not effecting in the data-sources in the project..what is the way to edit the database after adding it to the project without loosing the queries built in the dataset designer.. thans...
|
|
|
|