command-line-interface

Creating column family or table in Cassandra while working Datastax API(which uses new Binary protocol)

北城以北 提交于 2019-11-30 21:08:37
I have started working with Cassandra database. I am planning to use Datastax API to upsert/read into/from cassandra database. I am totally new to this Datastax API (which uses new Binary protocol) and I am not able to find lot of documentations as well which have some proper examples. When I was working with Cassandra CLI using the Netflix client(Astyanax client), then I created the column family like this- create column family profile with key_validation_class = 'UTF8Type' and comparator = 'UTF8Type' and default_validation_class = 'UTF8Type' and column_metadata = [ {column_name : crd,

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

ⅰ亾dé卋堺 提交于 2019-11-30 19:38:38
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 for test purposes, but won't work for production for obvious reasons. I've also looked into passing a

How to invoke octave script in unix shell

青春壹個敷衍的年華 提交于 2019-11-30 19:34:23
问题 I have written an octave script file (.m) If anyone could point me out on how to run octave scripts on unix shell that would be really helpful. I do not want to execute the script by invoking octave program. I am new to unix and octave. Thanks in advance 回答1: Yes, of course you can write an Octave program. Like so: $ cat octave_program #!/usr/bin/env octave ## Never forget your licence at the top of the files. 1; function [rv] = main (argv) disp ("hello world"); rv = 0; return; endfunction

'ng new my-app' error

北城余情 提交于 2019-11-30 19:01:52
问题 I am trying to generate a new project and skeleton application using the latest version of Angular. I have tried uninstalling and reinstalling Angular CLI using: C:\>npm install -g @angular/cli@latest C:\>ng --version @angular/cli: 1.4.5 node: 8.8.1 os: win32 x64 This error occurs when trying to run 'ng new my-app' in command prompt: 'Error: The command "new" has an option without the required type and name field' Any help to resolve this issue is appreciated. 回答1: This is a known issue and

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

孤人 提交于 2019-11-30 18:34:34
This question already has an answer here: Delete lines in a text file that contain a specific string 14 answers 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 a way to tell sed to erase only the line where the exact keyword "domain.com" appears This is the original content of /etc

Python: cmd execute last command while prompt and empty line

戏子无情 提交于 2019-11-30 18:29:21
The question may be not clear enough to get. Let me clear in details. I'm using python cmd library to implement my own CLI framework and when hit the enter button without typing any command it executes last command. This it not one I wanna do. mycli~: cmd --args executes command execution stops mycli~:[hit enter button] Then it will execute again cmd --args. However I just want to go down with new line. def emptyline(self): pass Will do just fine! After a long googling I could not find a valuable advise to prevent this. I decide to go inside the cmd library and override the method. I figured

How to retrieve the timestamp from cassandra?

随声附和 提交于 2019-11-30 17:51:03
In the below cassandra, "get result"..we can able to retrieve the column name and values. But how to retrieve the timestamp..Is there any better idea to get the values by using timestamp [default@sample]get user[bob]; => (column=name, value=bobdroid, timestamp=1335361733545850) => (column=email, value=bob@gmail.com, timestamp=1335361733545850) => (column=age, value=23, timestamp=1335361733545850) => (column=password, value=MTIz, timestamp=1335361733545850) Returned 4 results. Elapsed time: 4 msec(s). It's not recommended to use column Cassandra timestamps directly in client code; ideally, you

Using jq, convert array of objects to object with named keys

一个人想着一个人 提交于 2019-11-30 17:41:32
Given a json file in the format as : [ { name : "A", value : "1" }, { name : "B", value : "5" }, { name : "E", value : "8" } ] How would I convert it to something like this using jq: { "A" : { name : "A", value : "1" }, "B" : { name : "B", value : "5" }, "E" : { name : "E", value : "8" } } jq '{(.[].name) : "the name"}' 'myfile.json' gets me an object with [].name keys but how do I assign the object to it? map( { (.name|tostring): . } ) | add (The tostring is for safety/robustness.) INDEX/1 If your jq has INDEX/1 (introduced after the release of version 1.5), you can simply write: INDEX(.name)

Test whether the actual output is a terminal or not in node.js

回眸只為那壹抹淺笑 提交于 2019-11-30 17:09:25
I'm writing a command line interface for one of my programs, and I would like to use the colorized output of winston if it's appropriate (the output is a terminal and it's not redirected to a file). In bash it can be done with the -t test as this SO answer correctly says. But I'm looking for the node.js alternative for testing this. loganfsmyth Similarly to the bash examples you link to, Node has the 'tty' module to deal with this. To check if output is redirected, you can use the 'isatty' method. Docs here: http://nodejs.org/docs/v0.5.0/api/tty.html#tty.isatty For example to check if stdout

$_SERVER['argv'] with HTTP GET and CLI issue

倖福魔咒の 提交于 2019-11-30 15:57:09
问题 I'm trying to write down a script to fetch some online data; script should be invoked either by a cron job or php cli and with standard GET HTTP request . As stated on PHP website $_SERVER['argv'] should fit my needs: Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string. However i can't get it to work with standard HTTP GET request. $