background-process

Where should I put background processes in rails?

泄露秘密 提交于 2019-12-06 13:29:09
I'm building a Rails project that has a cron-type job that I'm managing with Rufus Scheduler. I have two questions about how to set this up appropriately in Rails: Where's the best place to put the job's code? Where should I place the Rufus code to schedule the job? How should I kick it off? To control the scheduler I would create a config/initializers/task_scheduler.rb : task_scheduler = Rufus::Scheduler.start_new task_scheduler.every("1m") do Something.to_do! # Do something every minute! end Now for the Something.to_do code, that sort of depends on what it does. Perhaps it is a data model

Initiating Non-waiting Background Process in Perl

岁酱吖の 提交于 2019-12-06 11:52:56
I have a Perl script that needs to kick off another process in the background and exit without waiting for the other script to finish. There are lots of threads on StackOverflow that cover how to wait in Perl or how to not wait for other programming languages, but I can't seem to find the right answer for Perl. I've read up quite a bit and thought I was doing the right things but none of my attempts seem to be working correctly. Here are all the variations I've tried so far to no avail: system(qq|perl /util/script.pl $id|); system(qq|perl /util/script.pl $id &|); exec(qq|perl /util/script.pl

AVPlayer Not Loading Media In Background

不打扰是莪最后的温柔 提交于 2019-12-06 11:35:35
When running in the background, my implementation of the AVPlayer is unable to play audio (e.g. podcast) that is downloaded, but is able to play songs that are stored locally. Failure to play in the background is only when the phone is disconnected from my computer. If my phone is direct connected to my computer/debugger, any media that is local or is downloaded plays without a problem. In the foreground, there is also no problem playing either media type. Here is my implementation: AVPlayer *moviePlayer; AVPlayerItem *playerItem; NSURL *address = /* the url of either a local song or remote

Accessing a WPF FlowDocument in a BackGround Process

落爺英雄遲暮 提交于 2019-12-06 08:16:50
Accessing a WPF FlowDocument in the BackGround My question relates to accessing a UI object, in the background in WPF. I have seen dozens of sample apps, that all are simple, easy to follow, and 95% of which tell you how display a progress bar. That’s not quite what I want….. My problem is this: I want to perform a long task (or many long tasks) by accessing a FlowDocument in a RichTextBox. The exact task isn’t relevant here, but an example might be to scan through the document, and count the number of times a particular word appears, or how many red characters there are……. In a long document,

Oreo Background Services

不打扰是莪最后的温柔 提交于 2019-12-06 08:06:16
Within our application we use multiple Services and Intent Services for BLE communication, microphone recording, etc. We have noticed the newly Background Limitations and Restrictions (Yes, we did notice it rather late, I know). I've changed the implementations for using ContextCompat.startForegroundService() function and using the startForeground() with a notification like it stated in the docs. But we saw that when the application is killed , the Foreground Service dies also after a few minutes. Should it happen? Should the Foreground Service will only continue to work if the app is in the

How to launch a job in a shell which will persist even if the shell which launches it terminates

こ雲淡風輕ζ 提交于 2019-12-06 07:18:02
问题 How do I lauch a job in a Linux shell, so that even if the shell which launches it terminates, this job will still persist? More specifically, I am trying to run strace on a process. It runs perfectly if I do it in a terminal. However, I want to do it in a remote shell which will stop as soon as all the commands have been executed. "strace -p pid &" doesn't have any effect because when the shell stops, the background job also gets killed. How should I do it? nohup seems to be thing I am

Using another thread for “networking” , in Android

为君一笑 提交于 2019-12-06 04:40:29
I am developing an Android application and when it launches : 1) I make an HTTP Request to my server to send a small JSON file. 2) Open a webView to show a URL. When the server is running properly there is absolutely no problem and everything goes smoothly. HOWEVER , if for any reason the server is down , the HTTP request literally hangs and i need to wait till there is an HTTP timeOut which is around 30seconds till i actually see the webView with the URL loading. I read that i shouldn't make any networking inside the UI thread and i should use another thread for that. In BlackBerry , that i

Why do I get the information of “suspended (tty input)” when I run my script in the background

梦想的初衷 提交于 2019-12-06 04:28:03
问题 I've written a tcsh script to clear garbage data in a cluster, the code is : set hosts = $1 set clear_path = $2 foreach i ($hosts) rsh $i rm -rvf $clear_path end When I run this script in the background like this : disk_clean.sh hosts_all /u0/data/tmp > log & The job will get stuck and show the information like this: [1] + Suspended (tty input) If I run this in foreground, it can finish normally. Why does this happen? How can I run this script in the background and redirect the output into a

NetworkInfo is not properly responding to network changes on phone running Nougat

孤人 提交于 2019-12-06 03:15:20
问题 Preface: This is working just fine on a phone running 6.0.1. but on my phone that is running 7.1.1, it is not, as shown below. build.gradle (Module:app) compileSdkVersion 25 buildToolsVersion "25.0.0" applicationId "com.gesslar.threshvote" minSdkVersion 19 targetSdkVersion 25 AndroidManifest.xml <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <receiver android:name=".NetworkChangeReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action

How to Run a Task in swift on a particular date-time in background either application is on or off

隐身守侯 提交于 2019-12-06 02:12:13
问题 I am working on alarm application, i need to schedule alarm on specific time, I use scheduleLocalNotification for scheduling alarms and it's working fine as i want. BUT I need to run to a request to my API server before triggering alarm. In that request I want to check some parameters returning from API server, If that satisfies some condition. If any one have a method that run on a particular date - time in swift Please help me for that func addAlarm (newAlarm: Alarm) { // Create persistent