cli

PHP CLI Application on Debian: why can't I output a line break?

Hello! I have a really puzzling problem: I am writing a PHP CLI application running on a debian server. I am connected to the server via SSH, just the normal way. Everything runs as usual. Except the following: echo "My CLI fun\n\n"; echo "Is this."; Outputs on the SSH terminal, when executing the PHP script: My CLI funIs this. I ...

PHP Segmentation fault when started from crond

Hello, I've a php script that's started each minute from cron. It almost always runs without any problem, except for about 10 times within 24h. The times it fails I get a segmentation fault like: bin/sh: line 1: 21815 Segmentation fault /usr/bin/myscript The number after "line 1:" is always different. I'm running: PHP 5.2.6-1+l...

Lock statement vs Monitor.Enter method.

I suppose it is an interesting code example. We have a class, let's call it Test with Finalize method. In Main method here is two code blocks where i am using lock statement and Monitor.Enter call. Also i have two instances of class Test here. The experiment is pretty simple - nulling Test variable within locking block and try to collec...

PHP SASL(PECL) sasl_server_init(app) works with CLI but not with ApacheModule

I have written a simple auth script so that Webusers can type in their username and password and my PHP script verifies them by SASL. The SASL Library is initialized by php function sasl_server_init("phpfoo"). So phpfoo.conf in /etc/sasl2/ is used. phpfoo.conf: pwcheck_method: saslauthd mech_list: PLAIN LOGIN log_level: 9 So ...

C CLI game concept

So I just wanted to get some opinions on the overall structure of a game I have to build for a programming class. Essentially - I'm building two programs - a client and a server for a battleships game. I've already written the actual program which plays the battleships game. The program I've written is where a map and rules file is read...

Getting 'choice' to work in Highline Ruby Gem without error and getting variable from it

I'm having a couple of problems using Highline in Ruby, and trying to get the choice element, detailed here, to work. At the moment the following code produces the error "error: wrong number of arguments (0 for 1). Use --trace to view backtrace" How do I get the variable out of choice? At the moment I have the 'do' setup, but I have ...

how to use console use in Symfony2

I found the console and run it like this: root@valugi-laptop:/var/www/sandbox/hello# php console Symfony version 2.0.0-DEV - hello Usage: Symfony [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v Increase verbosity of messages. --versi...

PHP CLI application debug in ZendStudio (STDIN)

0 I am trying to debug php CLI using Zend Studio. My problem: I can't get user input from keyboard. This is part of code (method in some class): public function getInput($promt = null, $defaultValue = null) { if(!isset($promt)){ $promt = self::$DEFAULT_PROMPT; } echo $promt; $stdin = fopen ( "php://stdin", "r" ...

How to do steps of an API through CLI/ batch mode without GUI

I'm using Audiveris API to generate xml(MusicXML) file once the sheetmusic(e.g. pdf/img file) is being input (i.e. When I give the sheet music (pdf file) location, to generate the xml file out of it (in another location)). Audiveris has its own GUI to do this. But can I do this process of sheetmusic-to-xml without using their GUI, but ...

CLI design and implementation?

I am developing a time management tool for my personal use. I prefer using keyboard over mouse, and on the interface have a general purpose text box which will act like a command line. I have just started thinking about what commands I need, what to use for the command names, how to pass in switches and parameters, and so forth. I wonde...

Reconstruction of java command line arguments

Is there a way to reconstruct the command line arguments passed to Java within a Java program, including the JVM options and classpath option? I have a Java program that needs to restart the JVM and manipulate its bootclasspath (i.e. trying to override some system classes). I use the libc system method to invoke the new JVM. I'm open ...

How do you distinguish your EC2 instances?

The ec2-describe-instances command is not very helpful in distinguishing the instances. Are there command line tools that give a better overview? Perhaps somewhat like http://github.com/newbamboo/manec2 but with support for different regions etc. ...

escape from a linux cli for loop

I'm doing something like this: for f in `find -iname '*.html'`; do scp $f remoteserver:$f; done; I've got through about 3 of the 1000 files and I've decided I want to abort the operation. CTRL+C only escapes the SCP login prompt and takes me to the next one, rather than escaping the for loop. Is there a better way than hitting CTRL+...

Command Line PHP with shell_exec works for root but not others

I have a very simple script that is to test if running a shell_exec (or backtick operator) basically works: #!/usr/bin/php5 <?php echo "This is a PHP script\n"; echo `ls -l /home/stoysnet/`; Unless I run this as root, it always gives me: $ ./foo.php This is a PHP script Warning: _shell_exec(): Permission Denied in /home/stoysnet/f...

Python CLI tool - general parsing question

If possible I would like to use the following structure for a command however I can't seem to figure out how to achieve this in Python: ./somescript.py arg <optional argument> -- "some long argument" Would it be possible to achieve this in a feasible manner without too much dirty code? Or should I just reconsider the syntax (which is p...

Doctrine generate-migrations-diff and migrate

Hi guys, I have tried to execute the cli command ./doctrine generate-migrations-diff and a version file has been created correctly in the right folder. The message is: generate-migrations-diff - Generated migration classes successfully from difference Then I try to execute another cli command ./doctrine migrate and a message appears t...

Pattern for Wrapping Shell Commands in a Class

Despite its inadvisability, using PHP's shell commands to interact with non-php system commands remains a common way of quickly achieving certain results in web applications. Has anyone abstracted out the common use cases into a class library (something in Zend maybe?) that offers a more sane/common way of handling this? Every time I en...

Adding a user control using Windows Form designer

This is probably an incredibly obvious question, but I just can't figure it out. I have a Windows Form managed by the form designer. I'd like to include a custom user control, also managed by the form designer. But I'm unable to get the custom control to show up in the Toolbox, even if I try manually adding it under the "Choose Items......

How to edit an PNG image per pixel via cli?

Say I have an PNG image where I want to change certain pixels to, say, black. How would I do that? My guess is that I should take the ImageMagick route. But how would I change, say, pixel ten from the top and from the left to black? To, say, 2% grey etc? EDIT: Since the comment field doesn´t work for code, this addition is directed t...

Performance of desktop computer vs Amazon EC2, CLI instructions

I am trying to compose a string of CLI commands doing various things to some files in one swoop: Combine a number of aac files into a larger one, 33 files times 10 mb (MP4BOX) Taking a small PNG file and making a few alterations to it (imagemagick) Changing a few tags, including setting the above PNG as the artwork (AtomicParsley) Movi...