w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
xdg-open doesn't work when another command's output is piped to it
Because you have to pass filename as option, and not data on stdin. Use xargs for that: locate file.ext | xargs xdg-open or just subshell: xdg-open "$( locate file.ext )"

Categories : Bash

php - system command parameter output show results in one line using IE
Use this instead of wordwrap: echo nl2br($output); transforms line ending characters ( ) to <br />s or combine: echo wordwrap(nl2br($output), 180, "<br /> "); or use <pre> for preformatted code: echo "<pre>" . wordwrap($output, 180) . "</pre>";

Categories : PHP

Show terminal output without "Press ENTER or type command to continue"
Use :susp or <C-z>. fg in shell to restore vim. Normally scrollback is available through <C-PageUp> though thus avoiding one line scroll at all costs is not necessary.

Categories : Vim

MongoDB workingSet by pymongo
>>> import pymongo >>> c = pymongo.MongoClient() >>> c['admin'].command('serverStatus', workingSet=True)['workingSet'] {u'note': u'thisIsAnEstimate', u'computationTimeMicros': 4555, u'pagesInMemory': 7, u'overSeconds': 388}

Categories : Python

Simple Qt program builds but doesn't show output
You need to create a window if you want to display a label. Basically something like this (not tested): QMainWindow* win = new QMainWindow(); QLabel *label = new QLabel(win, "Hello World!!!"); label->show(); win->show();

Categories : Qt

Piping output from 1 command to other command in an adb shell command line
One way is to create a shell script containing the commands you want and then run the shell script. Since the Android root filesystem is not writeable at run time (usually, unless you have rooted your device and remount it), you can copy the file to the removable (or emulated) storage, for example /sdcard. Then run the script using the command adb shell sh /sdcard/your-script-name. Because each script runs in its own subshell, both of your commands will be executed in the same shell on the device (you can confirm it with ps).

Categories : Android

C++ console ncurses project - QtCreator doesn't show any output in xterm neither in console
Try replacing addstr("Hello world"); with printw("Hello World !!!"); see

Categories : C++

How to redirect time command output in ksh when invoke shell function with dot command?
I tried to reproduce the issue and was not able to: % cat my.sh #!/bin/ksh echo hi % (time . my.sh) 2>&1 | tee my.log hi real 0m0.00s user 0m0.00s sys 0m0.00s % cat my.log hi real 0m0.00s user 0m0.00s sys 0m0.00s If you are still having this issue - please share your my_function.sh and full shell output.

Categories : Unix

different order of command line options in a command affecting my output
getoptlong() is doing exactly what it is supposed to do. The format-string "d:g:hv" implies that the parameters d and g require a value. Anything specified following a command-line parameter is consider a value being passed to it. You should run your program as $program --download file --version Checkout this detailed example demonstrating the various aspects of using getoptlong(). How rm can handle the differing position of its cmd-line params? Apparently because rm's parameters (r, v etc.) do NOT accept any values as arguments. Thus directory does not get passed to any of them but rather is a separate cmd-line argument on its own. You can confirm this from the source-code of rm. To do something similar for your program, you will need to modify the optstring to "dghv" a

Categories : C

Save command output to variable without it printing to standard output
fpings=$( {fping -c 1 -t 1 $ips | sort; } 2>&1 ) should work the {} capture everything and then it redirects both streams (out and err) to just out and saves in the variable

Categories : Linux

Fetching the output of a command executed through os.system() command
Use the subprocess module: subprocess.check_output returns the output of a command as a string. >>> import subprocess >>> print subprocess.check_output.__doc__ Run command with arguments and return its output as a byte string. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute.

Categories : Python

