QuestionId stringlengths 8 8 | AnswerId stringlengths 8 8 | QuestionBody stringlengths 91 22.3k | QuestionTitle stringlengths 17 149 | AnswerBody stringlengths 48 20.9k |
|---|---|---|---|---|
76382104 | 76383359 | I am building a calendar app and mostly in my code I use LocalDate to set my RecyclerView and some more functions.
I have a tablet that it's android version is 7.1.1, so it cant run anything in my code related to LocalDate.
I want to contest my self and make my app run to min SDK 16. Are there any alternatives for Loca... | android app LocalDate alternative for older API level | If you want to have Java 8+ features available in lower Android version, you can use one of the following options:
import the ThreeTen Android Backport (ABP)
make use of Android API Desugaring
With (one of) these two, you can use nearly all of the classes and functions of java.time in Android API Levels < 26, includi... |
76383806 | 76384014 | When running SAM build, I get a dependency error on the module that depends on another local module within my project. From mvn or IntelliJ I have no problems, but when i execute SAM build, i got an error of notFound symbols and classses.
Build Failed
Error: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] ... | I cant build my spring-boot multi module project with SAM | You stated in your comment:
"I am building a serverless application, deploying lambdas functions in api gateway."
If you are intereted in builidng a serverless app with Java, look at the PAM example. This example builds a complete serverless example that uses API Gateway, Lambda functions, Java SDK, a client app that u... |
76384235 | 76385656 | I have a class in Kotlin (Jetpack compose) with a variable title and an exoplayer that updates the title.
class Player{
var title by mutableStatOf("value")
....
title= "new value"
...
}
@Composable
fun Display(){
val player = Player()
player.title?.let{
Text(it)
}
}
In the user interface an instance of the class i... | Variable not updated in compose | You forgot to remember the player instance. Here, when you change title, your composable is recomposed because it reads the title. But when it is recomposed, you create new instance of Player with the default title.
val player = remember { Player() }
|
76384397 | 76385670 | Greetings I have problem. I am using Visual studio 2022 and created two projects there for one solution. One for back-end (ASP.NET) and the second one for fron-end (vuejs and vite). So here starts the problem. I used npm create vue@3 command to create vue project. And its launched fine , but when I did same thing in f... | No loader is configured for ".html" files: index.html Vitejs | The issue is the # symbol in your file path
D:/Projects/C#/DAINIS/vueapp/
I don't know the technical reason why this causes it to fail, but if you remove it, the project should run.
|
76382075 | 76383557 | R 4.2.1
package usage: netmeta 2.8-1
Issue:
In netmeta package, the function forest() will create a forest plot. One need to know that forest() can generate a forest plot presenting the network inconsistency between direct and indirect comparisons.
In my case, I have an extremely large network, which will lead to more ... | Saving an extremely long figure as pdf in R will cause all text invisible | PDF 1.x has an implementation limit for the page size:
The minimum page size should be 3 by 3 units in default user space; the maximum should be 14,400 by 14,400 units. In versions of PDF earlier than 1.6, the size of the default user space unit was fixed at 1⁄72 inch, yielding a minimum of approximately 0.04 by 0.04 ... |
76382178 | 76383650 | I have a table to entries where I am trying to concatenate few columns and the concatenation should not happen when any one of the required values are empty
Here is the spreadsheet. https://docs.google.com/spreadsheets/d/1lQUG4TmFTKghV8r6Gg3EilLx6zyuTkrNfnCatRVWp_U/edit#gid=189998773
I did try to use the formula =MAP(s... | Complex Cocatenation in gsheets | You can simplify your formula by omitting SCAN
=MAP(D5:D,H5:H,I5:I,J5:J,K5:K,
LAMBDA(dd,hh,ii,jj,kk,
IF(OR(dd="",hh="",ii="",AND(jj="",kk="")),,dd&"-"&hh&"-"&ii&"-"&if(kk<>"",kk,jj))))
(for future reference: try naming your LAMBDAs accordingly)
|
76385291 | 76385673 | I am trying to use glm in R using a dataframe containing ~ 1000 columns, where I want to select a specific independent variable and run as a loop for each of the 1000 columns representing the dependent variables.
As a test, the glm equation works perfectly fine when I specify a single column using df$col1 for both my d... | Using glm in R for linear regression on a large dataframe - issues with column subsetting | It would be more idiomatic to do:
predvars <- names(df)[20:1112]
glm_list <- list() ## presumably you want to save the results??
for (pv in predvars) {
glm_list[[pv]] <- glm(reformulate(pv, response = "col1"),
data=df, family=gaussian)
}
In fact, if you really just want to do a Gaussian GLM then it will b... |
76381069 | 76383663 | When I try to add a custom domain to Firebase Hosting, I encounter this error. Nothing happens when I click Continue.
Upon clicking continue, it loads for a few seconds, and then the same screen persists.
When I checked the console, HTTP requests are responded with 503 Service Unable.
| Firebase Hosting Can't Add Domain | firebaser here
While we did make some changes to our custom domain provisioning this week, it seems that you're hitting another problem.
Is any part of this on a Google Workspace account by any chance? If that is the case, your domain may not allow the search console. You'll want to reach out to their GSuite organizati... |
76383791 | 76384034 | Wonder if anyone can help.
On the attached on tab 2 I'm trying to do a vlookup to tab 1 to use column 1 'code' to bring back column 3 'email'. But if there is more than 1 match in column 1 for 'code', prioritize the row that has Level 1 in column 2 in tab 1. For example, there are two code 20, on tab 1 but the formula ... | Google Sheets vlookup to prioritize a column | You may try:
=index(ifna(vlookup(A2:A,sort(LookTable!A:C,2,),3,)))
the above code prioritizes Level 1 over blank level. Not sure if there's goin' to be 10s of levels and I have to choose say level 15 over level 8 or so; then use this alternate variant
=index(ifna(vlookup(A2:A,sort(LookTable!A2:C,--ifna(regexextract(L... |
76384189 | 76385755 | Overview:
Pandas dataframe with a tuple index and corresponding 'Num' column:
Index Num
('Total', 'A') 23
('Total', 'A', 'Pandas') 3
('Total', 'A', 'Row') 7
('Total', 'A', 'Tuple') 13
('Total', 'B') 35
('T... | Sort Rows Based on Tuple Index | You can try:
def fn(x):
vals = x.sort_values(by='Num', ascending=False)
df.loc[x.index] = vals.values
m = df['Index'].apply(len).eq(3)
df[m].groupby(df.loc[m, 'Index'].str[1], group_keys=False).apply(fn)
print(df)
Prints:
Index Num
0 (Total, A) 23
1 (Total, A, Tuple) 13
2 ... |
76382968 | 76384045 | I am getting the below error pointing to 'RouteChildrenProps':
I am just trying to get through a tutorial but I got stuck here. Here is the full code:
import React from 'react';
import { Route, RouteChildrenProps, Routes } from 'react-router';
import routes from './config/routes';
export interface IApplicationProps ... | RouteChildrenProps is not an exported member | React-Router v6 removed route props, these are a v4/5 export. The Route component API changed significantly from v4/5 to v6. There are no route props, no exact prop since routes are now always exactly matched, and all routed content is rendered on a single element prop taking a React.ReactNode, e.g. JSX, value.
import ... |
76381810 | 76383698 | I have a use case where C wrapper is loading the Rust DLL. Both C and Rust have infinate loop.
C code
#include "main.h"
#include <stdio.h>
#include "addition.h"
#include <time.h>
#include <unistd.h>
extern void spawn_thread_and_get_back(); // Rust function :
extern void keep_calling_rust_fn(); // Rust function :
int ... | Call Rust DLL function to spawn new thread from C wrapper and return the main thread back to C | Thanks everyone, After discussing in the comments above, here is the working answer. We just need to change Rust code
async fn counter() {
loop {
println!("I am getting called by Tokio every 2 seconds");
// Sleep for 1 second
sleep(Duration::from_secs(2)).await;
}
}
#[tokio::main]
asyn... |
76383253 | 76384048 | I add two numbers in Xcos and would like to show the result in the diagram. I managed to do so using a CSCOPE element and adding an extra CLOCK_c element:
However, I would prefer a display element that simply shows the number:
=> What component could I use for that?
If there is no existing display component for plain... | How to show result of static model (=plain number) in Xcos? | Use the AFFICH_m block (https://help.scilab.org/AFFICH_m). However, be warned that you still have to run the simulation to see the value:
|
76385130 | 76385764 | I am using MS Access to create a DB. I have different physical containers and I want to obtain the running sum of the liquid that has been added and taken out of the container to give the balance of the liquid inside the container.
The biggest problem is ordering liquid transactions. I have read lots of resources, and ... | Ms Access running sum with dates and order inside dates | I can't say anything about recursive queries in MS Access.It is interesting.
Try this query, where DSum counts sum from main table.
SELECT ContainerId, Quantity, DateTransaction, OrderInDate
,DateAdd("s",OrderInDate,DateTransaction) AS Expr1
,DSum("Quantity","InventoryTransactions"
,"[ContainerId]=" & [C... |
76383683 | 76384081 | These are 2 models I have:
class Skill(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name + " - ID: " + str(self.id)
class Experience(models.Model):
consultant = models.ForeignKey("Consultant", related_name="experience", on_delete=models.CASCADE)
projec... | IN DRF, how to create a POST serializer where I can add multiple values of a Foreign Key field | With the current relation, if your payload contains "skills_ids": [1,2,3], then you would create three differrent instances of Experience each one containing a skill, which is NOT what you want, that is bad practice.
Instead, a many-to-many relationship is more adequate, associating multiple skills to an Experience and... |
76381541 | 76383769 | I have a program that should generate combinations of concatenation of all possible adjacent characters.
For example
Input = [a,b,c]
Output = [a,b,c], [ab,c], [a,bc]
Input = [a,b,c,d]
Output = [a,b,c,d], [ab,c,d], [a,bc,d], [a,b,cd], [ab,cd]
Input = [a,b,c,d,e]
Output = [a,b,c,d,e], [ab,c,d,e], [a,bc,d,e], [a,b,cd,e]... | Generate combinations by combining adjacent characters | Here's a quick JavaScript version that you can run in your browser to verify the result -
function *mates(t) {
if (t.length == 0) return yield []
if (t.length == 1) return yield t
for (const m of mates(t.slice(1)))
yield [t[0], ...m]
for (const m of mates(t.slice(2)))
yield [mate(t[0], t[1]), ...m]
}
... |
76383755 | 76384101 | I'm trying to parse C style comments using FParsec. Not sure why this is failing:
My parser code:
let openComment : Parser<_,unit> = pstring "/*"
let closeComment : Parser<_,unit> = pstring "*/"
let comment = pstring "//" >>. restOfLine true
<|> openComment >>. (charsTillString "*/" true System.Int32.... | Why is my FParsec parser failing to recognize a block comment? | The problem is that the combinators in your comment parser don't have the precedence/associativity that you want. You can fix this by grouping with parens:
let comment = (pstring "//" >>. restOfLine true)
<|> (openComment >>. (charsTillString "*/" true System.Int32.MaxValue)) |>> Comment
I find that ch... |
76385372 | 76385796 | Kotlin and Java code templates in Android Studio.
I tried to create a code template for the truth library that would work like the val template works i.e,
When you want to create a variable from the result of calling a function? you just type,
functionName().val.
When you press enter a variable is created ie, val f = ... | How can I create a code template in Android Studio to replicate the val template in Kotlin | This feature is named "Postfix completion"
You can find details here https://www.jetbrains.com/help/idea/settings-postfix-completion.html
I have tried now and it's allowed me to add and edit java and groovy templates but kotlin is not supported.
The other perfect feature of Idea is Live templates you can use them to im... |
76381363 | 76383926 | I have a simple class that one of properties is:
public TValue Value => IsSuccess
? _value
: throw new InvalidOperationException("The value of a failure result can not be accessed.");
So it works like this, when some operation is a success assign value from this operation to property easy. But now I when I do ... | Serialize property access exception to json | I'm wondering whether there isn't a better design for what you're trying to achieve. Namely, it might be better to move the IsSuccess check logic into a method so that it doesn't get hit during serialization. But if you really decide to do it this way, you could use a JsonConverter to catch and serialize the exception ... |
76383757 | 76384134 | I'm throwing an error in my loaders when response.status.ok of fetch is false. Error component is then loaded.
But my server sometimes returns 429 status code (too many requests) upon which I don't want to load an error component but instead simply do nothing, or maybe display some message but certainly without reloadi... | React Router cancel loader | You can check the response status code specifically for a 429 status and return any defined value back to the UI. I think the important detail here that you should return something instead of undefined. null appears to work and not throw any extraneous errors
function loader() {
let response = imitateFetch();
conso... |
76380714 | 76384044 | Question
How can I center an ImageView and a TextView within a ConstraintLayout, ensuring that they remain centered regardless of the ConstraintLayout's height, while also ensuring that the ImageView shrinks if necessary to maintain visibility of the TextView?
Expected results:
In case of a large ConstraintLayout (cent... | How can I center an ImageView and TextView in a ConstraintLayout while adjusting ImageView size to maintain TextView visibility? | If you take your closest solution, try setting the ImageView height and width to wrap_content again (so it displays at its native size) but add app:layout_constrainedWidth="true" and app:layout_constrainedHeight="true". This basically lets you define the height and width you want (i.e. whatever the image size actually ... |
76385243 | 76385822 | How can I provide string to function in pytest, so that function under test treat it as content of file ?
I have function that is parsing file. File is custom text format.
I want to test multiple different input files.
Initial idea was to use pytest is this way:
import pytest
import mymodule as t
# this is all valid o... | How to mock string as content of file for pytest? | I wrote a pytest plugin called pytest_tmp_files to solve this exact problem. Here's how it would look for your example:
@pytest.mark.parametrize(
'tmp_files', [
{'f': '#'},
{'f': '##'},
{'f': ''},
{'f': ' '},
{'f': ' '},
],
indirect=['tmp_files'],
)
def test_is_in... |
76383483 | 76384221 | I am using Nextjs and I would like to use the html tag, input type of 'date'. I also would like to set a defaultValue and I did something like this and it is not working:
const [dDate, setdDate] = useState('17/11/2022');
const ReactComponent = ()=>{
return(
<input type="date" className=" bord... | defaultValue for input type 'date' is not working in Nextjs | Try using a different date format with the value attribute, like so:
<input type="date" value="2022-11-17"/>
|
76381366 | 76384056 | I created a aws eks using assume role api. Role A assume role B to performe create EKS api. I create the eks and specify that the EKS's cluster role is role C. As I know,the role C's arn will be stored in eks aws-auth configMap.
When A assume role C to access the created EKS, "Failed to get namespaces: Unauthorized" re... | Can't use assume role to accesss aws eks which is created by assume role api | You have some misconception; The role that is stored in aws-auth configmap for system:masters group in your cluster is not the cluster role, but the iam principal that creates the cluster itself, as per official doc.
When you create an Amazon EKS cluster, the IAM principal that creates the cluster is automatically gra... |
76380876 | 76384084 | Adding description with --description while creating deb package on linux creates deb file, which when opened with QApt package installer (double click installation) shows defined text in description section, which seems like a bold header and underneath there is that description again with first character stripped:
C... | Description bug in DEB file created by jpackage when opened with QApt installer | A solution to this problem might be to use multi-line description. First line is then bold text and second line is below it, altough bug still remains when using single-line description.
jpackage -t deb \
--app-version 1.0.0 \
--icon books256.png \
--name hello \
--description 'first line
second line' \
--dest target/j... |
76384941 | 76385914 | I've composed the component below, and I need to apply a type for the custom iconFontSize prop. How can I do this?
import { SvgIconComponent } from '@mui/icons-material'
import { Typography, TypographyProps} from '@mui/material'
type Props = TypographyProps & {
Icon: SvgIconComponent
iconFontSize: /* insert type h... | How to type Material UI Icon's fontSize prop? | You can type iconFontSize as a union type of 'inherit' | 'large' | 'medium' | 'small':
type Props = TypographyProps & {
Icon: SvgIconComponent
iconFontSize: "inherit" | "small" | "medium" | "large"
}
If you want to use the exact type from the MUI type definition file, you can alternatively use:
import { Overrid... |
76381138 | 76384119 | I'm using three.js and I need to create a few clones of a texture made with THREE.WebGLRenderTarget().
I can use the original texture, e.g.:
scene.background = renderTarget.texture;
But if I try to use a clone of it:
const tex = renderTarget.texture.clone();
scene.background = tex;
I get the following error:
THREE.WebG... | Cloning a texture created with THREE.WebGLRenderTarget | Problem solved: I created a framebuffer texture, and I copied the texture by using method renderer.copyFramebufferToTexture() of class THREE.WebGLRenderer.
|
76382996 | 76384240 | given a distance, turns calculate the number of turns to be on each speed - 1 2 4, and 8. to complete the distance on the last turn.
you start on speed 1, and in each turn you can accelerate to the next speed or do nothing (1 -> 2, 2 -> 4, 4 -> 8), once you accelerate you can't slow back down.
each turn you are moving ... | algorithm to calculate speeds to move in order to arrive in x turns | This is a fairly exhaustive approach, but it does provide the correct answer to the problem above about how to cover your distance in a specified number of steps.
For my method, I first created the output dictionary in the form of {1: distance, 2: 0, 4: 0, 8: 0}, where, for each key-value pair, the key represents your ... |
76385015 | 76385939 | I am writing jolt for transforming this data but not getting desired result
If practice_loc,prac_num and topId are same for two or more data then they will be combined together with separate S1 and S2 within subList. Else they would pass as it is with addition of subList only.
Data
[
{
"practice_loc": "120",
... | Jolt not printing anything | Your current spec is pretty good. Would be suitable to rearrange it like that
[
{ // group by those three attributes
"operation": "shift",
"spec": {
"*": {
"*": "@1,practice_loc.@1,prac_num.@1,topId.&",
"S*": "@1,practice_loc.@1,prac_num.@1,topId.subList[&1].&"
}
}
},
{ // ... |
76381511 | 76384131 | My problem is that I have found a solution for one group of checkboxes and shows the selected data in a text field in my dynamic formular.
But I think the line $('input:checkbox').change((e) does not make sense if I want to use a different, or new, group of checkboxes.
My idea is that the two different groups of checkb... | Different Checkbox groups should write data in textfields | The way I'd approach this is as below, with explanatory comments in the code:
// simple utility variable and functions to reduce some of the repetitive typing:
const D = document,
// here we have means of creating an element, and passing various properties
// to that new element (className, textContent, borderCol... |
76384666 | 76385966 | I am building a docker-compose.yml file inside a workspace, but when I try to run docker-compose, I can't start my services because of the following error ENOENT: no such file or directory, open '/entity-service/package.json' the same error happens when trying to start the agent-portal-service container as well but the... | Can't find services package.json when running docker-compose | The important parts of your entity-service definition look like this
entity_service:
working_dir: /entity-service
volumes:
- /agent-workspace:/entity-service
command: npm run start:debug
You map /agent-workspace to /entity-service in the volumes section. You also set your working directory to /enti... |
76382916 | 76384251 | I have two functions that take a single options argument with differing properties, except for type, which is used to identify the function.
type FuncAOptions = {
type: 'A'
opt1: string
opt2: boolean
}
function funcA(options: FuncAOptions): number {
if (!options.opt1) throw new Error('Missing required ... | Specify function parameter types in TypeScript mapped trype | If you want functionMap[type](options) to type check without loosening things up with type assertions or the any type, then you'll need to write it terms of generic indexes into a base key-value type or mapped types of that type. This is as described in microsoft/TypeScript#47109.
Essentially you want type to be seen ... |
76381320 | 76384140 | I'm doing a pet project of a social network and I'm having problems with authorization.I getting Access Denied when I send a request with a jwt token.
I am doing the following chain of actions:
Registration where I specify the login email and password (Works well)
Authorization where by login and password I get a toke... | Spring Security Access Denied with Spring Boot 3.0 | Your problem relates to the difference in Spring between ROLES and Authorities and the Spring hack that treats Roles as Authorities prefixed with "ROLE_"
In order to use the annotation @PreAuthorize("hasRole('ROLE_USER')") you need a Permission as follows:
ROLE_USER("ROLE_USER")
Which is related to your ERole enum as ... |
76381531 | 76384167 | I have a Wix installer.
In the Product.wxs file, I have the below piece of code:
<Product Id="*"
Name="$(var.PRODUCT_NAME)"
Language="1033"
Version="!(bind.FileVersion.myDLLfile)"
Manufacturer="$(var.CompanyName)"
UpgradeCode="{D00BA432-7798-588A-34DF-34A65378FD45}">
In the Features.wxs, I have the... | Get product version from a custom action | The easiest way is probably to store the value in a Property and read that property in the custom action. The bind variable syntax would make setting the property easy.
<Property Id="ThisIsASillyThingToNeedToDo" Value="!(bind.FileVersion.myDLLfile)" />
|
76384063 | 76385989 | I have the following query.
SELECT *
FROM user u
LEFT JOIN operator o ON o.id = u.id
WHERE u.user_type_id IN (2,4) AND u.is_enabled = 1 AND u.office_id = 225
If I run explain on the query above, it shows that it uses the index IX_user_type for the table user.
If I just change the office_id comparison value like the fo... | Why does Mysql change query execution plan based on query parameters? | MySQL may decide not to use the index on office_id if the value you are searching for is too common.
By analogy, why doesn't a book include common words like "the" in the index at the back of the book? Because such common words occur on a majority of pages in the book. It's unnecessary to keep a list of those pages und... |
76382547 | 76384317 | How can I modify this script to be able to see/print some of the results and write the output in JSON :
from google.cloud import bigquery
def query_stackoverflow(project_id="gwas-386212"):
client = bigquery.Client()
query_job = client.query(
"""
WITH
SNP_info AS (
SELECT
CONCAT(CAST(rs_id ... | Save the output of bigquery in JSON from python | Check out json documentation for further information.
records = [dict(row) for row in results]
out_file = open("bigquery_response.json", "w")
json.dump(records , out_file, indent = 6)
out_file.close()
|
76381598 | 76384253 | Now I'm using UIImage sync extension.
struct PostView: View {
let url: String
var body: some View {
PrivateImageView(image: UIImage(url:url))
}
}
extension UIImage {
public convenience init(url: String) {
let url = URL(string: url)
do {
let data = try D... | How to rewrite sync method using SwiftUI? | There is no way to get a data from the inter/intranet synchronously you have to use an async method and account for the time it takes to download.
extension String {
public func getUIImage() async throws -> UIImage {
guard let url = URL(string: self) else {
throw URLError(.badURL)
}
... |
76385236 | 76386062 | I have am setting up a very simple test site on my localhost under IIS which needs to be accessible locally from https. IU have followed the steps below:
In IIS for my local server, I have created a self signed certificate and stored in the "Personal" store
I have added a https binding for my test site to this new ce... | Self signed certificate not working on localhost IIS | The solution involved using Powershell rather than IIS manager to generate the self signed certificate. ISS always used the machine name rather than the sitename as the common name.
The powershell command I used was as follows:
New-SelfSignedCertificate -DnsName testsite -CertStoreLocation cert:\LocalMachine\My
After ... |
76378736 | 76384351 | I am trying to use XE7 to connect to an in-house REDCap server. REDCap has a detailed description of the API at https://education.arcus.chop.edu/redcap-api/ and a test server at https://bbmc.ouhsc.edu/redcap/api with a test token key. There is assistance at https://mran.microsoft.com/snapshot/2015-08-18/web/packages/... | How do I implement SSL in Delphi to connect to a REDCap API server? | You are setting up the TLS connection correctly (provided the appropriate OpenSSL DLLs are available where Indy can find them).
What you are not setting up correctly is your data parameters. Curl's --data-urlencode command puts the data in the HTTP request body, not in the HTTP headers. So you need to put the data in t... |
76381369 | 76384486 | In my program I have to import data from a remote sqlserver database.
I am using ASP.NET MVC 5 and EF6 Code First (I'm new with EF and MVC 5).
First, I copy data from a remote view to a table in the local database.
For this part I use this code in the action method (names are in italian):
using (var source = new TimeWe... | Stored procedure with EF6 Code first - best practice? | You can create stored procedure directly in db and write all three remaining part of your process (point a,b,c) in one SP (stored procedure). SP is stored as object file in sql so it's fast and sql server don't spend time in making execution plan and other extra things.
In order to create sp, you need to more familiar ... |
76384694 | 76386084 | For example, I can add definitions for C/C++ preprocessor with CMake
add_definitions(-DFOO -DBAR ...)
and then I can use them for conditional compilation
#ifdef FOO
code ...
#endif
#ifdef BAR
code ...
#endif
Is there a way to do the same thing with Zig and its build system using compilation arguments or somet... | How to do conditional compilation with Zig? | You can do something similar using the build system. This requires some boilerplate code to do the option handling. Following the tutorial on https://zig.news/xq/zig-build-explained-part-1-59lf for the build system and https://ziggit.dev/t/custom-build-options/138/8 for the option handling:
Create a separate file call... |
76382999 | 76384407 | How can I configure my ASP.NET Core 6 Web API controllers to use AWS Cognito authorization?
This is the code I wrote in my program.cs file:
var AWSconfiguration = builder.Configuration.GetSection("AWS:Cognito");
var userPoolId = AWSconfiguration["UserPoolId"];
var clientId = AWSconfiguration["ClientId"];
var region = A... | Cognito JWT Authorize in ASP.NET Core 6 Web API | Cognito access tokens don't have an audience claim - though ideally they should. In other authorization servers, APIs check the received access token has the expected logical name, such as api.mycompany.com.
For Cognito you will need to configure .NET to not validate the audience, similar to this. Other token validatio... |
76381827 | 76384517 | Im totaly new in wordpress php and cron. So, I have a task. I need to take data from a form and put it into a cron function.
This is me code. I created custom plugin page in wordpress admin panel and try to run this code.
actually the code works if I enter a article id instead of a variable $post_id;
function cron_add... | How to pass arguments in cron job function | Per the docs for wp_schedule_event, the fourth parameter, which you are 't currently using, is $args
Array containing arguments to pass to the hook's callback function. Each value in the array is passed to the callback as an individual parameter.
The array keys are ignored.
Default: array()
This means you should be a... |
76381875 | 76384775 | I am executing a script which starts an executable proc1.exe. When proc1.exe is running, the batch file has to start another executable proc2.exe.
Example: File A.bat runs proc1.exe with following requirements.
When proc1.exe is running, proc2.exe should run.
When proc1.exe is closed, proc2.exe should be terminated.
... | How to start a GUI executable and a console program and terminate the console application on GUI application closed by the user? | The task is very unclear.
Is proc1.exe started outside of the batch file or also by the batch file?
Is proc1.exe a Windows console or a Windows GUI application and does it open files for read/write operations or makes it registry reads/writes or does it open connections to other processes or even other devices?
Is pro... |
76383269 | 76384410 | I'm getting the following error when trying to compile my rust diesel project despite the diesel docs showing that this trait is implemented
the trait bound DateTime<Utc>: FromSql<diesel::sql_types::Timestamptz, Pg> is not satisfied
My schema.rs
pub mod offers {
diesel::table! {
offers.offers (id) {
... | the trait `FromSql` is not implemented for `DateTime` | You need to enable the "chrono" feature for the implementation for DateTime<UTC> from the chrono crate to be provided. This is shown as an annotation in the docs and is not enabled by default. You can read more about this feature and others in Diesel's crate feature flags section of the docs.
So your Cargo.toml should ... |
76381239 | 76385356 | For min(ctz(x), ctz(y)), we can use ctz(x | y) to gain better performance. But what about max(ctz(x), ctz(y))?
ctz represents "count trailing zeros".
C++ version (Compiler Explorer)
#include <algorithm>
#include <bit>
#include <cstdint>
int32_t test2(uint64_t x, uint64_t y) {
return std::max(std::countr_zero(x), s... | Is there a faster algorithm for max(ctz(x), ctz(y))? | These are equivalent:
max(ctz(a),ctz(b))
ctz((a|-a)&(b|-b))
ctz(a)+ctz(b)-ctz(a|b)
The math-identity ctz(a)+ctz(b)-ctz(a|b) requires 6 CPU instructions, parallelizable to 3 steps on a 3-way superscalar CPU:
3× ctz
1× bitwise-or
1× addition
1× subtraction
The bit-mashing ctz((a|-a)&(b|-b)) requires 6 CPU instruction... |
76384813 | 76386149 | These two formulas are the same, except the first one is not an array formula and the second one is. How can the first formula be converted to an array formula? Getting circular logic when using the array formula.
Standard Formula (works fine, no circular logic):
=LET(a, A2, b, B2, c, C2, d, D1, e, E1,
dd, IF(a =... | Using Office365 Excel array formulas, how to convert this standard formula? | INDEX each array and use SCAN to return the values:
=LET(
a, A9:A12,
b, B9:B12,
c, C9:C12,
d, D8:D11,
dd, IF(a = 1, 0, d),
SCAN(0,a,LAMBDA(z,y,(INDEX(b,y)*INDEX(c,y)+INDEX(dd,y)*z)/(INDEX(b,y)+INDEX(dd,y)))))
|
76383596 | 76384510 | Is there a way/function to calculate the proportion of each raster cell covered by a polygon? The polygons are usually larger than single cells and the landscape I'm working on is pretty big. I'll like to do it without converting the raster into cell-polygons and st_union/st_join, but I'm not sure if it's possible.
The... | Area of each cell covered by polygons | Thanks for the comments.
At the end the terra::rasterize() function with the cover = T parameter applied on the polygons layer does exactly what I was looking for... and it's super fast.
I was able to keep it all on the "raster side" and avoid the more intense processing of vectorizing the raster template and doing int... |
76381200 | 76385707 | I want the starting point 0% and the ending point 100% of the progress bar to be in the lower left corner. And the progress of the value changes to display normally. How can I accomplish it?
I want the progress bar to increase and decrease in value along the circle.
The result of my test is not correct, I don't know wh... | How to create Custom progress bar minimum value 0 starts from the bottom left corner? | change the piang calculation in the convert function so that the starting point at the bottom left is taken into account in the calculation
double piang = (angle - 143.2) * Math.PI / 180;
so the class looks like this
public class AngleToPointConverter : IValueConverter
{
public object Convert(object value, Type t... |
76384224 | 76386230 | Good morning! I have a customer ID field included in the table DAC. I would like for this selector to operate identically to the customer ID field in the sales order form. I used all pertinent DAC code from the sales order to create the field in my custom screen; however, when I attempt to use all the same attribute... | Why is 'CustomerOrOrganizationInNoUpdateDocRestrictor' inaccessible in my Acumatica project? | CustomerOrOrganizationInNoUpdateDocRestrictor is an internal class, so you can't access it.
You can use this restrictor instead:
[PXRestrictor(
typeof(Where<Customer.type, IsNotNull, Or<Current<PX.Objects.SO.SOOrder.aRDocType>,
Equal<ARDocType.noUpdate>, And<Current<PX.Objects.SO.SOOrder.behavior>, ... |
76383243 | 76384553 | I have an operation that I want to succeed with two different conditions. For example, if the status code is 501 OR message is not 'FAILED'. Is there a way to have assertions grouped together logically like AND/OR. If assertion 1 passes OR assertion 2 passes, I want my test case to succeed.
| Chain assertions together in kotlin | @cactustictacs suggests "naming" your assertions and then chaining them.
I'll suggest an answer by showing code that validates 4x REST interface inputs that have some complex permutations that allowed / not allowed. This code is arguably easier to read than a classic if ... else structure.
See how they are evaluated u... |
76381084 | 76386067 | I've merged a 3D surface pressure field (ERA5, converted from Pa to hPa, function of lat,lon and time) with a 4D variable which is also a function of pressure levels (lat,lon,time,level).
So, my netcdf file has two fields, Temperature which is 4D:
float t(time, level, latitude, longitude)
surface pressure, which is 3d... | use surface pressure to mask 4D netcdf variable | Your diagnosis of the NCO behavior is essentially correct. The "broadcast"
ncap2 -s 'mask=(level>sp)' t_ps.nc mask.nc
fails because level and sp are arrays (not scalars) that share no dimensions. The fix would be to create and use a temporary 3D version of level with something like
ncap2 -s 'level_3D[level,latitude,lo... |
76385355 | 76386251 | I am making graphics on excel from python using xls writer and want to make a graphic with green colored bars for positive values, and red for negative.
Current code seems like this:
chart3 = workbook.add_chart({'type': 'column'})
chart3.add_series({
'values': '=Summary!$W$2:$W$76',
'categories': '=Summary!$A$2... | How to set invert_if_negative to fill bars to a solid color in python xlswriter | You will need version >= 3.1.1 of XlsxWriter which supports the invert_if_negative_color parameter:
from xlsxwriter import Workbook
workbook = Workbook("chart.xlsx")
worksheet = workbook.add_worksheet()
chart = workbook.add_chart({"type": "column"})
worksheet.write_column("A1", [3, 2, -3, 4, -2])
chart.add_series(... |
76380701 | 76386331 | I'm trying to do drop caps in the Twenty Twenty-Three theme on WordPress 6.2.2.
All the docs I find when I google it are for older versions of WordPress, and possibly on an older theme. It used to be easy, but I can't find relevant docs for how to do this with the Twenty Twenty-Three theme.
And following on from that, ... | Custom CSS drop caps in Wordpress 6.2.2 with Twenty Twenty Three theme | Neither TwentyTwentyTwo nor TwentyTwentyThree currently support dropCaps. Since the layout looks undesirable on certain user systems, it was agreed that dropcap support is not mandatory for either theme. Read more - WordPress issues: https://github.com/WordPress/twentytwentytwo/issues/180
But there's a workaround avail... |
76383382 | 76384575 | The following code generates this image
I want the "y"-axis label to be "Space" and the "x"-axis label to be "time" for the left subplot. However, I am failing to achieve this. Why does my plotting code not do as I desire?
p1 = surface(sol.t, x, z, xlabel="Time", ylabel="Space", zlabel="|u|²", colorbar = false)
p2 = c... | Axis labeling for subplots | Setting custom axis labels for 3d plots doesn't work with Plots and plotlyjs() backend. Only with GR backend your labels are displayed.
You can try this version using PLotlyJS.jl instead Plots.jl:
fig=make_subplots(rows=1, cols=2, specs =[Spec(kind="scene") Spec(kind="xy")],
horizontal_spacing=-0.1, ... |
76381599 | 76386720 | I have created a website and included identity for logging in. On the manage your account page, the new email box keeps autopopulating and I can't figure out how to stop it.
I have tried to add the 'autocomplete=off' to the tag (see below code) but it still populates.
@page
@using FarmersPortal.Areas.Identity.Pages.A... | 'newEmail' box that comes with identity is autopopulating and I can't stop it | asp-for sets the id, name and validation related attributes, and it also sets the value of the input element if there is already a value within the model passed to the view.
From your code, You are using:
<input asp-for="Input.NewEmail" class="form-control" autocomplete="off" aria-required="true" />
to input the value... |
76384911 | 76386287 | I have a situation where I use several sliders on the page due to which the actual height of the page changes
Let's say my html height is 600px but due to some sliders the actual page height is 1000px
And because of this, when I try to stick the footer to the bottom using position: absolute and bottom: 0, I have it pla... | stick footer to bottom if actual page height is greater than html height | You can use flexbox. Uncomment height property in body to see the changes.
Check the elements html, body, main and footer in the code below.
Resources:
CSS Tricks | Flexbox
CSS Tricks | Flexbox and Auto Margins
Dev | Stick Footer to The Bottom of The Page
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
... |
76387119 | 76387120 | In swift there is the guard let / if let pattern allowing us to declare an object or a property only if it can be unwrapped.
it works a follow:
func getMeaningOfLife() -> Int? {
42
}
func printMeaningOfLife() {
if let name = getMeaningOfLife() {
print(name)
}
}
func printMeaningOfLife() {
guar... | guard/if let in Java - declare a property or an object if it can be unwrapped | The answer is No.
Apparently this syntax also exists in Clojure and according to this Stack Overflow answer there is no way to declare a property if it can be unwrapped in Java.
|
76387153 | 76387187 | I have a situation I am writing a powershell GUI.
I need to take the password in a secure input.. How can I do it ?
The passwd input need to be secured in the window
below is my code
$Passwd = New-Object system.Windows.Forms.TextBox
$Passwd.multiline = $false
$Passwd.width ... | Powershell GUI, How to take password input without exposing | You need to set UseSystemPasswordChar to $true:
$Passwd.UseSystemPasswordChar = $true
|
76384259 | 76386348 | Is there a way to achieve such kind of alignment of numbers in multiple strings, preferably in interface builder? Please see the attached screenshot.
| String text alignment by decimal point (Swift) | One approach to achieve this is by using a table view and programmatically adding constraints to align the separator symbol. This method offers scalability as it only includes elements visible on the screen. An interesting aspect of this approach is that the separator's position may change based on the largest offset c... |
76385322 | 76386379 | I am developing 2 plugins for Banno and have a hosting question.
My client will be hosting the plugins on S3. Can I use 1 bucket for both plugins or will they each need a bucket?
Thank you.
I haven't uploaded anything to S3 yet.
| Banno External Plugin S3 Hosting Question | We don't have material specific to Amazon Web Services (e.g., S3) but here's some general guidance which may be helpful.
No matter what, you'll need to make sure that your plugin's content is hosted by your public-facing web server. This means your web server must be accessible via the internet and cannot require the u... |
76382443 | 76384657 | Im currently designing a menu for a food festival. I use google sheets. I have a sheet filled with food choices. the menu for a given week should not have food items from the previous weeks. This is a mandatory requirement & I'm not able to get the drop-down if I use Data validation & custom formula.
I use =FILTER('Ite... | Google Sheets - Data Validation - Conditional based on Column in another sheet | Validation Helper Columns
I added some 'helper' columns for the validation.
They can be on the same sheet or a different one.
There is one for each course: Appetizer, Main, Dessert, and Drink. I assume Main and Course 2 both share the same dishes.
The FILTER formula would return an array of Dishes that match the corr... |
76382591 | 76384670 | In Ubuntu-22, google-cloud has been installed through snap store;
> whereis gcloud
gcloud: /snap/bin/gcloud
> snap list | grep google
google-cloud-sdk 432.0.0 346 latest/stable google-cloud-sdk** classic
Docker has been installed via snap too;
> snap list | grep docker
docker ... | Google Container Registry: Permission issue while trying to pull/push images with authenticated credentials | Removing snap installation and installing docker with package manager apt has fixed my issue.
The difference I have observed between two installations;
With snap, once gcloud auth login directs me to browser, authentication was completed by choosing google account only (Please see the 3rd code block in my question, no... |
76385271 | 76386421 | I'm trying to optimize my Postgres query. I'm running into problems with some of the joins here. My main issue is around the filter h.type='inNetwork' and my geometry search ST_Intersects(ST_MakeValid(ser.boundaries)::geography, ST_MakeValid(ST_SetSRID(ST_GeomFromGeoJson(<INSERT_GEOMETRY_JSON>)). Something about that s... | Optimizing joins in a postgres/postgis query |
the large majority of the h table is true for the condition h.type='inNetwork', which is making my geometry query run for a much larger set of rows than intended.
I don't understand. If most of the table meets the condition h.active is true and h.type='inNetwork', then most of the table gets processed. What else co... |
76383772 | 76384721 | I am creating a link list widget. Whenever we clicked on Title button, it adds a list with add link option. Everything is working fine but whenever I am trying to click the remove title button. The button is not working anymore. Where the alert is working and logs are showing also in console but the action is not worki... | Link list sidebar widget remove button not working in jquery | At line 23 you are only selecting a parent HTML element when the remove-title button is clicked, but doing nothing with it.
if ($(".remove-title").length) {
$("body").on("click", ".remove-title", function() {
console.log("clicked");
$(this).parents(".btn-options");
});
}
First you should make sure you'... |
76387124 | 76387192 | Adding and removing classes to elements in React
I’m a complete newb with React but basically I’ve been trying to make it so that a container goes from hidden to visible when you click a button.
Usually I’d just do an eventListner and add.classList or remove.classList but I can’t find the equivalent to that in react ?
... | What is the equivalent of add.classList in React for toggling visibility? | I would recommend adding a condition to render the element/component instead of using classes.
const [visible, setVisible] = useState(false);
return (
<div>
<button onClick={() => setVisible(!visible)}>toggle</button>
{visible && <span>hello</span>}
</div>
);
|
76383780 | 76384730 | I have the following point configuration:
import numpy as np
T=np.array([9,9])
X1=np.array([8,16])
X2=np.array([16,3])
points=np.array([[4, 15],
[13,17],
[2, 5],
[16,8]])
This can be represented as:
Given T, X1, and X2, I want to find all points of the array points... | Find points inside region delimited by two lines | The naive solution to this can be thought of as a series of stages
embed the values into equations in a Two-Point Form
for each line defined by the Equations
for each point in the collection to compare
at X, see if Y is below the line value
boolean AND on the results, such that only values below both lines match... |
76384948 | 76386605 | Xdebug does not stop at breakpoints.
I tried different versions of Xdebug. (current v1.32.1, v1.32.0, v1.31.1, v1.31.0, v1.30.0)
This is my configuration at the launch.json file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, vis... | Xdebug not stopping at breakpoints | I went ahead and installed xampp and xdebug.
Our launch.json files and wizard output are identical and it seems to work ok for me.
My php.ini doesn't include the last line with the port number or the apostrophe after the xdebug closing brace that you have.
[xDebug]
zend_extension = xdebug
xdebug.mode = debug
xdebug.sta... |
76382864 | 76384737 | I have tried severally to perform some numeric aggregation methods on numeric data with pandas. However, I have received a NotImplementedError, which then throws a TypeError, whenever I do so. I hypothesize that pandas is refusing to ignore the string columns when performing said numerical tasks. How do I prevent this?... | How do I prevent 'NotImplementedError' and 'TypeError' when using numeric aggregate functions in Pandas pivot tables with string columns? | This has been deprecated in Pandas 2.0. This is the warning pandas 1.5.3 gives:
FutureWarning: pivot_table dropped a column because it failed to
aggregate. This behavior is deprecated and will raise in a future
version of pandas. Select only the columns that can be aggregated.
You now have to select the specific colu... |
76387117 | 76387222 | Can I assume the following code will always pass my assertions? I'm a worried about the index value. I'm not sure if the scoped value will be passed along to the Task.Run lambda expression. I think it will be scoped just like the attributesChunked value seems to be. But I'd like some confirmation.
var tasks = new List<... | Can I be guaranteed that a variable value will be passed along to a new running Task? | For each task you create, you are introducing a closure on the index variable declared in that iteration. So yes your Task will use the right value, as can be tested using following code:
static async Task Main(string[] args)
{
var tasks = new List<Task>();
var attributes = new string[4] { "att1", "att2", "att3... |
76384430 | 76386630 | I'm experiencing a strange (bug?) when importing the yaml-cpp static library with CMake.
main.cpp
#include "yaml-cpp/yaml.h"
CMakeLists.txt (working)
add_library(yaml-cpp ${PROJECT_BINARY_DIR}/path/to/libyaml-cpp.a)
target_link_libraries(main yaml-cpp)
CMakeLists.txt (not working)
add_library(yaml-cpp STATIC IMPORTED... | Strange behavior from CMake when importing a STATIC library | For both of you who answered, I appreciate it. Turns out I should have provided more information in my question. The issue was arising basically from the fact that I am attempting to create a portable installation, with the entire source of each of the dependencies within the project folder-structure, which is somethin... |
76384877 | 76386661 | I'm fairly new to Rshiny and looking for some help to understand how to create a plot using slider values as input. The user selected slider values are displayed as a table, and used as inputs to calculate an equation. The resulting calculated values are stored in a table (if possible I'd like to be able to download th... | Rshiny-Use slider values to cacluate a dataset and plot the calculated values | Made some tweakings in your code; now it does what you want:
library(shiny)
library(ggplot2)
ui <- fluidPage(titlePanel(p("title", style = "color:#3474A7")),
sidebarLayout(
sidebarPanel(
sliderInput("Max", "Max:",
... |
76382956 | 76384761 | I've been trying for couple days to integrate a poor Bootstrap theme template in a React app with no success.
So, I've created a new application in my folder. All good. Installed all the packages required by the theme and upgraded to the latest version. All good.
Now, let's customize the App.js component in React with... | React - integrate custom Bootstrap theme | Rather than importing jquery.min.js from assets, you should use npm to install the jquery package and then import relevant modules in the files where you need them. This is a more "react" way of doing things and it's much easier to update dependencies from the command line.
Run npm install jquery from the command line... |
76383351 | 76384817 | After updating Google.Apis.Oauth2.v2 NuGet package to v. 1.60.0.1869, I start getting exception Access to the path C:\Users is denied when trying login with Google in my UWP app. Here's my code:
string fname = @"Assets\User\Auth\google_client_secrets.json";
StorageFolder InstallationFolder = Windows.ApplicationModel.Pa... | Google.Apis.Oauth2.v2 + UWP: Access to path c:\users is denied | After some tried, I failed to make Google.Apis.Oauth2.v2 NuGet package v. 1.60.0.1869 to work with UWP. I made Google Login works by removing the NuGet and implementing OAuth flow myself as described in my answer here.
|
76387092 | 76387227 | WaitGroups, Buffered Channels, and Deadlocks
I have this bit of code which results in a deadlock and I'm not certain why. I have tried using mutex locking in a few different places, closing channels in and outside of separate go routines, but the result is still the same.
I'm trying to send data through one channel (in... | What is the cause of the deadlock in my Go code using WaitGroups and Buffered Channels? | The code in your main function is sequential and first tries to write 3k values into inputChan then will read values from outputChan.
Your code blocks on the first of those steps:
nothing drains from outputChan before 3k values are succesfully sent to inputChan, so the workers end up stuck on outputChan <- i after the... |
76387085 | 76387252 | we have used mat-select in our project, the panel shows overlapping on the trigger text like version 14 and before (material version 12 was used in our project)
after finding few hacks, the panel showed below the trigger text, but it was not consistent with different screen sizes, specially the mobile view.
We found t... | mat-select panel still shows overlapped like version 14 and below even after upgrade to angular material 15 | Based on the comments, you have only updated to Angular material 15, but is running in legacy mode.
To fully migrate you need to run.
schematic: ng generate @angular/material:mdc-migration
however due to class name changes to the mdc- prefix etc and structual changes in some of the componets. you should follow their mi... |
76383522 | 76384890 | That's a result when I receive after trying to run ASP.NET Core 7.0 runtime image in Amazon ECS container (AWS Fargate service).
My project in on ASP.NET Core 7.0 Web API.
Here is a docker file for image which built on Jenkins and sent to Amazon ECS
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 8... | ASP.NET Core 7.0 container: Failed to create CoreCLR, HRESULT: 0x8007000E | So, the problem is fixed by adding
ENV COMPlus_EnableDiagnostics=0
in the final stage of Dockerfile.
So, it should looks like
FROM base AS final
ENV COMPlus_EnableDiagnostics=0
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MyMetaGame.API.dll"]
Found the solution here
|
76384192 | 76386662 | I have two virtual machines. First has apache server, and wordpress on virtualhost. Second has mysql server for my wordpress in first vm. Mysql configuration use ip adress of first vm. But when i leave my home and in result leave my home wi-fi, ip adress of first vm is changing when i connect to internet from my phone ... | How to make sure that my virtual machine does not change its IP address when connecting to different networks? | It is said that by default IP addresses are assigned dynamically, so the IP changes if you are in different network (that is, when you access the Internet through mobile data instead of home wifi). You may assign static IP address to your VM. This is done from inside of your VM.
|
76384852 | 76386672 | How do you change the size of the text in the TextComponent in Flame? I want to make the text larger
I used the Flame documentation to get this, but I don't know how to modify it for a larger text size (like 20pt vs 14pt). Also, what is the anchor?
final style = TextStyle(color: BasicPalette.darkBlue.color);
final re... | How can I change the size of the text in TextComponent using Flutter Flame? | final style = TextStyle(
color: BasicPalette.darkBlue.color,
fontSize: 20.0, // Change the font size here
);
final regular = TextPaint(style: style);
TextComponent startText = TextComponent(
text: 'test text',
textRenderer: regular,
)
..anchor = Anchor.topCenter
..x = (width * 0.2)
..y = (height - (heigh... |
76384267 | 76386693 | I'm using NPM install API cache for my MERN application. I want one of my requests to be cached and then when a request is made to another route it refreshes the cache (it fetches the new data). I've managed to get one of my requests to be cached but I can't manage to clear it.
This is my code
const apicache = require(... | How to clear cache for a route with the 'apicache' package | I was able to get this work using the apicache-plus package.
const apicache = require("apicache-plus");
router.get(
"/api/users/getName/1",
apicache.middleware("10 minutes"),
async (req, res, next) => {
req.apicacheGroup = "toClear";
const someData = { someName: "Amy" };
res.json(someData);
}
);
r... |
76387202 | 76387264 | I'm facing an issue with razor page navigation. I'm in the https://localhost:7154/Application/setupAccount page and i have to redirect to https://localhost:7154/Loan/setupLoan page.
So I used RedirectToPage("setupLoan", new{id=123}. but the issue is that it's looking like a setupLoan page inside the Application folder.... | Razor page redirect to another folder page | Try:
return RedirectToPage("setupLoan", new { area = "Application",id=1 });
result:
You can read Areas with Razor Pages to know more.
Update
return RedirectToPage("setupLoan", new { area = "Loan",id=1 });
Update 2
Loan is a page folder. not area folder ,
try:
return RedirectToPage("/Loan/setupLoan", new { id... |
76383257 | 76384992 | I'm developing a simple message server app, using WebSockets and NestJs gateways. Server receives an event to indentify a listener with name, and then sends websocket updates to that listener.
Right now I'm using subject/observable approach, server after listen-as event returns a new observable, which filters all upcom... | Is there a way to stop old observable and set new after event in Nest Gateways? | Found a solution by using a native WebSocket instance. It passes the same object if request was made by same client. So, using a WeakMap, we can manually track all subscriptions objects, and unsubscribe them, if we get the same WebSocket client
export class MessagesService {
private subs = new WeakMap<WebSocket, Subs... |
76385199 | 76386831 | OK I have set up jupyter notebook on a gcp VM, I want it to start automatically every time VM is started with a predefined token. (OS in Centos)
Does any one have any idea how to solve this final issue so that we can get the jupyter notebook started under the user test1 , everytime the VM starts ?
Here is what I have d... | How to start Jupyter Notebook on a GCP VM with predefined token automatically on VM start? | As John has already pointed out to you in the comment, sudo is not a good option, since the Startup scripts run as root, su can be used to switch to another profile.
Few other things that you should be aware of is that as you are using virtual enviornment, you have to set up similar enviornment variables as 'activate'
... |
76383937 | 76388079 | When I'm creating a new project in PyCharm, I can see some environments I created for old projects that have been deleted:
but I can't find a way to delete these entries. Where are they? How do I delete them?
I tried going to "Python Interpreters" following https://www.jetbrains.com/help/pycharm/configuring-python-int... | How do I remove deleted Python environments in PyCharm? | The Interpreters list from the New Project dialogue has a different entry point from the project specific list. Go to File > New Projects Setup > Settings for New Projects (instead of going to File > Settings as usual):
Going through the other entry point you can already notice the Python Interpreter item in the sideb... |
76387278 | 76387294 | In SwiftUI,
Text("a \n b \n c \n d \n e")
.lineLimit(3)
In SwiftUI, the above code shows output including 3 dots in the end.
Output:
a
b
c...
But my target is to show the output without dots like this -
Target:
a
b
c
| How to remove 3 dots after end of line limit | implement the following way.
Text("1\n 2 \n 3 \n 4 \n 5".truncateToLineLimit(3))
extension String {
func truncateToLineLimit(_ lineLimit: Int) -> String {
var truncatedString = ""
let lines = self.components(separatedBy: "\n").prefix(lineLimit)
for line in lines {
truncatedStrin... |
76382914 | 76385022 | I have three frames; left_frame, middle_frame and right_frame. I would like to have no gap between left_frame and its scrollbar. How can I achieve it?
import tkinter as tk
from tkinter import ttk
def create_dummy_chart(frame, index):
# Create a dummy chart
label = tk.Label(frame, text=f"Chart {index}", width=1... | How to remove gap between a frame and its scrollbar? | If you're referring to the one or two pixel space between the canvas and the scrollbar, you can set the highlightthickness attribute of the canvas to zero, or you can set the highlightcolor to the same color as the background of the canvas so that the highlight ring is not visible when the canvas has the keyboard focus... |
76385290 | 76388158 | I looked inside the the built in WebApplicationBuilder class and noticed the
public ILoggingBuilder Logging { get; }
property. Here is the entire ILoggingBuilder interface:
public interface ILoggingBuilder
{
IServiceCollection Services { get; }
}
It just stores a single property so what is the point of this inter... | What is the point of the ILoggingBuilder interface in ASP.NET Core? | It's about scoping and reducing intellisense hell. If everything was on IServiceCollection it would get cluttered quickly. Subsystems that are highly configurable and are themselves extensible need a "target" to extend. This is one of the patterns the platform employs to solve this problem.
Some of the patterns you'll ... |
76387293 | 76387324 | I'm added i18next React for old project. So many text not can be translate. How can I search all of them in VSCode?
Some case:
<Button className="w-full" onClick={onClick}>
Save
<Button>
<Button
type="primary"
onClick={onCLick}
className="ml-2"
>
Save
</Button>
<Button>Save</Button>
<ContentWrapper title="... | How to seach text not translate in VSCode? | Find:
(<Button[\s\S\n]*?>[\n\s]*)(\w+)([\n\s]*</Button>)
Replace:
$1{t('$2')}$3
|
76384368 | 76388195 | Bokeh scatter plot disappears when checkbox is added to layout.
If I exclude layout = row([checkbox_group, p]) and do show(p), I get the intended scatter plot with the color bar.
But when I include layout = row([checkbox_group, p]) and do show(layout), the scatter plot disappears whereas the checkbox and color bar appe... | Bokeh plot is missing in layout when checkbox group is used | Your problem comes from the selected sizing_modes in the figure and the row function calls.
Your are setting the sizing_mode of the figure to stretch_width and you are using the default sizing_mode of the row-layout which is fixed. This leads to a behavoir where the figure is shrunk to a minimal width of 0.
To fix this... |
76378492 | 76385025 | There is a C function that gets the acceleration values of x,y,z of an accelerometer sensor (MEMS IMU) as input, and calculates the rotation matrix in a way that the z axis is aligned with the gravity. It is being used for calibrating the accelerometer data.
#define X_AXIS (0u)
#define Y_AXIS (1u)
#define Z_AXIS (2u)
... | How to calculate rotation matrix for an accelerometer using only basic algebraic operations | A quaternion representation can apply rotations without trig functions. But this appears to be a version of: https://math.stackexchange.com/a/476311 . The math appears to be a variation thereof, where "a" and "b" are the accelerometer and gravity vectors.
The method also appears to assume measurements will not be perf... |
76384085 | 76388372 | What would be the correct return value of my setMyBirthday function in the HomeRepository class for the code to work? Void doesn't seem to be the right return value.
Fragment:
private fun HomeViewModel.setupObserver() {
myBirthday.observe(viewLifecycleOwner) { response ->
when(response) {
is Res... | Kotlin Firebase Realtime Database correct return value for setValue() in MVVM |
What would be the correct return value of my function in the HomeRepository class for the code to work? Void doesn't seem to be the right return value.
Indeed Void is the type of object the setMyBirthday function returns. So your function should look like this:
// 👇
suspend... |
76387171 | 76387347 | Problem: I am trying to scrape the image source locations for pictures on a website, but I cannot get Beautiful Soup to scrape them successfully.
Details:
Here is the website
The three images I want have the following HTML tags:
<img src="https://ik.imagekit.io/02fmeo4exvw/exercise-library/large/14-1.jpg" style="dis... | Beautiful Soup Img Src Scrape | The content is provided dynmaically via JavaScript, but not rendered by requests per se, unlike in the browser.
However, you can search for the JavaScript variable:
var data = {"images":["https://ik.imagekit.io/02fmeo4exvw/exercise-library/large/14-1.jpg","https://ik.imagekit.io/02fmeo4exvw/exercise-library/large/14-2.... |
76383602 | 76385062 | I have an HTML image that I want to pan & zoom programatically. In order to improve the experience, I added a CSS transition for smoothness.
When I click on the image, I need to determine the mouse position within the image. Currently, event.offsetX gives me the mouse position within the image at the current frame of t... | Javascript event.offset alternative for final value during CSS scale & transition | If you don't mind adding some additional HTML and CSS:
function onButton() {
const img = document.querySelector("#img");
img.style.scale = 5.0;
const target = document.querySelector("#target");
target.style.scale = 5.0;// make sure target's style matches img's style
}
function onImage(event) {
console.log(e... |
76383390 | 76385275 | I have a VStack like this:
var body: some View{
VStack{
//some view
}
.background(
ZStack{
LinearGradient(gradient: Gradient(
colors: [
.yellow_500,
.yellow_500,
... | How to ignore safe area for a background with a linear gradient and image in swiftUI? | Your current setup has the right idea, but if you want to completely ignore the safe area for the VStack's background, you should apply the .ignoresSafeArea() modifier on each of the backgrounds.
The white space you are seeing might be a result of the VStack not filling up the whole screen.
Try moving .ignoresSafeArea(... |
76387297 | 76387372 | How to conditionally assign a value to "ingList" based on the value of recipeList?
class Calculator extends StatefulWidget {
List<IngredientList> recipeList;
Calculator(this.recipeList, {Key? key}) : super(key: key);
@override
State<Calculator> createState() => _CalculatorState();
}
class _CalculatorStat... | How to conditionally assign a value to Flutter List | You can use initState to do that
class Calculator extends StatefulWidget {
List<IngredientList> recipeList;
Calculator(this.recipeList, {Key? key}) : super(key: key);
@override
State<Calculator> createState() => _CalculatorState();
}
class _CalculatorState extends State<Calculator> {
List<IngredientList> in... |
76384547 | 76388486 | I am learning Rust. I am working on an embedded Rust project to interface with an I2C LED driver.
I have defined a pub enum LedRegister that defines all of the I2C registers used to control each LED. These register definitions are always one byte, they set by the chip's datasheet, and they will never change. However, I... | Passing a variable to a function within another function | Casting a reference to an integer is like casting a pointer to an integer, which gives you the address and not the value inside casted, except it is not allowed and you need to go through a raw pointer explicitly. This doesn't require unsafe (led as *const LedRegister as u8), but this also doesn't do what you want.
The... |
76383164 | 76385416 |
.App {
font-family: sans-serif;
text-align: center;
}
.section-01 {
position: relative;
z-index: 0;
background-color: red;
color: white;
padding: 2rem;
}
.section-02 {
position: fixed;
z-index: 1;
background-color: blue;
color: white;
padding: 1rem;
top: 25vh;
left: 30vh;
}
.div-01 {
... | Z Index complexity - How to position a component inside of a div to have a higher z-index value against a component outside to its level? | Objective
Given 2 sibling positioned elements (.section-01 and .section-02), of which the first element sits at a lower stacking context than the second element. Place the child positioned element of the first element (.section-01 > .div-01) above the second element (.section-02) in the z-axis.
Criterias
Only the child... |
76387354 | 76387413 | In PowerBI, I have a managed parameter which is a list of text.
abc, def, ghi.
And that parameter is being use to call a custom function in powerbi i.e. MyCustomFunction(@Name)
My question is how can I change the value of the parameter from the url when I load the report (after i published it to PowerBI service)?
i.e. ... | How can I use url query parameter to set the value of a 'Parameters' in PowerBI? |
My question is how can I change the value of the parameter from the url when I load the report (after i published it to PowerBI service)?
You can't. In Power BI reports, the URL query parameters can be used to filter the report. See Filter a report using query string parameters in the URL
Parameters can be set from t... |
76387183 | 76387423 | I am trying to make a simple navbar I managed to make the base but when I try to personalize I am getting stuck.
My objective is that when the mouse goes over each element(home, etc) it highlights like a box, but currently it only highlights the <a> I tried and not the <li> holding it.
I'm trying to make the <li> an an... | Need help personalizing my CSS navbar: how do I highlight the element on mouseover? | The only :hover declaration you have for li is the default value of display: block while the color change declarations are made only for a. However, the effect that I believe you are trying to achieve is better accomplished by making the anchors block-level with padding.
Not related to the hover effect, just correcting... |
76383862 | 76388595 | I have a Dockerfile which I later want to feed some initial sql dump into:
FROM mysql:debian
EXPOSE 3306
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["mysqld"]
Then there is my docker-compose.yaml:
version: '3'
services:
mysql:
container_name: ${CONTAINER_NAME}
build:
context: .
restart: always
... | Mysql in docker container doesn't accept credentials | It is embarrassing to admit, but both commenters @RiggsFolly and @DavidMaze are right in what they said: I hadn't used MySQL for quite a while on my machine. When I checked the task manager, I indeed found a local mysqld running already, which of course was primed with different credentials. After killing the process (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.