eval

Repeater's SeparatorTemplate with Eval

穿精又带淫゛_ 提交于 2019-12-07 10:58:19
问题 is it possible to use Eval or similar syntax in the SeparatorTemplate of a Repeater? Id' like to display some info of the last item in the separator template like this: <table> <asp:Repeater> <ItemTemplate> <tr> <td><%# Eval("DepartureDateTime") %></td> <td><%# Eval("ArrivalDateTime") %></td> </tr> </ItemTemplate> <SeparatorTemplate> <tr> <td colspan="2">Change planes in <%# Eval("ArrivalAirport") %></td> </tr> </SeparatorTemplate> <asp:Repeater> <table> Hopping that it'll generate something

Is this use of Javascript eval() 100% safe?

谁说胖子不能爱 提交于 2019-12-07 09:05:50
问题 I'm writing a PHP library which generates Javascript code. The Javascript code has a number of components named component001 , component002 , etc. Pages are loaded dynamically via AJAX. I need to pass the name of the component via URL variable which is then evaled() by the script. The only way I am protecting what is being evaled is with the regular expression ^component[0-9]{3}$ : if it passes it gets evaled, otherwise it does not. To me this is 100% safe since nothing will get executed

\r\n vs \n in python eval function

喜欢而已 提交于 2019-12-07 08:40:57
问题 Why eval function doesn't work with \r\n but with \n. for example eval("for i in range(5):\r\n print 'hello'") doesn't work eval("for i in range(5):\n print 'hello'") works I know there is not a problem cause using replace("\r","") is corrected, but someone knows why happens? --Edit-- Oh! sorry , exactly, I meant exec. Carriage returns appeared because I'm reading from a HTML textarea via POST (I'm on a Linux box). now It is clearer, thanks to everyone. 回答1: You have a strange definition of

Angular/Typescript Eval and this

风流意气都作罢 提交于 2019-12-07 07:56:32
问题 So I am having a problem understanding how eval works with this in typescript/angular. Could someone please help me get the eval to work here? This is just a demo program so just ignore the fact that the logic doesn't make sense. I would just like to have eval update a dynamic array with a dynamic value. https://stackblitz.com/edit/angular-pfyt7q?file=src%2Fapp%2Fapp.component.ts export class AppComponent { arrTest1 = []; arrTest2 = []; arrTest3 = []; constructor() { this.TestClass.Run("this

Pass argument to perl file in debugger and set breakpoint in file executed by system

假装没事ソ 提交于 2019-12-07 06:15:45
问题 So I run a file in the perl debugger using perl -d file.pl. But then the file.pl is supposed to take arguments also. How do I supply arguments to the file.pl One more question: file.pl has this line in it: system("./file2.pl"); Is there a way to set a breakpoint in file2.pl if it is running as system ? I have spent 7 days on perl debugger and I am not able to set a breakpoint at file2.pl Please help EDIT: Got an awesome response from DVK to add DB::single=1. I tested that on some files and it

R - evaluate nested function call in a deserialized environment

拈花ヽ惹草 提交于 2019-12-07 01:54:28
I am trying to run an already existing chunk of R code in a sandbox-ed fashion, by saving the global environment (containing functions and data) to a file, then loading it into a new environment (not the global environment) and evaluating a function call within that environment. However, I'm running into trouble with functions calling other functions in the environment. Here's an example: f1 <- function(x) x*2 f2 <- function(y) f1(y) + 1 save(list=ls(), file="env.RData") rm(list=ls()) jobenv <- new.env(parent=globalenv()) load("env.RData", envir=jobenv) expr <- quote(f2(3)) eval(expr, envir

Read file with fs.readFileSync and eval contents…which scope have the functions? How to access?

[亡魂溺海] 提交于 2019-12-06 23:41:38
问题 I recently tried to import a file into my existing node.js project. I know this should be written with a module but i include my external javascript file like this: eval(fs.readFileSync('public/templates/simple.js')+'') The contents of simple.js looks like this: if (typeof examples == 'undefined') { var examples = {}; } if (typeof examples.simple == 'undefined') { examples.simple = {}; } examples.simple.helloWorld = function(opt_data, opt_sb) { var output = opt_sb || new soy.StringBuilder();

eval() does not assign variable at runtime

a 夏天 提交于 2019-12-06 23:31:36
问题 I use eval() to assign a list to a var: eval('mylist = [1,2,3]') but when I run it , I got a SyntaxError. What's wrong with it? If I cannot do assignment in the eval() , how do I assign a var in the runtime. 回答1: Use exec for statements: >>> exec 'lis = [1,2,3]' >>> lis [1, 2, 3] eval works only on expressions, like 2*2 , 4+5 etc eval and exec are okay if the string is coming from a known source, but don't use them if the string is coming from an unknown source(user input). Read : Be careful

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

不羁岁月 提交于 2019-12-06 20:27:25
问题 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 'ARRAY') { print "we can handle this ..."; } else { die $x; # rethrow } } } sub inner { die "OH NOES!" } Now I want to change that code so that it does the following: print a full

when to use DataFrame.eval() versus pandas.eval() or python eval()

自古美人都是妖i 提交于 2019-12-06 19:34:45
问题 I have a few dozen conditions (e.g., foo > bar ) that I need to evaluate on ~1MM rows of a DataFrame , and the most concise way of writing this is to store these conditions as a list of strings and create a DataFrame of boolean results (one row per record x one column per condition). (User input is not being evaluated.) In the quest for premature optimization, I am trying to determine whether I should write these conditions for evaluation within DataFrame (e.g., df.eval("foo > bar") or just