w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Pseudo-terminal will not be allocated because stdin is not a terminal ssh bash
You seem to assume that when you run ssh to connect to a server, the rest of the commands in the file are passed to the remote shell running in ssh. They are not; instead they will be processed by the local shell once ssh terminates and returns control to it. To run remote commands through ssh there are a couple of things you can do: Write the commands you want to execute to a file. Copy the file to the remote server using scp, and execute it with ssh user@remote command Learn a bit of TCL and use expect Write the commands in a heredoc, but be careful with variable substitution: substitution happens in the client, not on the server. For example this will output your local home directory, not the remote: ssh remote <<EOF echo $HOME EOF To make it print the remote home directory

Categories : Bash

gnome-terminal font resize (zoom in, zoom out), but adjust terminal height and width contrariwise for getting a "lock in" of window dimensions
I can’t tell you for sure, but since this is GNOME and moreover GNOME 3, it’s unlikely that the Terminal has this kind of customization built-in. But in Linux, you can always improvise. How about the following. Find a program that can send keys to an X11 window. Maybe xdotool. Find a program that can control an X11 window’s geometry. Maybe xdotool. Write a short script that locates the terminal window (probably just the focused one), sends it Ctrl-Plus / Ctrl-Minus, waits a tiny bit, then sets its geometry to the one you like (or to whatever it was initially, which you can also query with xdotool). Bind this script to a keyboard shortcut of your choice, say Win+Plus / Win+Minus. No idea how to do this in modern Ubuntu / GNOME 3, but GNOME 2’s Metacity used to have GConf keys f

Categories : Misc

Linux terminal input: reading user input from terminal truncating lines at 4095 character limit
I do not have a workaround for you, but I can answer question 2. In linux PIPE_BUF is set to 4096 (in limits.h) If you do a write of more than 4096 to a pipe it will be truncated. From /usr/include/linux/limits.h: #ifndef _LINUX_LIMITS_H #define _LINUX_LIMITS_H #define NR_OPEN 1024 #define NGROUPS_MAX 65536 /* supplemental group IDs are available */ #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ #define LINK_MAX 127 /* # links a file may have */ #define MAX_CANON 255 /* size of the canonical input queue */ #define MAX_INPUT 255 /* size of the type-ahead buffer */ #define NAME_MAX 255 /* # chars in a file name */ #define PATH_MAX 4096 /* # chars in a path name including nul */ #define PIPE_BUF

Categories : Linux

echo new line to terminal only when current terminal line is not empty
Test your variable's value if it's not empty with -n: [[ -n $VAR ]] && echo "$VAR" # POSIX or Original sh compatible: [ -n "$VAR" ] && echo "$VAR" # With if: if [[ -n $VAR ]]; then echo "$VAR" fi if [ -n "$VAR" ]; then echo "$VAR" fi It's actually equivalent to [[ $VAR != "" ]] or ! [ "$VAR" = "" ]. Furthermore in Bash you can test it if it's only filled with whitespaces: shopt -s extglob ## Place this somewhere at the start of the script [[ $VAR == +([[:space:]]) ]] && echo "$VAR" if [[ $VAR == +([[:space:]]) ]]; then echo "$VAR" fi Use [[:blank:]] to only match spaces and tabs and not newlines and the likes if it's more helpful. If you want to remove empty lines from input file or pipe you can use other tools like sed: sed -ne '/^$/!p'

Categories : Bash

VBA to Copy Information From a Folder of Files and Compile Information to a Single Workbook
This is not the full code, but it should help you. When you work with multiple workbooks keep track of them. For example start with: Dim CurrWB As Workbook Set CurrWB = ActiveWorkbook Then in the cycle: Dim WB As Workbook For Each StrFile In var Set WB = Workbooks.Open(loc & StrFile) ... WB.Close Next StrFile Inside the cycle you can find the area to copy doing something like: R1 = 1 Do While WB.Sheets("Sheet name").Cells(R, 2) <> "Starting text" R1 = R1 + 1 Loop R2 = R1 + 1 Do While WB.Sheets("Sheet name").Cells(R2, 2) <> "Ending text" R = R + 1 Loop For R = R1 to R2 CurrWB.Sheets("Report").Cells(RReport, 3) = WB.Sheets("Report").Cells(R, 3) RReport = RReport + 1 Next R

