w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How do I set a command-line flag when running a Symfony2 Command test?
disabling debug in the kernel You can initialize the kernel in your test's setUp() method with debug set to false. use SymfonyBundleFrameworkBundleTestWebTestCase; class YourCommandTest extends WebTestCase { public function setUp() { static::$kernel = static::createKernel(array('debug' => false)); static::$kernel->boot(); // ... } Have a look at WebTestCase->createKernel(). using enviroments If you don't want the debug output in your logs edit/create app/config/config_test.yml and edit ... monolog: handlers: file: type: stream level: debug # log-level ... ... to another log level that suits your needs. Then execute your command using the test environment with --env=test

Categories : PHP

How to issue a command from the command line of a process running on Linux
If you don't mind waiting for the calls to finish (one at a time) before returning control to your program, you can use the subprocess library. If you want to start something running and not wait for it to finish, you can use the multiprocessing library.

Categories : Python

Trouble running android command in command line
What Am I missing? You are missing two ~ characters, perhaps. The exact path is /Users/me/Development/adt-bundle/ That's not what you typed into your PATH. Your PATH says that there is no /Users/me -- instead, PATH is expecting a /Development directory in the root of your volume. Now, in Linux, the solution would be to add a ~ to indicate that /Development is relative to your home directory: export PATH=${PATH}:~/Development/adt-bundle/sdk/platform-tools:~/Development/adt-bundle/sdk/tools My OS X shell experience is rusty, so I forget if ~ will map to /Users/me or not. If it does, use ~, otherwise, go with: export PATH=${PATH}:/Users/me/Development/adt-bundle/sdk/platform-tools:/Users/me/Development/adt-bundle/sdk/tools

Categories : Android

Running 7zip command line silently via Python
Pipe stdout and stderr to your system's null file: import os with open(os.devnull, 'w') as null: subprocess.Popen(['7z', 'e', input_file, '-o', output_dest, '-y'], stdout=null, stderr=null)

Categories : Python

execute cat command in subprocess,Popen() of python
The problem is that you're passing the command as multiple args. You need to pass them as a list or a tuple. Like: subp.Popen([ 'egrep','list_of_IDs','/home/bimlesh/python/result.log' ], stdout=subp.PIPE,stderr=subp.PIPE,shell=True)

Categories : Python

Defining the command line arguments of a linux command in python
format is your friend: import os, sys if len(sys.argv) == 2: os.system("sudo rtcwake -m off -s {}".format(sys.argv[1])) else: print "usage: ..." so the seconds are command line parameters. Or, you can make it interactive: import os secs = raw_input() os.system("sudo rtcwake off -s {}".format(secs)) to verify that the user input is an integer: try: secs = int(secs) except: print 'usage: '

Categories : Python

Always given command line before python fabric command is executed on remote
Interesting, I don't have such issue, your code works fine for me (up to adding env.key_filename and env.password) c:work>fab hello [x.x.x.x] Executing task 'hello' [x.x.x.x] run: touch hello.world Done. Disconnecting from x.x.x.x... done. I'm using Fabric 1.7.0 and Paramiko 1.11.0. Possibly it's a problem of the terminal on your server.

Categories : Python

Piping output from 1 command to other command in an adb shell command line
One way is to create a shell script containing the commands you want and then run the shell script. Since the Android root filesystem is not writeable at run time (usually, unless you have rooted your device and remount it), you can copy the file to the removable (or emulated) storage, for example /sdcard. Then run the script using the command adb shell sh /sdcard/your-script-name. Because each script runs in its own subshell, both of your commands will be executed in the same shell on the device (you can confirm it with ps).

Categories : Android

Flyway command line filesystem migrations from actual command line input
flyway.cmd -configFile=/path/to/other/configFile.conf should do what you want. I just checked and it seems I forgot to document this on the website (It is in the usage description of the tool itself). Could you file an issue against the website, requesting this to be added?

