interpreter

In what Javascript engines does Function.prototype.toString not return the source code of that function?

南楼画角 提交于 2019-11-29 06:11:47
问题 EDIT: To be explicit, I am not looking for advice or opinions on the qualitative merit of the various issues implied by the functionality in question — neither am I looking for a reliable solution to a practical problem; I am simply looking for technical, verifiable answers to the question in the title. I have appended the question with a list of non-conforming browsers. Using a function's .toString method will typically render the source code for that function. The problem is that this

How to get the full path to php interpreter / binary without shell access

大城市里の小女人 提交于 2019-11-29 05:57:09
How can I get the full path to php interpreter from a php script (no command line access). What I need to do is: $foo = "/usr/bin/php"; echo $foo; But I need to get the path first so I can assign it to foo. If you have a solution that works on both Windows and nix even better but if not, nix would be fine. Before you ask, Asking the host is out of the question No shell access The problem is that using whatever it outputs doesn't work. For example PHP_BINDIR will output /usr/bin but using /usr/bin/php won't help. The full code is: exec("php-cli $path_to_file > /dev/null 2>/dev/null &"); But

Why python compile the source to bytecode before interpreting?

谁说胖子不能爱 提交于 2019-11-29 01:45:30
Why python compile the source to bytecode before interpreting? Why not interpret from the source directly? Nearly no interpreter really interprets code directly , line by line – it's simply too inefficient. Almost all interpreters use some intermediate representation which can be executed easily. Also, small optimizations can be performed on this intermediate code. Python furthermore stores this code which has a huge advantage for the next time this code gets executed: Python doesn't have to parse the code anymore; parsing is the slowest part in the compile process. Thus, a bytecode

/usr/bin/perl: bad interpreter: Text file busy

a 夏天 提交于 2019-11-28 21:08:25
This is a new one for me: What does this error indicate? /usr/bin/perl: bad interpreter: Text file busy There were a couple of disk-intensive processes running at the time, but I've never seen that message before—in fact, this is the first time that I can remember getting an error when trying to run a Perl script. After a few seconds of waiting, I was able to run it, and haven't seen the issue since, but it would be nice to have an explanation for this. Running Ubuntu 9.04, file system is ext3. cjm I'd guess you encountered this issue . The Linux kernel will generate a bad interpreter: Text

How to force interpreter show complete stack trace?

佐手、 提交于 2019-11-28 20:48:57
Is there any way to force Scala interpreter (started through SBT) to print complete stack trace. By default, less than 10 lines are displayed: scala> new CacheMonitoringClient javax.management.InstanceNotFoundException: com.bea:Name=DomainRuntimeService,Type=weblogic.management.beanservers.domainrun time.DomainRuntimeServiceMBean at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:195) at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224) at javax.management.remote.rmi.RMIConnectionImpl_921_WLStub.getAttribute(Unknown Source) at weblogic.management.remote.common

Haskell: actual IO monad implementation, in different language?

拥有回忆 提交于 2019-11-28 20:35:08
问题 How is IO monad actually implemented?in sense of, what would be the actual implementation of the main function? How would I call haskell function (IO) from another language and do I in that case need to maintain IO my self? Does main pulls IO actions (Lazily) as references and then call them? Or it is interpreter job, when it found actions in its way it can call them? Or maybe something else? Is there good IO monad implementation in different language which can help to deeply understand what

sandboxing/running python code line by line

匆匆过客 提交于 2019-11-28 19:41:41
I'd love to be able to do something like these two are doing: Inventing on principle @18:20 , Live ClojureScript Game Editor If you don't wanna check the videos, my problem is this: Say I had this code: .... xs = [] for x in xrange(10): xs.append(x) ... I'd like to make an environment where I can execute the code, statement for statement and watch/trace the locals/globals as they change. Maybe give it a list of vars to keep track of in the locals/globals dictionaries. Like stepping through the code and saving the state info. Optimally I'd like to save every state and it's associated context

What is the exact definition of a Metacircular Interpreter?

蹲街弑〆低调 提交于 2019-11-28 19:31:16
Is it legal to call a C compiler written in C or a PHP interpreter written in PHP metacircular? Is this definition valid only for languages of a specific type, like Lisp? In short, what are the conditions that an interpreter should satisfy for being called Metacircular? A metacircular interpreter is an interpreter written in a (possibly more basic) implementation of the same language. This is usually done to experiment with adding new features to a language, or creating a different dialect. The reason this process is associated with Lisp is because of the highly lucid paper "The Art of the

PyCharm. /usr/bin/python^M: bad interpreter [duplicate]

寵の児 提交于 2019-11-28 18:33:07
This question already has an answer here: ./configure : /bin/sh^M : bad interpreter [duplicate] 15 answers Cannot figure out, where to change EOF in PyCharm. My scripts, started with: #!/usr/bin/python # -*- coding: utf-8 -*- Outputs something like this, when I try to run it like executable (chmode +x): -bash: ./main.py: /usr/bin/python^M: bad interpreter: No such file or directory What to do and how to be? Set line separator to Unix : The issue is not EOF but EOL. The shell sees a ^M as well as the end of line and thus tries to find /usr/bin/python^M . The usual way of getting into this state

How to get the current Python interpreter path from inside a Python script? [duplicate]

本秂侑毒 提交于 2019-11-28 18:08:10
This question already has an answer here: Find full path of the Python interpreter? 3 answers I want to run a Python script from a Python script with subprocess , and I wish to do it using the same interpreter for each of them. I'm using virtualenv, so I'd like to do something like: subprocess.Popen('%s script.py' % python_bin) How do I get python_bin ? It should be /usr/bin/python outside a virtualenv, and /path/to/env/bin/python in a virtualenv. Ignacio Vazquez-Abrams The name of the interpreter is stored in the variable sys.executable I found it by: >>> import sys >>> help(sys) ... DATA _