Categories : Excel

Reply mail structure information: how to retrieve sent and received information
There's no standard for the structure of a reply email. It's not usually done using multipart email, it just uses human-readable text, often with > prefixes to denote quoted text. This allows replies to be interspersed inline with the quoted material. The only standard features of replies are a couple of headers: In-Reply-To: <ID> and References: <ID1>, <ID2>, <ID3>, ... In-Reply-To contains the message ID of the message that was replied to. References is a growing list of message IDs -- when you reply, you take the original message's reference list and append the ID of the message being replied to at the end. See RFC 5322 for more details about these headers.

Categories : PHP

how to get the information of about database events and actor information
Look at the MODULE, ACTION and CLIENT_INFO columns of V$SESSION. Then, in the package(s) and/or trigger(s) you suspect are performing the update, call DBMS_APPLICATION_INFO.SET_MODULE and DBMS_APPLICATION_INFO.SET_ACTION: BEGIN DBMS_APPLICATION_INFO.SET_MODULE(trigger_name, 'trigger start'); -- some code... DBMS_APPLICATION_INFO.SET_ACTION('updating employee'); -- code which updates the employee table DBMS_APPLICATION_INFO.SET_ACTION('doing something else'); -- more code... DBMS_APPLICATION_INFO.SET_MODULE(NULL, NULL); END; See also the example provided in the usage notes.

Categories : Oracle

Execv for own terminal
The path argument to execv is supposed to be the path specification to the executable file you want to run, not just a directory as returned by getcwd. From the manpage: The initial argument for these functions is the pathname of a file which is to be executed. In other words, you're looking for something like: execv ("/bin/echo", command); The code you currently have is trying to run your current directory, something that's unlikely to end well, and something you may have noticed if you checked the return value from execv along with errno: nudge, nudge, wink, wink :-) In terms of what to do for other programs, you simply substitute their full path name for /bin/echo. You should also be aware that exec is a family of functions, each with slight variations. Some allow environme

Categories : C

Why do frameworks and git hub ask you to use Terminal?
Being a newbie is ok. The terminal is the go to because writing programs, tools, and scripts with a couple lines of bash or python is, well, a couple of lines versus an entire gui and all the lines of code to go with it. meteor create hello-stream That's telling you to run the program called meteor with the supplied arguments (create hello-stream). If you haven't installed meteor, do that next. From their website, open your terminal and type/paste: curl https://install.meteor.com | sh That downloads a file from the URL and pipes (|) it to the sh command. The file it downloads is a shell script that takes care of setup/installation. Now go back and try the meteor command again. More reading You might try and find a terminal tutorial. This is the first one I found: http://www.ee.s

Categories : Javascript

How to spawn a terminal?
There are plenty of examples in the documentation. child = pexpect.spawn('/bin/bash') will spawn a new child, but if you don't interact with it, you won't see anything, as the input and output are handled by pexpect. And if you don't have anything else in your script, the child will be destroyed when your interpreter exits. Pexpect doesn't open any visible terminal, the child is running entirely in the background (unless you call child.interact()).

Categories : Python

Applescript Terminal with OSX 10.8
Many times with keystrokes, the applescript code runs faster than the computer interface can perform the typing... so you have issues. The solution is to put short delays between the typing commands to give the computer interface time to perform the typing. Also your System Events code should not be inside the "tell application Terminal" block of code. Try this. You can play with the normalDelay and shortDelay times to make them longer or shorter as needed. set normalDelay to 1 set shortDelay to 0.2 tell application "Terminal" to activate delay normalDelay --give time to activate Terminal tell application "System Events" keystroke "cd " & ingestPath --path to autoingestion.class delay shortDelay keystroke return delay shortDelay keystroke "java Autoingestion " &