Categories : Windows

Running Perl Script from Command Line?
According to the documentation: Perl Express is not tied to a specific Perl port and should work with any build for Windows. and the system requirements: Windows 98/Me/2000/XP/2003, Perl Interpreter So you, presumably, have a separate Perl distribution already installed somewhere. That should have a perl.exe executable that you can use to run your script.

Categories : Perl

Overhead in running Julia from command-line
Please see the julia-users@googlegroups.com mailing list for questions like these. This one has been answered a few times (possibly also on StackOverflow), so check the archives first. It is also generally a much better way to get current, prompt answers to questions about Julia. Yes, I just checked and it's the first related question: Julia compiles the script everytime?

Categories : Misc

Error while running through command line in springs
There could be many configuration / environmental differences when running maven from Eclipse vs command line: The maven version / path. In Eclipse the actual maven binary can be default / explicitly set via preferences, whereas in command line your OS will pick the first one available on your PATH env var. Check maven version using mvn -version Maven user / global settings.xml. When running through command line typically ~/.m2/settings.xml is used but this can be explicitly overridden on Eclipse preferences Maven local repository cache. If you have discrepancy on 1 and/or 2, you could end up with different local repository cache. Incorrect artifact distribution could cause build to fail if performed against different local repository cache. Eclipse maven could use different version of J

Categories : Spring

Running a function that prompts from command line
You can pass arguments to your python program via the sys.argv list. They are passed in as strings, similar to C's argc,argv convention. Shell: $ python myprog.py 1 2 1 1 2 4 myprog.py: import sys print [int(x) for x in sys.argv[1:]] As you can see, we are using all of the members of sys.argv except the first. The first member, like argv[0] in C, is the program name. If you already have some function defined in your python program, you can add this to the bottom of the file: if __name__ == '__main__': MyFunction([int(x) for x in sys.argv[1:]]) As an alternative, if you don't want to modify your python program, and it already reads its inputs from the standard input stream, you can use shell programming: echo 1 2 1 1 2 4 | python myprog.py or, depending upon how your prog

Categories : Python

wxpython GUI running a command-line program
I wrote up an article where I did something along the lines that you're talking about. I needed to run ping and traceroute and capture their output in real-time. Here's the article: http://www.blog.pythonlibrary.org/2010/06/05/python-running-ping-traceroute-and-more/ Basically you need to redirect stdout to a text control and then do something like this: proc = subprocess.Popen("ping %s" % ip, shell=True, stdout=subprocess.PIPE) line = proc.stdout.readline() print line.strip() As you can see, I use subprocess to start ping and read its stdout. Then I use the strip() command to remove extra whitespace from the beginning and end of the line before I print it out. When you do the print, it gets redirected to the text control.

Categories : Python

-nographics alternative for MAC OSx in running unity3d from command line?
The Unity3d -nographics command line option is not available on Mac. You have complete control of the arguments you send to Unity3d through the plugin when specifying the "Editor command line arguments". What are you trying to do exactly ? Note: I am the author of the Unity3DBuilder plugin. So please report any missing feature to the plugin's issue tracker.

Categories : Osx

Running R script from crontab gives different results than from command line
Don't compare a string to a number if you don't have to. If you removed the space from the format pattern (i.e. made it "%H" instead of " %H"), it should work. However, you don't have to introduce strings in this case; you can get the hour as a number by converting to POSIXlt and extracting the hour component. Try this: as.POSIXlt(Sys.time())$hour > 12

Categories : R

MSTest execution stuck when running through command line
As Mike said in the comments, the issue was actually a bug in VS 2010 that made it impossible to run tests through the 2010 IDE if you have VS 2012 installed side by side. Unfortunately, I was unable to install VS 2010 SP1 on the build machine, but it is also possible to solve the issue by adding the /noisolation argument to the standard command line syntax (this runs the tests through the MSTest process, which somehow solves the issue). However, since you cannot define additional arguments to be passed to MSTest through TFS's integrated automated testing feature, I wrote my own application that invokes as a scheduled task, runs the tests and sends an email containing an HTML report (I used trx2html for that -- note that if you're using VS2012, you'll need the beta 0.7 version, as there'

