Including JavaScript in SVG

Here is a working version as I would write it: <!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd”> <svg version=”1.1″ xmlns=”http://www.w3.org/2000/svg”> <circle cx=”250″ cy=”250″ r=”50″ fill=”red” /> <script type=”text/javascript”><![CDATA[ var KEY = { w:87, a:65, s:83, d:68 }; var moveSpeed = 5; var circle = document.getElementsByTagName(“circle”)[0]; var x = circle.getAttribute(‘cx’)*1, y = circle.getAttribute(‘cy’)*1; document.documentElement.addEventListener(‘keydown’,function(evt){ switch (evt.keyCode){ … Read more

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

For UNIX based systems (Linux, Mac): Hello, you can type : Ctrld Ctrld closes the standard input (stdin) by sending EOF. Example : >>> import sys >>> message = sys.stdin.readlines() Hello World My Name Is James Bond # <ctrl-d> EOF sent >>> print message [‘Hello\n’, ‘World\n’, ‘My\n’, ‘Name\n’, ‘Is\n’, ‘James\n’, ‘Bond\n’] For Windows : To … Read more

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

In order to manipulate the terminal you have to use control sequences. Unfortunately, those codes depend on the particular terminal you are using. That’s why terminfo (previously termcap) exists in the first place. You don’t say if you want to use terminfo or not. So: If you will use terminfo, it will give you the … Read more

Interactive input/output using Python

None of the current answers worked for me. At the end, I’ve got this working: import subprocess def start(executable_file): return subprocess.Popen( executable_file, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) def read(process): return process.stdout.readline().decode(“utf-8″).strip() def write(process, message): process.stdin.write(f”{message.strip()}\n”.encode(“utf-8”)) process.stdin.flush() def terminate(process): process.stdin.close() process.terminate() process.wait(timeout=0.2) process = start(“./dummy.py”) write(process, “hello dummy”) print(read(process)) terminate(process) Tested with this dummy.py script: #!/usr/bin/env python3.6 import … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)