command-line-interface

Examining Berkeley DB files from the CLI

喜你入骨 提交于 2019-11-28 17:00:51
问题 I have a set of Berkeley DB files on my Linux file system that I'd like to examine. What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI utility to be able to take a look inside without having to start writing scripts. 回答1: Check out the db-utils package. If you use apt, you can install it with the following: apt-get install db-util (or apt-get install db4.8-util or whatever version

How can I get XDebug to run with PHPUnit on the CLI?

夙愿已清 提交于 2019-11-28 16:37:28
问题 I've tried running the following CLI command: phpunit -d xdebug.profiler_enable=on XYZTestCase.php but it just runs as normal. Can anyone point me in the right direction?? Thx! Here's the XDebug settings: xdebug xdebug support => enabled Version => 2.1.2 Supported protocols => Revision DBGp - Common DeBuGger Protocol => $Revision: 1.145 $ Directive => Local Value => Master Value xdebug.auto_trace => Off => Off xdebug.collect_assignments => Off => Off xdebug.collect_includes => On => On xdebug

Git error on git pull (unable to update local ref)

大兔子大兔子 提交于 2019-11-28 16:10:13
I only have branch master and im getting this error every time i try to "git pull": error: Couldn't set refs/remotes/origin/master From /var/lib/git/xxx/project ! a0f80ea..49177a3 master -> origin/master (unable to update local ref) and when i do "git pull origin master" i get: error: Couldn't set ORIG_HEAD fatal: Cannot update the ref 'ORIG_HEAD'. i have been searching but cant find why My team and I ran into this error, unable to update local ref , when doing a pull in SourceTree. We used : git gc --prune=now This removes any duplicate reference objects which should fix the issue. Here are a

How to distinguish command-line and web-server invocation? [duplicate]

浪子不回头ぞ 提交于 2019-11-28 16:03:34
Is there a way to distinguish if a script was invoked from the command line or by the web server? ( See What is the canonical way to determine commandline vs. http execution of a PHP script? for best answer and more detailed discussion - didn't find that one before posting) I have a (non-production) server with Apache 2.2.10 and PHP 5.2.6. On it, in a web-accessible directory is my PHP script, maintenance_tasks.php . I would like to invoke this script from the command line or through a HTTP request (by opening in a browser). Is there some variable that allows me to reliably determine how

Redirect stdout pipe of child process in Go

浪尽此生 提交于 2019-11-28 15:15:41
I'm writing a program in Go that executes a server like program (also Go). Now I want to have the stdout of the child program in my terminal window where I started the parent program. One way to do this is with the cmd.Output() function, but this prints the stdout only after the process has exited. (That's a problem because this server-like program runs for a long time and I want to read the log output) The variable out is of type io.ReadCloser and I don't know what I should do with it to achieve my task, and I can't find anything helpful on the web on this topic. func main() { cmd := exec

Switch php versions on commandline ubuntu 16.04

◇◆丶佛笑我妖孽 提交于 2019-11-28 15:12:40
I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04 I know with Apache as my web server, I can do a2enmod php5.6 #to enable php5 a2enmod php7.1 #to enable php7 When I disable php7.1 in Apache modules and enable php 5.6, Apache recognizes the change and uses php 5.6 interpreter as expected. But when I run internal php web server from the commandline: php -S localhost:8888 php handles requests using php 7, how do I switch between php 6.6 and php 7.1 in the commandline ? Interactive switching mode sudo update-alternatives --config php Manual Switching From PHP 5.6 => PHP 7.1 Default PHP 5

Command-line svn for Windows?

余生颓废 提交于 2019-11-28 13:39:58
问题 Is there a command-line based version of svn for Windows? I know I can get TortoiseSVN, but that just doesn't work for me. 回答1: Newer versions of TortoiseSVN contain a console svn client, but by default the corresponding option is not checked. The svn.exe executable is not standalone and it depends on some other files in the distribution but this should not be a problem in most cases. Once installed you might need to add the folder containing svn.exe to the system PATH as described here so

Git commit in terminal opens VIM, but can't get back to terminal

江枫思渺然 提交于 2019-11-28 13:08:47
问题 Trying to learn GitHub at the moment and doing this Git essentials tutorial over at nettuts. I'm on the lesson about making commits. The teacher types git commit and it opens VIM as his editor (I'd also like to know how to make it open up in Sublime Text 2 instead) anyways it opens in VIM and I add in 1 line saying this is my first commit and hit save. Next it then prompts me to save the output to the desktop, something I did not see in his screencast. Now I'm still in VIM and not sure how to

Printing to printers in PHP

一世执手 提交于 2019-11-28 11:46:55
I'm trying to set up a CLI PHP application to print a set of web pages to a default or specified printer. I'm on a Windows 7 machine with PHP 5.2.11 running in a CLI. To test the print functionality I've loaded PHP_printer.dll and I'm printing to Onenote, a print to file option, using the exact printer name given in PRINTER_ENUM_LOCAL. Update : Here's the latest code: $handle = printer_open("Send To OneNote 2010"); printer_start_doc($handle, "My Document"); printer_start_page($handle); $filename='index.html'; $fhandle=fopen($filename, 'r'); $contents = fread($fhandle, filesize($filename));

Python interactive CLI application?

别来无恙 提交于 2019-11-28 10:57:23
I'm not even sure what these would be called? I used to write them in ADA running on VAX-VMS! I want to make a simple menu-driven application that would let me display menus and use the cursor keys to navigate around them, choose items and navigate around the app. All fully old school text based. I want to be able to take over the whole terminal window and display stuff in different places. Is this possible in Python? Check out the Python HOWTO on Curses Programming with Python and here is the library reference . Another easy to use library is Urwid - Console User Interface Library. http:/