Categories : Tfs

Using and running Tortoise svnsync in Windows via command line
When you install TortoiseSVN you are given the option to install the Subversion binaries as well: Once you do that, you will see svnsync.exe in the installation folder: As long as you have C:Program FilesTortoiseSVNin in your PATH variable, you will be able to call svnsync.exe from the command-line: (You can view your PATH variable thus (on Windows 7): Start -> right-click Computer -> Properties -> Advanced system settings -> Environment variables.... DO NOT overwrite whatever is there - simply append the path to TortoiseSVN if it isn't already there. More info here.) Hope this helps.

Categories : Windows

msinfo command line export only running tasks
If you can use Powershell rather than msinfo32, this is significantly easier and a lot quicker: powershell Get-Process. This runs quickly and can easily be piped to a file, e.g. powershell Get-Process > . fo.txt. This should work on any version of Windows which supports Powershell 2.0 or later, I believe. See http://technet.microsoft.com/en-us/library/ee176855.aspx for complete documentation of the Get-Process cmdlet. There are a lot of options you can use to limit the columns the cmdlet outputs, so that you don't have to parse a ton of extra columns.

Categories : Misc

running SWF from the command line and getting trace output to the console
You can use the command line debugger, fdb to see console output. First, compile a debug SWF: mxmlc -debug=true myApp.mxml Then launch the debugger: java -jar ../lib/fdb.jar Then you can either launch your app in the standalone Flash Player or in a browser. When you see the (fdb) prompt, use the run debugger command to start your app. You have several choices: run <path to SWF> (launch SWF in the standalone Flash Player) run <url to SWF> or run <path to HTML file that embeds SWF> (launch in browser)

Categories : Misc

Display progress of a command line process that is running in MVC
I hope this link will help: Asynchronous processing in ASP.Net MVC with Ajax progress bar You can call Controller's action method and get the status of the process. Controller code: /// <summary> /// Starts the long running process. /// </summary> /// <param name="id">The id.</param> public void StartLongRunningProcess(string id) { longRunningClass.Add(id); ProcessTask processTask = new ProcessTask(longRunningClass.ProcessLongRunningAction); processTask.BeginInvoke(id, new AsyncCallback(EndLongRunningProcess), processTask); } jQuery Code: $(document).ready(function(event) { $('#startProcess').click(function() { $.post("Home/StartLongRunningProcess", { id: uniqueId }, funct

Categories : Asp Net Mvc

Running a Java program in Eclipse as if from command line
You need to go to: Run Configuration > Argument > Program argument. Then copy and paste "inputFile.txt" "inputFile2.txt" inside the box.

Categories : Java

Debug in Eclipse while running from command line ubuntu
Is your application written in C or in Java? If your application is in C and you are using CDT, you can attach to existing project by: Run your application from terminal. In Eclipse CDT, go to main menu "Run"->"Debug Configurations...", double-click "C/C++ Attach to Application" and press "Debug" (you should not need to specify executable and/or project). For Java applications, see this

Categories : Eclipse

Getting output from running command line app in Inno Setup
With TLama pointing to the progress bar messages I was able to solve the problem. At first I needed to pass the progress bar handle from Inno to my C# app. For this I created a function that would return me the int-pointer as a string function GetProgressHandle(Param: String): String; begin Result := Format('%d',[WizardForm.ProgressGauge.Handle]); end; and use it in the Run-section when calling my app: [Run] Filename: "{app}myApp.exe"; Parameters: "{code:GetProgressHandle}"; .... In C# I read the int-pointer from the console arguments and use it to create an IntPtr: IntPtr pointer = new IntPtr(Int32.Parse(args[0])); To send the messages to the progress bar I imported user32.dll and re-defined the needed constants, that normally can be found in commctrl.h: [DllImport("user32.dl

Categories : C#

Running JUnit 4 from command line on Eclipse project
Just take off the .class part. Java knows to look in that file when you specify the class name. java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore MySuite

Categories : Java

PHP Error encountered when running Command Line using CodeIgniter 2.xx
https://github.com/EllisLab/CodeIgniter/issues/1890 Just replace $_SERVER['REMOTE_ADDR'] with $this->server('remote_addr') at the line that generates the notice. - modify /system/core/Input.php line 351

Categories : PHP

Running TestNG programmatically using maven command line
The simplest solution to run tests in parallel is to use the configuration for the maven-surefire-plugin like this: </plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.15</version> <configuration> <parallel>methods</parallel> <threadCount>10</threadCount> </configuration> </plugin> [...] </plugins> Usually you don't need a separate testng.xml file to run the tests, cause they will be run by default based on the naming conventions for tests. Furthermore it's not needed to make separate include rules apart from that your given definition is

Categories : Maven

Package error when running r code on command line
RStudio sets a default repository when you call install.packages from within RStudio. When you run the script via the command line, you have to tell R which repository to use (or set a global default repository). You can easily fix this problem by telling R to use your favorite repository. For example, if you want to use RStudio's package repository, set repos="http://cran.rstudio.com/" inside the install.packages call. if (!require("yaml")) { install.packages("yaml", repos="http://cran.rstudio.com/") library("yaml") } This should work!

Categories : R

How to query running java application from command line?
Your program can use the attach API to locate the running JVM and connect to it. http://docs.oracle.com/javase/7/docs/jdk/api/attach/spec/ Then you can tell it to load an agent into the JVM. See the java.lang.instrument package description, chapter “Starting Agents After VM Startup” to see how such an agent can be implemented. This agent can call the desired method in the target JVM. Note that there already exists the JMX agent for a lot of operations you might want to perform when dealing with managing another application. It’s worth studying it.

Categories : Java

PHP CGI replaces name of called file in command line exec calls, causing infinite loop
You really should use the CLI version of PHP for this. You may be able to sneak around the CGI stuff by unsetting each of the environmental variables that are listed in the CGI specification. http://en.wikipedia.org/wiki/Common_Gateway_Interface <?php $cmd = array(); // Explicitly clear CGI variables from the environment. This relies on "E" being // set in your http://www.php.net/manual/en/ini.core.php#ini.variables-order foreach ($_ENV as $k => $v) { if (preg_match( '/^(HTTP_|REQUEST_|SERVER_|PATH_|DOCUMENT_ROOT|GATEWAY_INTERFACE)/', $k)) { $cmd[] = "$k=''"; } } // Generates a command like: "GATEWAY_INTERFACE='' /usr/bin/php myscript.php" $prefix = implode($cmd, ' '); shell_exec("$prefix /usr/bin/php myscript.php");

Categories : PHP

sudo command in Popen
sudo, ssh, sftp are all designed to know if there is a tty attached, so they ask for a password. The reason is that putting passwords in code is a big security violation. You can use the expect utility to run sudo or ssh and your python code, too... Use expect in bash script to provide password to SSH command

Categories : Python

Command works in command line but gives 'no such file or directory' in bash script
Remove the quotes around line 8. Like this: ./optAlg.exe "$inputFile" 500 2>&1 > "output/$outputFile" By placing quotes around the whole line you tell bash to execute a command which is called exactly ./optAlg.exe $inputFile 500 2>&1 > output/$outputFile and of course there is no such command. In reality you want to run ./optAlg.exe with parameters. Do not forget to place quotes around the variables because otherwise filenames that have whitespace characters are going to be passed as several arguments. Please read about arguments. And you can read about common pitfalls as well.

Categories : Bash

PHP exec command works in shell and php command line but not on website
You can add the second parameter to help debug, $output will display what the cp command is doing, whether it be an error or not. I would also recommend placing quotes around the files, just in case something with a space gets in there. $src = "/mnt/..."; $dest = "/var/www/..."; exec("cp '$src' '$dest'", $output, $retrun_var); var_dump($output, $retrun_var);

Categories : PHP

How to get command-line equivalent of command entered in Task Scheduler
schtasks /query /? schtasks /create /? the first has an option to export to xml, the second one as an option to import from xml. If you have only one or a few tasks to schedule, I would create them "the hard way" with schtasks /create

Categories : Windows

Batch file/command to start a program through command line
I'll edit this if you respond to my comment but if you want to simply execute this command via a batch file (and you know nothing about batch files): Open a text editor (e.g.Notepad) Type in your command (e.g. c: andaotherfoldermyprogram.exe 10 20) Save the file as mybatchfile.cmd Double click the file (in Windows Explorer etc.)

Categories : Windows

different order of command line options in a command affecting my output
getoptlong() is doing exactly what it is supposed to do. The format-string "d:g:hv" implies that the parameters d and g require a value. Anything specified following a command-line parameter is consider a value being passed to it. You should run your program as $program --download file --version Checkout this detailed example demonstrating the various aspects of using getoptlong(). How rm can handle the differing position of its cmd-line params? Apparently because rm's parameters (r, v etc.) do NOT accept any values as arguments. Thus directory does not get passed to any of them but rather is a separate cmd-line argument on its own. You can confirm this from the source-code of rm. To do something similar for your program, you will need to modify the optstring to "dghv" a

Categories : C

php sudo shell_exec command runs from command line, but not from browser
Would it be out of the question to make a shell script that would run your command? #!/bin/sh sudo whoami in the php: $retVal = `/path/to/custom/script/myscript.sh &2>1`; if ($retVal) echo 'SWEET'; else echo 'POOP: ' . $retVal; {command} inside `` means the same as shell_exec('{command}') on a linux server. If I'm not way off base here your goal is to add users to your VPN (among other things perhaps) in which case you could pass command-line parameters for username/password/etc to your custom shell script. It's not exactly a pure shell_exec() answer to your question, but maybe you can run myscript.sh without doing sudo. Just basing this on the fact you said everything you tried worked in shell and path was set in echo $PATH, but not sudo echo $PATH in your PHP script. Seem

Categories : PHP

How can i tell Java code run the script as it was running from command line as normal user?
Fist remove & from this line system("/var/tmp/runme.sh &"); Second, maybe since, you are using this: "/bin/sh", Java is running the script as different shell every time you invoke using Runtime? and you are executing /var/tmp/runme.sh from the same shell everytime. Note: /bin/sh is an interpreter and with Java Runtime you are invoking multiple instances of it to execute your script every time.

Categories : Java

Running EXE application in GINA beofe login screen (Command line)
I see you tagged your question with "Gina", so I guess you know that Credential Providers do not exist on XP. Your answer depends on when exactly you want to run that program, especially with regards to the secure attention sequence (SAS, or when a user press CTRL-ALT-Delete) Before the SAS, use WlxDisplaySASNotice After the SAS, use WlxLoggedOutSAS Since you don't want to write a whole GINA yourself, you could use a custom Gina that wraps msgina.dll. Here is one I wrote, you can find the original I started from in the Platform SDK. Using that approch, you get a chance to execute code just before or just after certain events, like running your program after a successful logon, something like : int WINAPI WlxLoggedOutSAS(PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId, P

Categories : Windows

FlaggedRevs requires running .../mediawiki/maintenance/update.php from command line
You need to run it using php.exe. If you have it in your PATH, you can use just: php update.php If you don't have it in PATH, you need to specify the whole path yourself: C:path ophp update.php

Categories : PHP



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