on-internet

Jest TypeError: Cannot read property of null

I have a setup for an external application and start it within a const, then put it in the const allowAppInstance the configuration of the appConfig export const setupRemote = () => { if (isRemoteAvailable) { try { ... const allowAppInstance = SetupConfig.start(remoteInstance); return { allowAppInstance, }; } catch (e) { console.error(e); } } }; here I export export const appSetupConfig = () => setupRemote().allowAppInstance; in the component, I get this setup and put it in a const import { appSetupConfig } from '.../myapp' useEffect(() => { const allowAppInstance = appSetupConfig(); ...the re

Join the discussion →

How long does it usually take for Google to review an app in closed testing?

I'm fairly new to app development and I uploaded a couple of instances of an app to closed testing in Google Play Console. The first reviews from Google went quite fast and was approved, but now it is over 4 hours since I uploaded the most recent APK for closed testing and it still says that it is under review. I think I published around 5 APKs today for closed testing. I was just wondering if this is common? How long does it usually take? Does it take longer for them to review if you upload more APKs in a short amount of time? If so, is there a way to avoid this kind of behaviour? Best regard

Join the discussion →

Negatable options in perl

I have a negatable option defined as top!. When a command uses this option, say : command_name -top, prints a warning to the user Code snippet for it is as follows : if ($args{top}) { print "Warning"; } But, when a command uses a negated option, say : command_name -notop, it does not print the same warning to the user. Is there a way to get same warning for both the cases?

Join the discussion →

How do I force saveWidget to create a single file outside of RStudio?

In RStudio, I can save my HTML widget to a single file with: htmlwidgets::saveWidget(x,"filename.html",selfcontained=TRUE) When running an R script with the above line through Windows Task Scheduler (which calls Rscript.exe), a multi-file HTML is generated (i.e. an HTML file with an associated directory of referenced stuff). Using RGui also fails to generate a single-file HTML. These are the lines from an RGui implementation that replicates the issue: library(leaflet) library(htmlwidgets) map <- leaflet::leaflet() %>% addTiles() %>% setView(lng=172.4,lat=-41,zoom=6) saveWidget(map,file="delete

Join the discussion →

How to create shortcut icons for Windows, MacOS and Linux applications bundled with PyInstaller

I am building a Python application bundled with PyInstaller which is available for Windows, Linux (as AppImage) and MacOS. I need shortcut icons for those. I have a logo, but I am struggling to bring it to the right format. It seems to me that all three platforms use different icon sizes and formats. Is there any online/offline generator that allows me to create icons for all three platforms from a jpg file?

Join the discussion →

Change dash Checklist values by callback

I would like to change the selected options of an plotly dash checklist by an callback. My minimal working example is as following (Values should change by hitting the 'load' button -> at loading the page nothing ist selected, after click the button 'SF' should be selected): import dash app = dash.Dash(__name__) app.layout = html.Div([ dcc.Checklist( options=[ {'label': 'New York City', 'value': 'NYC'}, {'label': 'Montréal', 'value': 'MTL'}, {'label': 'San Francisco', 'value': 'SF'} ], labelStyle={'display': 'block'}, value=[] ), html.Button('load', id='load-button', n_clicks=0) ]) @app.callba

Join the discussion →

How much flash memory is there in the microcontroller? [closed]

I have an STM32F303CBT6 microcontroller. On the ST site, the volume of the flash memory is 128 kB. In the reference manual the flash is up to 256 kB. In this case, register "Flash memory size data register" contains the value 128 (kB). There is also 128 kB in the ST-LINK utility. But in the cleaning window, the page costs 128 pages of 2 kB. This amounts to 256 KB. I didn't get it. What is the size of the flash memory?

Join the discussion →

PHP API error: "Cannot use object of type stdClass as array" when accessing json_decode result

I am writing a PHP REST API to allow users to upload content, and I am encountering a Cannot use object of type stdClass as array error. The sign-up part of the API handles input like this without any issue: $f = file_get_contents('php://input'); $jsonobj = stripslashes($f); $obj = json_decode($jsonobj); $email = $obj[0]; $password = $obj[1]; $country = $obj[2]; $city = $obj[3]; $broad = $obj[4]; $type = $obj[5]; $name = $obj[6]; However, the following snippet throws the error: $f = file_get_contents('php://input'); $jsonobj = stripslashes($f); $obj = json_decode($jsonobj); $serviceName = $obj

Join the discussion →

Discover / Autosuggest and calculateroute APIs do not return the same distance from the same point a to the same point b

I've been working with Here Maps APIs and while testing the APIs I have noticed that the results of the distance from a point A to B using the discover and autosuggest APIs differ from the results given by the calculateroute API Here is an example: Here is what the autosuggest API returns https://autosuggest.search.hereapi.com/v1/autosuggest?at=34.7505979,10.71047164&limit=5&lang=en&q=faculté de medecine&apiKey="Your_API_Key" { "title": "Faculté de Médecine", "id": "here:pds:place:788jx7ps-886689ec55920a84c15752902c00f8e9", "resultType": "place", "address": { "label": "Faculté de Médecine, Ave

Join the discussion →

Javascript how to add active class to clicked element and hide all others

I have a list-item-menu, where when I click on one of them it gets an active class, while I want all other list-items to get hidden but I'm not sure how to do that. Here is my script so far: const items = document.querySelectorAll('.menu-item'); items.forEach((item) => { item.addEventListener('click', (e) => { item.classList.toggle('active') // HIDE ALL OTHER "item"-elements }) }); can someone help me out?

Join the discussion →

why am I getting training accuracy 1.0 and test accuracy of .99 in LR model

I am doing a project on landslide classification, I have dropped null values and the unwanted columns but I am getting both training and testing accuracy of 1. df = pd.read_csv("full_dataset_v1.csv") df.head() # filter by severity. na is for non-landslide data df = df[df['severity'].isin(["medium", "small", "large", "very_large", "na"])] df = shuffle(df) df.reset_index(inplace=True, drop=True) print(len(df)) X = df.copy() df_col_length = len(df.columns) X.drop(X.columns[[0]], axis = 1, inplace = True) def generate_labels(binary = False): y = [] idx_to_severity = [ "large","medium","na", "small

Join the discussion →

How can I use enum in a testbench while passing a file with vectors?

I declared a typedef enum in a package (in a file called Definition.sv): typedef enum logic[3:0] { AND = 4'b0000, //AND EOR = 4'b0001, //XOR SUB = 4'b0010, //Subtraction ADD = 4'b0100, //Sum ORR = 4'b1100, //OR MOV = 4'b1101, //Scrive un valore in un registro MVN = 4'b1111 //MoVe and Not } alu_op; typedef enum logic[1:0] { LSL = 2'b00, //Logical Shift Left LSR = 2'b01, //Logical Shift Right ASR = 2'b10, //Arithmetic Shift Right ROR = 2'b11 //Rotation Right } shift_op; Then I wrote the testbench: `timescale 1ns/1ps `include "Definition.sv" module ALU_TB (); /*Inputs*/ data_bus A, B; // data_bus

Join the discussion →

HttpsUrlConnection SSLHandshakeException certificate_required

I am trying to access my api from java but I get the following error: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_required I do not get this error when I test the code on my personal Windows computer. But this error does occur on my linux production server running Ubuntu with openjdk 11. The server is hosted on that same ubuntu server, and proxied with Cloudflare SSL Full HttpsURLConnection con = null; try { URL url = new URL("https://www.example.com/"); con = (HttpsURLConnection) url.openConnection(); con.addRequestProperty("XF-Api-Key", "key"); con.addRequestProper

Join the discussion →

What is the best way to import local modules?

"What are the PEP-compatible ways to import a local package even from a parent folder with the least preassumptions" could be the long title. I am looking for a solution to make it possible to use a local package. My requirements: it must be PEP-compatible, i.e. at least the most commonly accepted PEP must support it OS, terminal, user and environment independent, i.e. the solution must not rely on any specific circumstances Among these solutions, I am looking for the one that is the simplest to implement the scope of the modification is flexible (doesn't need to be executed every time, but is

Join the discussion →

How to get result of an Activity without waiting for ? In a event driven fashion

I have a doubt in calling activities in parallel. I know that activities can be called parallelly using the Async.function. For my use case, I wanted to call n no of activities in parallel after receiving results from all activities I wanted to go to the next state either it could another activity or a decision task. But here it gives me a Promise object which similar to Future in java. If we write promise.get() to get a result but it is blocking the thread. I need something similar to event-driven fashion without blocking the thread.

Join the discussion →

Google pay “the transaction may be risky.For your safety ,it cant be completed at this time” what i do to remove this here is code

I am showing this error on only google pay3 i am using this to get payment through google pay UPI it give error "the transaction may be risky.For your safety ,it cant be completed at this time" what i do to remove this here is code. Only google pay showing this error other UPI apps transaction is successfull.I have use google pay business UPI id. I have use this two ways but showing same error, 1) String GOOGLE_PAY_PACKAGE_NAME = "com.google.android.apps.nbu.paisa.user"; int GOOGLE_PAY_REQUEST_CODE = 123; Uri uri = new Uri.Builder() .scheme("upi") .authority("pay") .appendQueryParameter("pa",

Join the discussion →

Testing zustand state changes caused by a component in Jest

I am pretty new to using jest and Im trying to test a component that makes a state change which acts upon my global state (using Zustand). Basically im clicking a button and its adding an item to my state.traits. Here is my component code: import { Flex, useToast } from '@chakra-ui/react' import { FC } from 'react' import { useProfileStore } from 'stores/profileStore' interface DataTrait { name: string, id: string } type Props = { trait: DataTrait } export const ChipItem: FC<Props> = ({ trait }) => { const { traits, setTraits } = useProfileStore() const toast = useToast() const traitNames = tr

Join the discussion →

Select all text in TextField upon click SwiftUI

How do I select all text when clicking inside a textfield? Just like how a web browser like Chrome would when you click inside the address bar. import SwiftUI import AppKit struct ContentView: View { var body: some View { TextField("Enter a URL", text: $site) } }

Join the discussion →

Proof of impossibility (or counterexample) for tan(x) = infinity, for floating-point values

The POSIX page of the tan function family (tan, tanf, tanl) in C says that: If the correct value would cause overflow, a range error shall occur and tan(), tanf(), and tanl() shall return ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL, respectively, with the same sign as the correct value of the function. However, in practice it is very difficult to actually obtain +∞ or −∞ as a computed result in such cases, since the floating-point number would need to be so close to an odd multiple of π/2 that its tangent would be larger than the maximum representable floating-point value of that type. Due to the sp

Join the discussion →

Can a powershell module call functions in its importer's scope?

Is it possible for a powershell module to call functions that live in its importer's scope? For example, say I have module.psm1, and script.ps1. Inside script.ps1 I import module.psm1, and define a function called Execute-Payload. Is there any way for the code in module.psm1 to call Execute-Payload?

Join the discussion →

SwiftUI selectable lists where selection variable is ordered

I'll keep it simple, I have a List with UUID identified items. This list is selectable, when EditMode() is entered user can tap items, and these get added to the selection variable: And the selection variable is: @State var selection = Set<UUID?>() However, the issue is that I care about the order in which the items are selected. And in the selection array, the items are not updated in a FIFO or LIFO way, they seem to be random or perhaps it depends on the value of the UUID but the point is it doesn't conserve the order in which they are added. I considered using a stack to keep track of what

Join the discussion →

MIPS and RISC-V Differences

I've been trying to learn RISC-V coming from MIPS and initially they don't look to dissimilar, especially the instruction set. Are there any significant differences between the two? Are most of the differences in the backend?

Join the discussion →

Why does the C++ standard not change std::set to use std::less<> as its default template argument?

#include <set> #include <string> #include <string_view> using namespace std::literals; int main() { auto v1 = std::set<std::string, std::less<>>{"abc"s}; v1.contains("abc"s); // ok v1.contains("abc"sv); // ok auto v2 = std::set{"abc"s}; v2.contains("abc"s); // ok v2.contains("abc"sv); // error } v1.contains("abc"sv); is more efficient than v1.contains("abc"s);, because it doesn't need to construct a string object. However, the C++ standard uses std::less<T>, rather than std::less<>, as std::set's default template argument. So, CTAD (Class Template Argument Deduction) doesn't work on std::less<

Join the discussion →

Getting 403 forbidden error in flask application

I am running a flask application in AWS fargate. In the app, I call a POST api which internally needs to call a public endpoint to collect some data using requests.get() method. @app.route("/findByPin", methods=["POST"] def find_by_pin(): pincode = request.form['pincode'] headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} url = [SOME_URL]?pincode=pincode requests.get(url, headers=headers) The error that I am facing is that the API call to the public endpoint is returning 403 status code in respon

Join the discussion →

Docker - "no-new-privileges"

I am having a little challenge around using the --security-opt=no-new-privileges flag for Docker. I am trying to follow this guide to build a Docker home server, and I managed to do everything. But in order to get things running, I had to turn off said flag. As for where I enable it, the container does not create and the log shows "standard_init_linux.go:211: exec user process caused "operation not permitted"" error. As I am getting this when directly running a container:  fabrice@docker-01  ~  1  sudo docker run -ti --security-opt=no-new-privileges --name test fedora:25 bash standard_init

Join the discussion →

Implement a brute force algorithm to find three missing word from BIP39 seed

I lost 3 middle words of my 24 words seed phrase for a nano ledger hardware wallet. As an example (not my real seed phrase) pledge horror unfair category a.... xxxxxx a...... core abuse tenant crew captain insect angry again deposit detail similar arrest kind copy pony door brass So I know the missing words in position 5 and 7 start with a and I don't have any clue for word number 6. I know for sure an ethereum public address that I used back in 2017, but I am not sure about my BTC address. I believe that cracking the seed phrase is doable, but as I am not a programmer (I have a beginner level

Join the discussion →

Discord Bot to start Minecraft Server

How do I program a Discord bot to start a Minecraft server? The only up-to-date tutorial to program a Discord bot is for python, but it seems like you need JavaScript code to write something similar (for example this Github code - but how do i implement it in a bot? https://gist.github.com/simonmeusel/1de7166288b12c04518c59158a85f5ef). Can anyone recommend an up-to-date tutorial and tell me how to implement the code from Github so that I can start the Minecraft Server via writing a command in a Discord channel? The Minecraft server I would like to start is hosted by a third party website. I ho

Join the discussion →

How to create JWT token in Symfony5?

I'm trying to create REST API with JWT authentification in Symfony5. At first I've tried to do as written here https://h-benkachoud.medium.com/symfony-rest-api-without-fosrestbundle-using-jwt-authentication-part-2-be394d0924dd . Difficulties appeared when I've tried to make method getTokenUser: /** * @param JWTTokenManagerInterface $JWTManager * @return JsonResponse * @Route("/api/login_check", name="api_login_check", methods={"POST"}) */ public function getTokenUser(UserInterface $user,JWTTokenManagerInterface $JWTManager) { return new JsonResponse(['token' => $JWTManager->create($user)]); }

Join the discussion →

Running sail artisan migrate gives error: "The term 'sail' is not recognized"

I am new to Laravel and recently upgraded a project from Laravel 7 to Laravel 8. Whenever I try to run a migration using Sail: sail artisan migrate I get the following PowerShell error: sail : The term 'sail' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + sail artisan migrate + ~~~~ + CategoryInfo : ObjectNotFound: (sail:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException When I instead try runni

Join the discussion →
Older stories