I'm using lwuit Container list with Cell Renderer to display an image grid. For network availability purposes, I want to display a default image and change it to the fetched image after download completes. I'm also having problems detecting the completed download. I'm using a thread queue to minimize amount of threads running. How can i notify a method that updates the model when download is complete? How best can I update the list with the new model? Thanks in advance.
Apparently you can change the list model on the fly. That way you can fetch the images with a thread queue and the update the model when the image fetching is complete
Related
In Nextjs when i save huge size data in the state, for example 50mb the state update speed is very low, and reducing the site permormance. Is there any solution to fix it i'm searching for 2 days. Thanks in advance.
Please create a thumbnail for the video and image for eg 300x300 and display it. It will not have lag time. Once you have to send to server send the blob of original acquired state.
Hope it helpss!!
Saving this amount of data in a single state might not be a good practice.
I suggest:
1- Spread the global state (can also be referred to as any parent state) into multiple local states (component states).
2- Only save the necessary data in the state (if you are using a state management library such as redux only save the really shared state which most likely will be some UI state), There are multiple types of states consider checking the following article for more details.
3- Use a data-fetching library such as React-Query you can benefit from the caching behavior that can play a similar role to a shared state.
I have a flutter app using the geolocator plugin to retrieve coordinate data while the user types in the address. I can see some lag on the screen as I type on my phone, in my console I see an error that it skipped an x amount of frames, and it is doing too much work on it's main thread. I plan to switch to using an API from Google instead. I also get this error while I upload images to Firebase (I didn't restrict size yet), I've seen the error pop up randomly but mostly for these two cases. What is the proper way to run operations on another thread in flutter? Unless I should be doing something else.
You should create a new Isolate Loop corresponding to a new thread.
I suggest you read this article from Didier Boelens blog which is very clear about all this concepts.
We have developed Swing-JavaFx Integrated application for multimedia content like Image & Animations. Base Container for application is Swing JFrame. Inside, for Image we are using JFXPanel. But after continuous run of say ~12hrs and log analysis, we have observed that Task submitted to Platform.runlater is never getting executed.
PS: Platform.setImplicitExit(false) is done.
Duration of occurence is not fixed, but usually after 6hrs.
Implementation is changing images repeatedly after a defined duration.
I'm implementing multithreaded core data downloader.
I have a problem with doubling objects while saving objects with unique string attribute in Entity.
If 2 threads are downloading from the same url simultaneously (f.e., updater-timer fires and application enters foreground - so user calls update method), I cant check existanse of object with unique attribute value in persistant store, so objects are doubling.
How can I avoid doubling objects and what is the best solution in terms of performance?
description: (sorry, I cant post images yet)
http://i.stack.imgur.com/yMBgQ.png
Another approach would be to perform the download/save within an NSOperation, and prior to adding an operation to the queue, you could check to see if there was an existing operation to download that URL in the NSOperationQueue.
The advantage of this approach is that you don't download any more data than is necessary.
I've run into this before and it's a tricky problem.
I solved it by performing by downloads in separate background threads (the same as you are doing now) but all code data write operations happen on a global NSOperation queue with numConcurrentOperations set to 1. When each background download was complete it created an NSOperation and put it onto that queue.
Good: Very simple thread safety - the NSOperationQueue ensured that only one thread was writing to CoreData at any one point.
Bad: Slight hit in terms of performance because the Core Data operations were working in series, not in parallel. This can be mitigated by doing any calculations needed on the data in the download background thread and doing as little as possible in the Core Data operation.
I have a method that gets called when entering a chart page in my WP7 app. It generates a List of objects and populates a ListBox. The content of each ListBoxItem is a Grid with 10 columns of data. The List gets generated incredibly quickly, even with 1000-2000 items. But as soon as the method starts building Grids and adding them to the ListBox it gets relatively much slower. Now, by this I mean it only ties up the the device for half as long as a comparable app on my 2nd gen. iPod Touch. So performance is great - as long as the user wants the data chart.
If the user hits the Start button the app exits so that's not a problem. My concern is when the user backs out to the previous page. The app just waits until the method has run. I notice similar behavior in more mainstream apps like the Kindle app. But I don't have that kind of clout with MarketPlace store! I do have a progress bar that keeps running so the behavior is the same.
Out of concern for being rejected by MarketPlace I tried putting the method into a BackgroundWorker process but that fails because it's in creating the UI elements that is where the bottleneck is and that is running on the UI thread so I get access errors. Is there a way to take a method that creates UI elements, such as a Grid, and make it cancelable?
Are you creating the UI elements within each ListBoxItem manually in code? If so, you will find increased performance by using databinding instead because the ListBox uses the VirtualizingStackPanel as the items container, so it will only actually create UI elements for enough elements to be seen and to scroll to immediately. Other elements are created when the user starts to scroll. The Silverlight for Windows Phone Performance Team have a great post on ListBox Performance.
If the dataset is particularly large you may find further peerformance improvements by using data virtualization as well (or instead) as Peter Torr explains in his Virtualizing Data in Windows Phone 7 post.
You should use the BackgroundWorker. When you need to update the UI use the following code...
Dispatcher.BeginInvoke(() =>
{
textBlock.Text = "some text";
etc
etc
}