21,626 questions
2
votes
1
answer
68
views
C# ! (null-forgiving) not working as expected [duplicate]
I was looking over some code and suggested a fix for verifying something isn't null that can be null and suggested the following:
// Path: Employee.cs
public class Employee(string name, DateTime? ...
-2
votes
0
answers
38
views
One RegEx to find the substrings in a string and omitt unnecessary characters [closed]
For the EnhanceAnyLexer Notepad++ plugin, I needed to write a RegEx in one line that would look for substrings in a string.
I found a solution, but it is poorly optimized.
Task: find a quoted string ...
-5
votes
0
answers
59
views
Why I have syntax error in comment on Python? [duplicate]
I have a problem I don't understand. I have a syntax error in the first line, which is a comment. I use Spyder to run my code, and the syntax error says "Pyflakes E". It's a really weird ...
0
votes
0
answers
11
views
unexpected token ':', expected one of token or <phrase> sequence: ] <typ_args>? or <typ> . <id> -> <typ_nobin> and <typ>Motoko(M0001)
I'm new to Motoko and I tried this but the syntax seems to fail
With this line of Code
" private var users : [Principal : Types.User] = [];
"
Here is where all the problem occurs, I can't ...
-1
votes
1
answer
61
views
Dlookup syntax with multiple criteria including "Like"
I need to create a unique ID based on 4 fields in a table - all are strings, despite 2 that look like numbers. Two of those fields are determined by user input on a form. A 3rd is based on the 2 ...
-2
votes
0
answers
60
views
PostgreSQL Syntax Error 42601 in WITH Clause Query [closed]
I am new to SQL and practicing on the northwind dataset.
When I run the code shown here in pgAdmin4, I get:
'ERROR: syntax error at end of input LINE 21: )' SQL state: 42601
Now, at this point I ...
-1
votes
0
answers
61
views
What is the correct syntax for a bash conditional like this? [closed]
I'm in the process of learning bash right now and am having trouble with the syntax for this conditional. It's supposed to check is there is at least one arg passed when run but throws this error:
...
2
votes
2
answers
72
views
How can I define a vararg with three types in Java?
Since I need a Java method to receive any number of objects of three specific classes I decided to use a vararg ... to implement it. However, I have the restriction that these three classes are:
java....
0
votes
0
answers
27
views
Device tree overlay syntax to add to the root node
Adding to the root node in a device tree overlay is easy enough:
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target-path = "/";
__overlay__ {
// ...
};
...
0
votes
1
answer
9
views
Where can I find a guid on CSON (Coffee Script Object Notation)?
I am familiar with JSON, and I can see some readability benefits of using CSON. However, while I can find all sorts of parsers for CSON, I can’t find a detailed description of the syntax itself.
I ...
1
vote
0
answers
59
views
Why can't you define a variable in a print statement? [duplicate]
I'm teaching Python to beginners, and got a question that initially stumped me. One of my students asked me why you can't define a variable in a print statement:
y = [1, 2, 3]
print(x=sum(y))
My ...
-1
votes
0
answers
69
views
Resolving Unexpected Identifier 'assert' SyntaxError in Node.jswhile Importing JSON with ES Modules
I am encountering a SyntaxError: Unexpected identifier 'assert' when attempting to import a JSON file using the assert { type: "json" } syntax in a Node.js project. The issue occurs with the ...
2
votes
2
answers
108
views
Correct syntax for whole array initializaition
Why is the following an error and what is the correct syntax?
struct a {
int b[4];
};
int c[4];
struct a a = {.b = &c};
Shouldn't a.b be of type int * or int[], why is it of type int?
(Note, ...
0
votes
0
answers
25
views
Cannot import .sql file created on a PC into PostgreSQL on my Mac. Converted to LF on VSC but I keep getting syntax error on the COPY query line
Never really worked with PostgreSQL before and I but cannot find anything online and chatGPT is now going in circles. Other team members work on PSc, I work on Mac. Set up psql, set up the db, ...
0
votes
0
answers
66
views
Is there a way to call for an anonymous interface with a parameter, as a method parameter itself?
Currently, I have this code working
public void method1(String a, Interf b) {
b.run(a);
}
public interface Interf {
void run(String z);
}
And I call this by using lambda expression ...
15
votes
2
answers
1k
views
Why constrain the unit type by a generic trait bound in a where clause (as in `where () : Trait<…>`)?
Today I've encountered a somewhat weird syntax - where ():
fn hex_primary<Stream, Context>(stream: Stream) -> Parsed<u8, Stream, Context>
where
(): IntRadixParse<Stream, Context, ...
5
votes
1
answer
85
views
Haskell requiring semicolon to be on a new line
I am new to haskell and had an university homework task that only compiled
having a line consisting only of a single semicolon. I am curious, whether this is intended behaviour and if yes, why?
(I ...
0
votes
1
answer
60
views
SQL for multiple AND conditions (bad syntax)
Having issues and it's certainly my SQL ability. Using an access database and I'd like to transition to using R for my queries (I use it to do the statistical analysis). I set up the tables in Access, ...
-2
votes
5
answers
133
views
C Syntax "Semicolon"
int i;
for (i = 0; i < 5; i++) {
printf(" %d \n", i);
}
output:
0
1
2
3
4
int i;
for (i = 0; i < 5; i++); {
printf(" %d \n", i);
...
0
votes
1
answer
8
views
Resolving Several Errors for a Line of Code in GAMS software
I have several errors in the following line:
e3_d(b).. sum( (t)$(ord(t) >= 1) and (ord(t) <= t-N_chp_on_max+N_chp_on_max), alpha(b, t) ) =l= N_chp_on_max;
Two errors (',' expected) and (Unknown ...
0
votes
1
answer
25
views
I keep getting Syntax error messages using SQL on BigQuery
I am a student taking an online course in data analytics. I'm learning SQL and it is my first time doing any type of coding. Recently, I've been encountering a problem where after following the ...
0
votes
0
answers
62
views
When should we use sc-macro-transformer instead of syntax-rules in MIT/GNU Scheme?
Recently I read one blog implementing amb with macro transformer. It has 2 implementations.
syntax-rules, i.e. Pattern Language
(define-syntax amb
(syntax-rules ()
((_) (fail))
((_ a) a)
...
1
vote
1
answer
53
views
Do dictionaries have the same implicit line continuation as parentheses?
I was surprised that this seems to work without parentheses:
dict = {
"a": 1 if True
else 2,
"b": 2
}
I know that dictionaries have implicit line continuation, but ...
0
votes
1
answer
89
views
Special characters used in Snowflake syntax: => and @
I am fairly experienced with SQL but I am new to Snowflake.
Learning about functions I came across with => like this, for example:
CREATE function functions.public.area_of_circle (radius float)
...
0
votes
0
answers
31
views
"Variable reference to a syntactic keyword" when using syntax-rules
minimal working code demo:
(define (demo-tree)
(custom-cons 0 1))
(define-syntax custom-cons
(syntax-rules ()
(
; (_ x y)
(custom-cons x y)
(cons-stream x y)
)))
(custom-...
-1
votes
1
answer
37
views
How can i center my navbar , cant seem to find where the prob is on my css and html?
I'm struggling to get the nav bar to go to the right of my header, it sits right below my logo.
.primary-header{ /*Main top header with navbar*/
display: flex;
}
.primary-header img { /*...
1
vote
1
answer
23
views
Cannot change the syntax color of punctuation in a theme
in the scope inspector you can see I'm setting the color of the brackets to #666 but they always show up as a blue color. Is there like a cheat sheet somewhere where we can figure this stuff out? ...
0
votes
1
answer
38
views
Syntax vs Semantics in Ontology Mappings
I’m working with two ontologies, A and B, which share the same semantics but are expressed using different syntaxes. Does the difference in syntax mean that it’s impossible to find correspondence/...
0
votes
0
answers
125
views
How to implement one anonymous loop form like do in the evaluator as a derived expression using Scheme?
This is from SICP exercise 4.9.
Exercise 4.9. Many languages support a variety of iteration constructs, such as do, for, while, and until. In Scheme, iterative processes can be expressed in terms of ...
2
votes
2
answers
90
views
What does ''' mean in Python?
Have been told that in Python
'''
is used to indicate the start of a multi-line string.
However I have also been taught that this code also allows for the documentation of functions and modules.
...
0
votes
0
answers
20
views
Question about JSON schema and syntax for... nested array?
I am struggling with a JSON schema used for API function calls (similar to the following but for a small scale project: https://docs.databricks.com/en/machine-learning/model-serving/function-calling....
0
votes
0
answers
71
views
Syntax restriction on constructors of template classes
When I define a templace class, I can write this (as less <T> as possible):
template <typename T>
class Foo
{
public:
Foo(){}
Foo(Foo const&){}
~Foo(){}
};
Or this (as ...
0
votes
0
answers
36
views
How to use the github API with OR queries within a repo? What is the right syntax/library?
I'm trying to use the github API to do a OR query within a repo.
Trying to do a programmatic replication of this query from the UI :
repo:open-telemetry/opentelemetry-demo AND (client OR import)
https:...
1
vote
1
answer
46
views
Direct import fails but "from ... import ..." succeeds
I have a Python module called my_module.py in a folder ~/my_module. I want to call this module from a Python interpreter and I don't know its directory. I run:
import os
os.chdir(os.path.expanduser(&...
0
votes
1
answer
72
views
yq wont recognize single quotation marks around the field when trying to split large YAML file into smaller ones
I have a large YAML file containing info about video games.
---
-
Name: Metal Gear Solid HD Collection
Console: PS3
Genre: Stealth
Progression: Unplayed
Maintenance: Perfect!
-
...
0
votes
1
answer
189
views
Not sure about my Jira Smart Value Conditional Logic Syntax
Here is what I'm currently using that only works when the first through third "if" is true, but fails to output the value when the fourth "if" is true.
Device Name: {{#if(not(...
0
votes
0
answers
24
views
I am confused with the way execution is supposed to take place. I do not understand why the code is not executed. I am using shelve [duplicate]
This is a code segment that begins line 261 in my file.
if __name__ == '__main__':
# main()
print('Checkpoint 0')
createShelve()
print('Checkpoint 1')
data = loadShelve()
print('Checkpoint ...
0
votes
0
answers
73
views
Troubleshooting Dynamic Distribution Group Filters: Excluding Disabled Objects
I’m currently working on creating a RecipientFilter for my test dynamic distribution group (on-premise), which I plan to replicate for a new group in my production environment. However, I’ve ...
1
vote
1
answer
56
views
Syntax problems with EXTRACT and DATE
Bigquery suggest me 'EXTRACT' funtion syntax:
extract(datetime_part FROM timestamp_expr [AT TIME ZONE tz_spec])
However, Bigquery notice "Unexpected keyword AT". Moreover, it's syntax in ...
1
vote
1
answer
32
views
Vue JS change to-be-edited variable depending on parameter passed into function
Hi JS (and general) newbie here,
I'm currently trying to make simple webpage with Vue JS which has clickable content which results in that section expanding to reveal more content.
I did this with a ...
3
votes
2
answers
110
views
Why are type annotations needed in Python dataclasses?
In opposition to standard classes in Python dataclasses fields must have a type annotation. But I don't understand what the purpose of these type annotations really is. One can create a dataclass like ...
-2
votes
2
answers
92
views
Passing a javascript method as an argument
I've been around javascript for a long time, but am pretty rusty with javascript Classes. For a particular project I'm working on, things are starting to get unwieldy and I'd like to start cutting up ...
1
vote
1
answer
63
views
Why do I get a syntax error using the ternary operator with function calls?
I'm writing a code in SystemVerilog, and I'm trying to use the ternary operator to decide between two function calls. Here's my code:
module tb;
int a = 1, b = 4;
initial begin
b > a ? $...
-1
votes
1
answer
40
views
Using sed to read a file. Why do I get `sed: -e expression #1, char 11: missing filename in r/R/w/W commands`?
I have a file with a line starting with Version:. I was trying to detect such line content from the shell and finally I used
grep 'Version:' filename
But before, I was trying to use sed without ...
0
votes
1
answer
49
views
How to run an SPSS 29 Syntax file from command mode?
I want to run an SPSS Syntax in command mode using IBM SPSS 29.
First I 'm using this commandline:
"path to SPSS executable" "path to syntax".
this works, but it only opens the ...
0
votes
0
answers
37
views
After hibernate update SQL syntax error is raised in SQL request in Spring Data
I have a query
@Query(value = """
SELECT cast((
EXTRACT(HOUR FROM AVG(j.finished - j.started)) * 3600 * 1000 +
EXTRACT(MINUTE FROM AVG(j.finished - j.started)) * 60 * 1000 +
...
4
votes
1
answer
94
views
Defining bareword operators in Raku
I have some questions regarding defining bareword operators in Raku. As it stands in the language, there are a variety of bareword operators, such as div, mod, gcd, & lcm. As I'm curious about the ...
1
vote
1
answer
162
views
Is it possible to use a C like array in C#?
I want to create a class that is basically just a fixed size array with some functions to it.
This would be done like this:
private class SomeClass : SomeSuperClass {
private readonly SomeType[] ...
0
votes
0
answers
45
views
Adding one careless dot in Scheme code works with one weird result without throwing syntax errors [duplicate]
Recently when I am coding my homework using Scheme language, I carelessly added one dot. Here is one minimal demo:
(define (test value)
(vector-map
(lambda (elem)
(cond
((number?...
0
votes
0
answers
21
views
Content-Security-Policy-Report-Only console error
I am getting a console error -
The Content-Security-Policy directive name 'Content-Security-Policy-Report-Only:' contains one or more invalid characters. Only ASCII alphanumeric characters or dashes '-...