Categories : Java

How to run my php file from mac terminal
In order to change the directory, you must type cd and then the file path name If you find the file in Finder, and hold the file, and drag it to the mac terminal window, it will place the entire path file....so just type cd, then drag file to get path DO NOT FORGET TO REMOVE THE FILE NAME ON THE END OF THE PATH and that will take you to the directory of the file.. after that, just type your "php test.php" (without quotes), and that should work Hope this helps!

Categories : PHP

Mac terminal problems
As the commenters have pointed out, it is recommended that you try to use rvm or its cousins, to install ruby into your home directory, this way, you dont need root to install gems by default, and this is more widely recommended. Alternatively you could try the same chown trick here try sudo chown -R <username>:<username> /Library/Ruby/Gems The second one is usually group name, it can be skipped, or you can let it stay.

Categories : Ruby

qt printing to terminal
You can use qDebug() << ..., qWarning() << ..., etc. Don't forget to include <QDebug>. Docs: QDebug

Categories : Linux

How do I run .scptd from Terminal in Mac?
You can use osascript to run apple scripts in the terminal.

Categories : Osx

Vim UTF8 characters in terminal
These escape characters appear when Vim is confused about what key presses it receives from the terminal emulator. The arrow keys are received as Escape followed by a character from A to D: ^]0A is <up>, ^]0B is <down>, ^]0C is <right> ^]0D is <left>. Editing an UTF-8 file has nothing to do with your issue. Here is what I have in my /.vimrc to work around that problem: nnoremap <Esc>A <up> nnoremap <Esc>B <down> nnoremap <Esc>C <right> nnoremap <Esc>D <left> inoremap <Esc>A <up> inoremap <Esc>B <down> inoremap <Esc>C <right> inoremap <Esc>D <left> I'm not aware of a better solution.

Categories : Vim

OSX Terminal Tabs/Windows
I have found the answer due to rubber duck debugging with my friend @artlogic on Twitter. The problem (or solution, however you choose to see it) was in System Preferences > General, the option "Close window when quitting an application" was checked and therefore closing the windows before quitting the application thus nullifying the effect I hoping for. That is all.

Categories : Osx

Making -std=c++11 the default in mac terminal
Create an alias: alias g++='g++ -std=c++11' should do the trick. (However, the version of GCC that comes with OS X is so ancient that it doesn't support C++11, you'd be better off using clang and clang++.)

Categories : C++

Red color in terminal not working
There must be something with your terminal settings, since the code you sent is correct. I get: and my settings are: and I use Konsole on KDE4.

Categories : Shell

Can Java ant spawn a new terminal
You can configure the java task to use javaw instead of java, so: <java jvm="javaw.exe" ...> I should caveat that I haven't tried this before (and I don't use ant anymore), but I don't see why this shouldn't work.

Categories : Java

Deleting SSH keys terminal
Depending on where they are located: rm github_rsa.pub and rm id_rsa.pub If they are in the default location then you can do rm ~/.ssh/github_rsa.pub and rm ~/.ssh/id_rsa.pub However this is likely answered already elsewhere.

Categories : Osx

How to not echo here document to terminal?
Try expect: #!/bin/sh echo "Enter sudo pass:" read -s SUDOPASS expect -c 'spawn ssh -tt remote_host sudo cat /etc/cma.conf ; expect -re "\[sudo\] password for .*:"; send "'"$SUDOPASS"' ";interact'

Categories : Bash

Determining whether STDERR is going to terminal
I think what you're looking for is isatty(3), in unistd.h. There's no way to tell whether a file handle has been redirected, period, but that'll tell you whether it's still interactive. See the source for the tty command in GNU coreutils.

Categories : Java

