Search Results

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

Page 131/344 | < Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >

  • Refreshing a UITableView

    - by MihaiD
    I have a UITableView subclass and a UITableViewCell sublass that I'm using for cells. I'm bulding all my cells in advance and store them in an array from where I use them in cellForRowAtIndexPath. Aside from this I have a thread that loads some images in each cell, in the background. The problem is that the cells don't get refreshed as fast as the images are loaded. For example, if I don't scroll my table view, the first cells only get refreshed when all cells have been modified and the thread has exited. Any ideas on how I can effectively refresh my tableview/cell?

    Read the article

  • log4j performance

    - by Bob
    Hi, I'm developing a web app, and I'd like to log some information to help me improve and observe the app. (I'm using Tomcat6) First I thought I would use StringBuilders, append the logs to them and a task would persist them into the database like every 2 minutes. Because I was worried about the out-of-the-box logging system's performance. Then I made some test. Especially with log4j. Here is my code: Main.java public static void main(String[] args) { Thread[] threads = new Thread[LoggerThread.threadsNumber]; for(int i = 0; i < LoggerThread.threadsNumber; ++i){ threads[i] = new Thread(new LoggerThread("name - " + i)); } LoggerThread.startTimestamp = System.currentTimeMillis(); for(int i = 0; i < LoggerThread.threadsNumber; ++i){ threads[i].start(); } LoggerThread.java public class LoggerThread implements Runnable{ public static int threadsNumber = 10; public static long startTimestamp; private static int counter = 0; private String name; public LoggerThread(String name) { this.name = name; } private Logger log = Logger.getLogger(this.getClass()); @Override public void run() { for(int i=0; i<10000; ++i){ log.info(name + ": " + i); if(i == 9999){ int c = increaseCounter(); if(c == threadsNumber){ System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTimestamp)); } } } } private synchronized int increaseCounter(){ return ++counter; } } } log4j.properties log4j.logger.main.LoggerThread=debug, f log4j.appender.f=org.apache.log4j.RollingFileAppender log4j.appender.f.layout=org.apache.log4j.PatternLayout log4j.appender.f.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n log4j.appender.f.File=c:/logs/logging.log log4j.appender.f.MaxFileSize=15000KB log4j.appender.f.MaxBackupIndex=50 I think this is a very common configuration for log4j. First I used log4j 1.2.14 then I realized there was a newer version, so I switched to 1.2.16 Here are the figures (all in millisec) LoggerThread.threadsNumber = 10 1.2.14: 4235, 4267, 4328, 4282 1.2.16: 2780, 2781, 2797, 2781 LoggerThread.threadsNumber = 100 1.2.14: 41312, 41014, 42251 1.2.16: 25606, 25729, 25922 I think this is very fast. Don't forget that: in every cycle the run method not just log into the file, it has to concatenate strings (name + ": " + i), and check an if test (i == 9999). When threadsNumber is 10, there are 100.000 loggings and if tests and concatenations. When it is 100, there are 1.000.000 loggings and if tests and concatenations. (I've read somewhere JVM uses StringBuilder's append for concatenation, not simple concatenation). Did I missed something? Am I doing something wrong? Did I forget any factor that could decrease the performance? If these figures are correct I think, I don't have to worry about log4j's performance even if I heavily log, do I?

    Read the article

  • Windows.Forms.Timer instance and UI threads

    - by David Rutten
    I have a custom control whose primary purpose is to draw data. I want to add a ScheduleUpdate(int milliSeconds) method to the control which will force an update X milliseconds from now. Since this is all GUI land, I should be using a Windows.Forms.Timer, but how does this timer instance know which thread it belongs to? What if ScheduleUpdate() is called from a non-UI thread? Should I construct the timer in the Control constructor? Or perhaps the Load event? Or is it safe to postpone construction until I'm inside ScheduleUpdate()? I know there are some very similar questions about this already, but I don't have a Timer component on my control, I'm constructing it on a when-it's-needed basis.

    Read the article

  • Php fetch rows from multiple MySQL tables

    - by Jon McIntosh
    Right now I am fetching all of the rows from one of my tables: query = "SELECT * FROM thread WHERE threadid = 2 ORDER BY threadid DESC"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if((!is_bool($result) || $result) && $num_rows) { while($row = mysql_fetch_array($result)) { $thread = $row['title']; $threadID = $row['threadid']; $poster = $row['postusername']; } What I want to do is go to another table on my database: "post_display", and get the row 'text' where the threadid = 2.

    Read the article

  • Hibernate constraint ConstraintViolationException. Is there an easy way to ignore duplicate entries?

    - by vincent
    Basically I've got the below schema and I'm inserting records if they don't exists. However when it comes to inserting a duplicate it throws and error as I would expect. My question is whether there is an easy way to make Hibernate to just ignore inserts which would in effect insert duplicates? CREATE TABLE IF NOT EXISTS `method` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; SEVERE: Duplicate entry 'GET' for key 'name' Exception in thread "pool-11-thread-4" org.hibernate.exception.ConstraintViolationException: could not insert:

    Read the article

  • Would watching a file for changes or redundantly querying that file be more efficient?

    - by badpanda
    I am wondering whether watching a file/directory for changes using the FileSystemWatcher class is extremely memory intensive. I am developing a desktop application in C# that will be running behind the scenes continuously on low-performance computers, and I need some way of checking to see if various files have changed. I can think of a few solutions: Watch the directories using FileSystemWatcher. Run a timed thread on an interval that goes through and manually checks this. Check manually every time the actionhandler thread runs (the program will occasionally do something, on an action). Any suggestions? Thanks! badPanda

    Read the article

  • CUDA, more threads for same work = Longer run time despite better occupancy, Why?

    - by zenna
    I encountered a strange problem where increasing my occupancy by increasing the number of threads reduced performance. I created the following program to illustrate the problem: #include <stdio.h> #include <stdlib.h> #include <cuda_runtime.h> __global__ void less_threads(float * d_out) { int num_inliers; for (int j=0;j<800;++j) { //Do 12 computations num_inliers += threadIdx.x*1; num_inliers += threadIdx.x*2; num_inliers += threadIdx.x*3; num_inliers += threadIdx.x*4; num_inliers += threadIdx.x*5; num_inliers += threadIdx.x*6; num_inliers += threadIdx.x*7; num_inliers += threadIdx.x*8; num_inliers += threadIdx.x*9; num_inliers += threadIdx.x*10; num_inliers += threadIdx.x*11; num_inliers += threadIdx.x*12; } if (threadIdx.x == -1) d_out[blockIdx.x*blockDim.x+threadIdx.x] = num_inliers; } __global__ void more_threads(float *d_out) { int num_inliers; for (int j=0;j<800;++j) { // Do 4 computations num_inliers += threadIdx.x*1; num_inliers += threadIdx.x*2; num_inliers += threadIdx.x*3; num_inliers += threadIdx.x*4; } if (threadIdx.x == -1) d_out[blockIdx.x*blockDim.x+threadIdx.x] = num_inliers; } int main(int argc, char* argv[]) { float *d_out = NULL; cudaMalloc((void**)&d_out,sizeof(float)*25000); more_threads<<<780,128>>>(d_out); less_threads<<<780,32>>>(d_out); return 0; } Note both kernels should do the same amount of work in total, the (if threadIdx.x == -1 is a trick to stop the compiler optimising everything out and leaving an empty kernel). The work should be the same as more_threads is using 4 times as many threads but with each thread doing 4 times less work. Significant results form the profiler results are as followsL: more_threads: GPU runtime = 1474 us,reg per thread = 6,occupancy=1,branch=83746,divergent_branch = 26,instructions = 584065,gst request=1084552 less_threads: GPU runtime = 921 us,reg per thread = 14,occupancy=0.25,branch=20956,divergent_branch = 26,instructions = 312663,gst request=677381 As I said previously, the run time of the kernel using more threads is longer, this could be due to the increased number of instructions. Why are there more instructions? Why is there any branching, let alone divergent branching, considering there is no conditional code? Why are there any gst requests when there is no global memory access? What is going on here! Thanks

    Read the article

  • Grails deploy on Tomcat6

    - by Jack
    Hello, while trying to deploy a Grails application into tomcat6 I ran into some problems: I used the grails war command to build up a war, then copied it to var/lib/tomcat6/webapps and tried to restart the container. I had to change default Tomcat policy to skip security exceptions, since I couldn't access environment variable (like grails.env), then tried again but it gives me an exception related to instantiating something, but it's not clear where should I try to fix the error, according to tomcat6 logs the problem is: SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsC$ org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext$ at java.lang.Thread.run(Thread.java:619) Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [Hiberna$ ... 1 more Caused by: java.lang.NoClassDefFoundError: org.hibernate.cfg.Environment It seems like it's unable to load org.hibernate.cfg.Environment class. I checked the applicationContext.xml and it refers to grails.xml to search for plugins, in this last file I actually have HibernateGrailsPlugin. Where should I look to find if the plugin is present?

    Read the article

  • [C#] Async threaded tcp server

    - by mark_dj
    I want to create a high performance server in C# which could take about ~10k clients. Now i started writing a TcpServer with C# and for each client-connection i open a new thread. I also use one thread to accept the connections. So far so good, works fine. The server has to deserialize AMF incoming objects do some logic ( like saving the position of a player ) and send some object back ( serializing objects ). I am not worried about the serializing/deserializing part atm. My main concern is that I will have a lot of threads with 10k clients and i've read somewhere that an OS can only hold like a few hunderd threads. Are there any sources/articles available on writing a decent async threaded server ? Are there other possibilties or will 10k threads work fine ? I've looked on google, but i couldn't find much info about design patterns or ways which explain it clearly

    Read the article

  • xsd:datetime and XmlGregorianCalendar causes NullPointerException

    - by Draemon
    The following works: public Date getDate() { return date; } and produces something like: <date>2010-03-23T17:43:50.879Z</date> And I can use an XmlGregorianCalendar to return xsd:date or xsd:time types fine: @XmlSchemaType(name="date") public XmlGregorianCalendar getDate() { return date; } which produces something like: <date>2010-03-23</date> But trying to return xsd:datetime like so: @XmlSchemaType(name="datetime") public XmlGregorianCalendar getDate() { return date; } Causes this stack trace: java.lang.NullPointerException at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.checkXmlGregorianCalendarFieldRef(RuntimeBuiltinLeafInfoImpl.java:864) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.access$200(RuntimeBuiltinLeafInfoImpl.java:111) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.print(RuntimeBuiltinLeafInfoImpl.java:536) ...snip... at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) Which doesn't mention my code at all. I'm using tomcat 6.0.24, java 1.6.0_16-b01

    Read the article

  • Using a JMS Session from different threads

    - by Evan
    From the javadoc for Session it states: A Session object is a single-threaded context for producing and consuming messages. So I understand that you shouldn't use a Session object from two different threads at the same time. What I'm unclear on is if you could use the Session object (or children such as a Queue) from a different thread than the one it created. In the case I'm working on, I'm considering putting my Session objects into a pool of available sessions that any thread could borrow from, use, and return to the pool when it is finished with it. Is this kosher? (Using ActiveMQ BTW, if that impacts the answer at all.)

    Read the article

  • OutOfMemoryException, stack size is huge, large number of threads

    - by Captain Comic
    Hello, I was profiling my .net windows service. I was trying to discover OutOfMemoryException and discovered that my stack size is huge and is growing because the the number of threads keeps growing. Each thread gets 1024 KB on Windows x64 machine. Thus when my app has 754 threads the stack size would be 772 MB. The problem for me is that i don't know where these thread come from. Initially my app has a very limited number of threads and they keep growing with time. I have two suspicions - either these threads are created by WCF or by database connection. My application uses both WCF and datasets. Also I tried to profile my app in Ants do Trace i can see large number of System.ServiceModel.Channels.ClientReliableDuplexSessionChannel and this number is increasing with time. I can see thousands of these objects created. So what I want to know is who is creating threads (tools to discover, profilers) and if it is WCF who is creating these threads.

    Read the article

  • Using device variable by multiple threads on CUDA

    - by ashagi
    I am playing around with cuda. At the moment I have a problem. I am testing a large array for particular responses, and when I get the response, I have to copy the data onto another array. For example, my test array of 5 elements looks like this: [ ][ ][v1][ ][ ][v2] Result must look like this: [v1][v2] The problem is how do I calculate the address of the second array to store the result? All elements of the first array are checked in parallel. I am thinking to declare a device variable int addr = 0. Every time I find a response, I will increment the addr. But I am not sure about that because it means that addr may be accessed by multiple threads at the same time. Will that cause problems? Or will the thread wait until another thread finishes using that variable?

    Read the article

  • change view with onSensorChanged result

    - by tipu
    I have a view, set by setContentView(new CompassView(this)); I have the onDraw and update methods filled out. What I need to do with the view CompassView is update my view with the new data at the end of the call in the onSensorChanged method. The methods I have to fill out, I believe, are the surfaceChanged and surfaceCreated. They are normally using threads which takes care of the update and onDraw calls but I removed the thread because when the thread was enabled, in the infinite while loop I was never getting any azimuth value what so ever.

    Read the article

  • Scala and the Java Memory Model

    - by Ben Lings
    The Java Memory Model (since 1.5) treats final fields differently to non-final fields. In particular, provided the this reference doesn't escape during construction, writes to final fields in the constructor are guaranteed to be visible on other threads even if the object is made available to the other thread via a data race. (Writes to non-final fields aren't guaranteed to be visible, so if you improperly publish them, another thread could see them in a partially constructed state.) Is there any documentation on how/if the Scala compiler creates final (rather than non-final) backing fields for classes? I've looked through the language specification and searched the web but can't find any definitive answers. (In comparison the @scala.volatile annotation is documented to mark a field as volatile)

    Read the article

  • Mock Assertions on objects inside Parallel ForEach's???

    - by jacko
    Any idea how we can assert a mock object was called when it is being accessed inside Parallel.ForEach via a closure? I assume that because each invocation is on a different thread that Rhino Mocks loses track of the object? Pseudocode: var someStub = MockRepository.GenerateStub() Parallel.Foreach(collectionOfInts, anInt => someStub.DoSomething(anInt)) someStub.AssertWasCalled(s => s.DoSomething, Repeat.Five.Times) This test will return an expectation violation, expecting the stub to be called 5 times but being actually called 0 times. Any ideas how we can tell the lambdas to keep track of the thread-local stub object?

    Read the article

  • how to implement a "soft barrier" in multithreaded c++

    - by Jason
    I have some multithreaded c++ code with the following structure: do_thread_specific_work(); update_shared_variables(); //checkpoint A do_thread_specific_work_not_modifying_shared_variables(); //checkpoint B do_thread_specific_work_requiring_all_threads_have_updated_shared_variables(); What follows checkpoint B is work that could have started if all threads have reached only checkpoint A, hence my notion of a "soft barrier". Typically multithreading libraries only provide "hard barriers" in which all threads must reach some point before any can continue. Obviously a hard barrier could be used at checkpoint B. Using a soft barrier can lead to better execution time, especially since the work between checkpoints A and B may not be load-balanced between the threads (i.e. 1 slow thread who has reached checkpoint A but not B could be causing all the others to wait at the barrier just before checkpoint B). I've tried using atomics to synchronize things and I know with 100% certainty that is it NOT guaranteed to work. For example using openmp syntax, before the parallel section start with: shared_thread_counter = num_threads; //known at compile time #pragma omp flush Then at checkpoint A: #pragma omp atomic shared_thread_counter--; Then at checkpoint B (using polling): #pragma omp flush while (shared_thread_counter > 0) { usleep(1); //can be removed, but better to limit memory bandwidth #pragma omp flush } I've designed some experiments in which I use an atomic to indicate that some operation before it is finished. The experiment would work with 2 threads most of the time but consistently fail when I have lots of threads (like 20 or 30). I suspect this is because of the caching structure of modern CPUs. Even if one thread updates some other value before doing the atomic decrement, it is not guaranteed to be read by another thread in that order. Consider the case when the other value is a cache miss and the atomic decrement is a cache hit. So back to my question, how to CORRECTLY implement this "soft barrier"? Is there any built-in feature that guarantees such functionality? I'd prefer openmp but I'm familiar with most of the other common multithreading libraries. As a workaround right now, I'm using a hard barrier at checkpoint B and I've restructured my code to make the work between checkpoint A and B automatically load-balancing between the threads (which has been rather difficult at times). Thanks for any advice/insight :)

    Read the article

  • launching java test bycommand line

    - by lamisse
    I created runner.bat to launch one java test it contains : path to java,classpath org.junit.runner.JUnitCore package.class when I launch it : FAILURES Tests run: 1, Failures: 1 Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress at java.lang.ApplicationShutdownHooks.add(Unknown Source) at java.lang.Runtime.addShutdownHook(Unknown Source) at com.sun.imageio.stream.StreamCloser$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.imageio.stream.StreamCloser.addToQueue(Unknown Source) at javax.imageio.stream.FileCacheImageInputStream.<init>(Unknown Source) at com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(Unknown Source) at javax.imageio.ImageIO.createImageInputStream(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at com.polyspace.util.guicomponent.CompositePanel.setBufferedImage(Unknown Source) at com.polyspace.util.guicomponent.CompositePanel.<init>(Unknown Source)

    Read the article

  • Program crashes in debugger before anything happens

    - by Tim
    I'm building an application for Windows XP using the MinGW tool chain and it sometimes crashes unexpectedly. So, I'm trying to use a debugger (Gdb) but the program exits with code 03 before anything happens. In fact, all I see from GDB is: [New thread 3184.0x7b8][New thread 3184.0xef8] Program exited with code 03. My suspicion is that there is some failed dynamic linking of a dependency (which are Qt, VTK, and ITK, all built with MinGW). However, this does not happen when I just run the program normally. Or if it happens, it appears to be intermittent and well after the program is launched and running. NOTE: I'm also using Cmake for cross compiling. What should I do? What can I try?

    Read the article

  • Unhandled exceptions in BackgroundWorker

    - by edg
    My WinForms app uses a number of BackgroundWorker objects to retrieve information from a database. I'm using BackgroundWorker because it allows the UI to remain unblocked during long-running database queries and it simplifies the threading model for me. I'm getting occasional DatabaseExceptions in some of these background threads, and I have witnessed at least one of these exceptions in a worker thread while debugging. I'm fairly confident these exceptions are timeouts which I suppose its reasonable to expect from time to time. My question is about what happens when an unhandled exception occurs in one of these background worker threads. I don't think I can catch an exception in another thread, but can I expect my WorkerCompleted method to be executed? Is there any property or method of the BackgroundWorker I can interrogate for exceptions?

    Read the article

  • java.io.FileNotFoundException for valid URL

    - by Alexei
    Hello. I use library rome.dev.java.net to fetch RSS. Code is URL feedUrl = new URL("http://planet.rubyonrails.ru/xml/rss"); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(feedUrl)); You can check that http://planet.rubyonrails.ru/xml/rss is valid URL and the page is shown in browser. But I get exception from my application java.io.FileNotFoundException: http://planet.rubyonrails.ru/xml/rss at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1311) at com.sun.syndication.io.XmlReader.<init>(XmlReader.java:237) at com.sun.syndication.io.XmlReader.<init>(XmlReader.java:213) at rssdaemonapp.ValidatorThread.run(ValidatorThread.java:32) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) I don't use any proxy. I get this exception on my PC and on the production server and only for this URL, other URLs are working.

    Read the article

  • What is the "official" place for community support for the Mere Mortals .NET framework?

    - by Ryan Hayes
    My team is using the Mere Mortals .NET framework from Oak Leaf. Being used to working with primarily open source software, I found it excruciatingly painful to find ANY community support for MM.NET. When I asked if there was any, the only place I was given to look for support was Universal Thread, which is a site which requires a membership for search and archived questions. It seems like a third party, pay-for site should not be the primary source of support for anything like this, especially MM.NET which costs $700 per developer. It doesn' to me like an entire community around MM.NET would choose to all pay on top of the license just to use a forum. If not Universal Thread, then what is the "official" place to find support for the Mere Mortals .NET framework?

    Read the article

  • SerialPort not taking input. It throws it back at me!

    - by Mashew
    When I try to write an AT command to my GSM modem, it does not seem to take the command. I have used PuTTY to check that the command words, it does. I have checked to see if the port is opening, it does. What could I possibly be doing wrong? NOTE: The "lol" part is for debugging purposes. ;3 SerialPort sp = new SerialPort("COM3"); sp.BaudRate = 9600; sp.DataBits = 8; sp.StopBits = StopBits.One; sp.Parity = Parity.None; sp.Open(); if (sp.IsOpen == false) { sp.Open(); } Thread.Sleep(1000); sp.WriteLine("AT+CMGF=1"); Thread.Sleep(1000); string lol = sp.ReadExisting(); sp.Close(); return lol;

    Read the article

  • g++ and c++0x specification support

    - by SepiDev
    although it's been said that the support for c++0x new features in g++ are in experimental mode, many gcc developer claimed that you can use most of the new features in your codes and get the program to work. but when I try to compile this simple program it results in segmentation fault. Why? #include <thread> #include <iostream> void my_thread_func() { std::cout<<"hello"<<std::endl; } int main() { std::thread t(my_thread_func); t.join(); } g++ -std=c++0x -Wall -o run main.cc

    Read the article

  • Can't resolve CalledFromWrongThreadException with Handler

    - by michel
    I will try to keep it simple: In my main activity I make a handler: public class ARViewer extends ARDisplayActivity { public final MHandler mHandler = new MHandler(this); public void onCreate(Bundle savedInstanceState) { ... The class MHandler: public final class MHandler extends Handler{ //main activity private ARViewer arnv; public MHandler(ARViewer arnv){ this.arnv = arnv; } @Override public void handleMessage(Message msg) { ... case H_RR : arnv.setContentView(R.layout.routeplanner); break; ... super.handleMessage(msg); } } But if I call the handleMessage method from a callback function in a other Class, definitely from a other thread, I still get the exception message: CalledFromWrongThreadException (Only the original thread that created a view hierarchy can touch its views) : public void rFound(Route route) { Message msg = new Message(); msg.what = MHandler.H_RR; ARViewer.arnv.mHandler.handleMessage(msg); }

    Read the article

< Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >