eval

eval() is not allowed [closed]

微笑、不失礼 提交于 2019-12-13 09:57:55
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am using the WPAlchemy MetaBox PHP Class in my wordpress theme for some custom post types. Problem appears when I run the Theme-Check: WARNING: Found eval in the file inc/metaboxes/MediaAccess.php. eval() is

How to add a script code in my html in real time on browser open it

感情迁移 提交于 2019-12-13 09:27:25
问题 I want add a script code function in my html page, i'm tried using $(element).append('my script') but, this method has add like a text, no like code. How i can do this? I executed this code in my page console: document.querySelector("body").append('<script> function validarValorElemento(e){ var xpathWay = "xpath=//"+e.target.tagName+"[@class=\'" + e.target.className+"\']" var elementValue = e.target.textContent alert(xpathWay) alert(elementValue)}</script>'); This is the result. 回答1: IF I

Function with eval won't make it through minification

…衆ロ難τιáo~ 提交于 2019-12-13 04:32:58
问题 Here is my weird function that let my users create their own javascript code function evalThisFunction(functionBody){ var func; eval("func = " + functionBody); return func; } But after minification with Closure Compiler (http://closure-compiler.appspot.com/), I get this result : function a(b){eval("func = "+b);} Do you see a way I can modify my weird function so it will still works after minification? 回答1: Yes, use the Function constructor: function evalThisFunction(functionBody){ return

Saving matlab files with a name having a variable input

心已入冬 提交于 2019-12-13 04:24:28
问题 Hi friends I am new to matlab. I came up with a code which can convert all nc files to mat files in one turn. I used a for loop. Everything is fine and I am able to convert all files successfully. But there is a small drawback. All files have same variable name(which appears in workspace). This requires manual renaming. I think this is due to my matlab syntax limitation. I am putting code below. It will be great if you can suggest a way. After fixing, it will be really time saving code for

eval cat inside a function

北慕城南 提交于 2019-12-13 02:59:25
问题 I've been trying to evaulate an expression inside a function as follows: eval "fn() { $(cat fn.sh); }" Where fn.sh contains the following: #!/bin/sh echo "You provided $1." So that when I call: fn "a phrase"` it prints "You provided a phrase.". However I cannot get it to work. What's particularly frustrating is that: eval "$(cat fn.sh)" works perfectly! What am I missing here? What I've tried: eval "fn() { \"\$(cat fn.sh)\"; }" fn # bash: #!/bin/sh # echo "You provided $1." # return 1: No

syntax error, unexpected '=' in eval()'d code

梦想与她 提交于 2019-12-13 01:29:26
问题 What is wrong with this code: <?php eval(" $start = microtime(true)*1000; echo 'hello'; $end=microtime(true)*1000; $time = $end-$start; $time = round($time,4); echo '<br />Time taken: '.$time.'ms<br />'; "); ?> It's exactly one line code(dont ask why) but for readablility I repeat <?php eval(" $start = microtime(true)*1000; echo 'hello'; $end=microtime(true)*1000; $time = $end-$start; $time = round($time,4); echo '<br />Time taken: '.$time.'ms<br />'; "); ?> I get this error: Parse error:

How to evaluate a variable as an expression for axis label in R?

萝らか妹 提交于 2019-12-13 01:11:48
问题 Objective is to allow user to pass a string to a plotting function and have it evaluated correctly as plotmath. Question is how to combine an evaluated expression with other string text. It seems the presence of any other string or expression nullifies the evaluation of the label. Example: label1 <- 'degree~C' plot(1:10, type='l', xlab=bquote(.(parse(text=label1)))) #evaluated correctly plot(1:10, type='l', xlab=bquote('Some text'~~Omega^2~~.(parse(text=label1)))) #missing degree C Here is

How can I run eval in ClojureScript with access to the namespace that is calling the eval?

∥☆過路亽.° 提交于 2019-12-12 21:41:07
问题 I have a library of functions which I want to let users play with in the browser. So I want to set up a situation like this : I'm developing with figwheel and devcards. In the main core.cljs I require various functions from my library, so they're all in scope. Now I want to let the user enter some code which calls that library. I see how I can run that code with eval, but I can't see how to make my library functions visible to the code being evaled. And I'm confused by most of the

Calling user defined functions in PHP eval()

痞子三分冷 提交于 2019-12-12 21:08:58
问题 I was been doing a php testing which uses eval() function, but it seems that eval() can't call user defined functions properly. Please see my example: function equals($a,$b){ if ($t == $r){ return true; } else{ throw new Exception("expected:<".$r."> but was:<".$t.">"); } } eval("$test = 1;"); try{ echo eval("equals($test,1);"); } catch (Exception $e) { echo $e->getMessage(); } but what I have received is always like "expected:<1> but was:<>", but if I have do an echo $test; I can get 1. I

How can I make functions available to ClojureScript's eval?

给你一囗甜甜゛ 提交于 2019-12-12 20:03:32
问题 In this blog post by Dmitri Sotnikov a function eval-str is provided for running a string containing ClojureScript: (defn eval-str [s] (eval (empty-state) (read-string s) {:eval js-eval :source-map true :context :expr} (fn [result] result))) If I have some function x that I want to be able to call from inside the eval string, how can I do that? 回答1: There are two parts to the answer, assuming x is a var associated with a ClojureScript function: The compiler analysis metadata for x needs to be