I'm rather new to Ruby, and so far, figuring out how to use "binding" objects is one of the biggest pain points for me. If I'm reading the documentation correctly, they're almost entirely opaque. To access the scope inside the binding object, you have to have a string of Ruby code and eval it using the binding.
Maybe I'm just a purist...
Is it possible to execute groovy code dynamically loaded in java application.
For example there is a database table which contains small pieces of groovy code, like:
def test(${val_to_insert_from_java}){
if (${val_to_insert_from_java} > 10){
return true;
}
return false;
}
Where ${val_to_insert_from_java} is a place...
Hello,
I have the following code:
eval($(this).text());
Now this.text() contains about 50 lines of JS with ''s and ""'s and various JS code. Now, FireFox, Safari and Chrome have no problem executing this code. However, IE7 reports:
Error: Expected ')' Code: 0
Now, I assume this is some "",'' or () ie syntax problem... however, I can...
I am using sun.misc.BASE64Encoder to encode an encrypted value, which is then added to a JSON field and subsequently sent to the client. I use Javascript's eval() function on the client to create an object from the JSON code. When eval() runs, it gives the error:
unterminated string literal
There are other fields in the JSON cod...
What's the best way to remove these tags from a string, to prepare it for being passed to eval() ?
for eg. the string can be something like this:
<?php
echo 'hello world';
?>
Hello Again
<?php
echo 'Bye';
?>
Obviously str_replace won't work because the two php tags in the middle need to be there (the the 1st and the last n...
I am calling a python script with the following command line:
myscript.py --myopt="[(5.,5.),(-5.,-5.)]"
The question is -- how to convert myopt to a list variable. My solution was to use optparse, treating myopt as a string, and using
(options, args) = parser.parse_args()
myopt = eval(options.myopt)
Now, because I used eval()...
How do you write a function in bash that executes the command that it is given as an argument, where
The given command may be an alias
Arguments must be passed on exactly as given; no evaluating may be done
In other words, how to write an as-transparent-as-possible wrapper function.
The goal of the wrapper function could for example...
I'm writing a script to execute CURL commands for a given user input. The script has multiple helper function to create the list of parameters (arguments) that will eventually be passed to CURL.
A stripped out example, is as follows :
#!/bin/bash
function create_arg_list
{
# THIS HTTP HEADER VALUE COMES FROM THE USER and MAY CONTAI...
What happens internally when I press Enter?
My motivation for asking, besides plain curiosity, is to figure out what happens when you
from sympy import *
and enter an expression. How does it go from Enter to calling
__sympifyit_wrapper(a,b)
in sympy.core.decorators? (That's the first place winpdb took me when I tried inspecting an...
Short question, if this works (and it does):
eval("new " + generator.className + "(" + generator.constructorArgs.join(", ") + ")");
why doesn't this work:
eval(generator.className + ".prototype.constructor.apply({}, generator.constructorArgs);");
The second expression always returns undefined, but in my opinion it should work. I ...
I have a database query that I am running inside an eval, to trap the error. Problem is that the error message is outputting to console, even though it is being trapped. How do I stop the error message from doing this, as I want to parse it myself and spit back my own messages?
my $dbh = DBI->connect('dbi:Pg:dbname=database;host=localho...
I am trying to insert dynamic data into a onclick property for a control the code looks like this
onclick="openRadWindow('<%#Eval("ID";) %>','<%#Eval("ParentObjectID") %>');"
I cant get it to fire and the trouble seems to be the double quotes, what is the correct method on escaping the quotes so that this fires.
...
Disclaimer; I'm fully aware of the pitfalls and "evils" of eval, including but not limited to: performance issues, security, portability etc.
The problem
Reading the PHP manual on eval...
eval() returns NULL unless return is
called in the evaluated code, in which
case the value passed to return is
returned. If there is a par...
I'll try and explain the best I can...
I have a page, we'll call it pageA. When a button is clicked on that page, an ajax request is sent out and the return data is eval()'d. That data obviously contains javascript code. This code could possibly contain event listeners that are added to pageA when it is eval'd. Something like jquery...
I have a let statement in which I would like to dynamically destructure a list. The following is my solution:
symList ;; list of some Strings which will become the vector of Symbols to assign to
valList ;; list of some values, same length as symList
(let [(map read-string symList) valList]
...)
An example value of symList would b...
Hello everybody.
I working with jQuery and i needed to generate an anonymous method with the eval() function.
The following lines worked with Opera but not with IE, FF, Chrome:
var callbackStr = "function(){alert('asdf');}";
var callback = eval(callbackStr);
callback();
This code works with all Browsers:
var callbackStr =...
My html page dynamically loads pages via Ajax for dynamic panels on the page. I need the script tags in the dynamically loaded pages to be executed. I fixed the code from a SO question. It works fine on FF/Safari/Chrome.
But dom nodes of type script work differently on IE. -- I can't seem to add text to a script node in IE 7:
// varia...
Hi, I'm new to ruby however it isn't really that drastic of a change coming from perl, anyways 've written a simple script to convert my gobs of perl Data::Dumper output into yaml configs, my problem is I'm using eval to accomplish this and seeing as I may like others to use this script one day I would like to eliminate eval for somethin...
Possible Duplicate:
How to use a variable in the replacement side of the Perl substitution operator?
I would like to do something like
$sub = "\\1";
$match = "hi(.*)";
$str = "hi1234"
$res = $str;
$res =~ s/$match/$sub/g
I would like this to return 1234 but in this case it returns \1. I.e. I want it to be equivalent to s/$m...
Hi all,
eval() returns the same error, even with the simplest of inputs.
>> ns=int2str(17)
>> xs=num2str(18)
>> d = eval(ns,'+',xs)
??? Index exceeds matrix dimensions.
>> eval('1/2')
??? Index exceeds matrix dimensions.
Any help would be appreciated.
...