command-line-interface

How to suppress output and check whether or not a command is successful?

孤者浪人 提交于 2019-12-10 11:31:37
问题 I am trying to write a powershell script that tests if a MySQL login is successful by using $? to check if an error occurs. I also want to suppress all output - successful or not successful - from the command. These are the things I've tried: mysql -u root --password=mypass -e "show databases" If ( $? ) { echo "Hooray!" } Else { echo "Boo!" } This works correctly but doesn't suppress any output. mysql -u root --password=mypass -e "show databases" > $null Works correctly still but does not

Windows 10 CLI UTF-8 encoding

℡╲_俬逩灬. 提交于 2019-12-10 10:36:49
问题 Problem: On an english Windows 10 using slovenian keyboard layout, all command line interfaces seem to have a problem with displaying (printing) UTF-8 characters, namely č, š and ž, which are replaced with ?. (I assume all UTF-8 specific characters, since ć and đ also do not work. ) Tested in: CMD, Powershell, Cmder on Windows 10 64-bit English - Slovenian keyboard layout ... unsuccessful Intellij IDEA on Windows 10 64-bit English language - Slovenian keyboard layout ... successful -> Works

Add pubnub to angular2 cli project

≡放荡痞女 提交于 2019-12-10 10:31:40
问题 I want to add PubNub to an angular2-cli project. The problem is with the linking; however, I followed the instructions of the pubnub-angular2 package on npmjs.com. When I try to load it in the browser, the error message is this: EXCEPTION: PubNub is not in global scope. Ensure that pubnub.js v4 library is included before the angular adapter In the app.module.ts , I have the following: import {BrowserModule} from '@angular/platform-browser'; import {NgModule} from '@angular/core'; import

Inspect network traffic from simple linux cli app

风格不统一 提交于 2019-12-10 09:41:42
问题 I'm running a small app on the command line, and I'm trying to watch the (http) network traffic it creates. Is there some kind of wrapper program (like 'time', or 'watch') which can display all network traffic to and from my app? (Or at least, make a copy of it in a file) 回答1: Use tcpdump in command line or wireshark in desktop. For example, to capture web traffic. tcpdump -s0 -i any -wfile.pcap port 80 To watch it directly remove the -wfile.pcap To read a previously saved file tcpdump -r

Why does Doctrine 2 create ~Entity.php file?

心已入冬 提交于 2019-12-10 09:36:54
问题 When I generate my entities I have a file prefixed with ~ like a backup file or something Is it a bug or you need to manually remove them? 回答1: From the official documentation in Symfony2 CLI command: $> php app/console help doctrine:generate:entities .... By default, the unmodified version of each entity is backed up and saved (e.g. Product.php~). To prevent this task from creating the backup file, pass the --no-backup option: php app/console doctrine:generate:entities Blog/Entity --no

How to write using BCP to a remote SQL Server?

北城余情 提交于 2019-12-10 09:27:15
问题 I have a remote SQL Server with a hostname I am using to connect to. BCP suggests to use bcp DBName.dbo.tablename in C:\test\yourfile.txt -c -T -t However when I try this it does not connect to DBName as that is not a valid alias. I get native error 2. How to I run BCP but specify an internet / network address to connect to, not an MSSQL server name? 回答1: How to I run BCP but specify an internet / network address to connect to, not an MSSQL server name? You can specify the IP address (here

CakePHP Bake Shell Error: Database connection “Mysql” is missing, or could not be created

徘徊边缘 提交于 2019-12-10 03:54:23
问题 I have an issue here with baking. I've read the previous answers to similar questions, but the solutions seem to not apply here. I can't bake because the error I receive is: Database connection “Mysql” is missing, or could not be created If I run which php the PHP it's reading is the correct path within MAMP. If I check the PDO modules: php -i | grep "PDO" PDO PDO support => enabled PDO drivers => sqlite, pgsql, mysql PDO Driver for MySQL => enabled PDO Driver for PostgreSQL => enabled PDO

PHP vs BASH for CLI scripting? [closed]

天涯浪子 提交于 2019-12-10 03:54:08
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I have never used PHP with CLI, but I have seen scripts running with PHP code. I was wondering: Why should we use BASH, when PHP is so popular and is able to run in CLI? What are the pros and cons with each one? Should I use PHP for all CLI scripting in the future? 回答1: It is

How to use the --verbose flag in the MySQL 5.6 command line client?

不羁的心 提交于 2019-12-10 03:06:01
问题 Going by the list of flags here, with the line at the top about usage: Usage: mysql [OPTIONS] [database] . I am running Windows 8; my table is "contact"; I want to create a tee file for source C:/myfile.sql with the verbose option on. I have tried mysql -v contact , -v contact , --verbose contact , --verbose source C:/myfile.sql , and various others. EDIT: adding screenshot of where I'm trying to run this, in case it helps. 回答1: The correct syntax for a verbose interactive session is: c:\>

Xdebug laravel artisan commands

偶尔善良 提交于 2019-12-09 18:06:14
问题 I regularly use xdebug to debug applications, I've built a laravel application that takes an upload of a csv inserts the data to the database and the ids to a job queue. I've written an artisan command to be run via cron to then do something with this data. Xdebug works for accessing the site via the browser, but its not breaking on breakpoints when ran from cli. I run php5-fpm. My files /etc/php5/fpm/php.ini and /etc/php5/cli/php/ini both contain the following settings: zend_extension=/usr