Multiple background downloads in ios7 using NSURLSessionConfigurations - ios7

I want to know about how to download a bunch of files one after the other. It is like if I have 5 files to download, I should automatically download all the 5 files in a sequence 1 complete then 2 , 2 then 3 this way all five should be completed automatically.
Its should all done in the background of my app . Thanks in advance

You should use NSURLSession. You can create a background session which will even continue to work after your app goes to the background and/or is terminated.
You ask the associated NSURLSessionTasks to download all the files, and the framework will take care of downloading as many of the files concurrently as makes sense (given the bandwidth etc.).
You'll be able to get download status if you need, and will get notified to completion of the downloads, even if your app wasn't running anymore. There's a lot to love about NSURLSession. You should consider it for all long running download/upload tasks.

I think you'll have to chain then manually. In other words keep your own queue of tasks. When one finishes remove it from the queue and start the next one.

Related

Creating an updater; replacing files that are in use?

I am trying to create an updater for a screenshot application I have.
I've done the main part of downloading the update, but I now need to find a way to rename the new file the same as the existing one -
e.g. "NewFile.exe" > "ScreenshotApp.exe".
Also, I don't want to add another .exe solely for updating, just for the purpose of keeping it light and portable.
Is there any way of renaming a file that's in use?
Perhaps telling Windows to rename it AS SOON AS the application has closed itself?
Option 1:
Have launcher which most likely you want update that will handle updating your application as well as launching.
Option 2:
Have external exe monitoring updates and updating your app.
Option 3:
Cretate batch file that will update your app whenever your done using it.
Option 3 is the one you are looking for but it is the worst. If anything goes wrong the app wont work and if user can live without it, they wont reinstall.
Option 2 is mostly used by bigger players. They either work all the time or are scheduled.
I would do option 3, it is much easier than you think, and if you want single exe, just make your app a dll, you can update it whenever you want but launcher will stay the same. That way you can handle any errors, and fix them if there is need for it.
Option 4 would be to run installer with fresh update that will close app install update. That solution is better to buy. For $250 you can get neat stuff where it would take you a lot man hours to o something even remotely close.

iOS app "Processing" in iTunes Connect

