Why closing stream when it don not use is best practise
How much effect on app's performance
Any other information also accepted Thankyou
I think this might help.
If you dont, those Memory resources get permanently blocked.
Related
Google best practices says that gpt.js must be in async mode https://developers.google.com/publisher-ads-audits/reference/audits/async-ad-tags
But async mode stop the render tree once is downloaded, and i think that if we can set up placeholders, it can be much better to use with defer.
Anybody can help me with this doubt?
Many thanks
I like t know if is better to use this
than this
to avoid blocking time in the render tree.
I'm trying to find a way to post data, while checking for internet connectivity. My problem is, if I have 50 photos to send to my server, say it takes 15secondes, how do I handle the case where I have a bad connection, or where I loose my connection in the middle of the process ? How do I wait until connectivity is back ? How do i try again in 10seconds ? And should I send the data all over again, or is it possible to keep where it stopped (when the connection was lost) ?
I already know of the connectivity plugin, i'm just trying to figure out if I should use a StreamBuilder, rxdart with a listener, etc... Is there a proper way to deal with it, or am I supposed to come up with my own solution ?
If you know of any articles or videos talking about this, thank you for letting me know ! I'm having a hard time finding these.
Ps : i'm not using Firebase, Firestore, etc...
Thanks !
Instead of posting all photos at once, break them down one-by-one. You can put them into a queue of Future or using [StreamQueue][1].
In queue object model, you can add an extra field to determine whether it succeeds or fails. If the result of posting a specific photo is failure, put it into queue again.
My app is calling a web service to retrieve some data, and I want to make the experience as best as possible. I figured out that using NSURLConnection it's very hard to give good timely feedback.
Sometimes my iPhone tries to load the data for a minute or two and I see no way of figuring out what is taking so long, or why the download is so troublesome. Then after a few minutes I sometimes end up with an error code.
I'd like to display exactly what is happening. Messages like:
"Establishing internet connection"
"Trying to connect to server"
"Connected..."
"Downloading data..."
"Download complete!"
And when there is trouble like server not reachable or DNS could not be resolved, it would be nice to just try again a few times and not simply quit and throw error.
Are there replacements for NSURLConnection which handle these things more gracefully and give better in-time feedback about what is happening?
I've been a big fan of the AFNetworking library. Very easy to use and wraps all your networking calls in blocks that are very easy to work with.
It is also is kept very current, so you should be safe in getting all the updates it needs as your project progresses and ages.
I think you should be misusing NSURLConnection and NSURLConnectionDelegate, since you can do most of you needs with them.
But, what about MKNetworkKit? I've been using it and it really makes those kind of issues easier to deal with.
Something that can help you achieve what you want. Since ASIHTTPRequest is no longer being supported MKNetworkKit would be your best choice. To check for connectivity, you can always use Reachability.
I have read about the CoreTelephony class and in this CTClass can check caller and find state of call....
But when and how to use this......
I think my application goes to background when call start..
help please or correct me......
It is not possible with the official SDK. The best that you can do is determine if the user is on a call. You can do this by inspecting the size of the status bar frame.
[UIApplication sharedApplication].statusBarFrame
If your asking if you can track phone calls in the background, you can't in all situations.
If you want to know if, at any point in time, when your running, you can. You can access the 'CTCallCenter' currentCalls property and it will give you the state of the call at that point in time.
If you want to track if a incomming call the cause of your application going to the background, you can use the 'CTCallCenter' callEventHandler property.
Not quite sure what you're trying to accomplish but after the call ends the user should automatically be brought back to the app.
It's not possible to get this information with the current SDK, most likely for privacy reasons. I'd recommend filing a feature request with Apple (http://radar.apple.com) however, I doubt it's something they're likely to include in the future.
Suppose two asynchronous operations try to read or write in the same file on a given folder. How does iOS deals with that? Is the operations queued? The app crashes? the file get corrupted?
In case it is up to the programmer to deal with this, where do I find informations or an example on how to deal with race conditions, queues, etc.?
Can you guys give me a hint?
thanks.
I think that when trying to acquire the file descriptor for your file, it should fail if it is already in use.
As there is apparently no way to know if the file is already opened, there might be a way to lock a file.
Links that may help you:
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LowLevelFileMgmt/Introduction.html
http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSFileHandle_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/Performance/Conceptual/FileSystem/FileSystem.html
http://developer.apple.com/library/ios/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/Glossary/Glossary.html
http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFFileDescriptorRef/Reference/reference.html
The most likely answer is "the file gets corrupted". The OS will not do anything to prevent multiple threads from writing to a file simultaneously, and if they're writing to overlapping sections of the file, all bets are off.
So, your best bet is to enforce your own queueing on access to the file. There are lots of ways to to that. At a low level, you can use an NSLock to prevent simultaneous access, or you might want to use a Dispatch Queue. The Concurrency Programming Guide mentioned by Julio's answer is a good reference.