eval

nmake - simulating eval function

淺唱寂寞╮ 提交于 2019-12-08 08:36:57
问题 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 --- 回答1: You can sort of do what you want with inline files. # ---- piotr1.mak ---- all : nmake -nologo -f piotr2.mak MYVAR=BBB #--- END --- # ---- piotr2.mak ---- AAA_SETTING=17 BBB

How do I simplify bash's 'eval “$TIME $BIN_FILE $BIN_OPTS &> $LOG_FILE”' and keep it working?

Deadly 提交于 2019-12-08 08:12:55
问题 I'm updating a bash script which serves as a program testing tool. Previously, I had this line in a script working perfectly ( $BIN_FILE is set to a relative path to the binary being tested): $BIN_FILE $BIN_OPTS &> $LOG_FILE Then I've decided to add some "performance measurements": time $BIN_FILE $BIN_OPTS &> $LOG_FILE" This worked perfectly as well, but when running many tests at once, script's output was too crowded with all those "real, user, system". Now I'm passing a second parameter to

DataBinder.Eval in c#

寵の児 提交于 2019-12-08 07:59:57
问题 Hi anybody know how to use databinder.eval in c# Actually I've tried this LinkButton lnkName = new LinkButton(); lnkName.CommandArgument = DataBinder.Eval("object","<%#COURSE_ID%>"); it is showing error. Whats the wrong with this? 回答1: You can't use Eval in the code behind of an aspx page. this: lnkName.CommandArgument = DataBinder.Eval("object","<%#COURSE_ID%>"); should be this: lnkName.CommandArgument = YOUR_OBJECT_PROPERTY_HERE; To fill in YOUR_OBJECT_PROPERTY_HERE you either need to

string to numeric array

自古美人都是妖i 提交于 2019-12-08 07:51:09
问题 From one program I generate bunch of data and it is stored in a file. An example of the file's contents is [[1, 2, 3], [4, 5, 6]] As you can see, the data has the exact form of an array. Later in another program I want to read the data and use it. I am using text_file = open('DataFile.txt') lines = text_file.readlines() #We have only 1 line but this doesn't matter The variable lines is an array of 1 element which is the string [[1, 2, 3], [4, 5, 6]] . I want this string to be again a numeric

How to fix postgres-utils eval() error: missing FROM-clause entry for table “foo”?

旧城冷巷雨未停 提交于 2019-12-08 06:56:44
问题 I'm looking for a way to evaluate price expressions stored in database in Postgres 9.1+ I tried code below from answer in How to evaluate expression in select statement in Postgres but got error ERROR: missing FROM-clause entry for table "product" LINE 1: select product.price*0.95 how to fix ? Maybe it is possible to pass customer and product current row as eval parameters and to use them in eval expresion ? create or replace function eval( sql text ) returns text as $$ declare as_txt text;

CNTK python API: How to get predictions from the trained model?

元气小坏坏 提交于 2019-12-08 05:15:49
问题 I have a trained model which I am loading using CNTK.load_model() function. I was looking at the MNIST Tutorial on the CNTK git repo as reference for model evaluation code. I have created a data reader (which is a MinibatchSource object) and trying to run model.eval(mb) where mb = minibatch_source.next_minibatch(...) (Similar to this answer) But, I'm getting the following error message Traceback (most recent call last): File "LID_test.py", line 162, in <module> test_and_evaluate() File "LID

PHP keep me from eval ;) Variables inside string

爱⌒轻易说出口 提交于 2019-12-08 04:30:03
问题 For reasons I'd rather not get into right now, I have a string like so: <div>$title</div> that gets stored in a database using mysql_real_escape_string . During normal script execution, that string gets parsed and stored in a variable $string and then gets sent to a function($string) . In this function, I am trying to: function test($string){ $title = 'please print'; echo $string; } //I want the outcome to be <div>please print</div> This seems like the silliest thing, but for the life of me,

Loop inside “heredoc” in shell scripting

﹥>﹥吖頭↗ 提交于 2019-12-08 02:34:01
问题 I need to execute series of commands inside an interactive program/utility with parameterized values. Is there a way to loop inside heredoc ? Like below .. Not sure if eval can be of any help here. Below example doesn't seem to work as the interactive doesn't seem to recognize system commands. #!/bin/sh list="OBJECT1 OBJECT2 OBJECT3" utilityExecutable << EOF for i in $list ; do utilityCommand $i done EOF 回答1: Instead of passing a here-document to utilityExecutable , the equivalent is to pipe

Eval and lexical variables

末鹿安然 提交于 2019-12-08 02:14:53
问题 I'm doing a small project just for fun, and I added eval support for it to make debug easier. But later I found a problem: (let ((x 1)) (eval (1+ x))) (defun foo (x form) (eval form)) (foo 1 '(1+ x)) Code above won't work. Could someone please explain why and how to work it around? Thanks very much. 回答1: First, though (let ((x 1)) (eval (1+ x))) may look like it does work (it certainly does something), it is likely not doing, what you intend it to do. eval is a regular function, so it

Eval a string without string interpolation

徘徊边缘 提交于 2019-12-08 02:11:17
问题 AKA How do I find an unescaped character sequence with regex? Given an environment set up with: @secret = "OH NO!" $secret = "OH NO!" @@secret = "OH NO!" and given string read in from a file that looks like this: some_str = '"\"#{:NOT&&:very}\" bad. \u262E\n#@secret \\#$secret \\\\#@@secret"' I want to evaluate this as a Ruby string, but without interpolation. Thus, the result should be: puts safe_eval(some_str) #=> "#{:NOT&&:very}" bad. ☮ #=> #@secret #$secret \#@@secret By contrast, the