Hi, i have been using System.Timer to run a windows service but have come across the problem where the timer randomly doesnt fire. I checked it yesterday and it hadnt fired for over 2 hours when its meant to fire every 10 mins. I read this up on Google and apparently its a known problem, the answer being to change over to Threading.Timer...
I need to download a huge number of files from net based on a keyword.
The steps i am following are
Using Scraping figure out the links to files
Using WebClient.DownloadData() download the byte[]
Save the arr to a file.
Is it a good idea to create one thread for downloading each file for better performance.
Any suggestions.
Thanks
f...
I have a background thread that goes off to a server and gets XML which then renders it to a graph.
I have an NSTimer which fires off a request every 5 seconds, what is typically the best way to stop the execution of a thread altogether (if at all possible), I know you can subclass NSInvocationOperation and implement the cancel method, ...
My program uses a NetworkOutput object which can be used to write data to a remote server. The semantic is that in case the object is currently connected (because there is a remote server), then the data is actually sent over the socket. Otherwise, it's silently discarded. Some code sketch:
class NetworkOutput
{
public:
/* Constructs ...
I have a multi-threaded application which parses some text and it needs to use English Culture Info for parsing numbers from this text.
So, i do not want to create EngCulture everytime i call the parsing function. Currently i am passing EngCulture as a parameter but i am not happy with this.
I want to define the EngCulture as a static me...
Suppose you want to keep an list of the last 10 visitors to your site in memcache.
Every time that someone accesses your site, you want to push them onto an array and shift off the first visitor in the array.
Of course, a potential problem is that multiple visitors could be overwriting and reading this array at the same time, possibly ...
I have a receive callback from an async client method that is supposed to call socket.BeginReceive internally to check if data is done being sent. The code is as follows:
private void ReceiveCallback(IAsyncResult ar)
{
try
{
StateObject state = (StateObject)ar.AsyncState;
Socket client = s...
Android documentation says that AsyncTask postExecute() is called on the UI thread. I was under the impression that postExecute() was called from the Thread where execute() was called : I have been using an AsyncTask in a background Service with its own thread, and postExecute() was called in the service thread, not the main thread.
Howe...
In my application, have 3 threads:
1. main
2. network send
3. network receive
Because the application need keep-alive the session, so thread #2 need send a keep-alive packet to server when idle more than 1 minute.
If the screen is on all are ok, but under screen off, thread #2 like blocking somewhere, and if I plug-in the USB cable for ...
Hi folks,
I've been implementing this little game idea, which is (somehow?) similar to Conway's Game of Life:
0) You have a matrix of colored dots (RGB values)
1) If the adjacent cell has a lower X value than your Y, put Y = 0 on that cell
(Where X and Y are Red || Green || Blue)
2) Red beats Green beats Blue beats Red
What I'm d...
I wanted a way to call a method asynchronously and have a function be fired upon completion. This is partially inspired by AJAX calls in web applications. Is my implementation ok? Is there a better way to do this?
public static class Tools
{
public static void RunAsync(Action function, Action callback)
{
BackgroundWorke...
Hi,
I am using a BackgroundWorker thread to do some work outside of the GUI thread in Silverlight 4. I would like to update widgets in the GUI context from the background thread, but have read warnings about doing so from Microsoft documentation. I understand that communicating from one thread to another throws an exception as only th...
Hello
I am java developer and need to make thread synch in iPhone. I have a thread, it calls other one and need to wait for that child thread to end.
In java I use monitor, by calling wait/notify
How can I program this in iphone?
thanks
...
Hello,
I'm having problems with sockets in java. I have a ServerSocket that is listening with accept() and spawns threads for each client-request. Communication between clients and the server works fine. I am using an inputstream to read data from clients in the serverthreads, like:
inputStream = mySocket.getInputStream();
bytes = inpu...
Hi Folks,
this is some kind of long post, so I have to say thanks for reading.
My app is supposed to process a lot of soundfiles, lets say 4000+. My first approach was to load a certain amount (lets say 200mb) of sound data, process it, write it and then "null" the data to let the gc free it. But regarting to the fact that the data is ...
I have the following Perl code:
push(@myArray, $myValue);
Is the operation atomic, or will I need to use locks, if multiple threads will be performing this same operation on many threads?
...
This question seems like it's probably a duplicate, but I was unable to find one. If I missed a previous question, apologies.
In Java, where I have most of my experience, if your main() forks a thread and immediately returns the process continues to run until all (non-daemon) threads in the process have stopped.
In C++, this appears no...
Hi guys,
In my app, I have a thread that runs continuously. By using Thread.Sleep(), the function executes every 10 minutes.
I need to be able to kill this thread when a user clicks a button. I know Thread.Abort() is not reliable. I can use a variable to stop the thread, but since it is sleeping it could be another 10 minutes before th...
I'm having trouble with a simple threading example. I know my methods aren't complete, but as of now, I want to press the start button and have that fire off a thread that increments a counter every second. I know it's connected in IB correctly since the NSLog tells me it gets to my timerThread method. But then it immediately jumps ba...
When I run bottle development server, I notice some warning showing up.
Can any one figure it out what exactly is the problem?
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.6/dist-packages/bottle-0.8.1-p...