kill

kill application from other application on ios 6 using void kill dont work

巧了我就是萌 提交于 2019-12-02 07:13:36
问题 i got jailbreak iphone ios 6 in my tweak on ios 4&5 I used (void) kill to close other app running in the background. this is my code: #import "SBApplication.h" SBApplication *app ; app = [[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:@"my killed program id "]; if(app) [app kill]; now when i trying that in ios 6 i cant get this to work ! need help? 回答1: Just to expand on Victors answer a bit... you want to get the pid from the application and if it

Best Practice for killing a JavaME 1.2 thread?

北战南征 提交于 2019-12-02 05:46:49
问题 Question: I'm interested to know the best practice for killing a long standing operation that is running as a background thread (lets call this thread WorkerThread ) in Java 1.2. Scenario Specifically, I'm developing an application for Blackberry devices whereby I make a HTTP connection. Big picture: a URL request if forwarded to a background thread ( WorkerThread ), the thread makes the request and returns the result using a call back. Scenario Details Now there exists a situation where at

Powerpoint issue when quitting

放肆的年华 提交于 2019-12-02 05:19:28
I have some c# code which opens a Powerpoint slide, refreshes the graphs, and then quits. This works fine, unless the user already has a Powerpoint slide open, in which case it will close down their existing session (losing any changes they may have made!) once the exe has run. So, the issue is if you have PPT’s open in the background, run my EXE which runs the below code (opening up a template, refreshing some graphs, saving and closing), upon application exit it disposes of the variable ppApp which seems to close down every running PPT. This is even the case if I omit ppApp.Quit();

timeout or close when process is finished

只谈情不闲聊 提交于 2019-12-02 04:36:44
I have a X.exe program that takes about 2-6 hours to finish. Exact time is unknown, but I'd like to implement a threshold of 6.5 or 7 hours. If this program does not return any value by this amount of time, it will be killed. How do I implement this using batch *.bat files? Here is what I had so far: a timer bat1.bat and an actual bat2.bat . bat1.bat: start cmd /C bat2.bat & timeout /t 25200 & taskkill /im X.exe /f bat2.bat: cd blah bat1.bat The problem with this approach is that only after 25200 seconds (or 7 hours) the timer will be stopped, and it won't be terminated before that limit. How

How to terminate a thread in Python without loop in run method?

爱⌒轻易说出口 提交于 2019-12-02 02:35:00
问题 Having class which has a long method. Creating a thread for that method. How i can kill\terminate this thread? Main problem is that i can't check for threading.Event in thread run() method because it doesn't contain loop. Similar code as here: import time import threading class LongAction: def time_consuming_action(self): tmax = 600 for i in range(tmax): print i time.sleep(1) time.sleep(tmax) self.tmax = tmax return "Slept well" class LongActionThread(threading.Thread): def __init__(self, la

C - Get PID of process opened with popen

耗尽温柔 提交于 2019-12-02 02:17:42
问题 I have a program written in C, which opens another program using popen. I 'd like to get the pid of that program or some kind of handler for it, so as to kill it after a certain time limit, or if it exceeds some ram, and stdout limits. I think this must be done with ptrace, which needs the PID, which I don't know how to obtain. 回答1: Just write your own implementation of popen that returns the PID. It's much less ugly than some crazy hackery around the existing popen . You can find source code

How to terminate a thread in Python without loop in run method?

十年热恋 提交于 2019-12-02 01:45:23
Having class which has a long method. Creating a thread for that method. How i can kill\terminate this thread? Main problem is that i can't check for threading.Event in thread run() method because it doesn't contain loop. Similar code as here: import time import threading class LongAction: def time_consuming_action(self): tmax = 600 for i in range(tmax): print i time.sleep(1) time.sleep(tmax) self.tmax = tmax return "Slept well" class LongActionThread(threading.Thread): def __init__(self, la_object): self.la = la_object threading.Thread.__init__(self) def run(self): self.la.time_consuming

kill application from other application on ios 6 using void kill dont work

核能气质少年 提交于 2019-12-02 00:16:07
i got jailbreak iphone ios 6 in my tweak on ios 4&5 I used (void) kill to close other app running in the background. this is my code: #import "SBApplication.h" SBApplication *app ; app = [[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:@"my killed program id "]; if(app) [app kill]; now when i trying that in ios 6 i cant get this to work ! need help? Just to expand on Victors answer a bit... you want to get the pid from the application and if it is greater than 0(a valid pid), kill it with either SIGTERM(Nicer, though it's not guaranteed to kill it) or

How can I kill the processes matching a grep older than 30 minutes?

此生再无相见时 提交于 2019-12-02 00:01:39
I have a set of processes that run in parallel. Occasionally some hang around longer than the script is supposed to allow: $time_start = microtime(true) $max_run_time = 30 * 60; // 30 minutes, measured in seconds while ((microtime(true)-$time_start) < $max_run_time) { // do stuff, but quit after 30 minutes } I'd like to kill old processes of this script that have been around longer than 30 minutes. How can I do as much from the command line? Here's a sample of current running processes: > ps aux | grep script.php my_user 856 28.3 0.7 546152 234568 ? S 11:46 88:42 php /path/to/my/script.php my

Android: Check if activity is destroyed by a system from service

社会主义新天地 提交于 2019-12-01 23:52:37
I have a service listening to some events from server. A service has START_STICKY flag that makes him restart when it's killed by OS. When service receive an event i have two scenarios. First, if activity isn't killed i need to send result to local broadcast receiver and update UI. Second, if it's killed by OS i want to recreate it and send data in bundle. But i don't know how to recognize that android killed my activity. onDestroy activity event doesn't come in this situation. @Override public void onComplete(CurrentOrdersResponse response) { if (response == null) { return; } boolean