on-internet

C#: ensure static variable retains its value

Goal: I am having some issues in C# when ensuring that a variable retains its assigned value for the duration / runtime of a program. In particular, I am attempting to: Read a number in from some input Save it to a variable of type double Print the variable Ensure that this value stays the same for the duration of the program, so that on the next iteration when a new value is read in, the previous value from step (2) is still printed. Attempts: I have attempted to use a global static variable such as public static double foo;, however, whenever the method that retrievs new values is called aga

Join the discussion →

SessionNotCreatedException: Message: Could not start a new session. Response code 500 error with Python Selenium Chrome In Docker

I installed selenium/standalone-chrome in docker, and the version is 4.1.2. But when I run my python code get bellow error: My selenium/standalone-chrome in docker: My python code: def demo(): options = Options() options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Remote( command_executor="http://localhost:4444/wd/hub", desired_capabilities=DesiredCapabilities.CHROME ) driver.get("https://www.google.com/") print(driver.current_url) driver.quit() Could anyone give me a favor on this issue? Thanks.

Join the discussion →

List multiple inputs in a row

I wonder if there is a way to show inputs type-text col-md-6. I want them to list top to bottom like this. Ex. Right now, I had to create more row per input. <v-row> <v-col cols="6"> <v-text-field v-model="temperature" :rules="form.rules.url" ></v-text-field> </v-col> </v-row> <v-row> <v-col cols="6"> <v-text-field v-model="temperature" :rules="form.rules.url" ></v-text-field> </v-col> </v-row> I was hoping I can do something like this, seems cleaner, but If I do that, it goes side by side. That's not what I wanted. <v-row> <v-col cols="6"> <v-text-field v-model="temperature" :rules="form.rule

Join the discussion →

How to use MockedStatic verify on static methods?

