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

In Linux,pdftoppm command is running two processes for single file
These are not two pdftoppm processes. The following is the pdftoppm process: root 25523 49.6 0.7 18192 12620 ? RN 14:13 0:59 pdftoppm -f 1 -l 1 /pdf/input.pdf /test/processing/output The following is the process for the shell command: root 25522 0.0 0.0 1844 500 ? SN 14:13 0:00 sh -c /bin/bash -c "pdftoppm -f 1 -l 1 /pdf/input.pdf test/processing/output" The first line in your grep output is for the shell command that was executed. The second line was for the actual pdftoppm invocation. The third line was for the grep. (Both your shell command and grep contained the string pdftoppm, which were a part of the process list when queried.)

Categories : Linux

Is it possible to use awk to print all line in a file and then do a command on a single column?
It its possible to run a shell command from awk. You just need proper quoting, like this: echo "123" | awk '{ print $0 | "openssl dgst -sha1 | sed '"'s/^.* //'"'" }' output: a8fdc205a9f19cc1c7507a60c4f01b13d11d7fd0

Categories : Bash

In perl, how do you store multiple values from a single test file line into an array
Well, in your case, I would probably consider using split, separating the fields on whitespace: while (<DATA>) { my @vals = split; # default split is fine print join(" ", @vals[3 .. $#vals]), " "; } Or if you want to store them, just push them onto an array, or use a hash with a suitable key. Something like... push @array, [ @vals[3 .. $#vals] ]; # push an array ref $hash{$vals[0]} = [ @vals[3 .. $#vals] ]; # use a hash The [ ... ] part is creating an anonymous array ref, which can then store the line's values in a single scalar slot.

Categories : Arrays

Running a macro from the command line on a file that exceeds excels row/column limit
You could load chunks of the .csv at a time, putting a prefix or suffix at the end of each import. Run VBA code on each chunk, then add back together. Unfortunately the Workbooks.OpenText method supports importing text starting at a particular row, not a particular column, so you'd need to break up the .csv file into manageable chunks outside of excel, before running VBA code.

Categories : Excel

Special Emacs setup for a single file: Run lisp code at startup from command line
Here's my view of the solution: (defun insert-test-text () (interactive) (insert "test")) (add-hook 'text-mode-hook (lambda () (if (string= (file-name-nondirectory (buffer-file-name)) "A.txt") (local-set-key (kbd "<f5>") 'insert-test-text)))) This will define the shortcut only for files named A.txt. You should tweak the code to your needs, of course. Also, don't forget to bookmark the file if you edit it a lot. I've got a very quick setup (around two key chords) for ~20 files/directories. that I edit a lot. The setup is described here. UPD If you want the binding for single file, just drop file-name-nondirectory like so: (add-hook 'text-mode-hook (lambda () (if (string= (buffer-file-name) "~/A.txt") (local-set-key

Categories : Bash

WIn764b: Cannot open include file: 'winsock2.h': No such file or directory when running npm install -g karma
binding.sln was built with Visual Studio 2010. I decided to install Visual Studio 2010. I selected "Or, download the previous: Visual C++ 2010 Express." from http://www.microsoft.com/visualstudio/eng/products/visual-studio-2010-express and npm install -g karma ran without errors.

Categories : Visual Studio

karma command not found when karma already installed
Try re-installing node.js. There are lots of ways to install it, but I recommend downloading from nodejs.org If that doesn't work, you may try to re-install karma.

Categories : Osx

Karma Test Runner And Closure Library "NOT SERVED FILE"
tl;dr; You need to add {pattern: 'lib/goog/deps.js', included: false, served: false} to your files list, where lib/goog/deps.js is the path to the deps.js file in your version of closure-library. Alright, so I dug into the Karma web server and the Karma closure plugin and found the problem. The problem is in web-server.js on line 103, caused by the fact that a file dependency is missing. Currently the karma-closure plugin doesn't report an error when there is a missing dependency and instead adds a file pointer with a path of undefined, which eventually causes the web-server.js file to blow up (which is what you're seeing). In my case I had missed doing the preprocessor on all of my files, so one of my projects dependencies wasn't getting mapped causing it to blow up. In your case it lo

Categories : Angularjs

Loading a mock JSON file within Karma+AngularJS test
I was looking for the same thing. I'm going to try this approach. It uses the config files to include the mock data files, but the files are a little more than json, because the json needs to be passed to angular.module('MockDataModule').value and then your unit tests can also load multiple modules and then the value set is available to be injected into the beforeEach inject call. Also found another approach that looks promising for xhr requests that aren't costly, it's a great post that describes midway testing, which if I understand right lets your controller/service actually retrieve data like in an e2e test, but your midway test has actual access to the controller scope (e2e doesn't I think).

Categories : Angularjs

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 unit test from command prompt fails
I encountered a similar error message a while back. If I remember correctly, the following was the crux of the issue: (it may not be 100% relevant for the OP, but it might be useful to somebody who hits this down the line). The problem was that my unit tests all failed in Release mode with an exception complaining about the availability (or lack thereof) of the SQLite.Interop.dll. I realised that when built in Debug mode, the binDebug folder had 2 sub folders (x64 and x86) each with a copy of SQLite.Interop.dll but, in Release mode these files/folders did not exist. To resolve it, I created the x64 and x86 folders in my project and added the appropriate version of SQLite.Interop.dll too them, setting the Copy to ouput setting to Copy if newer. (I had originally used 'Copy always' but it

Categories : C#

Error "Unable parse file browser.yml" when running a test with Magento automation test framework
I've resolved this by upgrading the Symfony Yaml package to the latest version: pear channel-discover pear.symfony-project.com pear install symfony/YAML Seems that the "---" syntax is supported on v. 1.0.6 (the latest stable at this moment).

Categories : Magento

Single-line comments preventing functions from running, multi-line comments do not cause issue, why?
// will comment the whole line So that whatever you are added in that line will become commented, but /**/ will only consider the content which will come under /* and */.So even if you have added anything after */ will not be considered as comment. See this LINK

Categories : PHP

Can't call py.test .py from command line?
The system is telling you: py.test is not installed in a standard location. If you installed using pip or easy-install, it should be in /usr/local/bin or possibly /opt/bin depending on your flavour of Linux, and these should be on your path. py.test has not been marked as executable. You installed from source using setup.py and the directory containing py.test is not on your path, probably in or below your home directory. Check for these possibilities, correct them if necessary and post the results of your efforts.

Categories : Python

How do I unit test command line flags in Go?
I'm not sure whether we agree on the term 'unit test'. What you want to achieve seems to me more like a pretty normal test in a program. You probably want to do something like this: func main() { flag.Parse() if formatType != text || formatType != json || formatType != hash { flag.Usage() return } // ... } Sadly, it is not easily possible to extend the flag Parser with own value verifiers so you have to stick with this for now. See Intermernet for a solution which defines a custom format type and its validator.

Categories : Unit Testing

How to test command line scripts with nose?
Use the "if __name__ == "__main__":" idiom in your scripts and encapsulate all of the function-ality in function-s. Then you can import your scripts into another script (such as a unit test script) without the body of it being executed. This will allow you to write unit-tests for the functionality and run them through nose. I recommend keeping the "main" block to a line or two. For example: plus_one.py #!/usr/bin/env python import sys def main(args): try: output(plus_one(get_number(args))) except (IndexError, ValueError), e: print e return 1 return 0 def get_number(args): return int(args[1]) def plus_one(number): return number + 1 def output(some_text): print some_text if __name__ == '__main__': sys.exit(main(sys.argv))

Categories : Python

How do I test a command-line program with PHPUnit?
One way is to use the backtick operator (`) to capture the output of the program, then examine that output. This works well under Unix/Linux-style OSes, as you can also capture error outputs like STDERR. (It is more painful under Windows, but can be done (especially using Cygwin).) For example: public function testHelp() { $output = `./add-event --help 2>&1`; $this->assertRegExp( '/^usage:/m', $output, 'no help message?' ); $this->assertRegExp( '/where:/m', $output, 'no help message?' ); $this->assertNotRegExp( '/where event types are:/m', $output, 'no help message?' ); } You can see that both STDOUT and STDERR were captured to $output, then regex assertions were used to test whether the output resembl

Categories : PHP

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

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

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

How to test RSpec tests output in command line
One way would be to refactor the code so that it takes an IO object as input and gives its output by calling puts on that. In normal use, use $stdout but in your tests use a StringIO object. If that is not feasible, you might consider inside your tests defining a special puts method in the class being tested. This would hide the real puts method.

Categories : Ruby

Passing each line of a file as command line argument to a binary file
Something this simple would normally be best handled by a "scripting" language, but it's pretty straight foreward in C++ as well. If you're reading your file from standard in: std::string args; while ( std::getline( std::cin, args ) ) { system( ("temp " + args).c_str() ); } should be all you need. (But you don't say what you want to do if temp fails.)

Categories : C++

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

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

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

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

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

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

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

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

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

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#

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

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



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