command-line-interface

How to pass parameters from command line to $_POST in php-script?

坚强是说给别人听的谎言 提交于 2019-12-28 02:44:06
问题 I know this could sound a little weird but I need to pass some parameters to a $_POST array. Similar to the way apache does it, or any other web server. Unfortunately I couldn't find libapache2-mod-php5 anywhere for my Ubuntu. 回答1: That's not easily doable. You can invoke the php-cgi binary and pipe a fake POST request in. But you'll need to set up a whole lot of CGI environment variables: echo 'var1=123&var2=abc' | REQUEST_METHOD=POST SCRIPT_FILENAME=script.php REDIRECT_STATUS=CGI CONTENT

require_once missing doctrine zend framework

假如想象 提交于 2019-12-25 12:10:03
问题 I'm integrating doctrine with Zend Framework. I've hit an error thrown from cli. It seems Zend_Application_Bootstrap_Bootstrap does not have a require_once for Zend_Application_Bootstrap_BootstrapAbstract. Has anyone hit this? my cli-config.php <?php $classLoader = new \Doctrine\Common\ClassLoader('App', __DIR__ . "/../application/models"); $classLoader->register(); $classLoader = new \Doctrine\Common\ClassLoader('Cms', __DIR__ . "/../application/modules/cms-modules/models"); $classLoader-

require_once missing doctrine zend framework

倾然丶 夕夏残阳落幕 提交于 2019-12-25 12:09:40
问题 I'm integrating doctrine with Zend Framework. I've hit an error thrown from cli. It seems Zend_Application_Bootstrap_Bootstrap does not have a require_once for Zend_Application_Bootstrap_BootstrapAbstract. Has anyone hit this? my cli-config.php <?php $classLoader = new \Doctrine\Common\ClassLoader('App', __DIR__ . "/../application/models"); $classLoader->register(); $classLoader = new \Doctrine\Common\ClassLoader('Cms', __DIR__ . "/../application/modules/cms-modules/models"); $classLoader-

Convert strings to bash escaped form

ぐ巨炮叔叔 提交于 2019-12-25 11:51:41
问题 How to make normal strings (filenames in my case) to Linux CLI/bash escaped strings? Examples: "It's a great weather today" -> "It\'s\ a\ great\ weather\ today" "Wind [Wine]" -> "Wind\ [Wine]" "/Downloads/RPM's/" -> "/Downloads/RPM\'s/" I would like to know if there's an easier way to do that, as I am reading filenames in my python script and when I am forwarding them to a bash command, it's failing. The problem is the number of files are too many and it won't be possible for me to rename or

apc_clear_cache not working from command line in php

假如想象 提交于 2019-12-25 07:59:46
问题 I have a php script which clears apc. The script is working fine, when I opening it using browser, but when I am running that file from command line, it is not clearing cache. I checked for apc.enable_cli setting, and that is also on (check the screenshot). And here is my php-code <?php if (isset($argv[1])) { $key = $argv[1]; $info = apc_cache_info("user"); foreach ($info['cache_list'] as $obj) { if (strstr($obj['info'], $key)) { apc_delete($obj['info']); } } } else { apc_clear_cache("user");

Change Activation-Config-Property on deployment via JBoss CLI

断了今生、忘了曾经 提交于 2019-12-25 05:12:11
问题 We would like to deploy an EAR containing message driven beans with JBoss CLI. For each environment there are different activation config property values. Our question: is it possible to change the values of the activation config properties after deploying the EAR with JBoss CLI? We know we could use property substitution. However this seems to set the activation properties at server startup. In contrast we would like to change the values at any time (maybe as long as application is disabled)

Visual C++ Detect a Right Click on a Button

纵饮孤独 提交于 2019-12-25 03:34:24
问题 I have a program where I want a right click on a button to do a completely different amount of code. I have the code display a messagebox for the example, but eventually it will just be a method call each. I'll show you the context in which I need it. Any and all help on how to detect a right click will help. Here's the snippet of code I have: private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { String^ buttonName = safe_cast<Button^>(sender)->Name; safe_cast

How to determine if a stream is STDIN in PHP

被刻印的时光 ゝ 提交于 2019-12-24 23:42:05
问题 I'm working on some PHP cli tools for a php framework and there's a situation where my script either reads from a file or STDIN . Since not all operations (like fseek() ) are valid on STDIN , I'm looking for a way to detect this. 回答1: Turns out that the function stream_get_meta_data() provides a solution, when called on standard in, the result is: array(9) { ["wrapper_type"]=> string(3) "PHP" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "r" ["unread_bytes"]=> int(0) ["seekable"]=>

MySQL: Directive for all columns to run through substring?

冷暖自知 提交于 2019-12-24 23:28:40
问题 I am working with a MySQL database on the CLI which has a few rows that each contain hundreds of characters. I therefore use substring(columnName,1,20) on each one for each query. This is tedious! Is there any directive that I can give so that all queries will run the columns through substring? Thanks! 回答1: CREATE VIEW TableStripped AS SELECT AcolumnThatDoesntNeedStripping , BcolumnThatDoesntNeedStripping , ... , SUBSTRING(columnA, 1, 20) , SUBSTRING(columnB, 1, 20) , SUBSTRING(columnC, 1, 20

Custom build task is not deleted

不羁岁月 提交于 2019-12-24 19:06:12
问题 I'm trying to delete a Build Task using tfx-cli . C:\Users\Work>tfx build tasks list TFS Cross Platform Command Line Interface v0.4.11 Copyright Microsoft Corporation id : 122d5ad0-61a1-11e6-b9c1-5b12bd371fa9 name : VersionAssembly friendly name : Version Assembly visibility : Build description : Update the assembly version number to match the build number version : 1.0.9 I now have the Task ID. C:\Users\Work>tfx build tasks delete --task-id 122d5ad0-61a1-11e6-b9c1-5b12bd371fa9 TFS Cross