i'm a beginner programmer and i was wondering if there was a way to do this, ideally i would have it so that it only asks for the input for 5 seconds, cancels and moves on if nothing has been pressed would i need a separate thread?, is there even a way to do something like this in c#? or is this just a limitation of using the console?
22644
I have a console app in which I want to give the user x seconds to respond to the prompt.  If no input is made after a certain period of time, program logic should continue.  We assume a timeout means empty response.  What is the most straightforward way of approaching this?
47899
Semantically, the Yes/No buttons are roughly equivalent to the Ok/Cancel buttons, but in general what would you recommend to use? Should I always use Yes/No or always use Ok/Cancel? Or does it depend on the case?
19310
I have some code that I only want to run once, even though the circumstances that trigger that code could happen multiple times.  For example, when the user clicks the mouse, I want to click the thing:  void Update() {     if(mousebuttonpressed) {         ClickTheThing(); // I only want this to happen on the first click,                          // then never again.     } }   However, with this code, every time I click the mouse, the thing gets clicked. How can I make it happen only once?
3920
Using C# and WPF under .NET (rather than  or console), what is the correct way to create an application that can only be run as a single instance?  I know it has something to do with some mythical thing called a mutex, rarely can I find someone that bothers to stop and explain what one of these are.  The code needs to also inform the already-running instance that the user tried to start a second one, and maybe also pass any command-line arguments if any existed.
27105
On the CLI, sometimes a command I type takes a while to complete, and sometimes I know when that's about to happen. I'm a bit confused on "backgrounding" and such in Linux.  What is the most common (or user-friendly way) of telling the CLI that I don't want to wait, please give me back my prompt immediately. And if it could give me a progress bar or just busy-spinner, that would be great!
89850
I want to write a console or Click Once WinForms app that will programmatically stop and/or start a windows service on a remote box.  Both boxes are running .NET 3.5 - what .NET API's are available to accomplish this?
19442
I can never remember how I do this because it comes up so infrequently for me. But in C or C++, what is the best way to read a character from standard input without waiting for a newline (press enter).  Also ideally it wouldn't echo the input character to the screen. I just want to capture keystrokes with out effecting the console screen.
79668
I want to create a communication between a parent and a child process, both written in C#. It should be asynchronous, event-driven. I don't want to run a thread in every process to handle the very rare communication. What is the best solution for it?
116831
I have created a short command block stack, one block teleports the player and the other plays block.piston.extend. My problem is that it teleports the player before the player can hear the sound. I would like to know if there is a way to delay the command from inside that command block. I have looked at other solutions but they all involve some complex scoreboard timer thing. If you could give me a solution that doesn't use that system or maybe you could explain it better.  This is the command I need to delay:  /tp @p -586.634 64 -430.697   If anyone could help I would really appreciate it, so thanks in advance!
41254
I just wanted to make some input where I press a key and the auto-repeat function engages so I don't have to press the 0 key many times to make a long number.  10000000000000000000000000000  This has always worked without fail in the past, but it's not something I do often and I'm not sure where to look next to figure out what might be preventing this.     I've toggled the sliders to change the delay for key repeat, but the only thing I can hang my hat on is that perhaps Lion disables this with the new feature where you hold down some keys (like the vowels, but also some consonants) to get alternate accented characters.  s turns into ß or ś or š and so on....  Am I missing an obvious setting, or is this something that has moved to a hidden setting or is simply a bug that these controls are still around since key repeat is now deprecated?  Comments welcome if anyone doesn't have an answer, but can provide specifics where this does work for them. I've checked two Macs so I'm guessing it's not related to keyboard type or connection method.
119341
I'm pretty new to programming and made a few programs so far. I recently made a Calculator program and I hope you guys could tell me what I could do to improve. int firstNumber; string sign; int secondNumber; int answer;  Console.WriteLine(&quot;Input Number:&quot;); firstNumber = Convert.ToInt32(Console.ReadLine()); Console.Clear();  Console.WriteLine(&quot;Input Sign:&quot;); sign = Console.ReadLine(); Console.Clear();  Console.WriteLine(&quot;Input Second Number:&quot;); secondNumber = Convert.ToInt32(Console.ReadLine()); Console.Clear();  switch (sign) {     case &quot;+&quot;:         answer = firstNumber + secondNumber;         Console.WriteLine(answer);         Console.ReadKey();     break;     case &quot;-&quot;:         answer = firstNumber - secondNumber;         Console.WriteLine(answer);         Console.ReadKey();     break;     case &quot;*&quot;:         answer = firstNumber * secondNumber;         Console.WriteLine(answer);         Console.ReadKey();     break;     case &quot;/&quot;:         answer = firstNumber / secondNumber;         Console.WriteLine(answer);         Console.ReadKey();     break;     default:         Console.WriteLine(&quot;Invalid Input&quot;);     break; }
51350
I want to record the time using System.currentTimeMillis() when a user begins something in my program. When he finishes, I will subtract the current System.currentTimeMillis() from the start variable, and I want to show them the time elapsed using a human readable format such as "XX hours, XX mins, XX seconds" or even "XX mins, XX seconds" because its not likely to take someone an hour.  What's the best way to do this?
44387
I am looking for good ideas for implementing a generic way to have a single line (or anonymous delegate) of code execute with a timeout.  TemperamentalClass tc = new TemperamentalClass(); tc.DoSomething();  // normally runs in 30 sec.  Want to error at 1 min   I'm looking for a solution that can elegantly be implemented in many places where my code interacts with temperamental code (that I can't change).  In addition, I would like to have the offending "timed out" code stopped from executing further if possible.
118832
I've got an issue. When (Input.GetMouseButtonUp (0), Speedy script is disabled, thus we cannot enable it again from inside the script like shown below. How can we go around this?  public class  Speedy : MonoBehaviour {  GameObject car;   if (speed == good)     {         GameObject car = GameObject.FindWithTag ("Car");          if (Input.GetMouseButtonUp (0))          {             car.GetComponent&lt;Speedy&gt;().enabled = false;         }          else car.GetComponent&lt;Speedy&gt;().enabled = true;     } }
9698
I'm trying to write a program in C (on Linux) that loops until the user presses a key, but shouldn't require a keypress to continue each loop.  Is there a simple way to do this? I figure I could possibly do it with select() but that seems like a lot of work.  Alternatively, is there a way to catch a ctrl-c keypress to do cleanup before the program closes instead of non-blocking io?
19248
I have a form with an &lt;input type=text /&gt; and I want to call a javascript function after 5 seconds of the last key press, and every time a new key is pressed, this timer should reset and only call the function after 5 seconds.  How can I do this?  I'm using jQuery.  thanks!
12512
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value.  If the user changes another value (or the same value again by clicking many times on the spinner arrow) while the first thread is working, I would like to abort the first thread (and the update of the 3D view) and launch a new one with the latest parameter value.  How can I do something like that?  PS: There is no loop in the run() method of my thread, so checking for a flag is not an option: the thread updating the 3D view basically only calls a single method that is very long to execute. I can't add any flag in this method asking to abort either as I do not have access to its code.