A bison set evaluation code error - set

I write a sets evaluation program with flex and bison.
I face a problem with error
bison -d calc.y
flex calc.l
cc -o a.out calc.tab.c lex.yy.c -lfl
calc.y: In function 'yyparse':
calc.y:25: error: request for member 'exp' in something not a structure or union
calc.y:25: error: request for member 'set' in something not a structure or union
calc.y:25: error: request for member 'set' in something not a structure or union
calc.y:26: error: request for member 'exp' in something not a structure or union
calc.y:26: error: request for member 'set' in something not a structure or union
calc.y:26: error: request for member 'set' in something not a structure or union
calc.y:27: error: request for member 'exp' in something not a structure or union
calc.y:27: error: request for member 'set' in something not a structure or union
calc.y:27: error: request for member 'set' in something not a structure or union
calc.y:30: error: request for member 'set' in something not a structure or union
calc.y:30: error: request for member 'string' in something not a structure or union
calc.y:31: error: request for member 'string' in something not a structure or union
calc.y:32: error: request for member 'set' in something not a structure or union
calc.y:32: error: request for member 'set' in something not a structure or union
* Error code 1
my platform information is as follow:
Compiler Version: gcc 4.2.1
Bison: 2.5.1
Flex: 2.5.4
Please help me to deal with above error, thanks very much!
The following links are my codes on Gist.
calc.l:gist.github.com/fbukevin/5662335
calc.y:gist.github.com/fbukevin/5662350
test.h:gist.github.com/fbukevin/5662533
Makefile:gist.github.com/fbukevin/5662359
(I don't have enough reputation to pose more than two link, so I took off "http://")

I found the answer here with different title. Thanks everybody try to help me.
Referenc: Flex/Bison Error:request for member `str' in something not a structure or union

Related

RethinkDB error: SyntaxError: missing ) after argument list

Hello i'm new to RethinkDB and facing issue with join query.Whenever I run my query it gives following error:
SyntaxError: missing ) after argument list
Following is my query:
r.db("test")
.table("posts")
.innerJoin(
r.db("test")
.table("user")
.filter({
"username": "super_admin"
}),
lambda posts,
user: posts["user_id"] == user["id"]
)
.zip()
It looks like you are trying to run Python code in a JavaScript interpreter.
The equivalent JavaScript code might be:
r.db("test").table("posts").innerJoin(
r.db("test").table("user").filter({
"username": "super_admin"
}),function(posts, user){
return posts("user_id").eq(user("id"))
}).zip()
As a side note, the query could be optimized by using eqJoin instead of innerJoin and perhaps also by using an index instead of a filter.
Put one semicolon ; after zip();

puppet stdlib 'member" function not working

Trying to use the member function of the puppet stdlib module:
effectively:
$myvariable = 'FOO'
then when using the member function:
member(['FOO','BAR'], $myvariable)
I keep getting the error message:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Function 'member' must be the value of a statement at /etc/puppet/modules/mymodule/manifests/init.pp:###
Looking at the stdlib documentation for member, we see that member is an rvalue. This means in this context that you need to have its output assigned. This is what the error message of must be the value of a statement is hinting at. Note a helpful wikipedia article on l-values and r-values https://en.wikipedia.org/wiki/Value_(computer_science)#lrvalue.
Your code will work, for example, if you assign the output of member(['FOO','BAR'], $myvariable) to a variable or a resource attribute.
For example:
$myvariable = 'FOO'
$variable = member(['FOO','BAR'], $myvariable)
notify { $variable: }
will result in a notify 'true' during compilation.

How to select DOM elements with number value id using D3

All:
I wonder how do I select a DIV element with id="1" in D3, I can do it in jQuery, but when I turn to D3, it gives error like:
Uncaught DOMException: Failed to execute 'querySelector' on
'Document': 'div.chart#1' is not a valid selector
<div id="1"></div>
Thanks
The id TAG must start with letter, but you can use this:
d3.select('[id="1"]').append("div");
This is the example in JSFiddle
And here the technical explanation.
I had a situation when trying to select an element by id using d3 failed with the error:
Uncaught DOMException: Document.querySelector: 'obj_id' is not a valid selector.
My work around was to define a function
const d3Select = (id) => d3.select(document.getElementById(id))
an example of usage:
const dom = d3Select('obj_id')
.attr('class','warning')
and it works just fine
If you gave it an ID, you can select it directly by ID. You don't need to specify div in the selector.
d3.select('#1')
.foo()

pg: exec_params not replacing parameters?

First time using pg gem to access postgres database. I've connected successfully and can run queries using #exec, but now building a simple query with #exec_params does not seem to be replacing parameters. I.e:
get '/databases/:db/tables/:table' do |db_name, table_name|
conn = connect(db_name)
query_result = conn.exec_params("SELECT * FROM $1;", [table_name])
end
results in #<PG::SyntaxError: ERROR: syntax error at or near "$1" LINE 1: SELECT * FROM $1; ^ >
This seems like such a simple example to get working - am I fundamentally misunderstanding how to use this method?
You can use placeholders for values, not for identifiers (such as table and column names). This is the one place where you're stuck using string interpolation to build your SQL. Of course, if you're using string wrangling for your SQL, you must be sure to properly quote/escape things; for identifiers, that means using quote_ident:
+ (Object) quote_ident(str)
Returns a string that is safe for inclusion in a SQL query as an identifier. Note: this is not a quote function for values, but for identifiers.
So you'd say something like:
table_name = conn.quote_ident(table_name)
query_result = conn.exec("SELECT * FROM #{table_name}")

ORA - 00972 : identifier too long

I am getting error (ORA - 00972 : identifier too long) while creating the view.
Please find the view statement.
create or replace view ELVW_ATM_REC_HANDOFF_1
(Rectype
,Recseq
,Record_Type
,Record_Sequence
,MESSAGE_TYPE
,PAN
,PROCESSING_CODE
,TRANSACTION_AMOUNT
,TRANSACTION_CURRENCY_CODE
,SETTLEMENT_AMOUNT
,SETTLEMENT_CURRENCY_CODE
,Billing_AMOUNT
,Billing_CURRENCY_CODE
,Transaction_DATE
,Settlement_Date
,TRACE
,REFERENCE_NUMBER
,Switch_Log_ID
,AUTHORIZATION_NUMBER
,RESPONSE_CODE
,Host_Error_Code
,TERMINAL_ID
,Acceptor_ID
,ACQUIRING_INSTITUTION_CODE
,REV_FLAG
,Original_Trace_Number
,From_Account
,To_Account)
as
select * from
(select 'FT'
,'count'
,'DT'
,rownum
,msg_type
,pan,proc_code
,txn_amt
,txn_ccy_code
,setl_amt
,setl_ccy_code
,bill_amt
,bill_ccy_code
,trans_dt_time
,setl_date
,stan,trn_ref_no
,'iso field 60'
,'isofield 38'
,resp_code
,error_code
,term_id
,'ISOmessage42'
,acq_ins_id
,decode(substr(msg_type,1,1),4,reverse(msg_type),msg_type)
,'ISOfield90'
,from_acc
,to_acc
from swtb_txn_log)
It seems error occurs at the decode function. if i comment it. its working fine. Please find the below code
create or replace view ELVW_ATM_REC_HANDOFF_1(Rectype,Recseq,Record_Type,Record_Sequence,MESSAGE_TYPE,PAN,PROCESSING_CODE,TRANSACTION_AMOUNT,TRANSACTION_CURRENCY_CODE,SETTLEMENT_AMOUNT,SETTLEMENT_CURRENCY_CODE,Billing_AMOUNT,Billing_CURRENCY_CODE,Transaction_DATE,/*Transaction_TIME,*/Settlement_Date,TRACE,REFERENCE_NUMBER,Switch_Log_ID,AUTHORIZATION_NUMBER,RESPONSE_CODE,Host_Error_Code,TERMINAL_ID,Acceptor_ID,ACQUIRING_INSTITUTION_CODE,/*REV_FLAG,*/Original_Trace_Number,From_Account,To_Account) as
select * from (select 'FT','count','DT',rownum,msg_type,pan,proc_code,txn_amt,txn_ccy_code,setl_amt,setl_ccy_code,bill_amt,bill_ccy_code,trans_dt_time,/*trans_dt_time,*/setl_date,stan,trn_ref_no,'iso field 60',
'isofield 38',resp_code,error_code,term_id,'ISOmessage42',acq_ins_id,/*decode(substr(msg_type,1,1),4,reverse(msg_type),msg_type),*/'ISOfield90',from_acc,to_acc from swtb_txn_log)
I have checked the length of the column name. Its less than 30 characters. Looking forward for your help.
Try giving an alias (that is shorter than 30 characters) to the DECODE function.
Example:
DECODE( ...stuff... ) MYALIAS
True, all of the column names in the view spec are less than thirty characters.
Howver, your view includes a inline query:
select * from ( select ...
This may be the problem. Because it may be trying to work out at identifier for DECODE() statement at that intermediate point. I say "may" because I can't reproduce this on my 10g box: defining column names for the view solves the ORA-01948.
Regardless, you can fix the problem simply by giving your DECODE() column an alias which is of an acceptable length.

Resources