eval

VB.NET logical expression evaluator

I need to test a logical expression held in a string to see if it evaluate to TRUE or FALSE.(the strig is built dynamically) For example the resulting string may contain "'dog'<'cat' OR (1>4 AND 4<6)". There are no variables in the string, it will logically evaluate. It will only contain simple operators = > < >< >= <= and AND , OR and O...

Accessing object property as string and setting its value

Hello there, I have an object in csharp from the class Account each account have a owner, reference, etc. One way I can access an accounts properties is through accessors like account.Reference; but I would like to be able to access it using dynamic string selectors like: account["PropertyName"]; just like in javascript. so I wou...

Using eval() in Javascript to unpack the array

I have an array that I need to unpack. So, from something like var params = new Array(); params.push("var1"); params.push("var2"); I need to have something like "var1", "var2". I tried using eval, but eval() gives me something like var1, var2...i don't want to insert quotes myself as the vars passed can be integers, or other type...

Can IDL evaluate strings as code?

Is there any functionality in IDL that will allow it to evaluate a a string as code? Or, failing that, is there a nice, dynamic way of including /KEYWORD in functions? For example, if I wanted to ask them for what type of map projection the user wants, is there a way to do it nicely, without large if/case statements for the /Projection_...

eval "the serialized object using JavaScriptSerializer()" after removing special characters

I need to eval an JavaScriptSerializer() object. var userSettings = '<%= new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(ViewData["UserSettings"]) %>'; The above line gives the output as: {"SalesTaxPercentage":7.75,"StartOfWeek":"SUNDAY","NoofRowsInList":10,"ShowDashboardEntry":5,"DisplayContactsFormat":"LastName...

How to eval javascript code with iPhone SDK?

I need to fetch some result on a webpage, which use some javascript code to generate the part I am interesting in like following eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--)d[c]=k[c]||c;k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b...

unterminated string literal on json eval

I am trying to eval() a json having speacial characters - 
 and getting "unterminated string literal" error in Firefox 3.5.9 Although the same works fine on IE. 7. I have set the character encoding to UTF-8 in both the browsers. Any idea why its an error in FF? Also right before converting the String to JSON, I ran this code in java ...

Is `eval`ing in a CPAN module without localizing $@ a bug?

I think I've encountered a bug in Params::Validate, but I'm not sure whether I identified the problematic code piece correctly. The code in question failed to pass exceptions up the chain (using Try::Tiny), so I started debugging and found out that a class used inside the try block has a destructor. This destructor calls object methods w...

Is there a way to pass params to a script in TCL that is run using eval source?

I have a script that calls: eval source \{$scriptfile\} where $scriptfile is another TCL script. Is there way to pass parameters to the script? I'd like to do something like: set sampleData "ID=14678934" eval source \{$scriptfile\} $sampleData I know that this isn't allowed but, is there a way to pass data to a script that is ...

.net 4 - run code from string - in C# / F# / IronRuby / IronPython.

What ways do I have in .net to run code from string? Console.WriteLine(Compile("1 + 2 * 3")); // results is 7. What other options do we have? C# - Compile the code on runtime? IronRuby / IronPython? F#? ...

evaluate boolean values in Java

I am trying to evaluate the following from a string boolean value = evaluate("false || true && true && false || true"); I need to get a boolean value of true for this one. Any ideas on how to solve this problem in the most efficient way? ...

Can I strictly evaluate a boolean expression stored as a string in Java?

I would like to be able to evaluate an boolean expression stored as a string, like the following: "hello" == "goodbye" && 100 < 101 I know that there are tons of questions like this on SO already, but I'm asking this one because I've tried the most common answer to this question, BeanShell, and it allows for the evaluation of statemen...

Updating a popup window from source page

I have a list of people wrapped in a-tags with onclick for opening a popup window. That popup window contains a previous and next button that invoker a function in the parent window to get the previous/next a-tag and execute the onclick for it. nextAnchor.onclick(); This should update the popup window with the new persons info, bu...

is there an eval in ML?

is there a eval function in ML? ...

get_called_class hack not working with eval-code.

Hi there. I am using a ge_called_class hack for allowing late static binding in php version 5.2 (found here). I have the following in my code: # db_record.php $ac = "ForumThread"; $objects = $ac::find("all"); This will not work in php 5.2 for some reason, so I have done this: # db_record.php $ac = "ForumThread"; eval("\$objects =...

javascript eval backslash in window NT path problem

I am experiencing a classic JS case (in my opinion) but after a lot of googling, still not able to find a solution. Backslash is considered as a escape character in JS but what you do when you need to pass windows path from the JS and print it? I am using eval because my java applet is executing the code and placing bits when it has a s...

Getting references to local variables created during eval() in JavaScript

In the scenario below, how can I get references to the variables declared during eval() if I do not know their names? function test() { eval("var myVariable = 5"); var locals = magic() // TODO What should we do here? alert(locals["myVariable"]); // returns myVariable } Just a note: JavaScript being evaluated comes from a trusted...

Matching n parentheses in perl regex

Hi, I've got some data that I'm parsing in Perl, and will be adding more and more differently formatted data in the near future. What I would like to do is write an easy-to-use function, that I could pass a string and a regex to, and it would return anything in parentheses. It would work something like this (pseudocode): sub parse { ...

Javascript: Replace Eval() and a object length undefined problem

Here's my stripped down function for recursing through a browsers dom structure. (function () { function displaydom (child, parent) { if (parent) {parent = parent+".";}; // if there is no parent then child is the parent var jsns = eval(parent+child); // Join parent + child and eval for (var i in jsns){ // l...

Why eval() isn't working here to deserialize such a simple JSON object?

Hi, I am trying to use eval() function to deserialize this JSON text by using eval function. var personJSON = {"FirstName":"Burak","LastName":"Ozdogan","Id":"001" ,"Department":"Information Technologies"}; var personBurakOzdogan = eval('(' + personJSON + ')'); But I am getting this error: *Microsoft JScript compilation err...