interactive

Writing a “real” interactive terminal program like vim, htop, … in C/C++ without ncurses

ⅰ亾dé卋堺 提交于 2019-12-18 10:05:16
问题 No, I don't want to use ncurses , because I want to learn how the terminal works and have fun programming it on my own. :) It doesn't have to be portable, it has to work on linux xterm-based terminal emulators only. What I want to do is programming an interactive terminal application like htop and vim are. What I mean is not the output of characters which look like boxes or setting colors, this is trivial; also to make the content fit to the window size. What I need is how to get mouse

multiprocessing package in interactive Python

独自空忆成欢 提交于 2019-12-18 06:09:33
问题 I have the following code test.py: #multiprocessing in the interactive Python import time from multiprocessing import Process, Pipe def MyProcess(a): while(1): time.sleep(1) a.send("tic") if __name__ == "__main__": a, b = Pipe() p = Process(target=MyProcess, args=(a,)) p.start() while(1): msg=b.recv() print(msg) It works fine if I execute it in the DOS shell "python test.py" But it doesn't work if I use "Execute File" from IEP (Pyzo). Traceback (most recent call last): File "<string>", line 1

Play multiple sounds at the same time in python

一曲冷凌霜 提交于 2019-12-18 04:52:41
问题 I have been looking into a way to play sounds from a list of samples, and I found some modules that can do this. I am using AudioLazy module to play the sound using the following script: from audiolazy import AudioIO sound = Somelist with AudioIO(True) as player: player.play(sound, rate=44100) The problem with this code is that it stop the whole application till the sound stop playing and I can't play multiple sound at the same time. My program is interactive so what I want is to be able to

git rebase interactive: squash merge commits together

瘦欲@ 提交于 2019-12-17 17:25:12
问题 I wanted to have a simple solution to squash two merge commits together during an interactive rebase. My repository looks like: X --- Y --------- M1 -------- M2 (my-feature) / / / / / / a --- b --- c --- d --- e --- f (stable) That is, I have a my-feature branch that has been merged twice recently, with no real commits in between. I don't just want to rebase the my-feature branch since it is a published branch of its own, I just want to squash together the last two merge commits into one

Positioning multiple, random sized, absolutely positioned elements so they don't overlap

ⅰ亾dé卋堺 提交于 2019-12-17 16:39:23
问题 Ok I need to be able to position a bunch of random sized absolutely positioned words on a page but I don't want any of the elements to overlap. The end goal is to have a fluid word cloud that responds to user interaction (remember the Google Balls Doodle?). I would really like to build this from scratch to develop my understanding of this type of development. Any help in this department would also be appreciated :) 回答1: I'm not sure if you also want to position the words randomly inside a

Interactive input/output using python

瘦欲@ 提交于 2019-12-17 05:54:09
问题 I have a program that interacts with the user (acts like a shell), and I want to run it using python subprocess module interactively. That means, I want the possibility to write to stdin and immediately get the output from stdout. I tried many solutions offered here, but none of them seems to work for my needs. The code I've written based on Running an interactive command from within python import Queue import threading import subprocess def enqueue_output(out, queue): for line in iter(out

Checking for interactive shell in a Python script

限于喜欢 提交于 2019-12-17 05:07:13
问题 I need to determine whether the shell which invoked my Python script was in interactive mode or not. If it was in interactive mode, the program should pipe output to less(1) for easy reading. If not, it should simply print its output to stdout, to allow it to be piped away to a printer, file, or a different pager. In a shell script, I would have checked if the prompt variable $PS1 was defined, or looked for the -i option among the flags stored in the $- variable. What is the preferred method

Passing arguments to an interactive program non-interactively

痞子三分冷 提交于 2019-12-16 19:58:11
问题 I have a bash script that employs the read command to read arguments to commands interactively, for example yes/no options. Is there a way to call this script in a non-interactive script passing default option values as arguments? It's not just one option that I have to pass to the interactive script. 回答1: For more complex tasks there is expect ( http://en.wikipedia.org/wiki/Expect ). It basically simulates a user, you can code a script how to react to specific program outputs and related

#load a package in F# interactive (FSharpChart.fsx)

♀尐吖头ヾ 提交于 2019-12-13 14:28:49
问题 Hi i'm a noob and asking this newbie question, please forgive me. I've installed successfully FSharpChart in my local directory ... Added package 'MSDN.FSharpChart.dll.0.60.0' to folder 'C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Expert in F\packages' Added package 'MSDN.FSharpChart.dll.0.60.0' to 'packages.config' Successfully installed 'MSDN.FSharpChart.dll 0.60.0' to Expert in F now, if i do #load "FSharpChart.fsx";; ^^^^^^^^^^^^^^^^^^^^^^^ stdin(4,1): error FS0078: Unable to find the

git rebase -i presents an empty MacVim file

时间秒杀一切 提交于 2019-12-13 12:25:36
问题 I'm trying to rebase a commit. However, any time I run git rebase -i f83eff3ffc8 , for example, a MacVim window opens, that's empty (there is no information in the file). Then once I write and close the file (even though it's empty), I get a Successfully rebased and updated refs/heads/clicktocall-hotfix message. The file name is .git/rebase-merge/git-rebase-todo . I also tried running it with sudo but this didn't make a difference. What could be the problem? I've never successfully completed