command-line-interface

Flush disk write cache from Windows CLI

孤人 提交于 2019-12-03 10:38:23
Does anyone know how to flush the disk write cache data from the cache manager for the current directory (or any given file or directory, for that matter), from a Windows command line? I found the SysInternals Sync worked well for me - although it flushes ALL cache, not just for the specific folder. Example of usage: IF EXIST Output RD /S /Q Output && Sync && MD Output By default it flushes all cached data for all drives - you can specify command-line options to restrict which drives but you cannot restrict it to just specific folders. Without it I would often get Access denied errors because

Apache Commons CLI : Getting list of values for an option

若如初见. 提交于 2019-12-03 10:28:48
For a CLI, I have a requirement to pass in an array of ints as input for a particular option. Example - The below command would take in an array of customerIds and perform some operations. myCommand -c 123 124 125 I have implemented the CLI using Apache commons CLI, and I am using getOptionValues("c") to retrieve this array. The problem is that, this is returning only the first element in the array, i.e. [123], while I am expecting it to return [123, 124, 125]. A condensed version of my code, CommandLine cmd; CommandLineParser parser = new BasicParser(); cmd = parser.parse(options, args); if

PHP cli script does not output anything

我的未来我决定 提交于 2019-12-03 09:59:29
So I have a php script which I execute using the following command: php -f my_script.php myArguments The script is under version control using svn. I just updated it, pasted the command to run it into a terminal, and executed it. However, there is no output. Not a failure message, not it printing anything, nothing. It looks like it never starts. Kind of like the following: me:/srv/scripts# php -f my_script.php myArguments me:/srv/scripts# Other scripts will run just fine. It is difficult for me to come up with an SSCCE, as I can't really share the code that is causing this, and I haven't been

Change Python interactive prompt “>>>”

血红的双手。 提交于 2019-12-03 09:51:58
This is probably a silly question, and I'll probably end up deleting it once I figure it out, but I swear I recall reading, in the Python 3.5 docs, how to change the >>> on the Python interactive prompt, such as how calling help() will change it to help> . But for some reason, when I've gone back to try and remember, I just can't find the instructions to it. Does anyone know if this is possible, or am I just imagining things? Thanks Gerrat You remember correctly. It's in the sys module (sys.ps1 & sys.ps2): Strings specifying the primary and secondary prompt of the interpreter. These are only

Linux: create random directory/file hierarchy

早过忘川 提交于 2019-12-03 09:45:25
问题 For testing a tool I need a directory with a whole bunch of different Office files in a deep nested structure. I already have the files in a directory, but now need to create some random nested sub directories and spread out the files in them. I could sit down and write a proper program in a programming language of my choice, but I wonder if there might be a clever combination of Linux command line tools + Bash to achieve what I want. Edit: to clarify, my input is a directory with a about 200

Changing Angular 5 publish url at runtime

≡放荡痞女 提交于 2019-12-03 09:42:37
I want to build an Angular 5 app once, and then publish it to different addresses, for example to: https://sub1.example.com/myapp1 https://sub2.example.com/myapp2 https://sub3.example.com/myapp3 By default, Angular will assume that all files are hosted in / so when i access index.html, it will load scripts such as https://sub1.example.com/vendor.bundle.js which will 404 because it's deploy to /myapp1/vendor.bundle.js (to make it slightly more complex, I'm actually loading the files from a CDN from a separate domain, but I don't think this affects the question): Angular 5 allows me to run: ng

Accessing Sitecore API from a CLI tool

我只是一个虾纸丫 提交于 2019-12-03 09:19:53
I would like to access the Sitecore API from within a command line tool (with a goal of exporting some information about users in the database), however I haven't been able to get a simple CLI program connected. To give a simple example using Sitecore; using Sitecore.Configuration; using Sitecore.Data; using Sitecore.Data.Items; ... static void Main(string[] args) { Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master"); Console.WriteLine(master.Items.ToString()); } As this currently stands, I get the following exception Unhandled Exception: System

Input bar at console bottom in C

喜夏-厌秋 提交于 2019-12-03 08:40:15
问题 Window bottom Some applications like vim, mutt, aptitude contain a top window section for output and a bottom section for the user to type in or for status display. (Suppose there is one child process to output and another one to take user input. The purpose is to allow for updated output at the same time as you are typing the input or viewing the status.) Actions Undo Package Resolver Search Options Views Help C-T: Menu ?: Help q: Quit u: Update g: Download/Install/Remove Pkgs | | | | | ┌───

Email piping with php script

百般思念 提交于 2019-12-03 07:46:30
问题 Hi' I want to forward all the emails(which are come to my inbox) to php script and retrieve email content and save it in a file. So do that I was add email forwarder with piping path correctly. Address to Forward :tickets@ana.stage.centuryware.org Pipe to a Program : /home/centuryw/public_html/stage/ana/osticket/upload/api/pipe.php I have used following script as pipe.php #!/usr/bin/php –q <? /* Read the message from STDIN */ $fd = fopen("php://stdin", "r"); $email = ""; // This will be the

How to solve InnoDB: Unable to lock ./ibdata1 mysql error?

本秂侑毒 提交于 2019-12-03 07:08:38
问题 2016-03-14 02:30:29 58150 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35 2016-03-14 02:30:29 58150 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 回答1: First, list MySQL processes using the ps command: ps aux | grep mysql And then kill the process sudo kill 56311 回答2: Believe it or not, the solution is elsewhere. The problem stems from AppArmor misconfiguration apparently. So just do: $ apt install apparmor-profiles and