terminal

Adding a Terminal into a swing application

半世苍凉 提交于 2019-12-20 04:03:08
问题 I am making an application in java and I want to have a terminal as part of my GUI. Is it possible to get the system terminal (or cmd if windows), and have it as part of my GUI in a panel ? If so do I need a library like http://code.google.com/p/dragonconsole/ or there is some "default" way of getting the standard system terminal ? Thanks 回答1: I don't think a console/terminal library is provided by the java language. However, you can use the Process and Runtime classes to mimic the desired

npm error: tunneling socket could not be established, cause=connect ETIMEDOUT

大兔子大兔子 提交于 2019-12-20 03:45:06
问题 I have an app that uses the Rails framework and implements AngularJs as part of the front end. I have pushed everything to Heroku and have the Heroku Toolbelt installed, but when I try to migrate the db using "heroku run rake db:migrate" I receive the following error(s): Installing core plugins heroku-cli-addons, heroku-apps, heroku-fork, heroku-git, heroku-local, heroku-run, heroku-status... Error installing package. Try running again with GODE_DEBUG=info to see more output. ! `run` is not a

running ssh process in background gets paused

别说谁变了你拦得住时间么 提交于 2019-12-20 03:13:18
问题 I have some scripts that I'm developing on a vm but sometimes needs to run on a production server to be properly tested. I need the output from the scripts for debugging so I've tinkered together the following solution: function test_remote() { scp $1 Prod:/home/xxx/tmp/ n=${1:t:r} f=${1:t} cmd="ssh Prod \"/usr/bin/php /home/xxx/tmp/$f\" > /home/xxx/tests/$n-remote-test.html" eval ${cmd} ssh Prod "rm /home/xxx/tmp/$f" echo "done" } which I have placed in my .zshrc file I would like to run it

Printing grep results to file and terminal

心已入冬 提交于 2019-12-20 02:48:24
问题 I'm trying to display the grep results to the terminal as well as to a file. The solution I've come up with is to just run it twice, but this obviously will create efficiency issues. grep -n "$SEARCH_TERM" "$i" grep -n "$SEARCH_TERM" "$i" >> /file.txt Is there a tag that will allow it to print to both using only one search? Thanks 回答1: The program you are looking for is "tee": grep -n "$SEARCH_TERM" "$i" | tee -a /file.txt 来源: https://stackoverflow.com/questions/17203050/printing-grep-results

Create a file using Runtime.exec using echo in linux?

对着背影说爱祢 提交于 2019-12-20 02:47:19
问题 I'm having trouble using Runtime.exec in Java, it seems some commands work while others do not. For example if I run echo some data > data.txt In my terminal it works fine, however if I try and use Java to do this it doesn't work. Runtime mRuntime = Runtime.getRuntime(); Process mProcess = mRuntime.exec("echo some data > data.txt"); mProcess.waitFor(); Is there any reason for this? 回答1: echo is not a real command in the sense that it has a binary that you can run. It is a built-in function of

How to remove dir background in `ls -color` output

醉酒当歌 提交于 2019-12-20 02:37:20
问题 I use default Linux Mint .bashrc, here is full bashrc, the output is like: some dir has green background, How to remove it? 回答1: To remove all background colors, stick the following into your ~/.bashrc : eval "$(dircolors -p | \ sed 's/ 4[0-9];/ 01;/; s/;4[0-9];/;01;/g; s/;4[0-9] /;01 /' | \ dircolors /dev/stdin)" 回答2: The explanation is given in the output of dircolors -p , e.g., Of course dircolors doesn't color its output. I used this script: #!/usr/bin/perl -w use strict; our $comment = "

adb command fail to execute if path contain spaces

孤人 提交于 2019-12-20 02:34:04
问题 I am trying to delete the file using adb command. But the file contain spaces. So adb command throws an error after reading half of the file name till space. Is there a way to overcome this issue. I am executing following adb command When I execute adb shell rm /sdcard/samsung_Nexus S_converter.xml Error message: rm failed for /sdcard/samsung_Nexus, No such file or directory How ever when I execute: adb shell rm /sdcard/samsung_Nexus_S_converter.xml File deletion is successful I searched for

How to send a string to the terminal without having it to be a standard command?

匆匆过客 提交于 2019-12-20 02:33:05
问题 I am writing a program in Java that needs to use terminal command to work. My function basically looks like this : public void sendLoginCommand() throws IOException { System.out.println("\n------------Sending Login Command------------\n"); String cmd="qskdjqhsdqsd"; Runtime rt = Runtime.getRuntime(); Process p=rt.exec(cmd); } public Process sendPassword(String password) throws IOException { System.out.println("\n------------Sending Password------------\n"); String cmd=password; Runtime rt =

raw terminal mode - how to take in input?

ⅰ亾dé卋堺 提交于 2019-12-20 02:30:05
问题 I have a chat client that takes in input in raw terminal mode, but I don't know about handling input in this mode. I need to know 2 things: How can I read the input in character-by-character and display it? Do I have to have some sort of a read loop that reads one character at a time and stores it in a buffer? If I want my server to process the input on new line entry, do I have to scan each character as it comes into my buffer and look for \n ? Also, an example character-by-character read

tput cup in python on the commandline

点点圈 提交于 2019-12-20 01:49:30
问题 Is there an elegant solution to do this shell script in Python without importing os ? tput cup 14 15; echo -ne "\033[1;32mtest\033[0m" ; tput cup 50 0 This just has been gnawing in my mind for some time now :) Thanks 回答1: All the terminfo capabilities are accessible via curses. Initialize it and use curses.tiget*() to get the capabilities you care about. 回答2: Thanks Ignacio Vazquez-Abrams for your input, it was a great push in the right direction. In the end i came up with this little code