eval

Why {} + {} is NaN only on the client side? Why not in Node.js?

不羁的心 提交于 2019-11-26 18:19:29
While [] + [] is an empty string, [] + {} is "[object Object]" , and {} + [] is 0 . Why is {} + {} NaN? > {} + {} NaN My question isn't why ({} + {}).toString() is "[object Object][object Object]" while NaN.toString() is "NaN" , this part has an answer here already . My question is why does this happen only on the client side? On the server side ( Node.js ) {} + {} is "[object Object][object Object]" . > {} + {} '[object Object][object Object]' Summarizing : On the client side: [] + [] // Returns "" [] + {} // Returns "[object Object]" {} + [] // Returns 0 {} + {} // Returns NaN NaN.toString()

PHP eval and capturing errors (as much as possible)

一个人想着一个人 提交于 2019-11-26 18:18:03
问题 Disclaimer ; I'm fully aware of the pitfalls and "evils" of eval, including but not limited to: performance issues, security, portability etc. The problem Reading the PHP manual on eval... eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally. It is not possible to catch a parse error in eval() using set

AttributeError: 'PandasExprVisitor' object has no attribute 'visit_Ellipsis', using pandas eval

时光怂恿深爱的人放手 提交于 2019-11-26 18:00:46
I have a series of the form: s 0 [133, 115, 3, 1] 1 [114, 115, 2, 3] 2 [51, 59, 1, 1] dtype: object Note that its elements are strings : s[0] '[133, 115, 3, 1]' I'm trying to use pd.eval to parse this string into a column of lists. This works for this sample data. pd.eval(s) array([[133, 115, 3, 1], [114, 115, 2, 3], [51, 59, 1, 1]], dtype=object) However, on much larger data (order of 10K), this fails miserably! len(s) 300000 pd.eval(s) AttributeError: 'PandasExprVisitor' object has no attribute 'visit_Ellipsis' What am I missing here? Is there something wrong with the function or my data? TL

Redis中使用Lua脚本(一)

こ雲淡風輕ζ 提交于 2019-11-26 17:34:15
Redis中使用Lua脚本(一) 一、简介 二、Redis中Lua的常用命令 2.1 EVAL命令 2.2 SCRIPT LOAD命令 和 EVALSHA命令 2.3 SCRIPT EXISTS 命令 2.4 SCRIPT FLUSH 命令 2.5 SCRIPT KILL 命令 三、Redis执行Lua脚本文件 3.1 编写Lua脚本文件 3.2 执行Lua脚本文件 四、实例:使用Lua控制IP访问频率 五、总结 参考资料 一、简介 Redis中为什么引入Lua脚本? Redis是高性能的key-value内存数据库,在部分场景下,是对关系数据库的良好补充。 Redis提供了非常丰富的指令集,官网上提供了200多个命令。但是某些特定领域,需要扩充若干指令原子性执行时,仅使用原生命令便无法完成。 Redis 为这样的用户场景提供了 lua 脚本支持,用户可以向服务器发送 lua 脚本来执行自定义动作,获取脚本的响应数据。Redis 服务器会单线程原子性执行 lua 脚本,保证 lua 脚本在处理的过程中不会被任意其它请求打断。 Redis意识到上述问题后,在2.6版本推出了 lua 脚本功能,允许开发者使用Lua语言编写脚本传到Redis中执行。使用脚本的好处如下: 减少网络开销。可以将多个请求通过脚本的形式一次发送,减少网络时延。 原子操作。Redis会将整个脚本作为一个整体执行

Specify scope for eval() in JavaScript?

末鹿安然 提交于 2019-11-26 16:52:16
问题 is there any way I can execute eval() on a specific scope (but NOT global) ? for example, the following code doesn't work (a is undefined on the second statement) because they are on different scope: eval(var a = 1); eval(alert(a)); If possible, I would like to create a scope on the fly. for example (the syntax is definitely wrong, but just to illustrate the idea) var scope1; var scope2; with scope1{ eval(var a = 1); eval(alert(a)); // this will alert 1 } with scope2{ eval(var a = 1); eval(a+

Alternative to eval() javascript [duplicate]

若如初见. 提交于 2019-11-26 16:07:24
问题 This question already has answers here : What are the Alternatives to eval in JavaScript? (9 answers) Closed 3 years ago . I work mainly with javascript, Jquery, knockout, etc The thing that attracted eval() to me is var a = 5; var b = 10; eval("a+b"); //Gives me output 15 Note: I work in cases where the value of a and b changes dynamically In my work I'm dealing with a lot of dynamic objects from json, knockout, etc. So eval solves most of my problems. But as I read I found there are so many

I can't seem to use the Bash “-c” option with arguments after the “-c” option string

落花浮王杯 提交于 2019-11-26 15:48:18
问题 The man page for Bash says, regarding the -c option: -c string If the -c option is present, then commands are read from string . If there are arguments after the string, they are assigned to the positional parameters, starting with $0 . So given that description, I would think something like this ought to work: bash -c "echo arg 0: $0, arg 1: $1" arg1 but the output just shows the following, so it looks like the arguments after the -c string are not being assigned to the positional parameters

instantiate a class from a variable in PHP?

喜欢而已 提交于 2019-11-26 15:04:04
I know this question sounds rather vague so I will make it more clear with an example: $var = 'bar'; $bar = new {$var}Class('var for __construct()'); //$bar = new barClass('var for __construct()'); This is what I want to do. How would you do it? I could off course use eval() like this: $var = 'bar'; eval('$bar = new '.$var.'Class(\'var for __construct()\');'); But I'd rather stay away from eval(). Is there any way to do this without eval()? Paul Dixon Put the classname into a variable first: $classname=$var.'Class'; $bar=new $classname("xyz"); This is often the sort of thing you'll see wrapped

what does eval do and why its evil? [duplicate]

删除回忆录丶 提交于 2019-11-26 14:39:20
问题 This question already has an answer here: When is JavaScript's eval() not evil? 25 answers Why is using the JavaScript eval function a bad idea? 26 answers var myString = "x", myObject = { x: 10 }, value = eval("myObject." + myString); alert(value) alert(myObject[myString]); eval is evil I have been reading about eval() function over the internet, but could not really grasp on what it actually does apart from " It Evaluates an expression ". Should we use eval() function only for numeric

Linux服务器PHP后门查杀

て烟熏妆下的殇ゞ 提交于 2019-11-26 14:10:39
shell脚本一句话查找PHP一句话木马 # find ./ -name "*.php" |xargs egrep "phpspy|c99sh|milw0rm|eval(gunerpress|eval(base64_decoolcode|spider_bc))" > /tmp/php.txt # grep -r --include=*.php '[^a-z]eval($_POST' . > /tmp/eval.txt # grep -r --include=*.php 'file_put_contents(.*$_POST[.*]);' . > /tmp/file_put_contents.txt # find ./ -name "*.php" -type f -print0 | xargs -0 egrep "(phpspy|c99sh|milw0rm|eval(gzuncompress(base64_decoolcode|eval(base64_decoolcode|spider_bc|gzinflate)" | awk -F: '{print $1}' | sort | uniq python脚本查找PHP一句话木马(注意缩进) #!/usr/bin/python # -*- coding: utf-8 -*- #blog:www.sinesafe.com import os