interactive

Interactive matplotlib plots via textboxes

为君一笑 提交于 2019-11-28 01:40:00
问题 I'm trying to create an interactive matplotlib plot of a multidimensional function with three parameters to vary. The problem is that the parameters can vary over a very large range, so I'd rather not use sliders but directly type the value I'd like. Basically, I'd like to recreate the canonical example below where instead of sliders I'd like text boxes in which I can input parameters import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button,

/usr/bin/find: cannot build its arguments dynamically

柔情痞子 提交于 2019-11-28 00:27:50
The following command works as expected interactively, in a terminal. $ find . -name '*.foo' -o -name '*.bar' ./a.foo ./b.bar $ However , if I do this, I get no results! $ ftypes="-name '*.foo' -o -name '*.bar'" $ echo $ftypes -name '*.foo' -o -name '*.bar' $ find . $ftypes $ My understanding was/is that $ftypes would get expanded by bash before find got a chance to run. In which case, the ftypes approach should also have worked. What is going on here? Many thanks in advance. PS: I have a need to dynamically build a list of file types (the ftypes variable above) to be given to find later in a

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

三世轮回 提交于 2019-11-28 00:20:15
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 :) I'm not sure if you also want to position the words randomly inside a container, but i've written a fiddle that does just that. You can modify the code to position one word right

kubectl YAML config file equivalent of “kubectl run … -i --tty …”

你。 提交于 2019-11-27 23:28:28
问题 I've been using "kubectl run" with assorted flags to run Jobs interactively, but have recently outgrown what I can do with those flags, and have graduated to using YAML config files to describe my jobs. However, I can't find an equivalent to the "-i" and "--tty" flags, to attach to the Job I'm creating. Is there an equivalent YAML spec for: kubectl run myjob \ -i \ --tty \ --image=grc.io/myproj/myimg:mytag \ --restart=Never \ --rm \ -- \ my_command Or is this maybe not the right approach? 回答1

Equivalent of Python's dir in Javascript

北战南征 提交于 2019-11-27 21:00:58
when I write Python code from the interpreter I can type dir() to have a list of names defined in the current scope. How can achieve to have the same information, programmatically, when I develop Javascript code from a browser using an interactive console like firebug, chrome console, etc? There are a couple of functions which do just this in the code for ChatZilla, you'll have to check the licence properly to see if you can just rip them out and use them wherever. The relevant functions can be found at http://hg.mozilla.org/chatzilla/file/59b46c0bf716/js/lib/utils.js#l136 dumpObject and

Having a console in a single-threaded Python script

时光总嘲笑我的痴心妄想 提交于 2019-11-27 15:25:06
问题 I would like to have an interactive console in a single-threaded script that has several TCP connections open. This means I can't just have a standard input blocking the thread. Is there an easy way to do this? Or should I just put the console in its own thread and be done with it? 回答1: You can subclass InteractiveConsole (from the builtin 'code' module) and override the push() method with a wrapper that redirects stdout/stderr to a StringIO instance before forwarding to the base

Detect empty command

这一生的挚爱 提交于 2019-11-27 14:43:19
问题 Consider this PS1 PS1='\n${_:+$? }$ ' Here is the result of a few commands $ [ 2 = 2 ] 0 $ [ 2 = 3 ] 1 $ 1 $ The first line shows no status as expected, and the next two lines show the correct exit code. However on line 3 only Enter was pressed, so I would like the status to go away, like line 1. How can I do this? 回答1: Here's a funny, very simple possibility: it uses the \# escape sequence of PS1 together with parameter expansions (and the way Bash expands its prompt). The escape sequence \#

How to finish sys.stdin.readlines() input?

妖精的绣舞 提交于 2019-11-27 12:06:14
This might be a silly question, but as I can't find an answer, I have to ask it. In interactive python I want to process a message which i get with: >>> message = sys.stdin.readlines() Everything works fine, but... how to stop it from getting an input and make it save into message variable? Stopping with ctrl+c stops whole process so there is no input to be saved anywhere. I guess there's an easy answer I just can't find... For unix based system : Hello, you can tape : Ctrl d Ctrl d closes the standard input (stdin) by sending EOF . Example : >>> import sys >>> message = sys.stdin.readlines()

What are the available interactive languages that run in tiny memory? [closed]

僤鯓⒐⒋嵵緔 提交于 2019-11-27 10:01:06
I am looking for general purpose programming languages that have an interactive (live coding) prompt work in 32 KB of RAM by itself or 8 KB when the compiler is hosted on a separate machine run on a microcontroller with as little as 8-32 KB RAM total (without an MMU). Below is my list so far, what am I missing? Python : The PyMite VM needs 64K flash, 8K RAM. Targets LPC, SAM7 and ATmegas with 8K or more. Hosted. Lua : The eLua FAQ recommends 256K flash, 64K RAM. FORTH : amforth needs 8K flash, 150 bytes RAM, 30 bytes EEPROM on an ATmega. Scheme : armpit Scheme The smallest target is the

Are there good Java libraries that facilitate building command-line applications? [closed]

主宰稳场 提交于 2019-11-27 09:45:40
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I need to write a simple command-line application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters... UPDATE Something that has built-in TAB completion would be particularly great. 回答1: I've used the Apache