How do I set up how often control tasks are shown to a toloker? - toloka

When I set up a page with the tasks, I want to make sure that a performer completes at least 1 control task per page so that I can check his quality in real time. How can I do that?

When you upload your file with Smart Mixing, you can indicate the number of control tasks per page.

Related

Restrict user to use only network provided time

I made an attendance app in Flutter in which I want to restrict employees to use only network provided time so that employees won't be able to temper the date and time.
Is there any option or solution to implement this in android and iOS as well?
Using this package datetime_settings we will get the settings of Automatic date & time of mobile so when automatic date & time is on mobile will give us an accurate network time otherwise we will show an error to turn on the automatic date & time in settings. That's how I used to restrict users to use only network-provided time.
I'll tell you what worked for me. Hope this can help you. I don't know if it's the most optimized way to do it, but it worked very well for me:
You need to create an internal clock for your app, and from this, use it instead of the DateTime.now() function. For this, you must take the server time when opening the app, and keep it updated with a timer that runs every 1 second.
Please note that the app goes to sleep (or closes) when the device is locked or the app is minimized for a certain amount of time (this depends on the operating system and battery saver settings), thereby stopping the internal clock, and consequently, it is delayed when the app is activated again. In my case, I got around this problem by using a foreground service that I designated to perform this task (I used flutter_foreground_task). Another advantage of using a foreground service, is that the user can close the app and the clock keeps running (and in my case, I also perform other simple tasks periodically).
If the user does not manipulate the system time, the difference should never reach 1 second.
Optionally, you could check when retrieving the server time, the difference with the device time, and if it is greater than a certain gap that you determine, warn the user, so that he can correct it if he prefers, so that he does not see a discrepancy with the time recorded and displayed by the application.
Regards.

Perform an action when application is started with 0 documents

I have an NSDocument application that restores its windows when it is reopened. I would like to check the number of windows and perform an action (show a welcome window) if there are none.
I tried to check NSDocumentController.shared().documents.count but it seems I check it at the wrong time because it is always 0 in the delegate lifecycle functions.
How can I perform an action when the application is launched without restoring any windows?
Here's what I do in my app: I just dispatch_after say, 0.5 seconds and then check the number of documents. That allows me enough time to restore at least one document if there are any to restore. This does result in a noticeable delay, of course, but I feel that it's short enough that most users won't realize it (especially if your app is able to load up quickly enough).

Better Handling of getting data from server in iPhone

I need to improve my coding.so i am finding something better.
My problem is i need to fetch the data from server from 10 different url.that url have images 100.
for example i need to hit
http://192.168.11.222/images/a
http://192.168.11.222/images/b
http://192.168.11.222/images/c
http://192.168.11.222/images/d
http://192.168.11.222/images/e
http://192.168.11.222/images/f
http://192.168.11.222/images/g
http://192.168.11.222/images/h
http://192.168.11.222/images/i
so a b c d e are folder on server that contain images.
Currently i am doing this through NSURLConnectionWithTag and then parse the response.and get saved.is there any another better way to handle this? i also need to show progress bar which is also difficult in this case.
I would setup an NSOperationQueue ,with a single operation per URL and set it to, say, three concurrent operations. Then use NSURLConnection's non-asynchronous API to do the download.
For your progress bar, it's probably good enough to update the progress after each individual file is finished, and do two of them at a time (or something). Chances are latency will be more than half the "progress" anyway, so unless you start trying to predict your ping times, a progress bar based on the actual bytes transferred will not be accurate enough to bother (unless these are very big images).
You will need to learn how operation queues and GCD work, but once you've got that sorted it really won't be much code at all, and it will be rock solid.
Basically you want to add a "block" of code to the operation queue for each URL to download, and the queue will figure out how to download each one, and then when each individual block of code is finished it executes another block on the main thread (dispatch_sync(dispatch_get_main_queue(), ^{ ... })) to update the progress bar.
If you are going to write network related code in your app, I recommend take a look at AFNetworking, it's a wrap of network API iOS already provided with much less hassle.

How to execute a function in background at specific intervals in iOS

I would like for my iOS app when it is in background mode to execute at specific intervals some functions
(What I precisely want to do is to check a URL, and indicate its (int) content as a badge.)
However, I don't know how to have the function executed in the background.
Thanks.
Read about Executing Code in the Background. There is a limited set of things you can do in the background, what you describe not among them unfortunately.
I think you have two options to solve this problem each of them has pros and cons.
First, one is background refresh check the link. Have in mind that it is different for ios 13 and above. You need to define background tasks check here. It takes me some time to understand the background tasks but it seems more logical and easy to manage if you have several tasks. Still, you don't have the full control of when this task will be executed. It depends on how much battery, network and so on your task will use every time. The system will choose what is the best time to run it.
There is one more option, to implement a silent push notification check here.
Here you can implement a good push mechanism for updates but you will depend on network and permission for notifications. Also, you will need a backend for this solution.
You need to define what works best for you.
I think the best option is to use the voip background mode. Here you can find all the required information: how to run background process on the iOS using private APIs to sync email items without jailbreaking the phone
https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app
To update the content frequently when the app is in the background might be difficult, Instead, you can wake the app by pushing a silent notification from backend at regular intervals.
For more information check this article also
https://medium.com/#m.imadali10/ios-silent-push-notifications-84009d57794c

Saving painting app data to cope with interruptions on iPhone?

I'm making an iPhone bitmap painting app. I want to support about five 1024x768 layers (~15Mb of data). My problem is that I do not know what strategy to use for saving the user's document to cope with my app being interrupted.
My document file format at the moment is to save each layer as a .png file and then save a short text file that contains the layer metadata. My problem is that, if the app is interrupted by something like a phone call, I'm unlikely going to have enough time for my app to be able to save all the data to disk as saving all the .png files can take ~10 seconds. What options do I have?
I've considered adding an autosave feature that would be called every five minutes. In the worst case, the user will lose a few minutes of work if the app fails to save on interruption (which isn't ideal).
An idea I've considered is to keep track of which layers have changed since the last autosave and only update the layer files that need to be updated. This means that, when interrupted, my app might only need to save one layer in the typical case. However, the worse case is still having to save several layers.
I'm not sure what to do. On a practical note, I've noticed many popular iPhone painting apps with good reviews will lose the current document progress if interrupted with a phone call. I'm beginning to doubt there is a way to solve this particular problem and that I might just have to go with something less than ideal.
The IOS4 SDK provides support for long-running background tasks, which would be the perfect place to save your layers. From the documentation:
You can use task completion to ensure that important but potentially long-running operations do not end abruptly when the user leaves the application. For example, you might use this technique to save user data to disk or finish downloading an important file from a network server.
Any time before it is suspended, an application can call the beginBackgroundTaskWithExpirationHandler: method to ask the system for extra time to complete some long-running task in the background. If the request is granted, and if the application goes into the background while the task is in progress, the system lets the application run for an additional amount of time instead of suspending it. (The backgroundTimeRemaining property of the UIApplication object contains the amount of time the application has to run.)
I'm not sure if this is feasible (you don't state how the user interacts with the layers, or indeed if this interaction is transparent from their perspective), but as a suggestion why not simply save the "active" layer out (via a background thread) when the user switches layers, as you'd then only need to save a single layer when your app is backgrounded.