How to to run separate processes on iOS - objective-c

How can I run a separate process (the executable will be in the main bundle) on iOS? NSTask seems to be missing...
BTW I don't care if this will be rejected by Apple, as it will never be submitted.

There is no way to run a seperate process other than launching a process that can run in background from xcode or the home screen.
If you want process 1 to kick off process 2 then you're out of luck.
However, if you want process 1 to run in background and then process 2 to be launched later and communicate with process 1 (via memory-mapped files or network) then you can do that as xcode will allow you to run more than one application on the simulator at a time.
Alternatively, you can emulate a process via a thread but that depends on what you want to do.

Related

C# application runs in the background as a process now i cant build the solution and cannot even kill the process

I ran into a very weird problem today with my C# application. I downloaded it today (from a trustworthy source my classmate sent me back the program we do together) At first when i tried to build and run the application, the whole visual studio got frozen and the app didnt even appear. After a lot of trying this problem just disappeared all of a sudden. However, now I cannot even build the solution, because I get the "unable to copy file because it is being used by another process" error message. I checked the task manager and the program runs in the background. I cant kill it because I have no access to do that(access denied message), I cant do that with a terminal command either(Because the terminal says this exe file is not running) and what is more even restarting my pc 2 times didnt make it disappear. It is no more in the processes after a restart, but i can still see it in the details view of the task manager.
I just have this program running in the background literally forever now?
Someone could explain me what even happened and if there is any way to solve it? I could even code (and build) the program for a while!

Develop an application with all its containers instantiated and used soon as the dev compilation, and do not wait deployment at delivery time for that

In my development environment, I have my IDE, a database, web-server... installed
A script exist: 80 different commands are ran for it.
Then, at delivery time (integration, acceptance), I have a big mess to execute a script that create many Docker containers, each having its goal: database, web-server, etc.
Their scripts are some subsets of the big one I'm using for my own local developer computer. But adapted.
It's very difficult to ensure the transition between my standalone - "flat" if I can say so - dev computer and the containerized version fitted for delivery.
I wonder if a way exists to develop directly an application being containerized at its early beginning :
With all the tree of its containers ready (and not a single one containing everything: it would be cheating...)
As soon as I compile my sources in my IDE : simple compilation would have for result binaries and files going in their due container
and it's in these containers that my application would be executed, even in development mode.
Is it possible? Is it already done by some of you?
Or does it have too much drawbacks to be attempted?

How to make console app Check if process is running

i'm making a Visual basic Console App to inject a DLL to an exe process if the process is running
the question here is how to make console application checks if the desired process is running
The Process class provides methods that allow you to get lists of running processes. For instance:
If Process.GetProcessesByName("notepad").Length <> 0 Then
' Notepad is running
End If

How to Kill Java Process in Windows, WITHOUT killing javaw.exe?

I have an external Windows .exe that is actually Java application: Running the .exe starts javaw.exe, which in turn runs that Java application.
I didn't write that application and have no access to it through an API. I need to be able to kill it, however. So right now I just kill the Windows process javaw.exe, which is fine for a test machine running only that Java application but if I need finer granularity, I cannot currently do so.
My searches yielded suggestions such as Sysinternal's Process Explorer or the jps command in the JDK, but in the target systems for which I intend to provide the script, neither JDK nor Sysinternal's Process Explorer can be running.
Is there any other way that doesn't require an external tool? Does javaw.exe have a switch or command line option that lists Java processes? Is there a JRE version of jps?
Thanks.
I'd still suggest just killing the javaw.exe.
I can't see the downside, since it is the process you want to kill after all.
Remember that if you run multiple applications on the machine, they should each have a separate JVM instance. So you can still kill the specific application if you need to.
The JDK (and possibly the JRE) ship with a utility called jps which can list all Java processes but also tell you the Main-Class currently running in that JVM. If JMX/JConsole is not an option, simply parsing the output of "jps -ml" and killing the appropriate process may work.
If you want to kill an entire JVM, just kill the javaw.exe process. Within a JVM there can be multiple Java threads but there's no way to poke into a JVM and terminate a thread unless the developer of the application provided a method to do so.
Based on your comment, multiple javaw.exe programs are running and you need to know which one to kill.
You might want to try connecting to each of the processes with JConsole and inspect the JVM. There may be enough clues to determine which one to kill. Once you've identified the profile of your application, you should be able to script the logic to make it easier in the future (use JMX to get most of the information provided by JConsole).
If the executable launches javaw then exits without providing any further information it seems like you need to use your scripting language to take a snapshot of running processes on the machine before launching the executable and after the executable has finished. Then you'll be able to deduce which is the new javaw process. What scripting language are you using?
Just another approach: if you have the jdk, there is a program called jvisualVM in the bin folder. It has nice info about each running JVM context. One of the things you can see is the PID of the VM, which I use to kill the process in Windows using task manager (on windows PID is not shown by default, but you can easily enable the column by going into view -> show columns )

LSOpenURLSpec error

I have created a minimal OS X boot stick (basically the Snow Leopard DVD with all the packages and installer stripped out). I've written a basic Cocoa app launcher to launch other apps that I put in the Applications folder (the minimal install lacks Dock and Finder).
When I try to launch an app I get this error:
LSOpenFromURLSpec() returned -10810 for application (null) path /Applications/MyApp.app
Where "MyApp.app" is the app I tried to launch. I've tried this with both NSWorkspace's openFile method and the UNIX "open" utility and I get more or less the same error. One way that launching an app works is if I just execute the main executable of the app itself. (e.g. /Applications/MyApp.app/Contents/MacOS/MyApp). However this method is kind of inconvenient as it stalls the launcher until the app I launched exits. Any alternate ways to launch an app (or fix the LSOpenFromURL error)?
Thanks
Found a workaround:
/Applications/MyApp.app/Contents/MacOS/MyApp >/dev/null 2>/dev/null &
Using that command starts apps without stalling the launcher.
open relies on Launch Services, which relies on the Finder. Your script workaround starts a new background process executing the application's code with its standard out and standard error open to /dev/null. That should work fine.
The C equivalent under Mac OS X would be to either posix_spawn or fork/vfork then exec the executable file.