terminal

Running Bash Script in Java

旧街凉风 提交于 2019-12-12 00:17:27
问题 So essentially, I am trying to run the command "/dir/command -arg" to change the LED color on a USB device in Java. I am using Ubuntu 10.04. When I run the command from the terminal, it works just fine. However, I tried every iteration of Runtime.exec() that I could find and none of them seem to work. I then created a script with the following contents: #!/bin/bash echo "hello" /dir/command -arg when I run this from a terminal it works just fine. However when I run @Override public void run()

Not able to read data from other terminal using read() system call

故事扮演 提交于 2019-12-11 22:24:10
问题 Hi everyone I am running the following code on pseudo terminal /dev/pts/1 and I am tryin to read the contents from the terminal /dev/pts/2 . #include<stdio.h> #include<unistd.h> #include<fcntl.h> int main(){ char str[50]; int fd = open("/dev/pts/2",O_RDONLY); str[read(fd,str,20)] = '\0'; printf("%s\n",str); return 0; } anirudh@anirudh-Aspire-5920:~$ gcc test.c anirudh@anirudh-Aspire-5920:~$ ./a.out n anirudh@anirudh-Aspire-5920:~$ On the terminal /dev/pts/2 I had typed "anirudh" however it

Store php exec in a session variable

陌路散爱 提交于 2019-12-11 22:00:12
问题 Is is possible to store an exec' output into a session variable while its running to see it's current progress? example: index.php <?php exec ("very large command to execute", $arrat, $_SESSION['output']); ?> follow.php <php echo $_SESSION['output']); ?> So, when i run index.php i could close the page and navigate to follow.php and follow the output of the command live everytime i refresh the page. 回答1: No, because exec waits for the spawned process to terminate before it returns. But it

Terminal Like Scrolling Text Android

与世无争的帅哥 提交于 2019-12-11 20:45:46
问题 I'm trying to get a text scrolling by terminal like effect for an application I'm writing. The problem is that the textview only updates after all the text has been added. How can I get it so it updates every line? 回答1: Call textView.invalidate() to force it to redraw itself. 来源: https://stackoverflow.com/questions/5070657/terminal-like-scrolling-text-android

Python/editline on OS X: £ sign seems to be bound to ed-prev-word

蓝咒 提交于 2019-12-11 20:14:31
问题 On Mac OS X I can’t enter a pound sterling sign (£) into the Python interactive shell. * Mac OS X 10.5.5 * Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) * European keyboard (£ is shift-3) When I type shift-3 in the Python interactive shell, I seem to invoke the previous word function, i.e. the cursor will move to the start of the last “word” (i.e. space-delimited item) typed on the line. When I’m back in the bash shell, typing shift-3 just produces a £, as expected. This version of Python

Mac Terminal link not working

。_饼干妹妹 提交于 2019-12-11 20:12:04
问题 I am trying to make a command line link for Sublime Text 3. If I run /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl Sublime Text opens like normal. I then run sudo ln "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl Restart the terminal and I get this: $ ls /usr/bin/subl /usr/bin/subl $ subl -bash: subl: command not found I also tried setting in my .profile alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" but I also

Runing an app in a terminal with a debugger on Linux using Qt Creator

别来无恙 提交于 2019-12-11 19:39:15
问题 I have simple console application in C++ written in Qt Creator 2.4.1 on Kubuntu 12.04. My app have simple menu where you choose what you want to do (using std::cin and getline() ). The problem is that I cannot input data in console in Qt Creator. So I use option "Run in terminal" (xterm). But when I want to run debugger I get "ptrace operation not allowed". So: In QtCreator console I cannot input data (debugger working) In terminal I cannot use debugger (ptrace operation not allowed) I need

How to start a process from another application and then open a terminal to that process in gnu screen

无人久伴 提交于 2019-12-11 19:16:43
问题 I'd like to be able to launch a process from a GUI application (right now I'm thinking specifically of letting an eclipse user -- possibly via a plugin -- click a button to launch a build using my organization's build system). I don't want this process to stop when I stop the parent application, and I want to be able to "switch into it" later, as though I launched it from a command line. I've seen GNU screen described as good for most of what I'm asking for, but I'm not sure about the "launch

How to Start and Stop Appium Server programmatically using Python

喜你入骨 提交于 2019-12-11 18:35:32
问题 I am a newbie to Python and have created simple Appium Automation Test case for Android mobile app. I have setup Jenkins server and want to run Appium on it so there are 2 ways: Run appium server via Jenkins (We can run it using appium command but when I run appium command it just "hangs up" and showing server console continiously) Start Appium Server programmatically using Python I know we can run Appium Server programmatically using Java but don't know about python. So, if you have any idea

VMIN and VTIME Terminal Settings for variable sized messages

試著忘記壹切 提交于 2019-12-11 18:16:04
问题 I'm trying to interface with a device via the serial port. The device sends out a 10 byte poll as a "heartbeat" every 700ms. Everytime I read the heartbeat I have to reply with a 12 byte long response. Within this response I can request that the device sends particular data inbetween polls. The amount of data is different for different requests. Is there a way to set up the serial port such that it will always read messages in one chunk regardless of their size? My current terminal settings