stop python in terminal on mac
CTRL+d -> Defines EOF (End of File). CTRL+c -> Will terminate most jobs. If, however you have written a python wrapper program that calls other python programs in turn, Ctrl-c will only stop the the job that is currently running. The wrapper program will keep running. Worst case scenario, you can do this: Open up: Applications -> Utilities -> Activity Monitor, Find the process labeled as python, highlight it in the activity monitor then click on "Quit Process". These three suggestions should work for most situations where you want a program to stop.

Categories : Python

Connecting to .sql file from terminal on a Mac
The SQL dump is usually a text file containing SQL commands like CREATE TABLE ... and INSERT INTO ... which will eventually construct the desired database for you. In order to execute these commands you will have to connect to the database server first and then (probobly also) select a database on that server.

Categories : Mysql

Git error on GitHub for Mac asking me to use terminal to "git add"
I understand that you want to use your GitHub for Mac GUI, but if you were to commit your changes through the terminal instead, here is what you would do: # Get the status of your working copy: $ git status # On branch Integrating-a-recommendations-textbox # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: assets/app/scripts/templates/popups/recommend.hbs # modified: web/wgwt/models.py # modified: web/wgwt/views.py # # Add each file you want to commit individually: $ git add web/wgwt/models.py # Or add them all at once: $ git add "*" # Make your commit $ git commit # You can also use the `--all` or `-a` flags during the commit

Categories : GIT

