Search Results

Search found 8588 results on 344 pages for 'thread abort'.

Page 136/344 | < Previous Page | 132 133 134 135 136 137 138 139 140 141 142 143  | Next Page >

  • iphone app photo upload to server from app threads

    - by user290380
    I have an app that needs to upload a least 5 photos to a server using API call available with the server. For that I am planning to use threads which will take care of photo upload and the main process can go on with the navigation of views etc. What I cant decide is whether it is OK to spawn five separate threads in iphone or use a single thread that will do the upload. In the later cases obviously it will become quite slow. Basically an HTTP POST request will be made to the server with the NSMutableURLRequest object using NSCOnnection. More threads mean more complexity and sync issues, but I can try to write code as neat as possible if it means better performance than a single thread which is simple but is a real stopper if performance is considered. Anybody with any experience in this kinda app. ??

    Read the article

  • asynchronous calls in asp.net

    - by lockedscope
    in this sample, two threads created; a worker thread created by BeginInvoke and an I/O completion thread created by SendAsync method. but another author in his UnsafeQueueNativeOverlapped example, don't recommend this. i want to use SendAsync or ...Async in an asp.net page and i want to use PageAsyncTask. however, its BeginEventHandler requires AsyncResult to be returned which SendAsync does not return. afaik, event based async pattern is the most recommended way so how could we call SendAsync or any ...Async methods without creating two threads and hurting the performance?

    Read the article

  • iPhone + OpenGL + Touches: FPS drop

    - by Anton
    Hey there, Recently I ran into a very strange issue: touching the screen of the iPhone and moving a finger around can eat up to 50% of my FPS. Yeah, I checked my code for possible bottlenecks – not the issue. The last resort I tried before writing this post – commenting out all the touch processing code and looking at FPS then. Results are: no touches – 58-60. Touching and moving the finger – 35-40 FPS instantly. The rendering is done in a separate thread, so that no main runloop events shall collide with it. However, it's very crushial for me (and the game I develop) to resolve this issue, because such FPS drop is really noticeable. Thank you for your help in advance. UPDATE: seems that setting rendering thread's priority to higher value helps a bit...

    Read the article

  • What happens to a transaction when App Pool recycles or the worker process is terminated forcefully?

    - by ARS
    The architecture of the application is straight forward. There is a web application which maintain account holder data. This data is processed and the status of account holders is updated based on number of business rules. This process is initiated using a button on the page and is a long running process (say 15 mins). A component is developed to do this data processing which internally calls stored procedures. Most of the business rules are kept in stored procedure. To handle timeouts the processing is done asynchornously(using Thread Pool or custom thread or Async Callback Delegates). The entire process run under a transaction. I would like to know your view on what happens to the transaction if the app pool is recycled or the worker process is terminated forcefully?

    Read the article

  • java statistics collection for performance evaluation

    - by user384706
    What is the most efficient way to collect and report performance statistic analysis from an application? If I have an application that uses a series of network apis, and I want to report statistics at runtime, e.g. Method doA() was called 3 times and consumed on avg 500ms Method doB() was called 5 times and consumed on avg 1200ms etc Then, I thought of using a well defined data structure (of collection) that each thread updates per remote call, and this can be used for the report. But I think that it will make the performance worse, for the time spend for statistics collection. Am I correct? How would I procceed if I used a background thread for this, and the other threads that did the remote calls were unaware of this collection gathering? Thanks

    Read the article

  • check whether fgets would block

    - by lv
    Hi, I was just wondering whether in C is it possible to peek in the input buffer or perform similar trickery to know whether a call to fgets would block at a later time. Java allows to do something like that by calling BufferedReader.ready(), this way I can implement console input something like this: while (on && in.ready()) { line = in.readLine(); /* do something with line */ if (!in.ready()) Thread.sleep(100); } this allows an external thread to gracefully shutdown the input loop by setting on to false; I'd like to perform a similar implementation in C without resorting to non portable tricks, I already know I can make a "timed out fgets" under unix by resorting to signals or (better, even though requering to take care of buffering) reimplement it on top of recv/select, but I'd prefer something that would work on windows too. TIA

    Read the article

  • How do I write object classes effectively when dealing with table joins?

    - by Chris
    I should start by saying I'm not now, nor do I have any delusions I'll ever be a professional programmer so most of my skills have been learned from experience very much as a hobby. I learned PHP as it seemed a good simple introduction in certain areas and it allowed me to design simple web applications. When I learned about objects, classes etc the tutor's basic examnples covered the idea that as a rule of thumb each database table should have its own class. While that worked well for the photo gallery project we wrote, as it had very simple mysql queries, it's not working so well now my projects are getting more complex. If I require data from two separate tables which require a table join I've instead been ignoring the class altogether and handling it on a case by case basis, OR, even worse been combining some of the data into the class and the rest as a separate entity and doing two queries, which to me seems inefficient. As an example, when viewing content on a forum I wrote, if you view a thread, I retrieve data from the threads table, the posts table and the user table. The queries from the user and posts table are retrieved via a join and not instantiated as an object, whereas the thread data is called using my Threads class. So how do I get from my current state of affairs to something a little less 'stupid', for want of a better word. Right now I have a DB class that deals with connection and escaping values etc, a parent db query class that deals with the common queries and methods, and all of the other classes (Thread, Upload, Session, Photo and ones thats aren't used Post, User etc ) are children of that. Do I make a big posts class that has the relevant extra attributes that I retrieve from the users (and potentially threads) table? Do I have separate classes that populate each of their relevant attributes with a single query? If so how do I do that? Because of the way my classes are written, based on what I was taught, my db update row method, or insert method both just take the attributes as an array and update all of that, if I have extra attributes from other db tables in each class then how do I rewrite those methods as obbiously updating automatically like that would result in errors? In short I think my understanding is limited right now and I'd like some pointers when it comes to the fundamentals of how to write more complex classes.

    Read the article

  • How to set up dynamically Part in MultipartRequestEntity

    - by ee_vin
    Hello, I'm using commons-httpclient-3.1 inside my android application. And I would like to know if it possible to manipulate Part (org.apache.commons.httpclient.methods.multipart.Part) dynamically? Essentially adding new FilePart and new StringPart at runtime before sending the request. Every example I've found until now suppose that you know how many fields you are dealing with. Ex: File f = new File("/path/fileToUpload.txt"); PostMethod filePost = new PostMethod("http://host/some_path"); Part[] parts = { new StringPart("param_name", "value"), new FilePart(f.getName(), f) }; filePost.setRequestEntity( new MultipartRequestEntity(parts, filePost.getParams()) ); HttpClient client = new HttpClient(); int status = client.executeMethod(filePost); code from http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/multipart/MultipartRequestEntity.html Android specific thread: http://groups.google.com/group/android-developers/browse_thread/thread/0f9e17bbaf50c5fc Thank you

    Read the article

  • How to fix this python error? RuntimeError: dictionary changed size during iteration

    - by aF
    Hello, it gives me this error: Exception in thread Thread-163: Traceback (most recent call last): File "C:\Python26\lib\threading.py", line 532, in __bootstrap_inner self.run() File "C:\Python26\lib\threading.py", line 736, in run self.function(*self.args, **self.kwargs) File "C:\Users\Public\SoundLog\Code\Código Python\SoundLog\SoundLog.py", line 337, in getInfo self.data1 = copy.deepcopy(Auxiliar.DataCollection.getInfo(1)) File "C:\Python26\lib\copy.py", line 162, in deepcopy y = copier(x, memo) File "C:\Python26\lib\copy.py", line 254, in _deepcopy_dict for key, value in x.iteritems(): RuntimeError: dictionary changed size during iteration while executing my python program. How can I avoid this to happen? Thanks in advance ;)

    Read the article

  • problem-configure-jboss-to-work-with-jndi(3)

    - by Spiderman
    Sorry for opening new thread every time for the same problem. It's just that I'd like to refine my question during my investigation and it's hard to do it in stackoverflow structure on the same question (maybe on purpose). Anyway, in continuation to this thread http://stackoverflow.com/questions/2843218/problem-configure-jboss-to-work-with-jndi2 I discovered that when running an application that is deployed on my JBoss 4.2.3.GA, when I perform: Context initialContext = new InitialContext(); Object dataSource = initialContext.lookup("java:/DefaultDS"); I get null as a return value even though DefaultDS is the default datasource that comes with Jboss installation. and generally, how come initialContext return null value? if the datasource is not found it should throw NamingException and in other case it should return real object. What can I do with null? isn't it a bad error handling of javax.naming.InitialContext ???

    Read the article

  • [java] Threading socket handler for two sided communication in tcp port

    - by raven
    I want to make a chat which will be programed in java. one computer will host the server and the other one will initiate the socket [tcp port]. now from what I read there should be a loop that will constantly read the socket which means it will make the code stuck. I have a button that is 'actionperformed' on mouse release, I want to know if it will work along with the loops that constantly reads the socket so that it will also send the infromation I wrote. If I must thread it, I want to know if the run() method must be void because if I thread it it will mean creating a new class, and the whole GUI is one big class which includes a text area, and it's private. also how can I extract the information from the socket directly to the text area? lets say the textarea variable is called "chatOutput". thx :)

    Read the article

  • How can I add similar functionality to a number of methods in java?

    - by Roman
    I have a lot of methods for logging, like logSomeAction, logAnotherAction etc. Now I want all these methods make a small pause after printing messages (Thread.sleep). If I do it manually, I would do something like this: //before: public static void logSomeAction () { System.out.println (msg(SOME_ACTION)); } //after: public static void logSomeAction () { System.out.println (msg(SOME_ACTION)); try { Thread.sleep (2000); } catch (InterruptedException ignored) { } } I remember that Java has proxy classes and some other magic-making tools. Is there any way avoid copy-n-pasting N sleep-blocks to N logging methods?

    Read the article

  • How can I receive messages using over http without MSMQ

    - by pduncan
    I need a reliable messaging framework that runs over http/https (due to client security requirements) and that doesn't use MSMQ (because some clients will use Windows XP Home). The clients only need to be able to receive messages, not send them. We already have a message queue on the server for each user, and the receivers have been getting messages by connecting to an HttpHandler on the server and getting a Stream from WebResponse.GetResponseStream() We keep this stream open, and pull messages off of it using Stream.Read(). This MOSTLY works, but Stream.Read() is a blocking call, and we can't reliably interrupt it. We need to be able to stop and start the receiver without losing messages, but the old stream often hangs around, even after we call Thread.Abort on its thread. Any suggestions?

    Read the article

  • Pattern for iPhone background loading during init?

    - by Rob S.
    Hi everyone, I'm currently kicking off a background thread to do some REST queries in my app delegate's didFinishLaunchingWithOptions. This thread creates some objects and populates the model as the rest of the app continues to load (because I don't block, and didFinishLaunchingWithOptions returns YES). I also put up a loading UIViewController 'on top' of the main view that I tear down after the background initialization is complete. My problem is that I need to notify the first view (call it the Home view) that the model is ready, and that it should populate itself. The trick is that the background download could have finished before Home.viewDidAppear is called, or any of the other Home.initX methods. I'm having difficulty synchronizing all of this and I've thought about it long enough that it feels like I'm barking up the wrong tree. Are there any patterns here for this sort of thing? I'm sure other apps start by performing lengthy operations with loading screens :) Thanks!

    Read the article

  • How to update the progress bar in runtime using c#

    - by karthik
    I am using the below code to update my progress bar. ProgressBar.Visible = true; ProgressBar.Minimum = 1; ProgressBar.Maximum = PortCount; ProgressBar.Value = 1; ProgressBar.Step = 1; int intdata = 5; for (int x = 1; x <= intdata; x++) { ProgressBar.PerformStep(); } MessageBox.Show("Done"); But, it is not getting updated during runtime. Is it because the progress bar is in the same thread. If so, how to update this progress from another thread. Help...

    Read the article

  • Threading Problems in ActionScript 2.0?

    - by yar
    Is it possible to have concurrency problems (thread competition) in an onEnterFrame method in ActionScript 2.0? I have written this cheesy code as a guard: if (!busy) { // I suspect some threading problems: is that even possible in flash busy = true; movePanels(); busy = false; } but this is no assurance against thread competition. If so, how can I do a basic semaphore/lock? Note: I suspect threading problems in my app, but if they're impossible, I'll check my code differently.

    Read the article

  • Is it possible to use instanceof when passing objects between Threads?

    - by Risser
    I've run into an issue where instanceof works, and then it doesn't. Going into details is difficult, but I think this might be the problem: Reading this: http://www.theserverside.com/news/thread.tss?thread_id=40229 (search for Thread.currentThread), it seems to imply that, even if the two objects are the same class, if you pass them between threads with different class loaders, instanceof (and isAssignableFrom) might still fail. This certainly would explain the behavior I'm having, but I was wondering if anyone could verify it? (I wish the article linked at the beginning of the discussion was still available, but it doesn't seem like it is.) Thanks, Peter

    Read the article

  • What is the effect of final variable declaration in methods?

    - by Finbarr
    Classic example of a simple server: class ThreadPerTaskSocketServer { public static void main(String[] args) throws IOException { ServerSocket socket = new ServerSocket(80); while (true) { final Socket connection = socket.accept(); Runnable task = new Runnable() { public void run() { handleRequest(connection); } }; new Thread(task).start(); } } } Why should the Socket be declared as final? Is it because the new Thread that handles the request could refer back to the socket variable in the method and cause some sort of ConcurrentModificationException?

    Read the article

  • Synchronizing access to an inner object's methods?

    - by user291701
    Suppose I have the following: public class Foo { private ReadingList mReadingList = new ReadingList(); public ReadingList getReadingList() { synchronized (mReadingList) { return mReadingList; } } } If I try modifying the ReadingList object in two threads, the synchronization above won't help me, right?: // Thread 1 foo1.getReadingList().setName("aaa"); // Thread 2 foo2.getReadingList().setName("bbb"); do I have to wrap each method I want synchronized like so: public class Foo { private ReadingList mReadingList = new ReadingList(); public synchronized void setReadingListName(String name) { mReadingList.setName(name); } public synchronized void setReadingListAuthor(String author) { mReadingList.setAuthor(author); } ... and so on for each method of ReadingList I want exposed and synched? I'd end up just writing wrapper methods for each method of ReadingList. Thanks

    Read the article

  • What would happen to GC if I run process with priority = RealTime?

    - by Bobb
    I have a C# app which runs with priority RealTime. It was all fine until I made few hectic changes in past 2 days. Now it runs out of memory in few hours. I am trying to find whether it is a memory leak I created of this is because I consume lot more objects than before and GC simply cant collect them because it runs with same priority. My question is - what could happen to GC when it tries to collect objects in application with RealTime priority (there is also at least one thread running with Highest thread priority)? (P.S. by realtime priority I mean Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime) Sorry forgot to tell. GC is in Server mode

    Read the article

  • Java - 'continue' loop iteration after certain timeout period

    - by Matt
    Is there a way to exit ('continue;') a loop iteration after a certain timeout period? I have a loop that will run gathering data from the web and then use this data to make a calculation. The data become obsolete after about 1 to 2 seconds so if the loop iteration takes longer than 1 second then i want it to 'continue' to the next iteration. Sometimes gathering the data can take time but sometimes the calculation can take longer than 1 second so a HTTP timeout won't work for what i need. Also, while doing the calculation the thread i am using is blocked so i cannot check System.currentTimeMillis(); Is there a way to use another Thread to check the time and force the original for loop to continue.

    Read the article

  • What happens to an instance of ServerSocket blocked inside accept(), when I drop all references to i

    - by Hanno Fietz
    In a multithreaded Java application, I just tracked down a strange-looking bug, realizing that what seemed to be happening was this: one of my objects was storing a reference to an instance of ServerSocket on startup, one thread would, in its main loop in run(), call accept() on the socket while the socket was still waiting for a connection, another thread would try to restart the component under some conditions, the restart process missed the cleanup sequence before it reached the initialization sequence as a result, the reference to the socket was overwritten with a new instance, which then wasn't able to bind() anymore the socket which was blocking inside the accept() wasn't accessible anymore, leaving a complete shutdown and restart of the application as the only way to get rid of it. Which leaves me wondering: with no references left to the ServerSocket instance, what would free the socket for a new connection? At what point would the ServerSocket become garbage collected? In general, what are good practices I can follow to avoid this type of bug?

    Read the article

  • implementing keepalives with Java

    - by Bilal
    Hi All, I am biulding a client-server application where I have to implement a keepalive mechanism in order to detect that the client has crashed or not. I have separate threads on both client and server side. the client thread sends a "ping" then sleeps for 3 seconds, while the server reads the BufferedInput Stream and checks whether ping is received, if so it makes the ping counter eqauls zero, else it increments the counter by +1, the server thread then sleeps for 3 seconds, if the ping counter reaches 3, it daclares the client as dead. The problem is that when the server reads the input stream, its a blocking call, and it blocks untill the next ping is received, irrespective of how delayed it is, so the server never detects a missed ping. any suggestions, so that I can read the current value of the stream and it doesn't block if there is nothing on the incoming stream. Thanks,

    Read the article

  • A Surface view and a canvas to move Bitmap

    - by John Apple Sim
    I have a SurfaceView and I want the Bitmap Logo inside it in the canvas to be movable What I'm doing wrong ? static float x, y; Bitmap logo; SurfaceView ss = (SurfaceView) findViewById(R.id.svSS); logo = BitmapFactory.decodeResource(getResources(), R.drawable.logo); x = 40; y = 415; ss.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent me) { try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } switch(me.getAction()) { case MotionEvent.ACTION_DOWN: x = me.getX(); y = me.getY(); break; case MotionEvent.ACTION_UP: x = me.getX(); y = me.getY(); break; case MotionEvent.ACTION_MOVE: x = me.getX(); y = me.getY(); break; } return true; } }); public class OurView extends SurfaceView implements Runnable{ Thread t = null; SurfaceHolder holder; boolean isItOK = false; public OurView(Context context) { super(context); holder = getHolder(); } public void run (){ while (isItOK == true){ //canvas DRAWING if (!holder.getSurface().isValid()){ continue; } Canvas c = holder.lockCanvas(); c.drawARGB(255, 200, 100, 100); c.drawBitmap(logo, x,y,null); holder.unlockCanvasAndPost(c); } } public void pause(){ isItOK = false; while(true){ try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } break; } t = null; } public void resume(){ isItOK = true; t = new Thread(this); t.start(); } } Now the surface view is just black .. nothing happens also its not colored 200, 100, 100

    Read the article

  • C++ WIN32: Short multitasking example

    - by Con Current
    I searched for examples on how to create a simple multithreaded app that does something similar to this: #include <iostream> using namespace std; int myConcurrentFunction( ) { while( 1 ) { cout << "b" << endl; } } int main( ) { // Start a new thread for myConcurrentFunction while( 1 ) { cout << "a" << endl; } } How can I get the above to output a and b "randomly" by starting a new thread instead of just calling myConcurrentFunction normally? I mean: What is the minimal code for it? Is it really only one function I have to call? What files do I need to include? I use MSVC 2010, Win32

    Read the article

< Previous Page | 132 133 134 135 136 137 138 139 140 141 142 143  | Next Page >