I uploaded my first iOS app today to iTunes Connect.
I uploaded it over xCode 7.2.1 and I see the app as "Processing" inside the "activity"-tab.
But under "AppStore"-tab for version 1.0 there is no app build visible. I only see the message that I should upload a build with xCode or Application Loader.
Is this normal or should I wait some time that the app is also showing up?
See the screenshots below:
Yes, this is perfectly normal. You just have to wait for it to finish processing (can take a few minutes or a few hours depending on Apple's traffic). Once it is done processing, it will appear in that builds section and you can select it as the version you want to submit. This is the same for TestFlight.
I recommend getting watchbuild and running it on your terminal so you can just get a notification on your computer when your build is done processing instead of having to keep checking App Store Connect.
It happened to me a couple of times. I just uploaded a new version (same code, just increased the version) and it was processed quite fast.
Just in case, the second time I kept the archiving dialog in the foreground.
This is normal. After uploading a build, iTunes Connect performs some processing to prepare it for TestFlight Distribution and App Store distribution.
The status of the build should go to ready after some time. Sometimes, this happens as fast as 15 minutes after uploading but can sometimes take 1 hour or longer. After the processing finishes, the build will become available to select for TestFlight betas and app submission.
Yes, this is perfectly normal. You just have to wait for it to finish processing (Can take a few minutes or a few hours depending on Apples traffic). Once it is done processing, it will appear in that builds section and you can select it as the version you want to submit. This is the same for testflight.
Additional from my personal experience (happened to me once and only once), if you submit the archive late at night on the last weekday or just before a public holiday, "sometimes" it might be processed on the next working day on the morning.
I'm at Indonesia (GMT +7), it is not uncommon for me to upload an archive around 7PM, and if it doesn't get processed in 15 minute, I usually just go home, and check it in the morning the next day. Because it happens a few time that if I upload too late, it get processed around 8AM the next morning.
I had this issue today, i tried all of the fixes suggested and found that you need to wait till the invitations are sent out. I think the servers were just very busy when i was trying to test my app.
It happened to me when I export Unity iOS build and upload it to AppStore there are more than 3 days waiting but still showing processing.
Finally, Many search things I found that Bitcode = NO here is the issue on my build I have Bitcode = YES once you change and set to NO and upload again your build it's not showing processing and it's working properly.

How to close/stop a .NET application and re-execute it?

My application updates(running a vba script) an excel shared workbook, and since it is shared, there shouldn't be problems when someone else is using the same file at the same time. But for some reason, sometimes it simply freezes, without any error message, just freezes.
Is there a way to programatically make the application stops/closes automatically when frozen or after some minutes(In normal conditions, this updating process shouldn't take more than 1 minute)?
And, if possible, re-launch the app again automatically after some minutes for at least 5 attempts?
This way would ensure process completes succesfully.
I have had to do this same thing before but because I had an application that would look for updates to it's self on the network and then update it locally. Problem is, you cannot update the exe that is running.
What I did to get around it is to create another program that would wait a second, update the exe, then run the exe again.
Because I did this with a few different apps, I made my "Updater" generic so I could send some command line parameters and it would use those to copy and run.
If you want to try something else, you might be able to accomplish this same thing by creating a BAT file and running it. I'm not real good on BAT files so I can't help you there. But, it is another way to handle it.

How to reliably handle files uploaded periodically by an external agent?

It's a very common scenario: some process wants to drop a file on a server every 30 minutes or so. Simple, right? Well, I can think of a bunch of ways this could go wrong.
For instance, processing a file may take more or less than 30 minutes, so it's possible for a new file to arrive before I'm done with the previous one. I don't want the source system to overwrite a file that I'm still processing.
On the other hand, the files are large, so it takes a few minutes to finish uploading them. I don't want to start processing a partial file. The files are just tranferred with FTP or sftp (my preference), so OS-level locking isn't an option.
Finally, I do need to keep the files around for a while, in case I need to manually inspect one of them (for debugging) or reprocess one.
I've seen a lot of ad-hoc approaches to shuffling upload files around, swapping filenames, using datestamps, touching "indicator" files to assist in synchronization, and so on. What I haven't seen yet is a comprehensive "algorithm" for processing files that addresses concurrency, consistency, and completeness.
So, I'd like to tap into the wisdom of crowds here. Has anyone seen a really bulletproof way to juggle batch data files so they're never processed too early, never overwritten before done, and safely kept after processing?
The key is to do the initial juggling at the sending end. All the sender needs to do is:
Store the file with a unique filename.
As soon as the file has been sent, move it to a subdirectory called e.g. completed.
Assuming there is only a single receiver process, all the receiver needs to do is:
Periodically scan the completed directory for any files.
As soon as a file appears in completed, move it to a subdirectory called e.g. processed, and start working on it from there.
Optionally delete it when finished.
On any sane filesystem, file moves are atomic provided they occur within the same filesystem/volume. So there are no race conditions.
Multiple Receivers
If processing could take longer than the period between files being delivered, you'll build up a backlog unless you have multiple receiver processes. So, how to handle the multiple-receiver case?
Simple: Each receiver process operates exactly as before. The key is that we attempt to move a file to processed before working on it: that, and the fact the same-filesystem file moves are atomic, means that even if multiple receivers see the same file in completed and try to move it, only one will succeed. All you need to do is make sure you check the return value of rename(), or whatever OS call you use to perform the move, and only proceed with processing if it succeeded. If the move failed, some other receiver got there first, so just go back and scan the completed directory again.
If the OS supports it, use file system hooks to intercept open and close file operations. Something like Dazuko. Other operating systems may let you know about file operations in anoter way, for example Novell Open Enterprise Server lets you define epochs, and read list of files modified during an epoch.
Just realized that in Linux, you can use inotify subsystem, or the utilities from inotify-tools package
File transfers is one of the classics of system integration. I'd recommend you to get the Enterprise Integration Patterns book to build your own answer to these questions -- to some extent, the answer depends on the technologies and platforms you are using for endpoint implementation and for file transfer. It's a quite comprehensive collection of workable patterns, and fairly well written.

App launch sequencer

Every morning when I get into work I launch about a dozen apps and whatnot (FF, TB, VSx2-3, Eclipse, SSH, SVN update x2-3). Needles to say this does a good job of warming up my HDD for the day. I rather suspect that it would run a lot faster if they were launched sequentially (not to mention that I wouldn't need to click in 17 different places).
Is there a preexisting product that can kick off a sequence of tasks/apps/etc. where each task is only started after the last app is done hammering the HDD?
It would nerd to be able to kick apps like VS and firefox and also be able to trigger explorer context menu items like SVN update in TortoiseSVN.
Try SlickRun, it's free, I've used it for years, I use it constantly and I'd be lost without it.
Think of it like a configurable Start->Run command, it'll do what you want (you can configure n second pauses between multiple commands), and if you install it you'll use it for a thousand different things before the first week is out.
P.S. I have no stake in SlickRun, I just like it :)
Unfortunately, I don't know of any software that can do this for you automatically.
However, can't you trigger the updates through a console SVN task? If so, can't this be done by creating a batch file? It's low tech, and you might want to add a few pauses between each task, but it should do what you want.
As you mention TortoiseSVN, I'll assume your O/S is windows.
You could launch an Autohotkey script at startup. I don't think it can easily detect HDD activity, but you can at least wait until each window appears with the WinWaitActive command.
If each application has an average time they take to complete, you could simply use Windows' Scheduled Tasks application. Obviously you'll need to be running Windows but Scheduled Tasks can be found in the Control Panel.
Execute "Add Schedules Task", select the program, the frequency and then the specific time.