I am using ajax to show the output after entering some data on textfield ,it is not showing proper output?
The approach should be Write onchange event (onchange of textbox content call the process() function) for the text box. or To add a button to triggering the function. => user enters the dish and clicks on button. Approach one (Using jQuery) <!DOCTYPE> <html> <head> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> <!--<script type="text/javascript" src="foodstore.js"></script>--> <script> $(document).on("keyup","#inputuser", function(){ var dish = $(this).val(); $.ajax({ type: "GET", url: 'foodstore.php', data : {food:dish}, success: function(data){alert(data); $('#usererror').html(data); } });

Categories : PHP

(eval (...)) in a flychecker command doesn't work with command symbols
This is the correct form: (flycheck-declare-checker unity-csharp-flychecker "given a c-sharp file, looks for the unity file and then tries to build it using mdtool." :command '("mdtool" "build" (eval (process buffer-file-name))) ...) Thanks for Bruce Conner for getting me to remove the quote before (process ...). That gave me a new error: Error: (void-variable source-original) So I dug into the source and saw there is no symbol substitution before evaluation. I assumed because we were given symbols that just using buffer-file-name wouldn't work, but I tried it and it does. I don't know if there are ramifications for that approach down the road.

Categories : Emacs

Sim command without command window output
You could try using evalc to capture the output to a variable. This way it is not displayed in the command window. for example sim('model') produces output, whereas: myCommandWindowOutput = evalc('sim(''model'')'); doesn't. In fact, you don't even need to assign the output, you could just write: evalc('sim(''model'')'); http://www.mathworks.co.uk/help/matlab/ref/evalc.html

Categories : Matlab

jQuery.hide() hides, but .show() doesn't show them back
$('#content div') hides all div inside #content, even the indirect children of #content element, when you display it back, you are displaying only the direct child div. When you hide the elements, you need to hide only the direct divs Try $('.mainmenuitem').click(function(){ $('#content > div').hide(); $('#' + this.id + '-content').show(); });

Categories : Jquery

How to set the terminal title to show the current running command while it's running and to show it in brackets once it's finished?
You can (ab)use PS1 by putting the same escape sequence in so that every time the prompt is printed, the title gets updated. export PS1="33]2;[$(history 1 | sed 's/^[ ]*[0-9]*[ ]*//g')]07$PS1" The final PS1 just keeps your old prompt for the actual command line. I don't actually use this, but it should work.

Categories : Linux

Cut the output of a command
What about using awk? xm list | awk '/^test2/ {print $2}' I added ^ in /^test/ so that it checks this text in the beginning of the line. Also awk '$1=="test2" {print $2}' would make it. Test $ cat a Name ID Mem VCPUs State Time(s) Domain-0 0 505 4 r----- 11967.2 test1 28 1024 1 -b---- 137.9 test2 33 1024 1 -b---- 3.2 $ awk '/^test2/ {print $2}' a 33

Categories : Linux

How to get raw output from SQL command in C#
Have a look at the InfoMessage event. It may send what you need, I don't have DB2 so that I can test. As an aside, there are other free SQL tools you can find online since you don't have SQL Manager any more. EDIT: I misunderstood. I thought you wanted output like what you get from PRINT statements and some system commands. DarkFalcon's answer is correct... you can do a simple for loop and output reader[i]. You may want to look at the column's data type to assist in formatting the output but you can easily iterate through it all.

Categories : C#

Sort output from ls command
Will this work for you? It prints the files in the order you specified, but it won't print them in color. In order to do that, you'd need to strip the ANSI codes from the names before pattern-matching them. As it is, it will handle filenames with embedded spaces, but not horribly pathological names, like those with embedded newlines or control characters. I think the awk script is fairly self-explanatory, but let me know if you'd like clarification. The BEGIN line is processed before the ls output starts, and the END line is processed after all the output is consumed. The other lines start with an optional condition, followed by a sequence of commands enclosed in curly brackets. The commands are executed on (only) those lines that match the condition. ls -ahlF --color=none | awk '

Categories : Sorting

Print output of AT command
If you mean how to get output from the modem, use read, readline or readlines methods of ser. See tutorial.

Categories : Python

df -h unix command output
try this: df -k | tr -s " " | sed 's/ /, /g' | sed '1 s/, / /g' and see this

Categories : Unix

Mem and Swap from the top command output
Swap space used is determined by your 'swappiness' system value.To find your current setting, try: cat /proc/sys/vm/swappiness The value can range from 0-100, with 100 being agressive swapping, and 0 meaning swap is only used when your RAM is at capacity.To adjust the value temporarily, try: echo $YOURVALUE > /proc/sys/vm/swappiness and to adjust it permanently, add a sysctl option echo $YOURVALUE >> /etc/sysctl.conf; sysctl -p Buffers and cache are for commonly opened and executed commands. Don't worry about them as space being "used", the kernel will automatically free up that space if the RAM is needed. You can force clear the cache with the following command (though it's really not needed): sync; echo 3 > /proc/sys/vm/drop_caches

Categories : Linux

pipe output from interactive command to less
You can try this: echo 'mypassword' | openssl enc -d -aes256 -in somefile | less But this doesn't look secure. I have not tried running openssl this way, but in case it is too verbose and if previous code is not going to work then you can always try using expect. Here's an example: expect -c ' spawn yourscript expect "Please enter your password:" send "$PASSWORD" '

Categories : Bash

Grep time command output
(time ls -l) 2>&1 > /dev/null |grep real This redirects stderr (which is where time sends its output) to the same stream as stdout, then redirects stdout to dev/null so the output of ls is not captured, then pipes what is now the output of time into the stdin of grep.

Categories : Linux

Getting terminal output of a command from python
You are getting the exit status. According to os.system() docs: On Unix, the return value is the exit status of the process encoded in the format specified for wait(). ... The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function. So, if you want to retrieve the output of the command, use subprocess module. There are tons of examples here on SO, e.g.: Assign output of os.system to a variable and prevent it from being displayed on the screen Equivalent of Backticks in Python

Categories : Python

How can I get shell command output to line up?
You can't do it the way you're going about it. Connection to host.com closed. is output by the command you called, and not returned via STDOUT, which you could capture with backticks. The problem is the use of backticks. They don't capture STDERR, which is most likely what ssh is using when it outputs its status. The fix is to use Open3's methods, such as capture3 which will grab the STDOUT and STDERR streams returned by the called program, and let you output them programmatically, allowing you to align them: stdout_str, stderr_str, status = Open3.capture3([env,] cmd... [, opts]) You should also look at Ruby's printf, sprintf or String's % method, which calls sprintf. Using % you can easily format your strings to align: format = '%7s %s' puts format % ["------>", "Executing:"] p

Categories : Ruby

innobackupex - get output from command line
I don't mean to step on @RudyVisser's answers in comments, but here's another solution: $syntax = 'innobackupex --user="'.$mysql_user.'" --password="'.$mysql_pass.'" --databases="'.$mysql_db.'" --stream=tar ./ | gzip -c -1 > /var/bak/2013-08-09-1431_mysql.tar.gz ; echo $?') $exit_status = shell_exec($syntax); The echo inside the command should report the exit status of innobackupex, which is 0 if the backup was successful, and non-zero if there was an error. http://www.percona.com/doc/percona-xtrabackup/2.1/xtrabackup_bin/xtrabackup_exit_codes.html PS: Percona XtraBackup also has a --compress option that uses the qpress algorithm, known to be very fast. I mention this because I notice you're using gzip -1 presumably for better performance.

Categories : PHP

Get system command output in C program
Ok, I was confused in my other answer. In any case, the philosophy in this answer is the same. You can use directly the popen function. Then you have something like this: int numOfCPU; FILE *fp = popen("grep -c ^processor /proc/cpuinfo", "r"); fscanf(fp, "%d", &numOfCPU); pclose(fp); I hope it will be useful.

Categories : C

Adding a row to output of piped command
You could use blocks in shells to insert another command and use it to insert lines before or after the output of the other command e.g. echo before grep: ps | { echo "header"; grep "something"; } To make it easier for you in a script you could use this form: ps | { echo "header" grep "something" # possibly other echos here. } In awk you could use BEGIN: ps | awk 'BEGIN { print "header"; } /something/;' And/or END to add tailing lines: ps | awk 'BEGIN { print "header"; } /something/; END { print "------"; }' Of course if you have more than two commands you could just use the form on the last command | command | { echo "header"; grep "something"; } Or command | command | awk 'BEGIN { print "header"; } /something/;'

Categories : Bash

To use lsf bsub command without all the verbosity output
Have you considered using job dependencies and post-process the logfiles? 1) Run each "child" job (removing the "-Is") and output the IO to separate output file. Each job should be submitted with a jobname (see -J). the jobname could form an array. 2) Your final job would be dependent on the children finishing (see -w). Besides running concurrent across the cluster, another advantage of this approach is that your overall process is not susceptible to IO issues.

Categories : Misc

live output from subprocess command
A good but "heavyweight" solution is to use Twisted - see the bottom. If you're willing to live with only stdout something along those lines should work: import subprocess import sys popenobj = subprocess.Popen(["ls", "-Rl"], stdout=subprocess.PIPE) while not popenobj.poll(): stdoutdata = popenobj.stdout.readline() if stdoutdata: sys.stdout.write(stdoutdata) else: break print "Return code", popenobj.returncode (If you use read() it tries to read the entire "file" which isn't useful, what we really could use here is something that reads all the data that's in the pipe right now) One might also try to approach this with threading, e.g.: import subprocess import sys import threading popenobj = subprocess.Popen("ls", stdout=subprocess.PIPE, shell=True) def stdoutpr

Categories : Python

Get osql output in command prompt
I believe you might be running into two separate problems: Set the FileName and Arguments properties like this: p.StartInfo.FileName = "osql.exe"; p.StartInfo.Arguments = @"-E -S @Server -d @Database -T -n -i ""@SqlFile""" .Replace("@Server", ConfigurationManager.AppSettings["Server"]) .Replace("@Database", Path.GetFileNameWithoutExtension(DB)) .Replace("@SqlFile", sqlFilePath); You might also encounter an encoding issue. make sure that you save you .sql file by using the Unicode Encoding (codepage 1200) (here's a question which describes the issue).

Categories : C#

confused about the output of SVN diff command
The file in question did not exist in revision 1 (it was probably added at revision 2). You do not have to worry about the exact meaning of the @@ strings, it just helps svn to locate the changes. In fact, it denotes the position (line number and number of following lines) in the file where the changes happened.

Categories : Linux

Single Column rpm command output
pairs = %x{rpm -qi ruby} .split(/(?<!:)s{2,}(?![s:])|#$//) .map{|line| line.split(/s*:s+/, 2)} width = pairs.map{|pair| pair.first.length}.max pairs.each{|k, v| puts "#{k.ljust(width)}: #{v}"}

Categories : Ruby

Check output of a python command
It might be printing that to stderr. Try redirecting that one to PIPE as well and read data from there. You can also append 2>&1 to the end of the command to get stderr redirected to stdout by the shell. You might have to add shell=True for that.

Categories : Python

How can I suppress command output when using backticks?
In case some output is going to standard error: OUT=$(git status > /dev/null 2>&1; echo $?) Of course, this does leave open the question: what is it you want to capture in OUT? [EDIT] The above will put the return code of git into $OUT.

Categories : Linux

How to get output of diff command on new lines
You need to run a sed command to replace '/n' with '' in the email conteent that is being sent. Emails are rendered as HTML text, hence the /n is ommited. makes the html show it on next line.

Categories : Linux

How to hide command output in bash
You can redirect stdout to /dev/null. yum install nano > /dev/null Or you can redirect both stdout and stderr, yum install nano &> /dev/null. But if the program has a quiet option, that's even better.

Categories : Bash

Output command window to text file
Navigate to the folder containing the executable that you have built in Visual Studio, open a console in that folder and at the console prompt enter e.g. >my_prog > my_output.txt

Categories : C++

Output of DIR command not as expected in batch file
Hmm.. First point - why do you need alphabetical order if your intention is to do some variety of "random" selection? Next - why are you setting _tmp - you aren't using it. Next - the brackets in your IF "%CD%"... are redundant - the quotes are there to tell batch that the string may contain separators Next - the /on switch tells DIR to output the SELECTED directory in alphabetical order. Next - _t0 appears to be intended to select 'lop 0' or 'lop 1' characters, but a DIR /s /b output will be X:dir...filename - doesn't sem particularly sensible... Next - you seem to have omitted the /i switch from your FIND commands to make the find case-insensitive. You've not shown your directory structure, so "season order" is nebulous. Presumably you've got ..shownameseasonepisode. Consider what hap

Categories : Windows



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.