w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
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 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#

The process cannot access the file 'x' because it is being used by another process while deleting saved image by application
This is explained in the documentation for Image.FromFile: The file remains locked until the Image is disposed.

Categories : Vb.Net

How to get process (external program) time, cpu usage for process run from java application?
Run this program in a separate thread, then run tasklist /v process (if Windows), intercept output, split lines into columns, find my-simple-app.exe and get necessary info. If tasklist info is not enough, then read process ID column form tasklist output and run some other util to get more info.

Categories : Java

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

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++

terminate application process on application close
You could try something like this to ensure all of the forms get closed. private void FormName_Closing(object sender, FormClosingEventArgs e) { Form parent = this; while (parent.MdiParent != null) parent = parent.MdiParent; closeChildren(parent); parent.Close(); } static void closeChildren(Form parent) { foreach (var child in parent.MdiChildren) { closeChildren(child); child.Close(); } } If closing all of the forms does not work, then you will need to ensure that any threads you started get stopped when the application is closing as the process does not stop until all threads have ceased.

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

WM 6.5 C# console application, capturing keystrokes while running in the background while another application has focus
Can you please post your exact method [System.Runtime.InteropServices.DllImport("coredll.dll")] public static extern short GetAsyncKeyState(int keyCode); if (GetAsyncKeyState(27) != 0) { //do something here cause the ESC key was pressed }

Categories : C#

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

How to close a WPF application running in system tray from a C# console application?
Use IPC as JeffRSon suggested. MSMQ is a very easy and effective way when two processes are on the same machine. Define a queue of your WPF application and when it starts, no matter showing UI or not, let it listen the queue. Console application can send a message to the queue with closing application message. You have to define the data contract. You can refer to: http://www.codeproject.com/Articles/3944/Programming-MSMQ-in-NET-Part-1

Categories : C#

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

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

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

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

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

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#

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#

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#

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

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

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#

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

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

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

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

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#

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#

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

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

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

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++

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#

Running MVC 4 Web Application, URL Without having Application Pool Identity
Set wwwroot folder for your www.myAppDomain.com to folder where your application is being deployed (e.g. c:myappwwwroot{appfiles}). This can be done by clicking on site and clicking basic settings button on right pane. You will get dialog where you can sett app root folder.

Categories : Asp Net Mvc

Find out specific weblogic process running
Use jdk instead: ps -ef | grep jdk The result would look like this: 1005         8383           31663           2 Jun04 ? 00:27:49 /weblogic103/jdk160_05/jre/bin/java -Dweblogic.Name=AdminServer ... etc

Categories : Java

user running a process with tasklist and python
You can get a lot of information from Microsoft's WMIC command. Start off by running wmic /OUTPUT:wmic-process-info.txt PROCESS get * on the command line to get a ton of stuff about processes written to wmic-process-info.txt. Then when you know what you're looking for, slim it down to the columns you want and run in python instead of saving to a file. wmic PROCESS get a,b,c.

Categories : Python

Fire a process off and have it keep running after perl script is done
Perl has several ways to launch background processes. (Note: I typically avoid posting link-only answers, but since there are several modules and that page is likely never going away, I feel it's safer than usual). For completeness, here's a short quote from the page: Several CPAN modules may be able to help, including IPC::Open2 or IPC::Open3, IPC::Run, Parallel::Jobs, Parallel::ForkManager, POE, Proc::Background, and Win32::Process.

Categories : Perl



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