Support
Quality
Security
License
Reuse
kandi has reviewed tutorials and discovered the below as its top functions. This is intended to give you an instant insight into tutorials implemented functionality, and help decide if they suit your requirements.
Just Announced - "Learn Spring Security OAuth":
Invalid CSS value error while Customizing Bootstrap 5 colors with sass 3
@import "../../node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/variables";
@import "../../node_modules/bootstrap/scss/mixins";
How do I resolve error message: "Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option"
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-Xjvm-default=all",
]
}
}
-----------------------
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
}
}
-----------------------
kotlinOptions{
freeCompilerArgs += [
"-Xjvm-default=all",
]
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach{
kotlinOptions{
freeCompilerArgs +=["-Xjvm-default=all",]
}
}
-----------------------
kotlinOptions{
freeCompilerArgs += [
"-Xjvm-default=all",
]
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach{
kotlinOptions{
freeCompilerArgs +=["-Xjvm-default=all",]
}
}
How to show error message in OutlinedTextField in Jetpack Compose
var text by rememberSaveable { mutableStateOf("") }
var isError by rememberSaveable { mutableStateOf(false) }
fun validate(text: String) {
isError = /* .... */
}
Column {
TextField(
value = text,
onValueChange = {
text = it
isError = false
},
trailingIcon = {
if (isError)
Icon(Icons.Filled.Error,"error", tint = MaterialTheme.colors.error)
},
singleLine = true,
isError = isError,
keyboardActions = KeyboardActions { validate(text) },
)
if (isError) {
Text(
text = "Error message",
color = MaterialTheme.colors.error,
style = MaterialTheme.typography.caption,
modifier = Modifier.padding(start = 16.dp)
)
}
}
-----------------------
OutlinedTextFieldValidation(
value = studentState.firstName.value,
onValueChange = { onFirstNameChange(it) },
label = { Text(text = "First name") },
error = "field cannot be empty"
)
@Composable
fun OutlinedTextFieldValidation(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier.fillMaxWidth(0.8f),
enabled: Boolean = true,
readOnly: Boolean = false,
textStyle: TextStyle = LocalTextStyle.current,
label: @Composable (() -> Unit)? = null,
placeholder: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null,
error: String = "",
isError: Boolean = error.isNotEmpty(),
trailingIcon: @Composable (() -> Unit)? = {
if (error.isNotEmpty())
Icon(Icons.Filled.Error, "error", tint = MaterialTheme.colors.error)
},
visualTransformation: VisualTransformation = VisualTransformation.None,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = true,
maxLines: Int = Int.MAX_VALUE,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
shape: Shape = MaterialTheme.shapes.small,
colors: TextFieldColors = TextFieldDefaults.outlinedTextFieldColors(
disabledTextColor = Color.Black
)
) {
Column(modifier = modifier
.padding(8.dp)) {
OutlinedTextField(
enabled = enabled,
readOnly = readOnly,
value = value,
onValueChange = onValueChange,
modifier = Modifier
.fillMaxWidth(),
singleLine = singleLine,
textStyle = textStyle,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
isError = isError,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
maxLines = maxLines,
interactionSource = interactionSource,
shape = shape,
colors = colors
)
if (error.isNotEmpty()) {
Text(
text = error,
color = MaterialTheme.colors.error,
style = MaterialTheme.typography.caption,
modifier = Modifier.padding(start = 16.dp, top = 0.dp)
)
}
}
}
-----------------------
OutlinedTextFieldValidation(
value = studentState.firstName.value,
onValueChange = { onFirstNameChange(it) },
label = { Text(text = "First name") },
error = "field cannot be empty"
)
@Composable
fun OutlinedTextFieldValidation(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier.fillMaxWidth(0.8f),
enabled: Boolean = true,
readOnly: Boolean = false,
textStyle: TextStyle = LocalTextStyle.current,
label: @Composable (() -> Unit)? = null,
placeholder: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null,
error: String = "",
isError: Boolean = error.isNotEmpty(),
trailingIcon: @Composable (() -> Unit)? = {
if (error.isNotEmpty())
Icon(Icons.Filled.Error, "error", tint = MaterialTheme.colors.error)
},
visualTransformation: VisualTransformation = VisualTransformation.None,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = true,
maxLines: Int = Int.MAX_VALUE,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
shape: Shape = MaterialTheme.shapes.small,
colors: TextFieldColors = TextFieldDefaults.outlinedTextFieldColors(
disabledTextColor = Color.Black
)
) {
Column(modifier = modifier
.padding(8.dp)) {
OutlinedTextField(
enabled = enabled,
readOnly = readOnly,
value = value,
onValueChange = onValueChange,
modifier = Modifier
.fillMaxWidth(),
singleLine = singleLine,
textStyle = textStyle,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
isError = isError,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
maxLines = maxLines,
interactionSource = interactionSource,
shape = shape,
colors = colors
)
if (error.isNotEmpty()) {
Text(
text = error,
color = MaterialTheme.colors.error,
style = MaterialTheme.typography.caption,
modifier = Modifier.padding(start = 16.dp, top = 0.dp)
)
}
}
}
Why is HttpRepl unable to find an OpenAPI description? The command "ls" does not show available endpoints
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
5.0.401
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
}
httprepl http://localhost:5000 --openapi /swagger/v1/swagger.json
//if (env.IsDevelopment())
//{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1"));
//}
"ASPNETCORE_ENVIRONMENT": "Development"
dotnet run --launch-profile "name_of_profile"
export ASPNETCORE_ENVIRONMENT=Development
set ASPNETCORE_ENVIRONMENT=Development
$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet run --no-launch-profile
dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
public void ConfigureServices(IServiceCollection services)
{
[... other code here ...]
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
}
public void Configure(IApplicationBuilder app)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
[... other code here for setting up routing and the like ...]
}
-----------------------
dotnet dev-certs https --trust
What is a "closure" in Julia?
julia> function est_mean(x)
function fun(m)
return m - mean(x)
end
val = find_zero(fun, 0.0)
@show val, mean(x)
return fun # explicitly return the inner function to inspect it
end
est_mean (generic function with 1 method)
julia> x = rand(10)
10-element Vector{Float64}:
0.6699650145575134
0.8208379672036165
0.4299946498764684
0.1321653923513042
0.5552854476018734
0.8729613266067378
0.5423030870674236
0.15751882823315777
0.4227087678654101
0.8594042895489912
julia> fun = est_mean(x)
(val, mean(x)) = (0.5463144770912497, 0.5463144770912497)
fun (generic function with 1 method)
julia> dump(fun)
fun (function of type var"#fun#3"{Vector{Float64}})
x: Array{Float64}((10,)) [0.6699650145575134, 0.8208379672036165, 0.4299946498764684, 0.1321653923513042, 0.5552854476018734, 0.8729613266067378, 0.5423030870674236, 0.15751882823315777, 0.4227087678654101, 0.8594042895489912]
julia> fun.x
10-element Vector{Float64}:
0.6699650145575134
0.8208379672036165
0.4299946498764684
0.1321653923513042
0.5552854476018734
0.8729613266067378
0.5423030870674236
0.15751882823315777
0.4227087678654101
0.8594042895489912
julia> fun(10)
9.453685522908751
julia> function gen()
x = []
return v -> push!(x, v)
end
gen (generic function with 1 method)
julia> fun2 = gen()
#4 (generic function with 1 method)
julia> fun2.x
Any[]
julia> fun2(1)
1-element Vector{Any}:
1
julia> fun2.x
1-element Vector{Any}:
1
julia> fun2(100)
2-element Vector{Any}:
1
100
julia> fun2.x
2-element Vector{Any}:
1
100
-----------------------
julia> function est_mean(x)
function fun(m)
return m - mean(x)
end
val = find_zero(fun, 0.0)
@show val, mean(x)
return fun # explicitly return the inner function to inspect it
end
est_mean (generic function with 1 method)
julia> x = rand(10)
10-element Vector{Float64}:
0.6699650145575134
0.8208379672036165
0.4299946498764684
0.1321653923513042
0.5552854476018734
0.8729613266067378
0.5423030870674236
0.15751882823315777
0.4227087678654101
0.8594042895489912
julia> fun = est_mean(x)
(val, mean(x)) = (0.5463144770912497, 0.5463144770912497)
fun (generic function with 1 method)
julia> dump(fun)
fun (function of type var"#fun#3"{Vector{Float64}})
x: Array{Float64}((10,)) [0.6699650145575134, 0.8208379672036165, 0.4299946498764684, 0.1321653923513042, 0.5552854476018734, 0.8729613266067378, 0.5423030870674236, 0.15751882823315777, 0.4227087678654101, 0.8594042895489912]
julia> fun.x
10-element Vector{Float64}:
0.6699650145575134
0.8208379672036165
0.4299946498764684
0.1321653923513042
0.5552854476018734
0.8729613266067378
0.5423030870674236
0.15751882823315777
0.4227087678654101
0.8594042895489912
julia> fun(10)
9.453685522908751
julia> function gen()
x = []
return v -> push!(x, v)
end
gen (generic function with 1 method)
julia> fun2 = gen()
#4 (generic function with 1 method)
julia> fun2.x
Any[]
julia> fun2(1)
1-element Vector{Any}:
1
julia> fun2.x
1-element Vector{Any}:
1
julia> fun2(100)
2-element Vector{Any}:
1
100
julia> fun2.x
2-element Vector{Any}:
1
100
-----------------------
struct LikelihoodClosure
X
y
end
(l::LikelihoodClosure)(β) = -log_likelihood(l.X, l.y, β)
make_closures(X, y) = LikelihoodClosure(X, y)
nll = make_closures(X, y)
julia> f(x) = y -> x + y
f (generic function with 1 method)
julia> f(1) # that's the closure value
#1 (generic function with 1 method)
julia> typeof(f(1)) # that's the closure type
var"#1#2"{Int64}
julia> f(1).x
1
julia> propertynames(f(1)) # behold, it has a field `x`!
(:x,)
julia> eval(Expr(:new, var"#1#2"{Int64}, 22))
#1 (generic function with 1 method)
julia> eval(Expr(:new, var"#1#2"{Int64}, 22))(2)
24
-----------------------
struct LikelihoodClosure
X
y
end
(l::LikelihoodClosure)(β) = -log_likelihood(l.X, l.y, β)
make_closures(X, y) = LikelihoodClosure(X, y)
nll = make_closures(X, y)
julia> f(x) = y -> x + y
f (generic function with 1 method)
julia> f(1) # that's the closure value
#1 (generic function with 1 method)
julia> typeof(f(1)) # that's the closure type
var"#1#2"{Int64}
julia> f(1).x
1
julia> propertynames(f(1)) # behold, it has a field `x`!
(:x,)
julia> eval(Expr(:new, var"#1#2"{Int64}, 22))
#1 (generic function with 1 method)
julia> eval(Expr(:new, var"#1#2"{Int64}, 22))(2)
24
-----------------------
struct LikelihoodClosure
X
y
end
(l::LikelihoodClosure)(β) = -log_likelihood(l.X, l.y, β)
make_closures(X, y) = LikelihoodClosure(X, y)
nll = make_closures(X, y)
julia> f(x) = y -> x + y
f (generic function with 1 method)
julia> f(1) # that's the closure value
#1 (generic function with 1 method)
julia> typeof(f(1)) # that's the closure type
var"#1#2"{Int64}
julia> f(1).x
1
julia> propertynames(f(1)) # behold, it has a field `x`!
(:x,)
julia> eval(Expr(:new, var"#1#2"{Int64}, 22))
#1 (generic function with 1 method)
julia> eval(Expr(:new, var"#1#2"{Int64}, 22))(2)
24
How can I configure Hardhat to work with RSK regtest blockchain?
/**
* @type import('hardhat/config').HardhatUserConfig
*/
require("@nomiclabs/hardhat-waffle");
module.exports = {
solidity: "0.7.3",
defaultNetwork: "rskregtest",
networks: {
rskregtest: {
url: "http://localhost:4444/",
},
},
};
% npx hardhat test
-----------------------
/**
* @type import('hardhat/config').HardhatUserConfig
*/
require("@nomiclabs/hardhat-waffle");
module.exports = {
solidity: "0.7.3",
defaultNetwork: "rskregtest",
networks: {
rskregtest: {
url: "http://localhost:4444/",
},
},
};
% npx hardhat test
running a vite dev server inside a docker container
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
resolve: { alias: { '@': '/src' } },
plugins: [vue()],
server: {
host: true,
port: 8080
}
})
-----------------------
$ npm run dev -- --host
vite v2.7.9 dev server running at:
> Local: http://localhost:3000/
> Network: http://192.168.4.68:3000/
ready in 237ms.
-----------------------
$ npm run dev -- --host
vite v2.7.9 dev server running at:
> Local: http://localhost:3000/
> Network: http://192.168.4.68:3000/
ready in 237ms.
FirebaseOptions cannot be null when creating the default app
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
// Replace with actual values
options: FirebaseOptions(
apiKey: "XXX",
appId: "XXX",
messagingSenderId: "XXX",
projectId: "XXX",
),
);
runApp(MyApp());
}
dart pub global activate flutterfire_cli
flutterfire configure
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(MyApp());
}
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-analytics.js"></script>
<script>
var firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
projectId: "xx",
storageBucket: "exxx",
messagingSenderId: "xxx",
appId: "xxx",
measurementId: "xxx"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
-----------------------
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
// Replace with actual values
options: FirebaseOptions(
apiKey: "XXX",
appId: "XXX",
messagingSenderId: "XXX",
projectId: "XXX",
),
);
runApp(MyApp());
}
dart pub global activate flutterfire_cli
flutterfire configure
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(MyApp());
}
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-analytics.js"></script>
<script>
var firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
projectId: "xx",
storageBucket: "exxx",
messagingSenderId: "xxx",
appId: "xxx",
measurementId: "xxx"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
-----------------------
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
// Replace with actual values
options: FirebaseOptions(
apiKey: "XXX",
appId: "XXX",
messagingSenderId: "XXX",
projectId: "XXX",
),
);
runApp(MyApp());
}
dart pub global activate flutterfire_cli
flutterfire configure
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(MyApp());
}
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-analytics.js"></script>
<script>
var firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
projectId: "xx",
storageBucket: "exxx",
messagingSenderId: "xxx",
appId: "xxx",
measurementId: "xxx"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
-----------------------
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
// Replace with actual values
options: FirebaseOptions(
apiKey: "XXX",
appId: "XXX",
messagingSenderId: "XXX",
projectId: "XXX",
),
);
runApp(MyApp());
}
dart pub global activate flutterfire_cli
flutterfire configure
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(MyApp());
}
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-analytics.js"></script>
<script>
var firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
projectId: "xx",
storageBucket: "exxx",
messagingSenderId: "xxx",
appId: "xxx",
measurementId: "xxx"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
-----------------------
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
// Replace with actual values
options: FirebaseOptions(
apiKey: "XXX",
appId: "XXX",
messagingSenderId: "XXX",
projectId: "XXX",
),
);
runApp(MyApp());
}
dart pub global activate flutterfire_cli
flutterfire configure
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(MyApp());
}
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-analytics.js"></script>
<script>
var firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
projectId: "xx",
storageBucket: "exxx",
messagingSenderId: "xxx",
appId: "xxx",
measurementId: "xxx"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
-----------------------
class Configurations {
static const _apiKey = "Your values";
static const _authDomain = "Your values";
static const _projectId = "Your values";
static const _storageBucket = "Your values"
static const _messagingSenderId ="Your values"
static const _appId = "Your values"
//Make some getter functions
String get apiKey => _apiKey;
String get authDomain => _authDomain;
String get projectId => _projectId;
String get storageBucket => _storageBucket;
String get messagingSenderId => _messagingSenderId;
String get appId => _appId;
}
lib/config
import 'config/config.dart';
final configurations = Configurations();
Future<void> init() async {
await Firebase.initializeApp(
options: FirebaseOptions(
apiKey: configurations.apiKey,
appId: configurations.appId,
messagingSenderId: configurations.messagingSenderId,
projectId: configurations.projectId));
-----------------------
class Configurations {
static const _apiKey = "Your values";
static const _authDomain = "Your values";
static const _projectId = "Your values";
static const _storageBucket = "Your values"
static const _messagingSenderId ="Your values"
static const _appId = "Your values"
//Make some getter functions
String get apiKey => _apiKey;
String get authDomain => _authDomain;
String get projectId => _projectId;
String get storageBucket => _storageBucket;
String get messagingSenderId => _messagingSenderId;
String get appId => _appId;
}
lib/config
import 'config/config.dart';
final configurations = Configurations();
Future<void> init() async {
await Firebase.initializeApp(
options: FirebaseOptions(
apiKey: configurations.apiKey,
appId: configurations.appId,
messagingSenderId: configurations.messagingSenderId,
projectId: configurations.projectId));
-----------------------
class Configurations {
static const _apiKey = "Your values";
static const _authDomain = "Your values";
static const _projectId = "Your values";
static const _storageBucket = "Your values"
static const _messagingSenderId ="Your values"
static const _appId = "Your values"
//Make some getter functions
String get apiKey => _apiKey;
String get authDomain => _authDomain;
String get projectId => _projectId;
String get storageBucket => _storageBucket;
String get messagingSenderId => _messagingSenderId;
String get appId => _appId;
}
lib/config
import 'config/config.dart';
final configurations = Configurations();
Future<void> init() async {
await Firebase.initializeApp(
options: FirebaseOptions(
apiKey: configurations.apiKey,
appId: configurations.appId,
messagingSenderId: configurations.messagingSenderId,
projectId: configurations.projectId));
Approaches for using RTK-Query hooks inside functions?
const [myState, setState] = useState(skipToken) // initialize with skipToken to skip at first
const result = useMyQuery(myState)
const changePage = () => {
setState(5)
}
const [trigger, result] = useMyMutation()
const handleSubmit = () => {
trigger(someValue)
}
-----------------------
const [myState, setState] = useState(skipToken) // initialize with skipToken to skip at first
const result = useMyQuery(myState)
const changePage = () => {
setState(5)
}
const [trigger, result] = useMyMutation()
const handleSubmit = () => {
trigger(someValue)
}
-----------------------
const [myState, setState] = useState(skipToken) // initialize with skipToken to skip at first
const result = useMyQuery(myState)
const changePage = () => {
setState(5)
}
const [trigger, result] = useMyMutation()
const handleSubmit = () => {
trigger(someValue)
}
-----------------------
const [myState, setState] = useState(skipToken) // initialize with skipToken to skip at first
const result = useMyQuery(myState)
const changePage = () => {
setState(5)
}
const [trigger, result] = useMyMutation()
const handleSubmit = () => {
trigger(someValue)
}
-----------------------
const [email, setEmail] = useState<string>('')
const [password, setPassword] = useState<string>('')
const [loginCredentials, setLoginCredentials] = useState<ILoginRequest>({ email: '', password: '' })
const { data, error, isError, isSuccess, isLoading } = useLoginQuery(loginCredentials, {
skip: loginCredentials.email === '' && loginCredentials.password === '',
})
Achieve Unique Column Width for each Cell in Different Rows with a GridPane?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
public class App extends Application {
@Override
public void start(Stage stage) {
Label lblFirst = new Label("First");
Label lblLast = new Label("Last");
Label lblNumber = new Label("Card Number");
Label lblMonth = new Label("Month");
Label lblYear = new Label("Year");
Label lblCVV = new Label("CVV");
TextField txtFirst = new TextField();
TextField txtLast = new TextField();
TextField txtNumber = new TextField();
TextField txtMonth = new TextField();
TextField txtYear = new TextField();
TextField txtCVV = new TextField();
HBox row1 = new HBox(10);
HBox row2 = new HBox(10);
HBox row3 = new HBox(10);
row1.getChildren().add(createCell(lblFirst, txtFirst));
row1.getChildren().add(createCell(lblLast, txtLast));
row2.getChildren().add(createCell(lblNumber, txtNumber));
row3.getChildren().add(createCell(lblMonth, txtMonth));
row3.getChildren().add(createCell(lblYear, txtYear));
row3.getChildren().add(createCell(lblCVV, txtCVV));
VBox rows = new VBox(10, row1, row2, row3);
StackPane.setMargin(rows, new Insets(10));
StackPane root = new StackPane(rows);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
private static HBox createCell(Label label, TextField text) {
HBox pane = new HBox(5, label, text);
label.setMinWidth(Pane.USE_PREF_SIZE);
text.setMinWidth(50);
pane.setAlignment(Pos.CENTER);
HBox.setHgrow(pane, Priority.ALWAYS);
HBox.setHgrow(text, Priority.ALWAYS);
return pane;
}
public static void main(String[] args) {
launch();
}
}
-----------------------
pane.add(getField(), 1, 0, 4, 1); // node, colIndex, rowIndex, colSpan, rowSpan
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class CreditCardPaneDemo extends Application {
@Override
public void start(Stage stage) throws Exception {
VBox root = new VBox();
root.setPadding(new Insets(5));
root.setSpacing(10);
Scene scene = new Scene(root,300,200);
stage.setScene(scene);
stage.setTitle("CreditCard");
stage.show();
GridPane pane = new GridPane();
pane.setStyle("-fx-border-color:black;-fx-border-width:1px;-fx-background-color:yellow");
pane.setPadding(new Insets(5));
pane.setHgap(5);
pane.setVgap(5);
pane.add(getLabel("First"), 0, 0, 1, 1);
pane.add(getField(), 1, 0, 4, 1);
pane.add(getLabel("Last"), 5, 0, 1, 1);
pane.add(getField(), 6, 0, 2, 1);
pane.add(getLabel("Card Number"), 0, 1, 3, 1);
pane.add(getField(), 3, 1, 5, 1);
pane.add(getLabel("Month"), 0, 2, 2, 1);
pane.add(getField(), 2, 2, 2, 1);
pane.add(getLabel("Year"), 4, 2, 1, 1);
pane.add(getField(), 5, 2, 1, 1);
pane.add(getLabel("CVV"), 6, 2, 1, 1);
pane.add(getField(), 7, 2, 1, 1);
pane.getColumnConstraints().addAll(getCc(70), getCc(20), getCc(80), getCc(20), getCc(25), getCc(90), getCc(80), getCc(100));
CheckBox gridLines = new CheckBox("Show grid lines");
gridLines.selectedProperty().addListener((obs, old, val) -> pane.gridLinesVisibleProperty().set(val));
root.getChildren().addAll(gridLines, pane);
}
private ColumnConstraints getCc(double width) {
ColumnConstraints cc = new ColumnConstraints();
cc.setPrefWidth(width);
return cc;
}
private Label getLabel(String txt) {
Label lbl = new Label(txt);
lbl.setMinWidth(Region.USE_PREF_SIZE);
return lbl;
}
private TextField getField() {
TextField field = new TextField();
field.setMaxWidth(Double.MAX_VALUE);
return field;
}
}
-----------------------
pane.add(getField(), 1, 0, 4, 1); // node, colIndex, rowIndex, colSpan, rowSpan
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class CreditCardPaneDemo extends Application {
@Override
public void start(Stage stage) throws Exception {
VBox root = new VBox();
root.setPadding(new Insets(5));
root.setSpacing(10);
Scene scene = new Scene(root,300,200);
stage.setScene(scene);
stage.setTitle("CreditCard");
stage.show();
GridPane pane = new GridPane();
pane.setStyle("-fx-border-color:black;-fx-border-width:1px;-fx-background-color:yellow");
pane.setPadding(new Insets(5));
pane.setHgap(5);
pane.setVgap(5);
pane.add(getLabel("First"), 0, 0, 1, 1);
pane.add(getField(), 1, 0, 4, 1);
pane.add(getLabel("Last"), 5, 0, 1, 1);
pane.add(getField(), 6, 0, 2, 1);
pane.add(getLabel("Card Number"), 0, 1, 3, 1);
pane.add(getField(), 3, 1, 5, 1);
pane.add(getLabel("Month"), 0, 2, 2, 1);
pane.add(getField(), 2, 2, 2, 1);
pane.add(getLabel("Year"), 4, 2, 1, 1);
pane.add(getField(), 5, 2, 1, 1);
pane.add(getLabel("CVV"), 6, 2, 1, 1);
pane.add(getField(), 7, 2, 1, 1);
pane.getColumnConstraints().addAll(getCc(70), getCc(20), getCc(80), getCc(20), getCc(25), getCc(90), getCc(80), getCc(100));
CheckBox gridLines = new CheckBox("Show grid lines");
gridLines.selectedProperty().addListener((obs, old, val) -> pane.gridLinesVisibleProperty().set(val));
root.getChildren().addAll(gridLines, pane);
}
private ColumnConstraints getCc(double width) {
ColumnConstraints cc = new ColumnConstraints();
cc.setPrefWidth(width);
return cc;
}
private Label getLabel(String txt) {
Label lbl = new Label(txt);
lbl.setMinWidth(Region.USE_PREF_SIZE);
return lbl;
}
private TextField getField() {
TextField field = new TextField();
field.setMaxWidth(Double.MAX_VALUE);
return field;
}
}
QUESTION
Invalid CSS value error while Customizing Bootstrap 5 colors with sass 3
Asked 2022-Mar-22 at 12:49I want to change bootstrap's default theme-colors with SASS , the problem is when I change a color and compile , it gives me invalid CSS value error.
I've read the docs and saw some tutorials on YouTube but I can't see where is the problem
I'm using bootstrap 5.1.0 , sass 3 this is my scss file:
@import "../../node_modules/bootstrap/scss/variables";
$theme-colors: (
"primary": //some color here,
);
@import "../../node_modules/bootstrap/scss/bootstrap";
and this is the error I get in terminal
PS F:\Coding\projects\sepehr\client\src\styles> sass style.scss custom.css
Error: ("primary": #0d6efd, "secondary": #6c757d, "success": #198754, "info": #0dcaf0,
"warning": #ffc107, "danger": #dc3545, "light": #f8f9fa, "dark": #212529) isn't a valid
CSS value.
╷
94 │ $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value") !default;
│ ^^^^^^^^^^^^^
╵
ANSWER
Answered 2021-Aug-24 at 14:36You need to import functions and mixins too...
@import "../../node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/variables";
@import "../../node_modules/bootstrap/scss/mixins";
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit