2,039 questions
2
votes
2
answers
143
views
How to use the [DefaultValue] attribute to ignore boolean = true properties in JSON serialization
This is a follow up question to the Ignore boolean property = true in JSON serialization.
I have a record with multiple bool properties, some of them having default value true and some false:
private ...
1
vote
0
answers
64
views
How to ensure default values in Gemini/Vertex structured output?
When sending a prompt with a schema/json schema, I'd like to ensure that some values would be always present with a default if they are not mentioned in the prompt.
Both Gemini API and Vertex API ...
1
vote
1
answer
75
views
Adding a column with default value incorrectly fills a different column
After executing the following script:
alter table test_table
add (test1 varchar2(1 char),
test2 varchar2(1 char) default 'T' not null);
I got interesting results... both columns are filled with ...
0
votes
0
answers
60
views
Replacing null values with corresponding default data type values in PostGreSql database
In my application, I have multiple databases in PostGreSql which can contain more than 500 table and each table can have 5 to 20 columns with different data types.
The data in the database is imported ...
1
vote
2
answers
40
views
Is there way to add one more argument to the function(which has var args) with default value without breaking existing calls?
I have a function
fun foo(
id: String,
vararg values: Int,
){
...
}
and there are calls like these
fun bar1(){
foo("id_1")
foo("id_2", 1)
foo("id_3&...
-5
votes
1
answer
67
views
How to completely reassign a dictionary that is a default mutable value in the formal parameters of a function in python
def myfunc(l=[]):
if not l:
l[:] = otherlist
The preceding snippet of code completely reassigns list l to whatever list is stored in variable otherlist and maintains that value across ...
0
votes
1
answer
376
views
typescript for react-hook-form without default values
We have react-hook-form + zod + react-query.
How do I type values with TypeScript to let it catch a bug if I do not provide optional default values?
https://codesandbox.io/p/sandbox/react-form-form-...
1
vote
2
answers
49
views
Angular insert default values into a library component
I'm wondering if it's possible to somehow insert default values into a component from a library (but not wrapping it into another component which does this) to set default values.
e.g. i don't want ...
0
votes
1
answer
298
views
How to set a default value for a specific cell in a matrix dropdown question in Survey JS?
`I'm working on a survey using SurveyJS, and I need help configuring a matrix dropdown question. My goal is to set a default value for a specific cell in this matrix.
Problem Description
In my survey, ...
0
votes
1
answer
312
views
Kotlin default value for non-null field in data class, then dont pass that attribute in json?
I have a data class :
import com.fasterxml.jackson.annotation.JsonInclude
import io.micronaut.serde.annotation.Serdeable
@Serdeable.Deserializable
@JsonInclude(JsonInclude.Include.NON_NULL)
data class ...
0
votes
0
answers
433
views
Postgresql pgvector: How to set a default value to a vector when its size is large?
Say I have a very large vector, I want to set all its indices to some default value. How can I achieve this? I seached online but couldn't find an answer. Note that this is not a postgresql array, ...
1
vote
1
answer
58
views
How to use the default value set for a table in a where condition in an update statement?
I want to use the default value (string) for a specific column in a specific table in the where condition of an update statement in SQLite. So, the column should only be updated if the current value ...
1
vote
1
answer
320
views
How can I turn a literal into an expression in SQLAlchemy for MYSQL?
I'm using sqlalchemy to create a table in mysql. I would like to have a JSON column, with a default value, but mysql doesn't allow literals to be the default value, only expressions.
If I create the ...
2
votes
4
answers
2k
views
Is there a way to set default values of columns that are NOT NULL in postgres?
In PostgreSQL, when a column is marked as NOT NULL and no value is provided for it during insertion, an error is thrown. However, in MySQL, if no value is provided, the default value is set based on ...
4
votes
1
answer
60
views
What is by default significance level of Modified Mann Kendal test in R?
I am using Modified Mann Kendal test in R.
I want to know its by default value for significance level. Can we set the significance level manually? For example: 5%, 10% etc. if possible, then how can ...
2
votes
1
answer
61
views
Is it possible to have a default value that depends on a previous parameter? [duplicate]
Suppose I want to write a recursive binary search function in Python. The recursive function needs to get the start and end of the current search interval as parameters:
def binary_search(myarray, ...
0
votes
1
answer
71
views
Default value of input 2 is from input 1. Why does the state of input 2 not get its default value from input 1?
I have 2 <input type="text"> elements. What users type in input 1 will be the default value of input 2. The value of input 2 will be used for other tasks. The tasks should run right ...
1
vote
1
answer
58
views
Json::Serializable don't use default value from proc
I'm trying to provide a default value for a struct attribute that is generated instead.
However when deserializing, the value is still nill.
playground:
require "json"
struct A
include ...
0
votes
0
answers
33
views
Exploring the Use of Mutable Default Arguments for Caching in Python [duplicate]
Today, while tackling this question on Project Euler, I stumbled upon an intriguing use-case for employing mutable objects as default arguments in Python functions. Typically, this practice is ...
0
votes
0
answers
431
views
Getting default values of any type in Python3
Assuming I want to make a function in python that just returns the default value of a given type as a parameter:
def PrintDefaultValue(valueType: type):
print(default(type)) // ?? # <-- how I ...
0
votes
2
answers
558
views
Get the default value of a property of an abstract class
Is there a way in C# to access the default value of a non-static, non-const property that is defined in an abstract class?
For example, given:
public abstract class SomeClass
{
public int ...
1
vote
1
answer
119
views
JOLT need missing values to be set as null and keep the same place
I have this Jolt spec :
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"id": "[&1].id",...
0
votes
0
answers
688
views
Default type discriminator for some subtypes in JsonDerivedType
For the following types' structure
public class Person { public string Name { get; set; } }
public class Adult : Person { public string Occupation { get; set; } }
... // many more subtypes
I need to ...
0
votes
0
answers
31
views
Get the specific value of default nonatomic parameter
I need to use the function capwords() from SGP in the way to get approach to use the value of default parameter special.words extended with my additional words. I.e. I need to do somthing like:
...
2
votes
2
answers
94
views
Multiple similar inputs to an R function - problems with providing them using lists
I have the following problem: I want to write a function that is supposed to get multiple similar sets of inputs, lets say:
FUN <- function(part1.x, part1.y, part1.z, part2.x, part2.y, part2.z){}
...
0
votes
1
answer
82
views
How to refer to the in-built Default value for a text FormField in Excel VBA
I am trying to write some code in Excel which loops through a number of documents and extracts details from FormFields. The documents are all produced from the same template and users can only enter ...
1
vote
1
answer
2k
views
ORA-02262: ORA-904 occurs while type-checking column default value expression while modify by sequence defaults
Why I got error? Column datatype is integer like a sequence value...
SQL> create sequence SEQ_TEST_ID;
Sequence created.
SQL> desc test
Name ...
0
votes
2
answers
88
views
Condition operator, doesn't react on condition changes, I guess
I have a React component representing a form with inputs (Text, Number, Date). The date input has a default value - today. I use this component for two functions: creating an object and editing an ...
-3
votes
1
answer
450
views
How to declare a default value for a struct with kelseyhightower/envconfig?
At the beginning, everything is going well.
I have a configuration to read from drivers with the help of the package github.com/kelseyhightower/envconfig
type NXConfig struct {
Enable bool `...
2
votes
2
answers
393
views
Is there any cool way to express `if x is None: x = self.x` in python class?
I'm just studying python OOP, and truly confused when to use self and not.
especially when I want to make a method that defaultly get object instance input and also wanna make it work as a normal ...
1
vote
1
answer
783
views
Symfony 6 set default value for unmapped ChoiceType field in form
I have this scenario:
A value is read from a cookie and passed as an $option to a FormType:
$indexOrder = $request->cookies->get('clientfile-order') ?? 'date-last';
$advancedSearchform = $this-&...
0
votes
0
answers
124
views
Dynamically set antd input default value in react js
I am trying to pass data to antd form and set the values of the data as default value of the input form but nothing displays on the input.
I get the id from from the url and use the id to fetch data ...
0
votes
2
answers
330
views
Add column to table with a default value from function
I am pretty new to this, so please be nice ;)
I have created a function in PL/SQL where I feed the function a UserNo and it gives me an email-address.
What I would like to be able to do, is to add a ...
2
votes
2
answers
2k
views
openApi generator spring template omits default values of properties
I attach a basic OAS 3.0 schema below. When using editor.swagger.io, I am able to view the default values of my properties in generated page, when expanding the schema details.
openapi: 3.0.3
info:
...
0
votes
1
answer
92
views
How can I specify an argument object when the default is NULL in R?
I am trying to write a function that sets the default for some arguments to NULL. However, when I then want to specify those arguments to not be NULL when calling the function, I receive the error ...
2
votes
0
answers
402
views
dataclasses use InitVar default to set instance attribute
When you provide a default for an InitVar typed variable in a dataclass, the attribute
for that variable is set (actually, for variables that lack a default the attribute seems to be
actively deleted ...
1
vote
0
answers
209
views
Can we set default values for inputs on demand in your workflow file set for Github Issue
Below is my github actions ISSUE_TEMPLATE that seeks input from user.
name: GH Action details
description: GH Issue form
title: "GH Action details"
assignees:
- my-devops
labels:
- ...
0
votes
1
answer
61
views
remove config default while uninstall plugin
i have a plugin where i set config defaults at the installation - die "defaultValue" Option in the config.xml won't work out of the box:
private function addDefaultConfiguration(): void
...
2
votes
3
answers
138
views
Python itertools.zip_longest with mutable fillvalue
In a code that evaluates a web response, I would like to zip elements from several lists. However, the elements of the iterators are dict's.
Therefore, I would like to fill up the missing values also ...
1
vote
1
answer
211
views
Oracle current_timestamp provides different values in same session
We have a table defined as:
CREATE TABLE tokens (
token VARCHAR2(36) NOT NULL PRIMARY KEY,
username VARCHAR2(60) NOT NULL,
insertedOn TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
If we connect to the ...
0
votes
1
answer
1k
views
How to make a button clicked by default in React
I'm working at a ToDo app and I managed to make a menu section with two buttons switching between the app section. The problem is that when it's first opened the 'About me' button should be clicked by ...
0
votes
2
answers
158
views
Trying to create default parameters for the child class
I want to create a class that will be a able to create a subclass. Here is an example of code:
class System:
def __init__(self, a=0, b=0, c=0):
self.a, self.b, self.c = a, b, c
...
1
vote
2
answers
83
views
jq: Defaulting multiple possibly-nonexistent key, in nested path?
I'd like to default values in place on jq, and return root document.
What I have (note that some property is missing from the inner object) is following, but length is not fixed:
[{"foo":{}},...
0
votes
2
answers
54
views
How to use function's default parameter in PHP
I want to do something like this.
function add($num1, $num2 = 1) {
return $num1 + $num2;
}
$bool = true; // Can be true or false
if($bool) {
add(5, 5);
} else {
add(5);
}
I was asking ...
1
vote
1
answer
103
views
Importing function with arguments with "variable" default values in Python
I want to use a function with a default argument (as in argument with default value) in two separate scripts in which that default argument is set differently. Of course, the function may also be ...
1
vote
1
answer
1k
views
Define default value to arguments in Snowflake Function (UDF)
I want to create SQL function two params:
CREATE OR REPLACE FUNCTION myudf (varchar_argument VARCHAR, number_argument NUMBER) ...
But I want to set default value if the user did not specify all ...
1
vote
1
answer
342
views
Lua script with input either piped from a command or passed as an argument with a default value
I would like to call a Lua script, say "test.lua", with an input argument through any of the following options:
Piping in the output of an earlier command, say as:
echo "value" | ...
2
votes
3
answers
1k
views
micronaut yaml configuration: special character in default value
This is what I'm having problems with in my application.yml file:
url: ${DATASOURCE_URL:jdbc:postgresql://localhost:5432/postgres}
It seems to treat it like it should cut it at the last colon:
...
0
votes
0
answers
86
views
Flutter dropdownbutton is not display current value selection
I have a menu where you filter geographical locations using two dropdown menus. Then the user proceeds to the main screen.
On the main screen, if the user wants to change the geographical location ...
0
votes
2
answers
139
views
Are there any default value tricks / Elvis Operator in Ocaml?
Are there any elvis like operator in Ocaml ?
Any sort of optional chaining that return the right value when the left one is empty, a default value operator, like the |> operator with opposite ...