w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
How to trigger an automatic screen lock process on my android phone after a specified process running specified time?
How unlock and lock screen programatically in android Has some excellent information on immediately calling the lock screen. You could implement a system using an alarm manager to trigger this event.

Categories : Android

Is a multi process Java program a single process in the context of the actual machine underneath the JVM it is running on?
You're confused between processes and processors. A JVM counts as a single process on your machine, yes. When you start the JVM it runs as a program and it executes Java byte code. A JVM can address all the processors on you machine. When you start a Thread in Java it executes on an available processor.

Categories : Java

Check if a process started with Process.Start is still running?
I found a way to check if one process has the file in his "CommandLine", meaning that it is currently editing the application: private static void OpenProcessIfNeeded(String file) { using (ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process")) { foreach (ManagementObject mo in mos.Get()) { if (mo["CommandLine"] != null && mo["CommandLine"].ToString().IndexOf(file, StringComparison.InvariantCultureIgnoreCase) > -1) { Console.WriteLine("Found!: " + mo["CommandLine"]); return; } } } Process.Start(file); }

Categories : C#

How can I lock UI while running the long running process in the main UI Thread in WPF (code in C#)
I would do it this way: Make a "global" (seen for UI thread and background thread) object of one of concurrent types. You can make it as singleton or pass an object to both threads All the long running thread does is reading data from concurrent object and process them. If main thread (or any other) need to do anything in background simply adds it to the concurrent collection. This kind of approach in concurrent programming is called Producer-consumer problem

Categories : C#

How to get Process object of already running process?
I believe you want GetProcessesByName. It will return an array of all the processes that match the name you give. array<Process^>^ notepadProcesses = Process::GetProcessesByName("notepad");

Categories : C++

Get child process id of already running process
In node.js you can do it via child_process library. There is a pid member function that returns the spawned child's pid. E.g. var spawn = require('child_process').spawn, grep = spawn('grep', ['ssh']); console.log('Spawned child pid: ' + grep.pid); grep.stdin.end(); You can also kill the child process with kill. The pty.js does a fork with a pseudo terminal, which is useful if emulating terminal. Otherwise you should use child_process to spawn/fork new processes.

Categories : C

Since App and service are in same process, it is not the case that the service is not running but the activity is running
Your assumption is invalid. It is perfectly possible to have a process with a running activity and no running service, if either nobody started the service, or the service was stopped. In the abstract, whether or not your activity is running is completely independent of whether or not your service is running.

Categories : Android

Get name of running process in php
Try the following: Before the script start to send emails create a file by example emails.log And when the script is done, remove it, When the script starts again ask if exists, and if exists kill the script, The only issue i see can happen is if the script dies unexpected or the page give a timeout the file will be not removed For avoid this you can create a cronjob in your server and configure for run it daily, weekly or whatever you want, the shell script will look something like: newsletter.sh #!/bin/bash if [ ! -f /tmp/newsletter.log ] then touch /tmp/newsletter.log php /var/www/newsletter.php >> /dev/null rm /tmp/newsletter.log fi Good luck!

Categories : PHP

Determine if process is running
Yes, it is possible, but you need a Tcl extension: Twapi. To check if a process is running, you could try to find a process with a specific name. you could use the this: package require twapi if {[llength [twapi::get_process_ids -name YOUR_EXECUTABLE.EXE]]} { puts "Process is currently running" } else { puts "Process not running" } See the manual about twapi::get_process_ids for more information. If you need a notification when a process starts/stops, it will be trickier and I have to look it up.

Categories : Windows

Running process in the background
I tried transport class and it was really great. Here's the code I used: ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname = "host_ip", username = "un"], password = "up") channel = ssh.get_transport().open_session() pty = channel.get_pty() shell = ssh.invoke_shell() shell.send("cd /my/directory/; nohup ./exec_name > /dev/null 2>&1 & ") But I still don't know how to kill it using python scripts; I have an open question about it here. EDIT 1: I have solved my problem about killing the process somehow; you can check it.

Categories : Misc

Is there a way in VBScript to tell if it's running as a 32 or 64 bit process?
At first I thought you could look at the PROCESSOR_ARCHITECTURE environment variable: Set objShell = WScript.CreateObject("WScript.Shell") Set colSystemEnvVars = objShell.Environment("System") WSCript.Echo "System = " & colSystemEnvVars("PROCESSOR_ARCHITECTURE") On a 32-bit command prompt on a 64-bit OS (i.e., CMD.EXE started from SysWow64), it returns x86 rather than AMD64. However it appears that from within a 32-bit CSCRIPT that's started from a 64-bit CMD.EXE it still returns AMD64. So the only other way (and it's a bit of a hack in my opinion - mostly as assuming things from paths always seems bad, but this is probably static enough to be reliable) is to combine this with looking where the CSCRIPT was launched from: WScript.Echo WScript.FullName ...if WScript.FullName conta

Categories : Vbscript

Running process in background
You have an extra &, so : for i in $(< input); do youtube-dl "$i" & done To go further the && operator is used in boolean tests, like : ((1 == 1)) && echo "1 == 1" || echo "1 != 1" always protect your variables with double quotes to prevent bash word splitting ! the backticks are deprecated in 2013 in favor of the $( ) form. It's more readable, and easy to nest.

Categories : Bash

Identifying Currently Running Process
To directly answer your question your code "doesn't work" because your process is not an Excel process. The process ID returned by GetCurrentProcessId() is the ID for your EXE which is not Excel. All of the Excel instances (even the one launched by your application) are different processes, so their process ID's will never match your process's ID. Now to answer your problem - what you need to do is to ensure that you are cleaning up your Excel instances correctly. The best way to do that is to not automate Excel at all, but to instead use a library that can create Excel files. See the answers to this question for some examples: Create Excel (.XLS and .XLSX) file from C# If for some reason you need to use Excel you will have to ensure that you clean up every single object that the Ex

Categories : Vb.Net

How to check if child process is still running?
Use is_alive() for this: if NdeProc.is_alive(): ... else: ... From the documentation: Return whether the process is alive. Roughly, a process object is alive from the moment the start() method returns until the child process terminates.

Categories : Python

Running jar.exe, process.waitFor never return
Found the solution myself. Apparently if you use ProcessBuilder.start in Java to start an external process you have to consume its stdout/stderr, otherwise the external process hangs. This is beacuase OS creates a pipe. All Unix like OSs and Windows behave the same in this regard: A pipe with a 4K is created between parent and child. When that pipe is full (because one side isn't reading), the writing process blocks. It seems that when there are 7+ files the jar.exe consume 4K, nad then stuck. Javadoc of process: By default, the created subprocess does not have its own terminal or console. All its standard I/O (i.e. stdin, stdout, stderr) operations will be redirected to the parent process, where they can be accessed via the streams obtained using the methods getOutputStream()

Categories : Java

Piping to running socat process, But how is this done?
Something like this: http://www.thegeekstuff.com/2010/07/perl-tcp-udp-socket-programming/ #!/usr/bin/perl #tcpclient.pl use IO::Socket::INET; # flush after every write $| = 1; my ($socket,$client_socket); # creating object interface of IO::Socket::INET modules which internally creates # socket, binds and connects to the TCP server running on the specific port. $socket = new IO::Socket::INET ( PeerHost => '127.0.0.1', PeerPort => '5000', Proto => 'tcp', ) or die "ERROR in Socket Creation : $! "; print "TCP Connection Success. "; # read the socket data sent by server. $data = <$socket>; # we can also read from socket through recv() in IO::Socket::INET # $socket->recv($data,1024); print "Received from Server : $data "; # write on the socket to server. $data = "DATA

Categories : Perl

Passing commands to a running process
No, there is no generic mechanism to "send commands from outside the program". Possible approaches to look at: sending keystrokes is one ultimate fallback to automating programs with any UI some programs expose COM automation interfaces (like Office/IE), or even COM remoting. some program expose REST remote management API (usually if the rest of program uses some form of HTTP server) some read configuration/other files some have custom API to execute commands remotely (i.e. most DB servers)

Categories : C#

Checking if user has process running
$LOGNAME provides the current user name. So in case you are using the command to run from X user and want to check for that specific user process, then you can add additional grep for $LOGNAME. I am using SUSE-Linux. In case you are using any other OS, Please specify.

Categories : Shell

Trying to get StandardOutput after running a console process
Seeing as the line you are missing seems like an error message, should you not be looking at Process.StandardError Property When a Process writes text to its standard error stream, that text is normally displayed on the console. By redirecting the StandardError stream, you can manipulate or suppress the error output of a process. For example, you can filter the text, format it differently, or write the output to both the console and a designated log file.

Categories : C#

issue with the function running process in js
Those function definitions are hoisted, that is, they appear in source order, only they act like they are all pulled to the top of the scope they're defined in. After knowing this, you can tell the second one clobbers the first's definition.

Categories : Javascript

How to check a process is running in monit
Is the process listening on any port/socket? If so you could do something like: if failed port 80 then restart or you could leverage some of the other connection testing possibilities: TCP/UDP port test syntax IF FAILED [host] <port> [type] [protocol | {send/expect}+] [timeout] [retry] THEN action Unix socket test syntax IF FAILED <unixsocket> [type] [protocol | {send/expect}+] [timeout] [retry] THEN action

Categories : Linux

Null Exception if process is already running
Why not use sproc instead of info? To answer the question, GetProcessesByName returns the friendly name of the process (i.e. usually no extension). So this should work string fName = Path.GetFileNameWithoutExtension(pname); Process info = Process.GetProcessesByName(fName).FirstOrDefault(); But as mentioned earlier, if that is your full code, there's no need to create an info variable because you're needlessly finding the same process that is already being stored in sproc.

Categories : C#

Initialize QProcess to a process already running
You should use an IPC system like e.g. Qt D-Bus on Linux. You then communicate with the other process over the IPC system instead of stdin and stdout. When your frontend application crashes, then the restarted application can reconnect to the backend process.

Categories : Qt

Call a method of a running process
You are geting the address of the method in the remote process and trying to call whatever happens to be in the same address in your process. You're actually lucky you got an AccessViolation. First you have to decide if the method should run in the calling process or the remote one. If it's supposed to run in the calling process then it's easier to just reference the DLL/EXE where the method resides and call it. But if you want it to run in the remote process you can use some form of remoting such as WCF.

Categories : C#

How to update UI before (and after) long running UI process in WPF?
You cannot manipulate UI controls in a background thread. If you are using the main UI thread to create your TabItems, then you also cannot have a 'Busy' or 'Loading' indicator... this will only work if you are using a alternative thread for your long running process. This is because your 'Busy' indicator will only become updated once the long running process has completed if it runs on the same UI thread.

Categories : C#

remount disk with running process
You can copy it to a tmpfs filesystem and execute it from there. A tmpfs filesystem stores all data in RAM and sometimes on your SWAP partition. Passing the -oremount flag to mount should also work.

Categories : Linux

Implement a long-running process in a web app
Can we use jquery ajax for this success: function(xhr_data) { console.log(xhr_data); if (xhr_data.status == 'pending') { if (cnt < 6) { cnt++; setTimeout(function() { ajax_request(); }, 15000); // wait 15 seconds than call ajax request again } } else { success(xhr_data); } }

Categories : Java

Is it possible to determine how long a process has been running
Process.GetProcesses will retrieve a list of running processes. Each Process has a StartTime property that Gets the time that the associated process was started. Simply subtract that from DateTime.Now to get how long the process has been running. static void Main(string[] args) { var procs = Process.GetProcesses(); foreach (var proc in procs) { TimeSpan runtime; try { runtime = DateTime.Now - proc.StartTime; } catch (Win32Exception ex) { // Ignore processes that give "access denied" error. if (ex.NativeErrorCode == 5) continue; throw; } Console.WriteLine("{0} {1}", proc, runtime); } Console.ReadLine(); }

Categories : C#

Generate MD5 hash of running process
Unfortunately I suppose, there is no solution for your problem. Because of address space layout randomization and other security and non-security features of ram you'll never get reliable results.

Categories : C#

C++ Check if specific process is running
Use WMI for this. From the command line you can do: wmic process where "executablepath = 'c:path oexecutable.exe'" get ProcessId You can use the WMI apis from C++ to do something similar. http://www.codeproject.com/Articles/10539/Making-WMI-Queries-In-C

Categories : C++

Is there a system call for obtaining the uid/gid of a running process?
At the moment, the only viable solution I can come up with is something along the lines of this. Obviously, not gone to the effort to see if this actually works as I would expect it to yet...: int len, pid, n, fd = open("/proc/12345/status", O_RDONLY | O_NOATIME); char buf[4096], whitespace[50]; if (0 < (len = read(fd, buf, 4096))) { n = sscanf(buf, "Uid:%s%d ", whitespace, &pid); }

Categories : C

Weird JVM crash on long running process - Possible JVM bug
Your application is receiving a signal as apparent from the stack trace: JVM_handle_bsd_signal I don't know which signal it is, but you could try to install signal handlers to find out: http://www.oracle.com/technetwork/java/javase/signals-139944.html#gbzbl Some common things that come to mind are: does the app set up some ulimits ? does anything else crash, suggesting hardware errors? have you tried using another jvm release - a patch or two away might be a different behavior

Categories : Java

Enable button clicking while another process is running
You have to run your "Kill All" method in an async method. The main thread is always blocked when you run a long process. More info about your problem: WinForm Application UI Hangs during Long-Running Operation Just use one of the following methods - run Kill All in: A BackgroundWorker Another thread Another task Use async/await Reactive extensions There are a several ways to notify you that the all processes are terminated! It depends on which method you use.

Categories : C#

Running Rake Task with Clock Process
Answer after long time :) but you need to add Procfile to work clockworker gem with heroku this question may help you.

Categories : Ruby On Rails

How many instances of a web application are running in one worker process?
I'm not sure if this applies to you, but HttpModule Initialize methods are called more than once because even though there is only one Application instance. One HttpApplication can spawn multiple HttpModule instances, so make sure those initializations are thread safe. Application_Start and _End will fire only once per site start and stop with your current settings, so that will not be the issue. If you are using the HttpContext.Cache object, you might have the issue mentioned in this answer: HashTable in HttpContext.Current.Cache If you want, you can try using WinDbg and get a dump of what is going on in your process but that is a really heavy-handed tactic that probably won't shed as much light as just looking through the code. Not until you look at it a little harder, and are still s

Categories : Asp Net

How to kill a child process which it is running parallely
newProcess1.on('close', function (code) { console.log('child process ' + newProcess1.pid + ' exited with code ' + code); newProcess2.kill(); newProcess3.kill(); }); http://nodejs.org/api/child_process.html

Categories : Multithreading

Random SQL Errors After Running Large Process
SQL express has limited usage of cpu and memory. Please check this SQL Server 2008 Express or Enterprise as well. If it is a production database, I would highly recommend you to switch back to enterprise version.

Categories : Asp Net

How to stop a Java process running in a webserver
There is no out of the box solution available for this but this can easily be implemented. You can fire a monitor thread on method call which can monitor the timing and either kill the process or notify some other method. You can of course implement logic in a several ways from here.

Categories : Java

What is the difference between Process.Start() and running manually?
Could it be a permissions issue? Regedit is automatically elevated when you double-click on it. But when running through your program, it is not. Perhaps that's why it lets you export some parts of the regiistry, but not others.

Categories : C#

What could cause a sudden ClassNotFoundException in a long running process?
The stack trace tells us that it is about processing annotations and not connected with loading the class for executing code. It seems that the annotation processor tries to resolve the value of an annotation member through the ClassLoader of the annotated element. In other words you have an annotation with a value of class type like @Foo(xyz=ABC.class) and a class or member annotated with this construct but the class ABC is not reachable through the ClassLoader of the annotated element at runtime. This does not conflict with the fact that this class has already been loaded through another ClassLoader.

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.