eval

Error: undefined is not an object (evaluating \\'RCTWebSocketManager.connect\\')

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I m using React-native v0.10.0 and getting this screen: Ok, So I figure out I m doing something wrong. So I downloaded the code from this official React-native website for integrating React-native into existing app using pod . The downloaded code uses React-native v0.2.1 and everything looks good there. So I copied the whole code and overrode mine, but the red screen still appears. It left me just with the changes of the React-native Is there any chance that the current version of React-native v0.10.1 doesn't work at all? :/ Thanks in

'GridView1' fired event PageIndexChanging which wasn't handled

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a gridview and I want to use paging. I have already set allow paging to true and page size to 5. I can see the numbers at the base of my gridview, but when i click on a number to move to respective page, it throws an error saying: The GridView 'GridView1' fired event PageIndexChanging which wasn't handled. Code: <asp:GridView ID="GridView1" runat="server" CellPadding="5" AutoGenerateColumns="False" AllowPaging="True" DataKeyNames="contact_id" onrowcancelingedit="GridView1_RowCancelingEdit" onrowediting="GridView1_RowEditing"

How to safely execute user-submitted PHP code [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-03 07:54:37
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: PHP sandbox/sanitize code passed to create_function I apologize for the very generalized question, but I need some guidance. What is the most ideal way to execute user-submitted PHP code? Think JSFiddle for PHP. I know there are sites that do this such as http://writecodeonline.com/php/ but I think that's PHP4 and doesn't work with half the code I try to run on it. I also know I could simply disable all the

python eval和其替代函数ast.literal_eval方法

余生长醉 提交于 2019-12-03 07:51:07
一、eval函数 原文链接:https://blog.csdn.net/sinat_33924041/article/details/88350569 eval()官方文档里面给出来的功能解释是:将字符串string对象转化为有效的表达式参与求值运算返回计算结果。 >> > s = '8*8' >> > eval ( s ) 64 >> > eval ( '2+5*4' ) 22 >> > x = 1 >> > y = 4 >> > eval ( 'x+y' ) 5 >> > eval ( '98.9' ) 98.9 >> > eval ( '9.9\n' ) 9.9 >> > eval ( '9.9\n\t\r \t\r\n' ) 9.9 最有用的一个是eval可以将字符串转换成字典,列表,元组 >> > l = "[2,3,4,5]" >> > ll = eval ( l ) >> > ll [ 2 , 3 , 4 , 5 ] >> > type ( ll ) < type 'list' > >> > d = "{'name':'python','age':20}" >> > dd = eval ( d ) >> > type ( dd ) < type 'dict' > >> > dd { 'age' : 20 , 'name' : 'python' } >> > t = '

python3 eval安全替代函数ast.literal_eval

半腔热情 提交于 2019-12-03 07:50:48
一、eval函数 eval() 官方文档里面给出来的功能解释是:将字符串 string 对象转化为有效的表达式参与求值运算返回计算结果。 示例: >>> s='8*8' >>> eval(s) 64 >>> eval('2+5*4') 22 >>> x=1 >>> y=4 >>> eval('x+y') 5 >>> eval('98.9') 98.9 >>> eval('9.9\n') 9.9 >>> eval('9.9\n\t\r \t\r\n') 9.9 最有用的一个是 eval 可以将字符串转换成字典,列表,元组 >>> l = "[2,3,4,5]" >>> ll=eval(l) >>> ll [2, 3, 4, 5] >>> type(ll) <type 'list'> >>> d="{'name':'python','age':20}" >>> dd=eval(d) >>> type(dd) <type 'dict'> >>> dd {'age': 20, 'name': 'python'} >>> t='(1,2,3)' >>> tt=eval(t) >>> type(tt) <type 'tuple'> >>> tt (1, 2, 3) eval() 函数功能强大,但也很危险,若程序中有以下语句: s=input('please input:') print

How to control when to compute evaluation vs training using the Estimator API of tensorflow?

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: As stated in this question : The tensorflow documentation does not provide any example of how to perform a periodic evaluation of the model on an evaluation set The accepted answer suggested the use of Experiment (which is deprecated according to this README ). All I found on online points towards using the train_and_evaluate method. However, I still do not see how to switch between the two processes (train and evaluate). I have tried the following: estimator = tf.estimator.Estimator( model_fn=model_fn, params=hparams, model_dir=model_dir,

DBI: raiseerror in eval

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This question refers to this comment from Ikegami: [...] But if you 're going to put an eval around every statement, just use RaiseError => 0. [...] in this thread . What do I gain, if I set RaiseError to 0 in such situations? #!/usr/bin/env perl use warnings ; use 5.10 . 1 ; use DBI ; my $db = 'my_test_sqlite_db.sqlite' ; open my $fh , '>' , $db or die $ !; close $fh or die $ !; my ( $dbh , $sth ); eval { $dbh = DBI -> connect ( "DBI:SQLite:dbname=$db" , "" , "" , {} ); }; if ( $@ ) { print $@ }; my $table = 'my_sqlite_table' ;

eval和ast.literal_val()

百般思念 提交于 2019-12-03 07:49:20
eval函数的作用是把数据还原成它本身或者是能够转化成的数据类型。 eval在做计算前并不知道需要转化的内容是不是合法的(安全的)python数据类型。 使用eval可以实现从元祖,列表,字典型的字符串到元祖,列表,字典的转换,此外,eval还可以对字符串型的输入直接计算。 ast.literal则会判断需要计算的内容计算后是不是合法的python类型,如果是则进行运算,否则就不进行运算。 来源: CSDN 作者: 转行撸学习 链接: https://blog.csdn.net/m0_37632218/article/details/84236472

内置函数eval及安全处理方式ast.literal_eval

旧街凉风 提交于 2019-12-03 07:49:04
内置函数 eval() 及安全处理方式ast.literal_eval() 1.eval() 功能:将字符串str当成有效的表达式来求值并返回计算结果。 eval()官方文档里面给出来的功能解释是:将字符串string对象转化为有效的表达式参与求值运算返回计算结果 语法上:调用的是:eval(expression,globals=None, locals=None)返回的是计算结果 其中: expression是一个参与计算的python表达式 ​ globals是可选的参数,如果设置属性不为None的话,就必须是dictionary对象了 ​ locals也是一个可选的对象,如果设置属性不为None的话,可以是任何map对象了 python是用命名空间来记录变量的轨迹的,命名空间是一个dictionary,键是变量名,值是变量值。 当一行代码要使用变量 x 的值时,Python 会到所有可用的名字空间去查找变量,按照如下顺序: 1)局部名字空间 - 特指当前函数或类的方法。如果函数定义了一个局部变量 x, 或一个参数 x,Python 将使用它,然后停止搜索。 2)全局名字空间 - 特指当前的模块。如果模块定义了一个名为 x 的变量,函数或类,Python 将使用它然后停止搜索。 3)内置名字空间 - 对每个模块都是全局的。作为最后的尝试,Python 将假设 x

