command-line-interface

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

大兔子大兔子 提交于 2019-11-30 06:40:51
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 there, but produces an output too long, and I have to remember to enable it. I am just looking for a

How to escape strings for terminal in Ruby?

风格不统一 提交于 2019-11-30 06:06:19
I am attempting to start mplayer. My filename contains spaces and these should be escaped. This is the code I am using: @player_pid = fork do exec "/usr/bin/mplayer #{song.file}" end where #{song.file} contains a path like "/home/example/music/01 - a song.mp3" . How can I escape this variable properly (and possible other weird characters that the title may contain) so the terminal will accept my command? Shellwords should work for you :) exec "/usr/bin/mplayer %s" % Shellwords.escape(song.file) In ruby 1.9.x, it looks like you have to require it first require "shellwords" But in ruby 2.0.x, I

Start a process in background, do a task, then kill the process in the background

蓝咒 提交于 2019-11-30 05:06:44
问题 I have a script that looks like this: pushd . nohup java -jar test/selenium-server.jar > /dev/null 2>&1 & cd web/code/protected/tests/ phpunit functional/ popd The selenium servers needs to be running for the tests, however after the phpunit command finishes I'd like to kill the selenium-server that was running. How can I do this? 回答1: When the script is excecuted a new shell instance is created. Which means that the jobs in the new script would not list any jobs running in the parent shell.

Passing an fstream (or equivalent) from C# to C++ through CLI

感情迁移 提交于 2019-11-30 03:30:47
问题 How can I pass an fstream or equivalent from C# through CLI to an unmanaged C++ DLL? Rough application outline: C# application reads a binary file from a database Unmanaged C++ dll is used to "decode" this file and return the information contained therein I can modify any of the C# code. The CLI wrapper is the only portion of the C++ side that I can modify. I'm currently saving the binary file to disk and passing the path of it to the CLI wrapper where it is opened as an fstream. This is fine

Run system command in ruby and interact with it

青春壹個敷衍的年華 提交于 2019-11-30 03:11:20
问题 I need to run a command on the command-line that asks for a user response. In case it helps the command is: gpg --recipient "Some Name" --encrypt ~/some_file.txt when you run this, it warns about something then asks: Use this key anyway? (y/N) Responding 'y' let's it finish correctly. I have been trying to use the open4 gem but I have not been able to get it to specify the 'y' correctly. Here is what I tried: Open4::popen4(cmd) do |pid, stdin, stdout, stderr| stdin.puts "y" stdin.close puts

Bash - find a keyword in a file and delete its line [duplicate]

為{幸葍}努か 提交于 2019-11-30 02:52:02
问题 This question already has answers here : Delete lines in a text file that contain a specific string (14 answers) Closed 6 years ago . I'd like to give a keyword, find the line where this keyword aṕpears in a file and erase the entire line. This is what I got but it is not working as it should: KEYWORD='domain.com' cat /etc/hosts | grep -v "$KEYWORD" > /etc/hosts UPDATE This is what worked for me: sed -i_bak -e '/domain\.com/d' /etc/hosts However, as I had two lines with "domain.com", is there

macOS Command Line Tool with Swift Cocoa Framework: Library not loaded

北城余情 提交于 2019-11-30 02:49:21
The following error is thrown when trying to run my target: dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: x/Xcode/DerivedData/x/Build/Products/Debug/PriorityQueue.framework/Versions/A/PriorityQueue Reason: image not found My target is a Command Line Tool (macOS) written in Swift. I'm using a Cocoa Framework (PriorityQueue) written in Swift. When I set EMBEDDED_CONTENT_CONTAINS_SWIFT to YES on the Framework , the target runs with the following warnings: objc[99144]: Class _TtC10Foundation15NSSimpleCString is implemented in both x/PriorityQueue.framework/Versions/A

How to change port number in vue-cli project

旧时模样 提交于 2019-11-30 02:38:19
How to change Port number in Vue-cli project so that it run's on another port instead of 8080. The port for the Vue-cli webpack template is found in your app root's myApp/config/index.js . All you have to do is modify the port value inside the dev block: dev: { proxyTable: {}, env: require('./dev.env'), port: 4545, assetsSubDirectory: 'static', assetsPublicPath: '/', cssSourceMap: false } Now you can access your app with localhost:4545 also if you have .env file better to set it from there If you're using vue-cli 3.x, you can simply pass the port to the npm command like so: npm run serve -- -

Plugin doesn't support this project's cordova-android version. cordova-android: 4.1.1, failed version requirement: >=5.0.0-dev

╄→尐↘猪︶ㄣ 提交于 2019-11-30 02:18:18
问题 I have a problem with cordova CLI, when I try to add a plugin which is in the NPM list of published plugins I get this error: "Plugin doesn't support this project's cordova-android version. cordova- android: 4.1.1, failed version requirement: >=5.0.0-dev" I saw this problem in stackoverflow here:Cordova-plugin-camera is not being loaded; failed version requirement for cordova-android version: >5.0.0-dev But this was due to using the version in Github and the recommended solution was to use

Convert HWND to IntPtr (CLI)

隐身守侯 提交于 2019-11-30 02:10:31
问题 I have a HWND in my C++ MFC code, and I want to pass this HWND to a C# control and get it as IntPtr. What Is wrong in my code, and how can I do it correctly? (I think it's something with wrong using of the CLI pointers, because I get an error that it cannot convert from System::IntPtr^ to System::IntPtr. But I don't know how exactly to make it all to work properly...) My C++ MFC code: HWND myHandle= this->GetSafeHwnd(); m_CLIDialog->UpdateHandle(myHandle); My C# code: public void UpdateHandle