command-line-interface

What is the equivalent of sequel pro's just checking “connect using ssl” in mycli?

随声附和 提交于 2019-12-01 22:48:55
When using SequelPro, I have to check "Connect using SSL" option to connect to a remote mysql database server, but without providing "Key File", "Certificate" or "CA Cert", which is shown as the screenshot below: Is there an equivalent way to do it in mycli ? Or just plain mysql command? It's the --ssl option, which means "Enable encrypted connection". mysql --ssl A full list of command-line flags for MySQL CLI ( mysql ) can be found here: https://dev.mysql.com/doc/refman/5.7/en/encrypted-connection-options.html I don't believe that that checkbox does anything as fancy as verifying

How do I select and edit an xml node with xmlstartlet?

心不动则不痛 提交于 2019-12-01 22:46:09
问题 Here I'm selecting the node: $ xmlstarlet sel -t -c "/configuration/property[name='http.agent.name']"/value conf/nutch-default.xml <value/> This doesn't edit it: $ xmlstarlet edit "/configuration/property[name='http.agent.name']"/value -v 'test' conf/nutch-default.xml I/O warning : failed to load external entity "/configuration/property[name='http.agent.name']/value" What would be an xmlstartlet command that does change the change? AFAIK -x is not supported in xmlstartlet yet. I'm working on

php exec() function and different hosts

心不动则不痛 提交于 2019-12-01 22:36:15
I have a script that executes a file in a couple of directories down which looks like this: exec("php-cli $file_path > /dev/null 2>/dev/null &"); //php command-line This works on most hosts but some hosts don't like it and it doesn't run, without generating any error. For the hosts that this fails on, i use exec("php $file_path > /dev/null 2>/dev/null &"); //notice the -cli is gone Which works fine. $file_path is the full path to the file being executed /home/blah/path/blah.php How can i make this uniform so it works on all servers (unix at least) **EDIT* * Well, I'm doing it this way, it is

Creating waiting/busy indicator for executed process

家住魔仙堡 提交于 2019-12-01 21:47:46
i've program which execute child process like cmd := exec.Command("npm", "install") log.Printf("Running command and waiting for it to finish...") err := cmd.Run() log.Printf("Command finished with error: %v", err) While this command is running it download and install npm packages which take some time between 10 to 40 sec, and the user doesnt know what happen until he see the stdout (10-40 sec depend on the network) , there is something that I can use which prints something to the cli to make it more clear that something happen, some busy indicator(any type) until the stdout is printed to the

PHP script won't run in the background

一笑奈何 提交于 2019-12-01 19:41:57
I am trying to run a php CLI script in the background and it just won't run - it has a status of Stopped SIGTOU (Trying to write output) - Here are the details Mac OS X Lion 10.7.2 PHP 5.3.6 with Suhosin-Patch (cli) (built: Sep 8 2011 19:34:00) I created a basic script test.php <?php echo 'Hello world'.PHP_EOL; ?> Here are the results of various tests:- php -f test.php (Hello world gets displayed) php -f test.php >test.log 2>&1 (Hello world gets put into test.log) php -f test.php >test.log 2>&1 & --- I get [1]+ Stopped(SIGTTOU) php -f test.php > test.log 2>&1 -- and the job just sits there

Run a PHP CLI script from a webpage

强颜欢笑 提交于 2019-12-01 19:39:17
问题 I have a (possibly dumb) question. I have a script made in php, constructed for cli usage. Works fine when I run it from the command line, no problem there. The problem is that the site I'm working on has ssh restrictions on the hosting server and I cannot ssh there to run it. Hence my question: how can I run the script from another php that is web-accessible? Already tried with exec(), system(), etc. The main problem is that I need he $_SERVER['SHELL'] variable set, and when the call is

How do I select and edit an xml node with xmlstartlet?

我只是一个虾纸丫 提交于 2019-12-01 19:31:24
Here I'm selecting the node: $ xmlstarlet sel -t -c "/configuration/property[name='http.agent.name']"/value conf/nutch-default.xml <value/> This doesn't edit it: $ xmlstarlet edit "/configuration/property[name='http.agent.name']"/value -v 'test' conf/nutch-default.xml I/O warning : failed to load external entity "/configuration/property[name='http.agent.name']/value" What would be an xmlstartlet command that does change the change? AFAIK -x is not supported in xmlstartlet yet. I'm working on conf/nutch-default.xml $ xmlstarlet ed --help XMLStarlet Toolkit: Edit XML document(s) Usage: xml ed

Cordova adds unwanted permission to AndroidManifest.xml when building from CLI

浪子不回头ぞ 提交于 2019-12-01 17:58:32
I use CLI to build my Cordova app, and I have added the Media plugin. 'cordova build' automatically adds the android.permission.RECORD_AUDIO to my AndroidManifest.xml even though I don't use that permission. So how do I remove it? Each time I build to release, the permission is added to the apk. In your project, edit the file plugins/org.apache.cordova.media/plugin.xml You'll see the android specific configuration <platform name="android"> <config-file target="res/xml/config.xml" parent="/*"> <feature name="Media" > <param name="android-package" value="org.apache.cordova.media.AudioHandler"/>

How to pass multiple variable from php to python script

假装没事ソ 提交于 2019-12-01 17:46:43
问题 I need help on this x-x assuming my php has 3 variables <?php $var1 = "1"; $var2 = "2"; $var3 = "3"; ?> So on the "exec" part im a bit stuck and confused, how do i pass those 3 variable into my python script, and how do i receive those 3 variables in my python script? 回答1: You just pass them as command line arguments: exec ( "/path/to/python/script.py $var1 $var2 $var3" ); Then in your Python script you can read them like this: import sys print sys.argv[1] # first parameter print sys.argv[2]

How to override register_argc_argv in PHP?

笑着哭i 提交于 2019-12-01 17:26:43
I'm using a shared host (fasthostingdirect) and for some reason they have this flag turned off by default. This means I'm unable to access PHP command line parameters... unless I use the -n (= --no-php-info ) flag after php.exe . Have tried ini_set('register_argc_argv', 1) in my php file but it has no effect. Am guessing this is due to the clamped down nature of the hosting provider, however they don't stop the -n option - not sure of the other implications of using this though. Does anyone have any better suggestions? The ini_set('register_argc_argv', 1) does not work because by the time the