How to open emacs gui/ide from mac terminal?
To do what you want, you'd need to find the location of the actual binary contained in Emacs.app, and use that as the command instead of emacs. Most likely, it's at /path/to/Emacs.app/Contents/MacOS/Emacs Which, if you have Emacs.app in your Applications folder, as would be typical, would be /Applications/Emacs.app/Contents/MacOS/Emacs To set it up with a shorter command to use, you could try adding to your .profile (I don't know what shell you use) the following line, or whatever equivalent it has for your shell (This works for bash and zsh, at least): alias emacsgui='/Applications/Emacs.app/Contents/MacOS/Emacs'

Categories : Osx

Importing a SQL db into mysql using the terminal
I found an SO post here. I used "source" like so: SOURCE /Users/myname/Desktop/somedb.sql; That worked. Great but the internet seemed to want me to use the method like so: mysql -u username -p password databasename < filename.sql I may post another question on when to use that second method but in the meantime I just used source from a SQL dump file

Categories : Mysql

Parsing terminal arguments Qt Mac OS X
First of all, you will have to link against the OX-X Framework. OSX works with Events similar to signal slots. The filename will also be given by an apple event. I`ve had this quite some time ago with another language, but i still found a reference: http://doc.qt.digia.com/qq/qq12-mac-events.html

Categories : C++

Closing a Terminal File
You appear to be in vim and are in insert mode. To save and close, you have to get out of insert mode. Hit the 'escape' key (or control-[, which I personally like since I don't have to pull my fingers away from the keyboard. I'm not currently at a mac, so I'm not sure if it's control-[ or command-[ in your terminal). Now type ':wq', without the quotes. Don't forget the colon. This is a vim command which will (w)rite and (q)uit. I believe git has opened this file for you as a temp file, and once you've finished writing to it, git will use that file automatically for your commit message. No worries about where to save it.

Categories : Osx

Vim colors too bright (terminal)
You shouldn't compare colorschemes in GUI Vim and in CLI Vim: the number of colors that can be used in both contexts is very different and it makes any comparison worthless. You can get very subtle colors in GUI Vim but you can only approximate them in CLI Vim. The values used for the gui and those used for the cli are probably different which explains what you see. The only way to have the same colors in gui and cli vim is to use only colors from the xterm palette for the gui. In Vim, you could :set background=light (and read :help 'background') to see if it makes the colors less bright. In your terminal emulator, you could see if there's a setting that deals with color brightness or the usage of bold.

Categories : Vim

Run terminal inside vim on a macbook?
Why don't you do things the other way around? You can use a terminal multiplexer such as Tmux and split a terminal window into two panes using C-b %. Inside the second pane you can run macvim inside a terminal with $ mvim -v You can navigate between the two panes with C-b o, (And do much more, but I'll leave it up to you to discover!) Doing things this way around is much more sane in my opinion, you get the full power of both the terminal and vim without having to hack around with Vim too much (Plus Tmux is very handy for many other uses). I hope doing things this way around is appealing enough for you!

Categories : Osx

Is it Possible using Terminal to run iOS Application in instrument?
Looks like you're missing a specific device ID ([-w device]). Although the template might have it, I think you need to specify it anyways at a command line. I did a bit of googling around and found this article. Here's a paired down script based on that article that you could use to run Instruments from a command line. runTests.sh XCODE_PATH=`xcode-select -print-path` TRACETEMPLATE="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate" APP_LOCATION=$2 DEVICE_ID=$3 if [ ! $# -gt 1 ]; then echo "You must specify the app location and the test file." echo " (optionally supply unique device ID of physical iOS device)" echo " eg. ./build.sh suite.js <xcodeproject directory>/b

Categories : IOS

script to record terminal on Mac
I am trying to compile the package util-linux (https://github.com/karelzak/util-linux, which contains linux version script) but without success: The error message from the compiler on the 'incompatible types' is the clue to why it failed. There's a conflict between the declarations in the system header files resident on OS X (BSD-based) and those in the include files from util-linux(GNU/Linux based).

Categories : Osx

How to download j connector using terminal?
To download MySQL Connector/J: Log into dev.mysql.com using Oracle SSO Go to http://dev.mysql.com/downloads/connector/j/ Right-click the blue "Download" button and choose "Copy Link Address" (or something similar) Paste the URL in your Terminal Depending on what you got available, you could use wget or curl to download. With curl you would use the -l options with the -o option specifying a filename: shell> curl -L -o mysql-connector-java.tar.gz http://... or shell> wget http://...

Categories : Java

I'd like my code to flow with my terminal a little better
You want to parse the command line arguments instead of reading input after the program starts. Use the argparse module for that, or parse sys.argv yourself.

Categories : Python

Grabbing the output from the terminal
I don't think you can pipe commands like that in subprocess. Here's a question with answers describing how to execute piped commands with subprocess. Here's another description of how to do it.

Categories : Python

How do you set the 16 Terminal Colors for Git-Bash?
Console colors are stored in the registry under HKCU/Console/[window name]/ColorTable00-15. [window name] is either "Git Bash" for the start menu entry or something like "C:_Program Files (x86)_Git_git-cheetah_.._bin_sh.exe" for the Windows Explorer context menu entry (supplied by Git-Cheetah). Alternatively, the registry settings can be overridden by storing an NT_CONSOLE_PROPS structure with appropriate ColorTable settings in the "Git Bash.lnk" shortcut via IShellLinkDataList::AddDataBlock. This happens e.g. if you edit the properties of a console window started via shortcut, or if you edit the shortcut properties directly. If you want the values from the registry instead, create a new "Git Bash.lnk" shortcut from scratch and leave the Options/Font/Layout/Colors tabs alone.

Categories : Windows

png terminal not working gnuplot in OS X 10.8.4
You have to re-install gnuplot and it's dependent package. Maybe, you need libpng, libgd. From guide Installing gnuplot on Mac OS X 10.6 I wanted to install gnuplot, the infamous data visualization tool, on my laptop running Mac OS X 10.6.6. I got the idea (probably from this page) that I should build gnuplot from its original sources. Of course, this brought in a half-mile of dependencies that also needed to be compiled, mostly via libgd. Thankfully, this libgd and Mac OS X document from the libgd wiki got me most of the way there. If you want gnuplot on Mac OS X, you might consider DarwinPorts or Fink, package systems designed to avoid the kinds of problems I work through below. I’ve been avoiding packaging systems on my computers, but not for rational or

Categories : Osx

is there a way to combine EOF with a terminal alias?
Instead, create a function an save it in your ~/.bashrc: importme() { ssh root@server.com << EOF mysql list databases; EOF } Source (. ~/.bashrc) and you will be ready to use it with importme.

Categories : Mysql



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