command-line-interface

exception 'PDOException' with message 'could not find driver' SQLSRV Laravel Artisan CLI

狂风中的少年 提交于 2019-11-30 15:38:40
问题 I am running php 5.5 on a Windows Server 2008. I am using the Laravel 4.0 framework for the application. I am connecting to a SQL SRV database via PDO, when executed via http there is no issue, connections are made data is called and updated without issue. However when calling a command from Artisan (Laravel's CLI tool) I get the following error in the log: log.ERROR: exception 'PDOException' with message 'could not find driver' in C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src

How do I see high-precision query times in mysql command line?

北城以北 提交于 2019-11-30 13:15:32
问题 I'm working through some optimization work, and I've noticed that in some mysql dumps people post in articles and questions (which I cannot find again now that I'm actually looking), there are high-precision execution times (0.05985215 sec instead of 0.06 sec). How can I see these more precise times for my queries on the command line? EDIT Example of this is: +----------+ | COUNT(*) | +----------+ | 11596 | +----------+ 1 row in set (0.05894344 sec) Using profiling gets me part of the way

how to make a PHP file run-able only through CLI mode?

匆匆过客 提交于 2019-11-30 12:09:30
It's available to browser, but I don't want it to execute when browsed by user, say,when browsed should exit, is there a way to detect whether it's currently Cmmand Line Mode? Paolo Bergantino See: What is the canonical way to determine commandline vs. http execution of a PHP script? Is there any way to know if a php script is running in cli mode? PHP - what is the best & easy way to determine if the current invocation is from CLI or browser Short story: php_sapi_name() . Another trick, $_SERVER has variables that are only set in CLI mode. Here is what i'm using, for a long time now... (since

Understanding Perspective Projection Distortion ImageMagick

只愿长相守 提交于 2019-11-30 11:37:20
问题 For a project I am trying to create a perspective distortion of an image to match a DVD case front template. So I want to automate this using ImageMagick (CLI) but I have a hard time understanding the mathematical aspects of this transformation. convert \ -verbose mw2.png \ -alpha set \ -virtual-pixel transparent \ -distort Perspective-Projection '0,0 0,0 0,0 0,0' \ box.png This code is en empty set of coordinates, I have read the documentation thoroughly but I can't seem to understand what

How to redirect from Audio Output to Mic Input using PulseAudio?

好久不见. 提交于 2019-11-30 11:32:11
I'm working on a mobile app for Maemo/MeeGo and Maemo uses PulseAudio. I want to play a mp3 to caller (and cancel the mic when doing it, and not to listen caller, everything should be done on background), to do this, I have to redirect Audio Output from a certain (if not possible, all) app, fake it as a Input and make Phone app use it. On my Ubuntu PC, I did it with pavucontrol. I created a NULL sink, then: Audio Output (from Amarok) --> to NULL Output Skype Input <-- NULL Output Skype Output --> NULL And It worked, Amarok played the music and It was streaming to Skype, without playing it to

How can I split my Click commands, each with a set of sub-commands, into multiple files?

守給你的承諾、 提交于 2019-11-30 10:25:20
问题 I have one large click application that I've developed, but navigating through the different commands/subcommands is getting rough. How do I organize my commands into separate files? Is it possible to organize commands and their subcommands into separate classes? Here's an example of how I would like to separate it: init import click @click.group() @click.version_option() def cli(): pass #Entry Point command_cloudflare.py @cli.group() @click.pass_context def cloudflare(ctx): pass @cloudflare

Delete files with string found in file - linux cli

江枫思渺然 提交于 2019-11-30 10:16:48
问题 I am trying to delete erroneous emails based on finding the email address in the file via Linux CLI. I can get the files with find . | xargs grep -l email@domain.com But I cannot figure out how to delete them from there as the following code doesn't work. rm -f | xargs find . | xargs grep -l email@domain.com Thank you for your assistance. 回答1: For safety I normally pipe the output from find to something like awk and create a batch file with each line being "rm filename" That way you can check

CLI-Spring Shell in IntelliJ

陌路散爱 提交于 2019-11-30 09:24:01
I am working on a CLI Spring shell code in IntelliJ. I run it and give some parameters. But when I type insert and press enter, console doesn't take it and it appears as if nothing happened! My code: @Component public class HelloWorldCommands implements CommandMarker { @CliCommand(value = "insert", help = "insert data to ParsEMS DB") public void insert() { try { Class.forName("org.postgresql.Driver"); Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ParsEMS", "xxxxxx", "xxxxxxx"); Statement st = con.createStatement(); st.executeUpdate("INSERT INTO node (name,

Passing a variable to PhantomJS via exec

假装没事ソ 提交于 2019-11-30 08:30:11
问题 I'm getting started with Grunt and wanting to pass a variable to a PhantomJS script I'm running via exec. What I want to be able to do is pass a url in for the script to take the screen capture from. Any help would be greatly appreciated, thanks! Darren Grunt script exec('phantomjs screenshot.js', function (error, stdout, stderr) { // Handle output } ); screenshot.js var page = require('webpage').create(); page.open('http://google.com', function () { page.render('google.png'); phantom.exit();

Get cpu percent usage in php

你离开我真会死。 提交于 2019-11-30 07:26:09
问题 I want to show percent CPU usage in PHP. Is not important if get values by cron in shell > output to file > parse in PHP or directly get value in php. I try many solutions found on internet but nothing was useful. With load average I can't display 0-100% graphic bar and functions I found for percentage output give me bad values or only value for first core. It would be nice to get number of percentage usage for every core. Is there solution for this? EDIT: I make temporary solution, it works