I have the following mocks for 2 different static method; UnitConversion.isCompatible() and Logging.error() that are called in my service method. Here is my test method: myService.demoMethod(); try (MockedStatic<UnitConversion> unitConversion= mockStatic(UnitConversion.class)) { unitConversion.verify(never(), () -> UnitConversion.isCompatible(any())); UnitConversion.isUnitsCompatible(any()); } try (MockedStatic<Logging> logging = mockStatic(Logging.class)) { logging.verify(times(1), () -> Logging.error(any())); Logging.error(any(); } The first method is never called while the second one is cal

Join the discussion →

How do you put padding/margin around the content of the drawer in antd?

It is showing up like this for me. How do I make the content have padding, without having to write custom CSS and use the className property? My drawer essentially looks like this: <Drawer closable visible width={400} placement="right" title="Create" > <Form layout="vertical" > <Form.Item name="name" label="Name"> <Input /> </Form.Item> </Form> </Drawer>

Join the discussion →

Python, Pandas, Yahoo Finance API

Having trouble getting Pandas data reader to retrieve price quotes from Yahoo’s API. The most up to date answer seems to be: "pip install --upgrade pandas pip install --upgrade pandas-datareader However, for the time being I will be using Google Collab and its Python platform, does anyone know how to update the pandas here? Or has the API truly just been discontinued?

Join the discussion →

How can I quickly return to Singapore after being denied entry due to testing positive for THC at the airport?

I am a French student going to Singapore to study for 4 months on a campus. I have been sent back from Singapore to my departure country as I have been tested positive to THC in the airport with CBD oil and empty grinder in my possession. Do you have any information on how to come back as soon as possible? Or any valuable information that would help?

Join the discussion →

How can I alleviate 'Run-Time Error 3078' after renaming queries?

Morning! I recently renamed a ton of queries I had in Access, went through the VBA and renamed every reference to those queries too. Now when I attempt to use a form that pulls & populates from those queries, I get a runtime Error 3078: Microsoft Office Access database engine is unable to find the input table or query ‘old query name’. When I select debug it takes me to a line that reads: strSQL = "SELECT * FROM qry_'NewQryName'_LineItems_TotalPerYear WHERE (EstimateID = " & EstimateID & " AND YearID >= " & StartYearID & " AND YearID <= " & EndYearID & ")" Set rs = db.OpenRecordset(strSQL, dbO

Join the discussion →

Compare dates in T-SQL

I have a table with a column date of datatype varchar. The values are '2022-03-08 07:00',2022-03-08 07:30 ... . In my stored procedure I have a parameter of type DATE and with a value '2022-3-8' DECLARE @d DATE = '2022-3-8' SELECT *, r.date AS date, @d AS d FROM Readings AS r WHERE CONVERT(VARCHAR, r.date, 23) = @d How can I compare these two? I get this error: Conversion failed when converting date and/or time from character string. I would like to remove time component and compare '2022-03-08' vs '2022-3-8'. Notice leading zero in month and day numbers.

Join the discussion →

Find Distinct results in spring data jpa

Im trying to fetch Distinct records, SQL query looks as follows select DISTINCT id from Table A where UserId = 'XXXX'; Currently, I have implemented this using spring data jpa @Query @Query(value = "select DISTINCT id from Table A where UserId = :userId") Can this be achived through spring data jpa query method ?

Join the discussion →

system.Drawing vs Maui.Graphics; From.Argb gives different output

So I am using .NET Maui and came across the following problem. I want to use .FromArgb but in Maui. Originally I was using System.Drawing.Color, but using Maui. Graphics.Color gives a different result: //Color (example color) int KeyColor = -16777088; //system.Drawing way: var forgroundColor = System.Drawing.Color.FromArgb(KeyColor); //Output: "{Name=ff000080, ARGB=(255, 0, 0, 128)}" //Maui.Graphics way (I have to use ToString cuz FromArgb needs an string): var forgroundColorMaui = Microsoft.Maui.Graphics.Color.FromArgb(KeyColor.ToString()); //Output: Red=0, Green=0, Blue=0, Alpha=1 So I want

Join the discussion →

IIS reverse proxy with owncloud and keycloak backend

What I'm trying to achieve I would like to create an IIS reverse proxy with hostname http://innerhub.domain.example/ and I would like to configure it to split the traffic as follows: http://innerhub.domain.example/owncloud goes to http://192.168.0.192:8080/ as my owncloud service is hosting on that ip:port. http://innerhub.domain.example/keyclkauth goes to http://192.168.0.192:8180/ as my keycloak service is hosting on that ip:port Why I'm doing this As owncloud documentation describes Owncloud's openID connect needs a reverse proxy so your IAPs can access the configuration under .well-known.

Join the discussion →

Python Exponential BackOff

I tried to implement the exponential backoff for my function using the reference code in Implementing a retry routine However in my case I do not want my function to fail or throw an error after the set number of retries. I would want to catch the error and log it and continue with the rest of the code. Tried multiple things but did not work for me. If someone could assist that would be great. Below is the the sample code. Also please make comments if I'm not handling the other custom exception correctly. import random, time from functools import wraps class ThrottledException(Exception): pass

Join the discussion →

Import could not be resolved Pylance(reportMissingImports)

I'm trying to import a bunch of flask related things. However I get the following error on almost all imports "Import could not be resolved Pylance(reportMissingImports)": The imports are working, however the keyboard shortcuts that the imports should provide are not. I've tried switching the python interpreter to the one that is in my venv, however that does not change anything either. I am using a virtualenv and here's a list of my installs and imports. bcrypt==3.2.0 cffi==1.15.0 click==8.0.4 cryptography==36.0.1 dnspython==2.2.0 email-validator==1.1.3 Flask==2.0.3 Flask-Bcrypt==0.7.1 Flask-

Join the discussion →

method run object iwshshell3 failed vba

I am trying to automate file upload on chrome with this VBA: Dim Customer_rates As String Dim WshShell As Object Customer_rates = "D:\FX Exch. Rates\2022-Feb-24 1707\MP_customer_exchange_rates_sample.xlsx" Set WshShell = CreateObject("WScript.Shell") WshShell.Run "cmd.exe/c echo" & Customer_rates & "| clip", vbNormal, True WshShell.SendKeys "^{v}" Application.Wait DateAdd("S", 2, Now) WshShell.SendKeys "{ENTER}" I get this error: method run object iwshshell3 failed

Join the discussion →

Power BI "A table of multiple values was supplied where a single value was expected."

I am trying to leverage a percentage column [percent] to filter the output of the column [throughput]. The DAX query for my measure returns: A table of multiple values was supplied where a single value was expected. The query looks like: Measure = CALCULATE(FIRSTNONBLANKVALUE('table'[throughput],FILTER(ALL('table'[percent]),'table'[percent] > 0.94 && 'table'[percent] < 0.96))) What am I missing?

Join the discussion →

Creating API using plumber

library(tidyverse) library(caret) library(InformationValue) library(epicalc) library(lubridate) library(Boruta) df <- read_csv("dataset.csv") sum(is.na(df)) str(df) names(df) #convert to R format df$sex <- as.factor(df$sex) df$drug_administered <- as.factor(df$drug_administered) df$pregnancy_status <- as.factor(df$pregnancy_status) df$symtoms_status <- as.factor(df$symtoms_status) df$marital_status <- as.factor(df$marital_status) df$education_level <- as.factor(df$education_level) df$occupation <- as.factor(df$occupation) #scale numeric variables df$current_age <- scale(df$current_age) df$weig

Join the discussion →

Jmeter warning and error Failed to start thread - pthread_create failed (EAGAIN) for attributes

I am using apache JMETER with 32gb ram heap size of HEAP:="-Xms1g -Xmx28g -XX:MaxMetaspaceSize=256m" And running the script like this- test.jmx -Jthreads=75000 -Jramp=120 -Jloop=15 -Jconstant_throughput=75000 getting error in meter logs- Uncaught Exception java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached in thread Thread[StandardJMeterEngine,5,main]. See log file for details. [13.374s][warning][os,thread] Failed to start thread - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached. Please

Join the discussion →

Why is "print()" required for my function to give a result in Python?

I noticed that if I remove the print() around my function call, it doesn't give me any result. Why is that? This function is from a simple assignment in Python which is to find the factor pairs of a number. I did that quite easily but now, when I use print(getFactorPairs(...)), the result is as expected, but when I just call the function getFactorPairs(...), it doesn't give me any result. # Find the factor pairs of a given number def getFactorPairs(n=0): num = n factors = [] pair = None for p in range(1, num + 1): for r in range(1, num + 1): if p * r == num: pair = (p, r) if (r, p) not in fact

Join the discussion →

My function not returning any result in python?

so I was doing a little math study and decided to recreate a simple assignment in python which is to find the factor pairs of a number. I did that quite easily but now I have a little issue which I have tried to figure out but to no avail. Here's the code: # Find the factor pairs of a given number def getFactorPairs(n=0): num = n factors = [] pair = None for p in range(1, num + 1): for r in range(1, num + 1): if p * r == num: pair = (p, r) if (r, p) not in factors: factors.append(pair) else: continue return factors print(getFactorPairs(120)) # Works fine getFactorPairs(120) # This doesn't give

Join the discussion →

what provides the metric "container_cpu_usage_seconds_total" to prometheus?

Sorry in advance as this is probably a very easy question to answer, I am pretty new to prometheus and grafana and I am trying to figure out where this metric in prometheus is coming from "container_cpu_usage_seconds_total". I have found online that all metrics starting with "node_" come from the node exporter pod. So I am just wondering if this metric is coming prometheus itself or is this also coming from the node exporter as we currently have no annotations set on our pods but are getting these metrics inside grafana. Thanks in advance!

Join the discussion →

keytool said "keystore password was incorrect"

I use these commands to generate a selfsigned cert: gmssl ecparam -genkey -name sm2p256v1 -out ca.key gmssl req -new -key ca.key -out ca.csr gmssl x509 -req -days 3650 -sm3 -signkey ca.key -in ca.csr -out ca.crt gmssl ecparam -genkey -name sm2p256v1 -out server.key gmssl req -new -key server.key -out server.csr gmssl x509 -req -days 3650 -sm3 -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt gmssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -name serverkey and I input "123456" whenever it says a password is needed, but when I try to import server cert

Join the discussion →

Message box position

I am working on a vba file and everything is working properly. However, ive run the codes again and noticed the message box does not appear in the center. How can i make the message box appear in the center of excel again?

Join the discussion →

Do we include all the combinations of n-grams in the actual anlaysis?

I looked at multiple tutorials on how to derive n-grams (here I will stick to bigrams) and included them in the analysis in NLP. Do we need to include all the possible combinations of bigrams as features because not all the bigrams would be meaningful? For example, if we have a sentence such as "I like this movie because it was fun and scary" and consider bigrams as well, these include (after pre-processing): bigrams=["like movie","movie fun", "fun scary"] I am not sure this might be a good approach, but what I can think of now is to include some frequent bigrams only as features. Or are there

Join the discussion →

Cannot find the latest jconnect jar file for sybase drivers

I was trying to get the latest jconn4.jar for the sybase drivers in my java project, but I cannot find the latest version of it. Here are the links where I did find it but they are older versions: https://osdn.net/projects/sfnet_id2d/downloads/jdbc%20drivers/jconn4.jar/ https://mvnrepository.com/artifact/jdbc.sybase/jconnect Also, the official link from older threads and articles that suggests this link which doesn't work because now its redirected to SAP portal http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/jconnect From some of the discussions from threads, it says that n

Join the discussion →

How to delete (the previous entry) from the Vue-router history?

I would like to delete the previous history entry in Vue-Router, is that even possible?? The solution must work in Vue-Router 4.x, and ideally in 3.x as well. The scenario that I'm implementing here is that a user does: pageA -> pageA:edit -> pageB When hitting "back" at pageB, I want to go to pageA (regular, non-edit) instead. I know that I could instead of a push to history of the page A:edit page, simply do a replace. However, it feels more natural that when hitting back in the A:edit page, you are returned to the regular non-edit page (there already is a check for changes in the beforeUpda

Join the discussion →

Discord.js DiscordAPIError: Invalid Form Body issue

I have a Discord bot and there is a problem with the command named privacy policy in this bot, I asked a lot of people and they said they don't know. Node.js version: 16.13.2 Discord.js version: 13.6.0 MAİN client.commands = new Collection(); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(`./commands/${file}`); client.commands.set(command.name, command); } COMMAND module.exports = { name: 'gizlilik', description:

Join the discussion →
Older stories