command-line-interface

Printing to printers in PHP

半世苍凉 提交于 2020-01-09 10:58:50
问题 I'm trying to set up a CLI PHP application to print a set of web pages to a default or specified printer. I'm on a Windows 7 machine with PHP 5.2.11 running in a CLI. To test the print functionality I've loaded PHP_printer.dll and I'm printing to Onenote, a print to file option, using the exact printer name given in PRINTER_ENUM_LOCAL. Update : Here's the latest code: $handle = printer_open("Send To OneNote 2010"); printer_start_doc($handle, "My Document"); printer_start_page($handle);

install ext-zip for Mac

大兔子大兔子 提交于 2020-01-09 10:17:11
问题 I am trying to run composer update and I get the following errors: Problem 1 - The requested PHP extension ext-zip * is missing from your system. Install or enable PHP's zip extension. Problem 2 - maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. - maatwebsite/excel 3.1.11 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]

install ext-zip for Mac

若如初见. 提交于 2020-01-09 10:15:08
问题 I am trying to run composer update and I get the following errors: Problem 1 - The requested PHP extension ext-zip * is missing from your system. Install or enable PHP's zip extension. Problem 2 - maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. - maatwebsite/excel 3.1.11 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]

The way to distinguish command-mode and insert-mode in Bash's Vi command line editing

折月煮酒 提交于 2020-01-09 08:39:45
问题 I'm always little bit confused when bash in vi-mode is switched to insert-mode, because it doesn't give any tip about used mode (command or edit). Is there any way to distinguish mods? May be automatic change of cursor color or something like that? 回答1: in /etc/inputrc (or ~/.inputrc) add this: set show-mode-in-prompt on this will prefix your prompt with + while in insert-mode, and : while in command mode in bash 4.3 EDIT: in the latest version of bash 4.4, you will instead get a prompt

how to get php cli processes share variables via apc

▼魔方 西西 提交于 2020-01-07 05:43:06
问题 i have apc.enable_cli=1 in php.ini for cli; i tested sharing variables with apc with this script: <?php $apctest=apc_fetch('apctest'); echo "apctest was " . $apctest; echo "\n"; if($argc>1){ $newval=$argv[1]; }else{ $newval='ok'; } echo "setting apctest to " . $newval; echo "\n"; apc_store('apctest',$newval); sleep(30); i runned it with php test_cli_apc.php > /dev/null & and then within 30 seconds runned php test_cli_apc.php but it has outputted "apctest was " , not "apctest was ok" i have

Definition of when finally is executed [duplicate]

我是研究僧i 提交于 2020-01-06 16:54:00
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Conditions when finally does not execute in a .net try..finally block In C# will the finally block be executed in a try, catch, finally if an unhandled exception is thrown? http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java#Finally_Blocks_and_Uncaught_Exceptions states that the finally block doesn't always run. That's wrong, right? The ECMA standard for the CLI (from which C# derives its exception

How to run CLI commands in PHP on another server using SSH?

血红的双手。 提交于 2020-01-06 03:12:23
问题 I am trying to run CLI commands in PHP but on a different server. In order to run the command on the other server I am using the linux ssh command. In order to run the CLI command in PHP I am using exec() . This works... $output = exec('cut -d: -f1 /etc/passwd'); //works! This works from the command line of one server to another... ssh my.otherserver.com "date" But, when I try to do this in PHP it does not work... $output = exec('ssh my.otherserver.com "date"'); //does not work! Is what I am

Mysql export piped to another mysql server using a custom query

你离开我真会死。 提交于 2020-01-05 12:31:33
问题 I am trying to do an export of a table in 1 mysql server and pipe the data directly to the new sql server. Lets say that I have a User Table that has 2 groups of users group = 1 or group = 2 What i want to do is something like: SELECT * FROM `User` WHERE `User`.`group`=1 | mysql -h newhost.com -u root -p dbname newTable Some of these queries will have joins if that makes a difference I have tried: mysql -e"SELECT * FROM `User` WHERE `User`.`group`=1" -u root -pxxxxxxx dbname| mysql -h newhost

Mysql export piped to another mysql server using a custom query

断了今生、忘了曾经 提交于 2020-01-05 12:31:09
问题 I am trying to do an export of a table in 1 mysql server and pipe the data directly to the new sql server. Lets say that I have a User Table that has 2 groups of users group = 1 or group = 2 What i want to do is something like: SELECT * FROM `User` WHERE `User`.`group`=1 | mysql -h newhost.com -u root -p dbname newTable Some of these queries will have joins if that makes a difference I have tried: mysql -e"SELECT * FROM `User` WHERE `User`.`group`=1" -u root -pxxxxxxx dbname| mysql -h newhost

What are some common HDFS commands that can be mapped in the bash files?

只愿长相守 提交于 2020-01-05 05:54:54
问题 I am relatively new to Hadoop and I have been using HDFS CLI a lot. Commands like hdfs dfs -ls are becoming redundant to type. Is it possible to create an alias to this command (i.e., h -ls ) in either the .bashrc or .bash_profile files? Are there any other useful commands that I can map here? 回答1: The good practice is to put aliases in .bash_aliases . For your problem, I'd put alias h="hdfs dfs" in my .bash_aliases file (create it if it doesn't exist) Most distribs will already have this in