command-line-interface

CakePHP 2.x warning SplFileInfo due to cakeshell

空扰寡人 提交于 2019-12-10 17:36:02
问题 I wrote a cakeshell script which I plan to use it using cronjob. while having run it manually (during testing), sometimes my site will throw SplFileInfo Warning e.g: Warning: SplFileInfo::openFile(/var/www/flat/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in /var/www/flat/lib/Cake/Cache/Engine/FileEngine.php on line 313 Warning (512): SplFileInfo::openFile(/var/www/flat/app/tmp/cache/models/myapp_cake_model_default_flat_list): failed to open

Edit text format with shell script

戏子无情 提交于 2019-12-10 17:34:56
问题 I am trying to make a script for text editing. In this case I have a text file named text.csv, which reads: first;48548a;48954a,48594B second;58757a;5875b third;58756a;58576b;5867d;56894d;45864a I want to make text format to like this: first;48548a first;48954a first;48594B second;58757a second;5875b third;58756a third;58576b third;5867d third;56894d third;45864a What is command should I use to make this happen? 回答1: I'd do this in awk. Assuming your first line should have a ; instead of a ,

How long does a mysql_connect stay open?

久未见 提交于 2019-12-10 17:21:34
问题 I have a CLI script which when you first start it: function __construct(){$this->connectToDatabase();} protected function connectToDatabase(){ try{ $this->databaseName = $this->dbname; $this->posName = $this->posName; $this->vlog = $this->vlogName; $this->database = mysql_connect($this->dbhost, $this->dbuser, $this->dbpass); mysql_select_db($this->databaseName, $this->database); } catch(Exception $e){ $this->console($e); } } This CLI script can stay running for days. How do i keep the mysql

Getting pdo_mysql driver to work in CLI

浪尽此生 提交于 2019-12-10 16:46:56
问题 I have a problem with the pdo_mysql extension in CLI. I'm working with a local LAMPP installation and making a info.php file I can see that I have PDO and the mysql driver enabled. But when I write php --ri mysql in the command line it returns Extension 'mysql' not present . I've read both php.ini, the one for CLI and the one that loads for the browser and I can't see no differences in the pdo configuration. PDO is activated for CLI but pdo_mysql is not and I can't find any pdo_mysql.so file

How to convert Swift 3 output of readLine() to Integer?

六眼飞鱼酱① 提交于 2019-12-10 16:33:42
问题 Please don't mark as duplicate until you read the whole thing. This is specific to Swift 3. I have functions that have parameters such as Ints, Floats, etc. I'd like to take the output of readLine() and have Swift accept the output of readLine() as these types, but unfortunately readLine() outputs a String? and when I try to convert it tells me it's not unwrapped. I need help. I'm using Ubuntu 16.04. For example, if I had area(width: 15, height: 15) , how would I replace 15 and 15 with two

How do I update a string attribute with xmlstarlet?

这一生的挚爱 提交于 2019-12-10 16:01:06
问题 $ xmlstarlet edit -L -u "/parse-plugins/mimeType/plugin[@id='parse-html']/@id" -v 'parse-tika' conf/parse-plugins.xml Why doesn't it replace the plugin id of mimetpes currently using parse-html plugin? From xmlstarlet documentation: Update value of an attribute xml ed -u ’/xml/table/rec[@id=3]/@id’ -v 5 xml/tab-obj.xml I'm working on nutch parse-plugins.xml. 回答1: as Mark pointed out, it works! To check that things changed use $ xmlstarlet sel -t -c "/parse-plugins/mimeType/plugin[@id='parse

Executing multiple simultaneous php scripts from CLI

…衆ロ難τιáo~ 提交于 2019-12-10 15:24:28
问题 I have 55 php files that I would like to run simultaneously from the command line. Right now, I am running them in multiple CLI windows using the code: php Script1.php I would like to be able to call one single php file that would execute all 55 php files simultaneously. I have been reading about how to make the command line not wait for the output, but I can't seem to make it work. This thread: How to run multiple PHP scripts from CLI suggests putting an & at the end of the command to run

how to get a .phar file real directory within the phar file code?

假如想象 提交于 2019-12-10 13:06:50
问题 I am trying to create a php executable (a phar file) for generating some files, and I would like to know how to get the real path of the phar file (within the phar file code). What I want to do is to create a folder in the same level of the phar file and create the new files there, but realpath(__DIR__.'/../') does not seem to work. Thanks 回答1: As shown in https://stackoverflow.com/a/28775172/282601 the __FILE__ constant has the full path with the scheme: phar:///home/cweiske/Dev/test/phar

I would like to store all command-line arguments to a Bash script into a single variable

瘦欲@ 提交于 2019-12-10 12:33:06
问题 Let's say I have a Bash script called foo.sh . I'd like to call it like this: foo.sh Here is a bunch of stuff on the command-line And I'd like it to store all of that text into a single variable and print it out. So my output would be: Here is a bunch of stuff on the command-line How would I do this? 回答1: echo "$*" would do what you want, namely printing out the entire command-line arguments, separated by a space (or, technically, whatever the value of $IFS is). If you wanted to store it into

Dotnet CLI build and test – just run the tests

余生长醉 提交于 2019-12-10 11:55:15
问题 **\*test*.dll I want use this schema on dotnet cli but I can't found dotnet test documentation nothing.my project file structure is this way this. At the moment tests It looking at all the .dll files under the .sln file. but I want just looking tests.dll files dotnet test --no-build "**\*test*.dll" //?? All files in my project 回答1: There isn't such a pattern to filter that for dotnet test, we can only filter tests by DisplayName or FullyQualifiedName for xUnit, refer to this link for dertails