background-process

Import python modules in the background in REPL

。_饼干妹妹 提交于 2019-12-06 00:06:31
Some python modules, notably matplotlib , take a long time to load start = datetime.datetime.now(); import numpy, pandas, matplotlib, sklearn; datetime.datetime.now() - start takes half a second with cached files, and several seconds for non-cached files . Is there a way to load these modules in the background, when in the Python interpreter? You can import modules in separate threads. Here is the solution. Create a file load_modules.py : from concurrent.futures import ThreadPoolExecutor import importlib import sys modules_to_load = ['numpy', 'pandas', 'matplotlib'] def do_import(module_name):

iOS Detect Bluetooth connection/disconnection

帅比萌擦擦* 提交于 2019-12-05 21:35:37
问题 Is it possible to be notified when a Bluetooth Device is connected or disconnected from iOS even when my app is in background ? On Android, I use the ACTION_ACL_CONNECTED and ACTION_ACL_DISCONNECTED events. But I cannot find equivalents for iOS. I found the CBCentralManager that can be used to monitor Bluetooth events, but my functions aren't called when a bluetooth device is connected/disconnected, only when I enable/disable the bluetooth. Is it an error on my side or is it normal ? I also

How do I force an app to always start from scratch when it returns from the background?

人走茶凉 提交于 2019-12-05 18:31:28
I'm working on an app that needs to run through a protocol from beginning to end. How do I force the app to always start at the beginning when brought back from the background, regardless of where it was left. Thanks If your goal is to restart the app from scratch at every start up, simply add/change the key UIApplicationExitsOnSuspend to YES in your info.plist file Here's the relevant link in the documentation http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html One option is to use exit() . However, that method is only

How can I act on Core Data iCloud sync notification when the app is in the background?

有些话、适合烂在心里 提交于 2019-12-05 13:01:28
I have an iOS app that uses Core Data with iCloud sync. The app is working perfectly and syncing across multiple devices. As part of my implementation my app is registered for the: NSPersistentStoreCoordinatorStoresDidChangeNotification This notification works perfectly with the app in the foreground, but what I would like to do is fire a local notification to let the user know that the iCloud data in the app has changed, whenever the app is in the background and a sync notification comes in. I was under the impression that iCloud Core Data syncing continued in the background, but I am having

CloudKit Push Notification, App running on background

夙愿已清 提交于 2019-12-05 12:45:16
When iOS8.2-app is running in the background, it does not receive any push notification, while if it is running on the foreground, it receives the push notifications fine. Any idea what is going on ? Running on CloudKit Development mode, the subscription is for add,edit,and remove, and using the following didReceiveRemoteNotification : -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { NSLog(@"Push received."); NSDictionary * apsDict = [userInfo objectForKey:@"aps"];

Background sync in iOS7

北战南征 提交于 2019-12-05 10:24:56
We have to develop an app which will support data sync operations at some time interval, whether the app is in foreground or in background. I want to know that in iOS7… is it possible to sync data (i.e. call web services) while the app is in background? can we access SQLite data base file/can we do DB operations while the app is in background? can we run timers in background? can we show alerts about some updates while the app is in background? Thanks in advance. Yes, it is. Yes, you can. Sometimes, but you shouldn't. Yes, you can. Go and research iOS 7 background operations. Talk of using

How to make JavaScript run at normal speed in Chrome even when tab is not active?

做~自己de王妃 提交于 2019-12-05 09:12:45
I've noticed a problem with my webapp - when Chrome active tab isn't set to my app, Chrome stops running my JS code until I open tab again. I guess it does to save CPU cycles. Else if you've 20 tabs open and each has code running, it will get slow quickly. This is all good, but my app requires that it keeps running in the background. It updates graphs in real time and analyses data every few seconds. If I move to another tab, graph updating and analysis stops (or becomes very slow - 1 second is now like 20 seconds). Then when I focus on tab again it resumes updating at normal speed but the

Geofence iOS8 : Require Background Mode for iOS Geofencing [closed]

和自甴很熟 提交于 2019-12-05 09:07:37
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I have used geofencing in my app. Geofence feature discription: App has two type of functionality while entering or exiting from the region: Reset fence: If user will enter in the region and that region has the functionality of reset fence then app will call one web-service and get the new fence list. This functionality is also should work in background mode. App Open: If user will enter in the region and that

Download several files in background (iOS 7 only)

橙三吉。 提交于 2019-12-05 06:16:37
问题 I'm currently developing a podcast application which will run only on iOS 7, and it has a feature that allows to synchronize and download recent episodes in background mode. So it's clear with Synchronization, I implemented the application:performFetchWithCompletionHandler method and call the sync method in it, and when the sync is done I call completionHandler with UIBackgroundFetchResultNewData , or if it fails I call UIBackgroundFetchResultFailed . But when I run the download manager to

Lock Screen iPod Controls Not Working With Spotify Music Player

大兔子大兔子 提交于 2019-12-05 06:04:18
I added the Spotify player to my app which also plays music using the MPMusicPlayerController. When music is playing from Spotify and the screen is locked, the remote control events are not received for play/pause and FFW/RWD when the user presses these buttons on the locked screen. If music is playing from the MPMusicPlayerController, I am able to receive the remote control events based on the following code: -(void) ViewDidLoad { ... [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; ... } and - (BOOL) canBecomeFirstResponder { return YES; } -