Hello all.
Heres my situation:
import foo, bar, etc
frequency = ["hours","days","weeks"]
class geoProcessClass():
def __init__(self,geoTaskHandler,startDate,frequency,frequencyMultiple=1,*args):
self.interval = self.__determineTimeDelta(frequency,frequencyMultiple)
def __determineTimeDelta(self,frequency,frequencyMu...
Hello,
I got an array which I iterate over and try to create a variable.
The name of the variable is variable and comes from the array. So I am using eval (this code will only be used on my local computer) to create the variables.
Weird enough I can create a variable and add plain text to the contents of it. But whenever I try to set a...
Let's say I have a variable's name stored in another variable:
myvar=123
varname=myvar
now, I'd like to get 123 by just using $varname variable.
Is there a direct way for that? I found no such bash builtin for lookup by name, so came up with this:
function var { v="\$$1"; eval "echo "$v; }
so
var $varname # gives 123
Which d...
Man page for bash says, regarding -c option:
-c string
If the -c option is present, then commands are read from
string. If there are arguments after
the string, they are assigned to the
positional parameters, starting with
$0.
So given that description, I would think something like this ought to work:
bash -c "echo arg ...
Here's a snippet of a bash script I'm writing to log CPU loads:
#!/bin/bash
# ... irrelevant nonsense ...
cmd1="/usr/bin/mpstat -P ALL | egrep '(AM|PM)([[:space:]]+)(0)' | tr -s ' ' | cut -d' ' -f4"
ldsys="$(echo $cmd1 | /bin/sh)"
# ... irrelevant nonsense ...
$ldsys is set properly when the script is executed conventionally from the ...
I'm trying to do an instance_eval followed by a attr_accessor inside initialize, and I keep getting this: `initialize': undefined method 'attr_accessor'. Why isn't this working?
The code looks kind of like this:
class MyClass
def initialize(*args)
instance_eval "attr_accessor :#{sym}"
end
end
...
I'd like to port a little piece of code from Ruby to Groovy, and I'm stuck at this:
def given(array,closure) {
closure.delegate = array
closure()
}
given([1,2,3,4]) {
findAll { it > 4}
}
Right now it dies with this message:
Exception thrown: Cannot compare ConsoleScript0$_run_closure1 with value 'ConsoleScript0$_run_closu...
Hi all,
I'm curious to know if R can use its "eval" function to perform calculations provided by e.g. a string.
This is a common case
> eval("5+5")
However, instead of 10 I get
[1] "5+5"
Any solution? :-)
...
Hello everybody,
I have a list of items in a page that must be hidden in sequence, but just after the previous item has been totally hidden.
I made the following code, where I create a big string inserting the callbacks inside the previous callbacks and later use eval to execute the effects, but despite the code is working fine as expe...
I'm updating a bash script which serves as a program testing tool.
Previously, I had this line in a script working perfectly ($BIN_FILE is set to a relative path to the binary being tested):
$BIN_FILE $BIN_OPTS &> $LOG_FILE
Then I've decided to add some "performance measurements":
time $BIN_FILE $BIN_OPTS &> $LOG_FILE"
This worked ...
I am trying to figure out how does eval() function works in a simple way. I tried the following code but it doesn't work, instead it shows up a parse error.
<?php
$str = "exit()";
eval($str);
?>
What's wrong with my code ?
...
Can anyone show me some absolutely minimal asp.net code to understand Eval() and Bind()?
It is best if you provide me with two separate code-snippets or may be web-links.
...
First I was changing HyperLink.NavigateUrl in code-behind on Page_Load().
But after I decided to do it in design using Eval() method.
<asp:HyperLink runat="server"
NavigateUrl='<%# String.Format("~/Refuse.aspx?type={0}&id={1}", Eval("type"), Eval("id")) %>' Text="Refuse" />
or
<asp:HyperLink ID="urlRefuse" runat="server"
N...
i want to execute a piece of bytecode so that it will run in a specific scope ?
for example
i want to be able to run this code
label.x = 100+label.width
and have it react to a label instance that is somewhere inside the compiled swf.
i want the code have the 'this' keyword of my abc code to point to the parent of the label instance....
Hi
I would like to count the number of calls made to eval in our javascript application.
I came up with the following, but it generates errors. These errors are hard to track, and my knowledge of the app is limited.
Can you tell what is wrong with my code ?
increment = function (){
var me = arguments.callee;
if (!me.count) me.co...
I need a way of taking an equation given as a string and finding it's mathematical answer, the big caveat is that I can't use eval().
I know the equation will only ever contain numbers, the four mathematical operators (i.e. * / + -) and parentheses, it may or may not have spaces in the string. Here's a couple of examples.
4 * 4
4+6/3
(...
I have strings which look like this one:
"(8, 12.25), (13, 15), (16.75, 18.5)"
and I would like to convert each of them into a python data structure. Preferably a list (or tuple) of tuples containing a pair of float values.
I could do that with eval("(8, 12.25), (13, 15), (16.75, 18.5)") which gives me a tuple of tuples, but I don't ...
I'm not really sure what to call these type of expressions, so an example would be easier...
Is there a way in Perl to evaluate expressions like a < b <= c? I have a configuration file that allows the user to provide conditional expressions for certain actions. Rather than splitting the condition into two parts (as I would normally do...
Is there a way to pass a list as a function argument to eval() Or do I have to convert it to a string and then parse it as a list in the function?
My simple example looks like:
eval("func1(\'" + fArgs + "\')")
I'm just not sure if there is a better way of taking fArgs as a list instead of a string
Note:
The list is provided from a ...
It seems to me that eval() is treated with the same disdain that goto is. And by eval, I mean a function for executing a string as code, as seen in PHP, Python, JavaScript, etc.. Is there ever a situation where using eval() is justified(except perl)? And if not, why do so many languages implement it?
...