Questions tagged [syntax]
Syntax refers to the actual language elements and symbols themselves. Questions should be tagged as syntax when the question specifically and almost completely relates to syntax alone. This tag should be used with a specific language tag
20,597
questions
0
votes
0
answers
23
views
Store hexadecimal numbers in a list python
I want to store hexadecimal numbers in a list. Doing this in python gives the following error:
a = [2a, cd, 12, 11, bd, 26, 64, 11, 2d, 34, 12, 55, 63, 67, e8]
File "main.py", line 4
a = ...
0
votes
1
answer
15
views
Do I need to use npm init every time I create a new project?
I saw people explaining that npm init is necessary to create the package.json file. But in my last practice project I forgot to use npm init and the package.json file was created when I used npx ...
0
votes
0
answers
19
views
Strange Unterminated String literal error
I'm making a simple todo app with Django but the error Unterminated String literal is creating a lot of problems. I know there is no unterminated string literal but the error keeps arriving? What ...
0
votes
1
answer
27
views
Simple bash script output [duplicate]
I try to write simple script to read temperature:
cpu=$(cat /sys/class/thermal/thermal_zone*/temp)
if [$cpu -ge 50000]; then
echo "OK"
else
echo "Not OK"
fi
echo $cpu is fine: ...
0
votes
0
answers
48
views
how solved a invalid syntax in python code [closed]
box= Text(top)
box.grid(row=1,column=1)
def model():
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfVectorizer
...
0
votes
0
answers
42
views
AWK output shown multiple times (going over several times)
I have this AWK code which attemps to create several counters for several metrics. I have the counters and the variables which are the sum of the columns I need.
When I print only the first print (...
0
votes
0
answers
8
views
For IntelliJ, convert between abbreviated and labeled syntax for a dependency in Gradle
Gradle offers two kinds of syntax to declare a dependency.
Abbreviated:testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0-M1'
Labeled:testImplementation group: 'org.junit.jupiter', name: '...
0
votes
0
answers
23
views
Proper Syntax for Nested If VBScript?
I'm struggling to get these if statements to work the way I want them to. Can anyone help me? I have embedded some of the questions I have in the code, but i'm trying to create a proper nested if ...
0
votes
1
answer
67
views
Is there a C++ Language Feature Mark a Variable to Prevent/Warn about Later Usage in the same Scope?
One of the common mistakes I find in C like code is the usage of a variable which is already consumed in the given scope. See the following fictive example function:
std::string normalizePath(const ...
2
votes
1
answer
17
views
YAML syntax for set_fact and vars in ansible
I have difficulties to get the differences between the following syntaxes when I set vars or facts in a YAML role:
vars:
app_path1: "{{ (ansible_facts.env.ProgramFiles + '\\\\' + item....
0
votes
0
answers
24
views
cannot find symbol syntax error while building through maven [duplicate]
Why my build failing saying cannot find symbol?
Code 1
public String getAzureUserName() {
return "user123";
}
public String getAzurePassword() {
return "...
1
vote
0
answers
29
views
What is this {}{/} curly brace syntax?
I have inherited Excel files where some of the cell content looks like this:
{MY}Jan 2022{/MY} {TY}Webcast{/TY}
What is this syntax, and are there programming languages to handle it? It looks like ...
0
votes
1
answer
36
views
Is `this` a keyword or a literal?
Why JS specs call this a keyword and not a literal?
It more seems to be a literal, because we can use it as a value, or what am I missing?
return this
What is it then?
-3
votes
0
answers
27
views
Uncaught SyntaxError: Unexpected token '<' | Error in root.render() | React [duplicate]
I am creating a portfolio website. I want to use React inside my simple html website.
The error is occurring when I render the component through root.render(<Form/>)
Here's my index.html's ...
-1
votes
1
answer
41
views
What is the correct syntax of JavaScript Factory Function? JavaScript Factory Function Syntax confusion
Both function getMyCar1 & getMyCar2 has same result but which one is the correct way of doing?
getMycar2: Why value have to use instead of key? key:value (carBrand:brand).
function selectCar(brand,...
-2
votes
0
answers
50
views
What does it mean to declare a variable with {} in C++? [duplicate]
I have never seen this before. I cannot find any information as to what this means. What kind of declaration is this?
0
votes
1
answer
22
views
Colon in python class body [duplicate]
Analizing Monai AI documentation found following code, I've never seen colon operator used in this way. How to interpret this: mod: nn.Module?
def _get_down_layer(self, in_channels: int, out_channels: ...
-1
votes
0
answers
15
views
Graphical representation of Lambda terms [Lambda Calculus]
Could somebody please explain to me how to make sense of/read those diagrams, using the famous "Mockingbird" metaphor (look at the bottom of the page!).
Thanks!
0
votes
1
answer
11
views
How does one set a floating-point to infinite in Open Shading Language?
I'm doing some materials work right now using Open Shading Language (OSL), and it has a convenient function, isinf(), which will determine whether a floating-point is infinite or not...
However, I can'...
0
votes
0
answers
25
views
MySQL - UPDATE returns syntax error using serialized data
I'm having troubles with this command
UPDATE wp_usermeta
SET meta_value = REPLACE(
meta_value,
'a:1:{s:6:"seller";b:1;}',
'a:1:{s:11:"wcfm_vendor";b:1;}')
WHERE meta_key ...
-1
votes
2
answers
38
views
Why am I getting a syntax error on this INTO command?
UPDATE: It helps if you put the data INTO your table first. I adjusted the code and it works!
I am working in SQL and I want to count unique titles within a table. The top code is a query I wrote to ...
0
votes
1
answer
29
views
Is it possible to write SQL queries using the logical order of evaluation? [closed]
While studying SQL, I found out about lexical and logical order of evaluation of clauses.
Is it possible to write SQL using the logical order in some DBMS?
For example:
SELECT column1, column2 FROM ...
0
votes
1
answer
45
views
I'm trying to understand the syntax of this cartesian-product function in Clojure
Here's some code for a cartesian product, it can be two lists, two vectors, or any number of combinations of the two. I'd really appreciate help with the second, fourth, and final lines, explaining ...
1
vote
1
answer
20
views
MiniZinc: Constraint for sum over two array indexes 'k','j' for all index 'i' in 3dArray creates TypeError
As the code below hopefully explains, I want to implement a constraint where for each 'i', the sum over all 'j' and 'k' for that specific 'i' in ARRAY[k,i,j] must be less than or equal to 1.
...
0
votes
1
answer
27
views
How to load a .word symbol into a register in Arm assembly?
Probably a common beginner question, and similar questions have been asked on this site, but I can't find any help on a couple points. If you have a 32-bit symbol defined with .word, and you want to ...
-2
votes
1
answer
36
views
Python keeps giving me a syntax error for else and elif [closed]
Trying to do this assignment and I really can't figure out what I'm doing wrong, I literally copied it directly from the book and Python still gives me a syntax error on the second print of line 1 and ...
0
votes
1
answer
30
views
Is "foo === bar" equal to "if (foo === bar) {return true}"? [duplicate]
I know this question falls in the realm of "basics", however I'd like to understand the inner workings of the language.
My question is:
Do operators 'return' the expression's value by ...
-1
votes
0
answers
18
views
Why does the expression with multiple "+" signs between numbers, following one-by-one, produces the result and no error in python? [duplicate]
For example:
>>> 5 +++++ 5
10
Can anybody explain what is happening under the hood?
0
votes
0
answers
11
views
Automa that can recognize any given DNA sequence
I'm new here, I'm on my first year of college for computer science, and I have my final exam for logic in 3 days. One of the question that the teacher could ask me is to design an Automa that can ...
-1
votes
1
answer
64
views
Difference between += and = 1+ in Java
Me and my friend have been working on a problem for school. We are traversing a graph with DFS and are counting the number of nodes in each given component. We get widely different results and have ...
1
vote
0
answers
9
views
getting syntax error while executing yo command, here i have attached the output
click here to see yo command output highlighted and the error,
i tried to install yo using command
npm install -g yo
Please help to come out of this issue
node version is: v8.17.0
npm version is: 6.13....
0
votes
2
answers
52
views
how to initialize a class object reference in C++ to simulate NRVO?
I meet a course programming problem, which asks me to initialize the A a using passing by reference (initialize the A a in the func). How can I call A's constructor by A's reference?
#include <...
1
vote
1
answer
37
views
Subset with only consecutive numbers
I want to generate all subset of {1,2,3,4} with only consecutive numbers. (For example I want subset {1}, {1,2} or {2,3,4} but not {2,4}. )
This is what I have been trying:
library(ggm)
p2<-...
0
votes
1
answer
37
views
CoffeeScript can't use spread operator with class fields
I can't understand why this syntax of spread method is wrong for CoffeeScript in WebStorm
class Test
fruit: {apple: "apple"}
init: ->
console.log 1, @fruit
spread: ->
...
0
votes
1
answer
13
views
Hive query to find conversion ratio
I am trying this query in Hive and it's not working.
select
(
(
select
count(*)
from
click_streaming
where
page_id= 'e7bc5fb2-1231-11eb-adc1-...
0
votes
2
answers
26
views
Sending Queries to a table in RMySQL, using R variables
I am trying to write data I have created in R and stored in arrays to MySQL table. Currently this is how I am doing it,
for(z in 1:60){
dbSendQuery(
mydb,
"insert into ...
0
votes
1
answer
38
views
Vue JS: reactive syntax
While I was trying to grasp reactivity fundamentals and its syntax I've encountered following problem. Consider this snippet:
const app = Vue.createApp({
data: dataFunction,
methods: {method1: ...
0
votes
1
answer
54
views
Is there another way to write SUM(IIF([CONDITION], 1, 0))?
What SUM(IIF([CONDITION], 1, 0)) does is very simple. So simple, that what I really just want to write is COUNT([CONDITION]) (but that's invalid). Is there a shorter or more preferred way to write SUM(...
0
votes
0
answers
18
views
Volar (vscode extension): line comment syntax in .vue files template section is wrong
I have enabled Volar, the Vscode extension (v0.34.15).
I have disabled the Vetur extension.
Now when commenting out code in the template part of a vue file, the comments have the wrong syntax:
{# <...
-1
votes
0
answers
18
views
explain the syntax of realloc and its uses [duplicate]
I'm studying about realloc and the syntax for it is:
void *realloc(void *ptr, size_t size);
but in many example of realloc being used the syntax they use is different ? for example
str = (...
0
votes
0
answers
22
views
How can I fix this syntax Error in python
%%bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install -q .
This code gives this error.
cd models/research/
...
0
votes
0
answers
19
views
Having problem when transport char[] parameter
I have a problem when I'm trying to transport a parameter to a DLL funtion.
when I code like:
private char[] mcusn;
public char[] McuSN
{
get { return mcusn; }
set
{
mcusn = new ...
0
votes
1
answer
23
views
EntityNotFoundException for aws glue "get-partition"
I'm trying to get metadata about Glue partitions via the CLI. I've tried following the docs but I keep getting the following error:
An error occurred (EntityNotFoundException) when calling the ...
0
votes
1
answer
22
views
passing null value from az cli to bash without exiting
I'm trying to get the value of a resource in azure via AZ CLI, and pass that value to a variable in bash.
id=$(az synapse workspace show -n $name -g $rsname --query 'identity.principalId' -o tsv 2<&...
1
vote
1
answer
15
views
Python syntax error in list comprehension on string for Lemmatization
I'm trying to only perform Lemmatization on words in a string that have more than 4 letters. The desired output from the following code should be 'us american', but I received an invalid syntax error.
...
0
votes
0
answers
19
views
MongoDB range query between two values - Repeating the field vs. two operators on the same field
I just had a question about the MongoDB querying language. I have a datastore containing a lot of geo-spatial and time series data and I'm attempting to query for records within a time range.
If I'm ...
0
votes
0
answers
16
views
Find out what packages, classes and methods the Jar file contains
I have a Java code editor with syntax highlighting, with a code hint menu and quick actions. The editor is written in C#. Once again, this editor is for editing Java code! I need to know what packages,...
0
votes
1
answer
27
views
What is the meaning of parameters starting with tilde ~ in functions?
What is the meaning of parameters starting with tilde ~ in functions, like in the this example:
let draw_line ~img ~color ~p0:(x0,y0) ~p1:(x1,y1) = ...
-1
votes
1
answer
42
views
MySQL -> You have an error in your SQL syntax error how can i fix this
MySql.Data.MySqlClient.MySqlException: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'not=41, durum='BASARISIZ' ...
0
votes
1
answer
50
views
Is there an if-let one liner shorthand?
I would like to be able to use if-let in a similar fashion to the commonly used if-else shorthand: <condition> ? <expression1> : <expression2>. This syntax would look something like ...