python中ast模块literal_eval()方法与eval()的区别

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 07:48:48
Python中,如果要将字符串型的列表,元组,dict转变成原有的类型呢?这个时候你自然会想到eval。 EVAL函数在Python的中做数据类型的转换还是很有用的。它的作用就是把数据还原成它本身或者是能够转化成的数据类型。 string <==>列表 string <==>元组 string <==> dict 也就是说,使用的eval可以实现从元祖,列表,字典型的字符串到元祖,列表,字典的转换,此外,EVAL还可以对字符 串型的输入直接计算。比如,她会将 '1 + 1' 的计算串直接计算出结果。 从上面来看,EVAL功能可谓非常强大,即可以做字符串与列表,元组,字典之间的类型转换,还可以做计算器使用!更有甚者,可以对她能解析的字符串都做处理,而不顾忌可能带来的后果!所以说eval强大的背后,是巨大的安全隐患!!!比如说,用户恶意输入下面的字符串 打开(r'D://filename.txt','r')。read() __import __( 'OS​​')。系统( 'DIR') __import __('os')。system('rm -rf / etc / *') 那么eval就会不管三七二十一,显示你电脑目录结构,读取文件,删除文件.....如果是格盘等更严重的操作,她也会照做不误!!!所以这里就引出了另外一个安全处理方式ast.literal_eval