FAQ Database Discussion Community


Background task spontaneous completion с#

c#,windows-runtime,windows-phone-8.1,background-process,background-task
Register a background task: string myTaskName = "Task"; foreach (var cur in BackgroundTaskRegistration.AllTasks) if (cur.Value.Name == myTaskName) { return; } await BackgroundExecutionManager.RequestAccessAsync(); BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder { Name = "Task", TaskEntryPoint = "Background.Task" }; taskBuilder.SetTrigger(new TimeTrigger(15, true)); BackgroundTaskRegistration myFirstTask = taskBuilder.Register(); Background task is created in the Windows Runtime...

Celery object editing best-practices

python,celery,background-process
I have a celery task that performs an operation on an objects attributes and saves it. Let's say we're computing a persons bmi. We take a persons height and weight and calculate the bmi, then save it on person.bmi. In Rails's DelayedJob you would just make an instance method: Class...

Efficient way of organizaing mail sending from Rails app

ruby-on-rails-4,deployment,background-process,mailer
I have an Rails 4 application with ruby 2.1.2 that runs on a VPS with 512 mb of RAM and want to know what are the ways of efficiently managing email notification with background job with the least possible additional background processes ( like Redis and Sidekiq, each of them...

Lightswitch task on a background thread

multithreading,background-process,visual-studio-lightswitch
I have a lightswitch app which sends an email when a new job is added. I added a sendemail helper class which is called when the record is inserted. This works however the interface hangs on save waiting for the email to be sent. I would like to perform this...

Background task behavior affected by debugger?

c#,windows-phone-8.1,background-process
I have a Windows Phone 8.1 Runtime app which has a background task triggered by a DeviceUseTrigger. In the runtime policy checks for this trigger type mentioned on MSDN, it says that the task will be terminated automatically by the OS if an I/O operation from the relevant device isn't...

Shell Job Control: Track status of background with WNOHANG wait

shell,wait,background-process
What does GNU mean by this line (from here)? The shell must also check on the status of background jobs so that it can report terminated and stopped jobs to the user; this can be done by calling waitpid with the WNOHANG option. I don't understand why the shell should...

How to play Windows Phone 8 SpeechSynthesizer during lock screen?

c#,windows-phone-8,background-process,speech-synthesis,speechsynthesizer
I have the following code to synthesize text to speech in a Windows Phone 8 application, however I can't seem to figure out how to have it continuously play during lock screen/screen off/or in the background. Does anyone have a suggestion or snippit of code on how to do this?...

Get an accelerometer's device id(or monitor an accelerometer in the backbround) on WinRT

c#,windows-8,windows-runtime,accelerometer,background-process
I am looking into the method of monitoring accelerometer in the background. We can get the sample for Windows Phone which implements it at MSDN. According to the sample code, it requires the id of an accelerometer. However, there is no property which gets the device ID for WinRT. var...

How to debug popen() not working?

php,windows,background-process,popen
On my Linux server I use shell_exec() to run scripts asynchronously. This function is not available on Windows, which I use for development, and so I am trying to use popen() instead. I am running Windows 10 x64, WampServer 2.5 x32 (PHP 5.5.12). I have the following code in a...

Transferring Data from Central to peripheral in Background mode in iOS

ios,iphone,xcode,bluetooth-lowenergy,background-process
I am developing an application for a custom wearable communicating through BLE. I have subscribed to the UI background modes in the info.plist file for Bluetooth-central. I am transferring a firmware file of around 600 kb by dividing into chunk sizes of 200 bytes each. The process is going fine...

How to implement UIRequiresPersistentWifi to work application in the background

ios,iphone,wifi,background-process
My application needs persistent wifi connection in the background, I think the only way to do is to apply UIRequiresPersistentWifi to info.plist file. So, below is what I have added to info.plist, I added UIRequiresPersistentWifi with YES. I added Required device capabilities with wifi I created NSInputStream, NSOutputStream streams in...

HealthKit data inaccessible in background

ios,background-process,health-kit,hkhealthstore
I want to pull HealthStore data in the background using background fetch but I keep getting an error: Error Domain=com.apple.healthkit Code=6 "Protected health data is inaccessible" UserInfo=0x17026fdc0 {NSLocalizedDescription=Protected health data is inaccessible}. Apple states: Because the HealthKit store is encrypted, your app cannot read data from the store when the...

Continously run Phirehose on EC2 micro instance

php,amazon-ec2,background-process,twitter-streaming-api,phirehose
I want to run Phirehose, a php Twitter streaming API on Amazon EC2 to run continuously. I used the following code <?php // TweetStream.php require_once "OauthPhirehose.php"; require_once "../ajax/common.php"; const table_name = "tweets"; set_time_limit(0); class Consumer extends OauthPhirehose { private $cobj; // mysqli object protected $count = 0; public function __construct($a,...

Draw the contents of an array modified in the background

objective-c,background-process,osx-yosemite,drawrect
I have a background thread that runs and modifies the contents of a NSMutableArray within an object. This takes a long time to run (several hours) and I periodically want to draw the contents of an array within the drawRect of a NSView to check on progress and see the...

How to do some task in background after kill the application

ios,iphone,background-process
i am doing one application.In that one task is running in background every time.My problem is,if i kill the application then that task also stopped.But i want to run that task after application killed by user.How to do this one.

In Django, how can I run a function in background

python,django,multithreading,background-process
I want to send email through send_mail() in Django to all the users in a table when I publish my article. I want to know how can I do this job by calling another function from my article publish function which can perform this task in background or in another...

Yahoo Weather app doing the undoable - iOS

ios,background-process,uilocalnotification
6 months ago I wanted to wake my app for 30 sec from background (terminated app) to download few lines of XML and parse it, but after trying with background fetch and silent push and reading articles online I came to conclusion that what I'm trying to accomplish is not...

Move python code to background after running a part of it

python,background-process
I have a python code, which has some part that needs to be run on foreground since it tells out if the socket connection was proper or not. Now after running that part the output is written into a file. Is there a way to move the running python code...

Does nodejs create background task or child process to execute callback function

node.js,asynchronous,callback,background-process,child-process
Does NodeJS create a background task or child process to execute callback functions? How does NodeJS execute the query below? MyModel.find({}, function (err, docs) { //Do some thing }); ...

Block completion handler reference is nil after completing background fetch

ios,objective-c,objective-c-blocks,background-process
I am trying to implement a background fetch of an RSS Feed using performFetchWithCompletionHandler, but when I want to call the completion handler it's nil. Am I missing a way to retain my reference to self.completionHandler? Am I declaring self.completionHandler correctly? in app delegate: //background fetch new RSS Feeds -(void)application:(UIApplication...

iOS - background fetch and threads

ios,background-process
I have app, that uses background fetch and update location during it. It works fine with this code: -(void)backgroundDidUpdateLocations:(NSArray *)locations { UIApplication *app = [UIApplication sharedApplication]; __block UIBackgroundTaskIdentifier locationUpdateTaskID = [app beginBackgroundTaskWithExpirationHandler: ^{ dispatch_async(dispatch_get_main_queue(), ^{ if (locationUpdateTaskID != UIBackgroundTaskInvalid) { if (_backgroundFetchCompletionHandler != nil) { NSLog(@"BG location finished 1");...

What is the best way to run a long task on Heroku with Ruby On Rails?

ruby-on-rails,ruby,heroku,background-process
I am looking for the best way to run a very long task in Heroku. I use Ruby On Rails for my web application and I have a very long task that I want to run it every week on Sunday during the night. It takes around 15~20 minutes. I...

running process in background on hangs PHP page

php,python,linux,background-process
I have a PHP page that launches a python script, yet the PHP page hangs until the script finishes. Is there a way to run the script that will not make it hang? PHP code The problem occurs in case alarm_on. All other cases work fine. <?php session_start(); if(isset($_COOKIE['userME'])) echo...

Android activity in background?

android,android-activity,background-process
I'm developing an application that starts from an activity A (main) and passes through login to an activity B, then C, and so on... Now, the need arose, at login, to start a certain algorithm that spins in a loop for the whole duration of the application. Is it possible...

Not receiving Push Notification in Sleep Mode

ios,apple-push-notifications,background-process,sleep-mode
Want: I want to be able to trigger a http request on receipt of a push notification(Silent) while the application is in the background(Includes while the phone is in sleep mode). Assumption: Push Notifications wake up application that is running in the background(Even while in sleep) https://discussions.apple.com/thread/3650066 : Offers a...

Background performFetchWithCompletionHandler using Blocks causes crash

ios,objective-c,objective-c-blocks,background-process
I have an app that successfully fetches and displays RSS Feeds that I'd like to add background fetch. I receive: Thread 1 EXC_BAD_ACCESS (code=1, Address=0x10) where indicated below. In app delegate: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //setup background fetch [application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum]; return YES; } //background fetch new RSS...

what is best approch to handle data when host Activity is not active

android,view,background-process
I have four activity Activity1,Activity2,Activity3,Activity4. Activity2 has some operation where we need to communicate with server that means we will send some request and according to request response will come. I click on button which will communicate with server in Activity2. Now i moved to Activity3 and Activity4. Still background...

Is this the a situation for using a service?

android,multithreading,service,background-process
I try to implement a mechanism in my progress wich checks in a defined period of time if a collection of sql statements return a specific value (e.g.: SQL: SELECT Count(Columns_A) AS Counted FROM TABLE B If the return Value is greater than 1 => write Flag into Row =>...

How trigger background process from Watch on iPhone (trigger: Watch)?

ios,swift,background-process,uilocalnotification,watchkit
I'd like to add to my Watch app functionality which send to iPhone app a Local Notification (while iPhone app is on the background or iPhone is locked). I know how to create Local Notification itself. What Im asking for is way, how to trigger background process (which contains also...

Why does git keep telling me it's “Auto packing the repository in the background for optimum performance”

git,background-process,packing
Note: I don't think this is a duplicate of this question, which is talking about a non-background pack which hangs git with a subtly different error message. In one of my git repositories, each time I invoke (for example) git fetch, git prints: Auto packing the repository in background for...

Using UIApplicationDidEnterBackgroundNotification flag

ios,swift,background-process
I call the function below using an NSTimer, and I want that when the countdown is done, a sound is triggered. I managed to do both in active mode and background using the codes below. Now I wanted to wrap them in a if statement, which depends on the app...

How do I execute a php file on the server using the screen command?

php,screen,server,background-process
I was looking at this post which is where I got the idea to use screens to execute my php scripts on the server: Running a PHP script completely on server side I was successfully able to execute a php script using: screen php ./file.php However, this did not work...

WPF 4.5: How to create child thread and continue task to UI main thread?

c#,wpf,background-process,caliburn.micro
I use WPF 4.5 and MVVM Caliburn Micro and have following WPF code: public class MainViewModel: Screen { public MainViewModel() { if (!ConnectServer()) { Console.WriteLine("Connection failed"); return; } // Following method can only be run if server connection established ProcessThis(); } } My code above has only one chance to...

How to run a .bat right after an user logs in, automatically? [closed]

windows,batch-file,windows-8,background-process
I am trying to write a script that runs automatically either after any user logs in or when a specific trigger key is pressed. Is there a way to implement this? Somewhat similar to how a background-process runs, without the user's permission nor knowledge.