eval

Eval strips time segment of a SQL DateTime field

Was going to call this "Eval won't give me the Time of Day," but thought that too cute. I'm kind of having the opposite problem from the suggested questions I see for my title, so here goes: Visual Studio 2008 Pro, SQL Express 2008, Vista. Web Project, where I'm opening records from an Event Table with JOINed info from a Facilities tab...

nmake - simulating eval function

I'd like to get value of variable named $(MYVAR)_SOME_SUFFIX in the b.mak makefile. Instead I get "b.mak(2) : fatal error U1001: syntax error : illegal character '$' in macro" # ---- a.mak ---- all : set MYVAR=SOME_PREFIX nmake -f b.mak #--- END --- # ---- b.mak ---- all: @echo $($(MYVAR)_SOME_SUFFIX) #--- END --- ...

how to convert string to code in c#

I saw there is such question in c++ I am a very begginer and I need a very simple example how to do it . the user writes code in the text box and what I need o do is to execute it how??? ...

Easily access an array based on its dimensions

Lets say I have an array which has n dimensions. Now in order to access a slot you typically use: array [1][0] What if the number of dimensions are not known at compile-time, is there an easy access like: slot = "1,0" array [slot] // accessing 1,0 Which means I can also easily navigate back and forth slot += ",2" array [slo...

exec statement with/without prior compile

These weekend I've been tearing down to pieces Michele Simionato's decorator module, that builds signature-preserving decorators. At the heart of it all there is a dynamically generated function, which works something similar to this... src = """def function(a,b,c) :\n return _caller_(a,b,c)\n""" evaldict = {'_caller_' : _caller_} co...

Improve speed by memory+eval or use regular file

I'm trying to improve the speed of our server but I would like to have your view of that before modifying everything. I have a high read rate on my file system. Right now we are using regular PHP file. I wonder if I can cache these file in Memcache and later do an eval on the code if it will be faster than letting these file get interpr...

Alternatives to JavaScript eval() for parsing JSON

Quick Question. Eval in JavaScript is unsafe is it not? I have a JSON object as a string and I need to turn it into an actual object so I can obtain the data: function PopulateSeriesFields(result) { data = eval('(' + result + ')'); var myFakeExample = data.exampleType } If it helps I am using the $.ajax method from jQuery. T...

when is eval evil in php?

hi all, i all the years i have been developing in php, i've always heard that using eval() is evil. considering the following code, wouldn't it make sense, to use the second (and elegant) option? if no, why? // $type is the result of an SQL statement // e.g. SHOW COLUMNS FROM a_table LIKE 'a_column'; // hence you can be pretty sure ab...

Perl: $SIG{__DIE__}, eval { } and stack trace

I have a piece of Perl code somewhat like the following (strongly simplified): There are some levels of nested subroutine calls (actually, methods), and some of the inner ones do their own exception handling: sub outer { middle() } sub middle { eval { inner() }; if ( my $x = $@ ) { # caught exception if (ref $x eq 'ARRA...

Is it possible to execute a string in MySQL?

I have to convert an MSSQL stored proc that passes a varchar that is a query. The proc has the following command: INSERT INTO Results EXEC (@Expresion); This isn't working. I'm pretty sure that EXEC and EXECUTE arent MySQL commands but CALL doesn't work either. Does anyone know if its even possible to have something like JavaScript'...

Pass multiple arguments through Eval to Javascript function

Hi, I am trying very hard to pass three parameters to a javascript function from within a itemtemplate of a gridview: For one parameter, it works fine: <asp:HyperLink ID="hypComment" runat="server" Font-Bold="True" NavigateUrl='<%# Eval("CCN", "javascript:ShowCommentPopUp({0});") %>'>Add </asp:HyperLink> where CCN is my column in gr...

Running Python code contained in a string

I'm writing a game engine using pygame and box2d, and in the character builder, I want to be able to write the code that will be executed on keydown events. My plan was to have a text editor in the character builder that let you write code similar to: if key == K_a: ## Move left pass elif key == K_d: ## Move right pass ...

how to evaluate formula passed as string in php?

Just trying to figure out the proper and safer way to execute mathematic operation passed as string. In my scenario it is values fetched from image EXIF data. After little research I found two way of doing it. first, using eval: function calculator1($str){ eval("\$str = $str;"); return $str; } second, using create_function: ...

C# Eval() support

Hi Guys, we need to evaluate a value in an object in run time while we have a textual statement of the exact member path for example: myobject.firstMember.secondMember[3].text we thought of parsing this textual statement using regex and then evaluate the text value by using reflection but before we do that i wonder if C# support some kin...

how to eval() a segment of a string

I have a string that has HTML & PHP in it, when I pull the string from the database, it is echo'd to screen, but the PHP code doesn't display. The string looks like this: $string = 'Hello <?php echo 'World';?>'; echo $string; Output Hello Source Code Hello <?php echo 'World';?> When I look in the source code, I can s...

How can I access variables that are named sequentially by a loop while still inside of the loop?

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the variable $tab) (23:32:12\[[email protected]) [~/bin]$ ...

eval issues in IE

While running eval() in IE7 if my JSON contains language specific characters like è, its not evalled properly. Is there a way I can change the language settings to make this work? ...

cakephp with jquery .load

hi, i've got a problem, i'm using cakephp and im loading into a div a page function loadContent(targetDiv, sourceUrl) { $(targetDiv).empty().html('<img src="/gambu/img/ajax-loader.gif" />'); $(targetDiv).load(sourceUrl); } it work's ok, but in a loaded page i've got autocomplete and thickbox, and that's not workin...

How can I get this eval() call to work in IE?

I have some javascript that goes out and fetches a javascript "class" on another xhtml page. The remote javascript looks something like the following: (function() { this.init = function() { jQuery("#__BALLOONS__tabs").tabs(); }; }) After this is fetched into this.javascript, I try to eval it and ins...

Dynamically referencing Javascript Array name without using Eval?

Given that EVAL is Evil how do I create an Array name dynamically: I have a bunch of Arrays and I need to reference different ones depending on what the user clicks. This bit of code gives me the array object: (eval(calendarObject.id + '7')) But eval is bad, so how to do I construct an Array name and then reference it? Here's a bi...