eval

eval creating problems in evaluating

i am using eval to convert string decimals to decimals. eval("000451.01"); When i am using the above statement javascript it throws exception 'expected ;' and when using eval("000451"); it gives me a different result. anyone has got any idea?? ...

Want to avoid eval AND Function constructor

Trying hard to replace the eval without using Function constructor. Stumped. I am not a newbie but not an expert either. jslint says this is evil; when I replaced it with a Function constructor, it said that was just a form of eval()! evaluateEventScript: function(requestObject) { var resultData; resultData = eval(r...

How safe is expression evaluation using eval ?

I am building a website where I have a need that user should be able to evaluate some expression based from the value in DB tables, instead of using tools like pyparsing etc, I am thinking of using python itself, and have come up with a solution which is sufficient for my purpose. I am basically using eval to evaluate the expression and ...

Help loading contstants stored in serialized array using eval() and constant()

DISCLAIMER: Please read carefully as this is NOT a question about storing arrays in constants or simple eval() or serialize() techniques. This IS a question primarily about how constants work in PHP and why the constant() function is not working to convert a constant name into a constant value. Thanks. BACKGROUND: For various reasons, I...

syntax problem in using eval() in a character literal

Hi, i have a link inside a repeater, and i want to change the url dynamically according to the value inside repeater item. The problem is when the href value is like this href='<%# (Boolean.Parse(Eval("HasFile").ToString())==true) ? "www.milliyet.com.tr" : "../Static_Pages_Content.aspx?Parent_ID=Eval("Node_ID")"%>' I'm gettin a synt...

Decoding eval gzinflate base64_decode (Anyone Know of a Decoder I could Use for This)

I want to make sure that this code is not harmful but everytime I try to decode it it doesn't actually do anything but give me even crazier looking symbols. Any suggestions would be helpful. Below is the actual encrypted code... eval(gzinflate(str_rot13(base64_decode('FZnHDoRVElF/cmE7Kw5rpx3tCO+95zLCe3Uaz9diL9cCFVZSc7wQf//3r7//qM55...

What are the Alternatives to eval in JavaScript?

I have a little bit of code that looks just like this: function StrippedExample(i1, i2, i3, i4, i5, i6, i7, i8) { this.i = []; for (var i=1,j=0 ;i<9;i++) { var k = eval("i"+i); if (k > 0) { this.i[j++] = k; } } } FireBug profiler claims that second longest function is eval(), taking up t...

Errors with basic PHP template using eval()

I'm just about ready to cry. I have read the php.net manual page, tried a dozen Google searches with various phrases, and scanned hundreds of stackoverflow threads. I have seen this method in use, but it just doesn't work for me. It seems so basic. I have a couple related questions or problems I don't know how to find answers to. The im...

Dynamic JavaScript If Statement

In PHP I can do: // $post = 10; $logic = >; $value = 100 $valid = eval("return ($post $logic $value) ? true : false;"); So the statement above would return false. Can I do something similar in JavaScript? Thanks! Darren. ...

PHP eval returns null but a return is called

Hi all, I have a, I think fairly easy, question, but I can't figure out what I'm doing wrong. I have a function which i call with PHP's function eval. I'm expecting an, selfbuilt, ArrayList to get as a result. But instead when I use gettype I see the result is NULL. Even though I'm using return in the eval-ed function. As far as I'm a...

What's wrong with this eval statement in Perl?

What's wrong with this eval statement in Perl? I'm trying to check that the XML is valid by catching any exceptions thrown from the parsing of the file with XML::LibXML: use XML::LibXML; my $parser = XML::LibXML->new(); #creates a new libXML object. eval { my $tree = $parser->parse_file($file) # parses the file contents i...

Why doesn't Perl's eval catch problems from Test::Cmd::Common->unlink?

Hi, I have the following perl code : use strict; use warnings; use Test::Cmd::Common; my $path = "/something/not/available"; my $test = Test::Cmd::Common->new(string => 'File system operations'); eval{ $test->unlink("$path"); }; ok(!$@, "file unlike"); print "done.\n"; The $test->unlink() line will fail and throw exception....

Parse error in eval

Is there something wrong with using the following: $test .= '$row[\''.$row[0].'\'].'; //When echo'ed shows echo $test; //$row['CustomerID'].$row['CompanyName'] //I have used it like this eval($test) PHP complains: Parse error: parse error in C:\w.php(73) : eval()'d code on line 1 I can't see where the parse error is. Please help. ...

PHP: using the eval function with HTML and PHP code

Hey guys, I currently have the following code coming from a database table: <h1 class="widgetHeader">My Friends</h1> <div class="widgetRepeater"> <p class="widgetHeader">Random Selection</p> <?php $friends = $user->getFriends(); ?> <p class="widgetContent"> <?php for ($i=0; $i<count($friends);$i++) {...

How can I pass parameters to Perl subroutines defined using eval?

I'm using a config file (in YAML) to define types that are used later on to validate other config values required for my app: --- action: > use List::MoreUtils; my $value = $_; any { $value eq $_ } qw(fatal keep merge non-fatal replace); dir : return defined $_ ? -d $_ : -1; file : return defined $_ ? -f $_ : ...

Convert string in Class name (from appengine datastore to class)

Hello guys, I'm using appengine to develop an application. Ideally I would like to define a new kind (called Recipe) like this: class Recipe(db.Model): ingredients = db.ListProperty(type) quantities = db.ListProperty(int) However it seems that you cannot use "type" as the class value in ListProperty. I was thinking of instead ...

Python eval error suppression

First off, I'm aware of eval's disadvantages and it will be used in an experiment I want to make only. I'm creating a script that works just like a Brute-Force algorithm but it won't break passwords but find the solution to a special form of an equation (more details are unnecessary). There will be lots of strings filled with (often sy...

Using Javascript, how can I simulate clicking on a server-side link button by using eval function in client-side?

hi all vascript, how can I simulate clicking on a server-side link button by using eval function in client-side? ...

How do you eval() a PHP code through multiple levels?

I have this code: $layout_template = template_get("Layout"); $output_template = template_get("Homepage"); $box = box("Test","Test","Test"); eval("\$output = \"$layout_template\";"); echo $output; In the $template_layout variable is a call for the variable $output_template, so then the script moves onto the $output_template variable ...

How do you create a PHP eval loop?

The code I'm using is: while($template = array_loop($templates)) { eval("\$template_list = \"$template_list\";"); echo $template_list; } It appears to detect how many templates there are successfully, but it just shows the same name for them all: Name: LayoutName: LayoutName: LayoutName: LayoutName: LayoutName: LayoutName: La...