instruction
stringlengths
0
30k
I am reading a book "Effective Java" and coming up with fragmnet of code: public enum Phase { SOLID, LIQUID, GAS; public enum Transition { MELT(SOLID, LIQUID), FREEZE(LIQUID, SOLID) BOIL(LIQUID, GAS), CONDENSE(GAS, LIQUID), SUBLIME(SOLID, G...
Nginx only caches file endpoints
|nginx|caching|
null
Your suggestion to split the author attribute on the comma separator was indeed accurate. The next step involves creating a count by aggregating the splits once again using the 'Generate Aggregation' operator. This operator functions 'row-wise' and is capable of counting the occurrences within the newly created author-...
I am a beginner learning react native. I want to use the `useSearchParams` hook from 'expo-router', but I get the error message: `error: TypeError: 0, _expoRouter.useSearchParams is not a function (it is undefined)` So maybe the `useSearchParams` hook doesn't exist anymore (I am following this from a tutorial). ...
React-Native: useSearchParams hook from 'expo-router'
|react-native|react-hooks|expo-router|
null
{"OriginalQuestionIds":[15528939],"Voters":[{"Id":364696,"DisplayName":"ShadowRanger","BindingReason":{"GoldTagBadge":"python"}}]}
You are correct, this is not possible.
I have an excel sheet that has a 100 numbers in a column, each of these numbers corresponds to the name given to a picture in a folder on the desktop. I need to upload these pictures from this folder onto the website canva in a way that each slide has one picture. the 100 slides are already made. i just need to upload ...
How do i automatically upload pictures from a folder onto canva using python?
|python|selenium-webdriver|selenium-chromedriver|
null
I am using `differential_evolution` from `scipy` to do optimization. `likehood` is vectorized to calculate all the populations at once. I have 36 parameters and `popsize=35`. `draws` is also a large matrix `(1000, 112, 7)` for each population, and it is random draws from some distributions. By following the [pytorch...
Pytorch how to use num_worker>0 for Dataloader when using multiple gpus
|python|pytorch|multiprocessing|gpu|pytorch-dataloader|
If you want to change log4j properties without redeployment, you need to copy the log4j.properties file to the `lib/classes` directory in the domain. In your case to `/opt/payara/payara5.2022.5/glassfish/domains/DEV01/lib/classes/log4j.properties`. This will put it on the classpath of your application and any changes t...
`Next.js`'s `cookies().get(key)` doesn't return the actual value of the cookie. It returns object of `{name: string, value: string}`. ```tsx async function fetchDataServerSide(url: string) { 'use server' let fetch_path = process.env.NEXT_PUBLIC_BACKEND_URL + '/api/' + url const options: RequestInit...
You can run them in separate terminals by doing this: if __name__ == "__main__": client.run(TOKEN)
This is my DataFrame: import pandas as pd df = pd.DataFrame( { 'main': ['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'y', 'y', 'y', 'y', 'y', 'y', 'y'], 'sub': ['c', 'c', 'c', 'd', 'd', 'e', 'e', 'e', 'e', 'f', 'f', 'f', 'f', 'g', 'g', 'g'], 'num_1': [10, 9, 8...
How can I change the groupby column to find the first row that meets the condtions of a mask if the initial groupby failed to find it?
You will need an `else` branch and you will need to remove the appropriate item: ``` if( ! empty($matched_roles) && isset($rates[$targeted_rate_id]) ) { unset($rates[$targeted_rate_id]); } else { unset($rates[$your_key_here]); } ``` In the above I've used `$your_key_here` because...
I use a library which constructs a Javascript object from a form's elements : `$("#frm").serializeJSON()` Here is [the website][1] of the library. So at runtime when a checkbox is not checked then it does not appear inside the Javascript object constructed from `$("#frm").serializeJSON()`. Although I set a name a...
Why are checkboxes not posted when unchecked?
|javascript|html|forms|
{"Voters":[{"Id":14732669,"DisplayName":"ray"},{"Id":1431720,"DisplayName":"Robert"},{"Id":272109,"DisplayName":"David Makogon"}]}
Please can you help me with this exercise: Half Sum Element: Write a program that inputs n integers and checks whether there is a number among them, which is equal to the sum of all the rest. If there is such an element, print "Yes" + its value, otherwise print - "No" + the difference between the largest element ...
``` "use client" import { useKindeBrowserClient } from '@kinde-oss/kinde-auth-nextjs' import Image from 'next/image'; import React from 'react' function DashboardHeader() { const {user} = useKindeBrowserClient(); return ( <div> <Image src={user?.picture} alt='logo' width={40} height=...
Unhandled Runtime Error TypeError: Cannot read properties of null (reading 'default') in my next.js
|javascript|next.js|typeerror|
SET TRANSACTION ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SNAPSHOT | SERIALIZABLE } will change the isolation level for the duration of the connection or until changed by a subsequent set command. In my case, lowering the isolation level to snapshot using t...
Trying to run my unittest program forever using python livereload. The output of the test is coming in the wrong format; it is difficult to quickly read and understand it. The below screenshot shows the program and output: [![enter image description here][1]][1] How to solve this output problem? [1]: https:/...
python livereload does not output unittest test output correctly
|python|python-unittest|
Maven (Java) does not build dependencies into a compiled file. Here is the code of my main class, the architecture of the application and the contents of the compiled file. ``` ` import club.minnced.discord.webhook.WebhookClientBuilder; public class Main { public static void main(String[] args) { ...
Maven (Java) does not build dependencies into a compiled file
|java|maven|compiler-errors|
null
Call that api in layout.ts file and as the user information gets fetched, store that information in store i.e Redux or Zustand then you can get that data in any component and if that component is directly present in layout like navbar or footer u can directly pass the data into that component from layout.ts
Your code don't work because has error in this lines: ```js const form = document.querySelector('form'); const inputs = form.querySelectorAll('input'); ``` **form is undefined so form.querySelectorAll is not run and next codes is not run!** just change code: ```html <form id="requiredFieldsModal" clas...
How to capturing global keyboard and mouse events in a desktop application in KMP
|kotlin|
null
Inside an HTML table. I have an input with a display flex parent with a width. The input is overflow hidden. I get a different behavior between browsers. Chrome shrinks the input field to the width. Firefox does not. If I put width:100% on the input it starts working on firefox but I would like to not add that style...
My code ```javascript //Geometrys var geometry = *Generic Poligon var g1 = *Generic Poligon //Geometrys Area var garea = ee.Number.parse(ee.Number.parse( geometry.area({'maxError': 1}) .divide(10000)) .format('%.2f')) var g1area = ee.Number.parse(ee.Number.parse( g...
null
There are a few vendors that cover this usecase that you might find by googling. It seems that they are called *[npm] registry firewall*. The way they work is that developers change their default registry from the public npm registry to the registry firewall. The registry firewall then act as a proxy between the dev...
I don't know how to do it, I've only been taught this partially and I need to do this so I can get bonus marks I tried just negating the values but i don't think that's right. The answer I'm getting is x'+y+z which i feel is wrong. This is because on other websites I saw that they are doing stuff like 'not a and no...
|python|pandas|dataframe|group-by|
A really easy way to serve a static folder, and an index.html when the route has no file name in it is: ```js .use( staticPlugin({ prefix: '/subfolder/if/needed/', alwaysStatic: true, indexHTML: true, // <-- }), ) ``` If someone requests `/subfolder/if/needed/`, it will send ...
> I find that CAS will flush all cpu write cache to main memory。 Is this similar to memory barrier? 1. It depends on what you mean by CAS. (A specific hardware instruction? An implementation strategy used in the implementation of some Java class?) 2. It depends on what kind of memory barrier you are talking a...
Creation multimap throught lambda-expression
|java|lambda|
If you’re seeing an error message related to Playwright, it’s likely that the necessary browser binaries have not been downloaded. Here are the steps to resolve this: Install Playwright in your project with `npm i playwright`. Download the required browsers with `npx playwright install`. Add a post-install script ...
I have a Function App written in Powershell, that is being triggered by Logic Apps and that sends back to Logic Apps following response: ``` Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK Body = [ordered]@{ "Subject" = "$scriptName execu...
Logic Apps and long running Azure Function (Powershell)
|powershell|azure-functions|webhooks|azure-logic-apps|
Can we do it like: def rolling_sum_with_reset(series, window_size): shape = series.shape[:-1] + (series.shape[-1] - window_size + 1, window_size) strides = series.strides + (series.strides[-1],) rolling_strides = np.lib.stride_tricks.as_strided(series, shape=shape, strides=strides) ...
I have a ClockObj which has an AlarmObj in a "HAS A" OOP relationship. Or should I say injected through the constructor. Inside the AlarmObj I have a isAlarmOn boolean variable. I am returning it using getter. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> c...
I am working on having a side bar open on a spreadsheet that shows case notes that are filtered by case numbers. I have the side bar correctly opening with a search box. I am searching for a known case number (its sample data with only 5 rows), and the HTML code is properly calling my function 'getInfoById()'. The exec...
Is there any way that I would be able to use this wrapper class "https://github.com/spotify-web-api-java/spotify-web-api-java" in a Java project that doesn't implement Maven or Gradle? And if so how would I be able to do it? Tried to google it but wasn't able to find any answers.
Can I use this Spotify wrapper without Maven/Gradle?
|java|api|
null
I have developed a web application using the MERN stack.I'm encountering a problem with the integration of the Google Drive API into my web application deployed in a production environment. The goal of my code is to allow users to upload a file (such as a PDF) from their local machine, then utilize the Google Drive API...
null
Is there any way that I would be able to use this wrapper class "[https://github.com/spotify-web-api-java/spotify-web-api-java][1]" in a Java project that doesn't implement Maven or Gradle? And if so how would I be able to do it? Tried to google it but wasn't able to find any answers. [1]: https://github.com/...
I have three separate csv files with landmark coordinates for separate species. I would like to perform a procrustes superimposition on the landmarks, but I first need to combine the landmarks into one object which I am trying to do with the combine.subsets function. However, for this function to work, my data must be ...
Check if you are running the first command in the python environment.
- <kbd>Ctrl</kbd>+<kbd>H</kbd> - Find what: `,[^,\r\n]+$` - Replace with: `LEAVE EMPTY` - **TICK** *Wrap around* - **SELECT** *Regular expression* - <kbd>Replace all</kbd> `\h+` stands for 1 or more horizontal spaces.
I added the following to my Strings.xml resources file to resolve the issue: <resources> <string name="com.crashlytics.android.build_id">none</string> </resources>
Try using a different svg icon since SVGs your current svg not have a `fill` property of the `X` part This should help you out: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <svg class="frame" width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="...
Maven (Java) does not build dependencies into a compiled file. Here is the code of my main class, the architecture of the application and the contents of the compiled file. ``` import club.minnced.discord.webhook.WebhookClientBuilder; public class Main { public static void main(String[] args) { Sy...
Call that api in layout.ts file and as the user information gets fetched, store that information in store i.e Redux or Zustand then you can get that data in any component and if that component is directly present in layout like navbar or footer then u do not need any store, u can directly pass the data into that compon...
Coding a two-dimensional, dynamically allocated array of `int` is a non-trivial task. If you use a _double pointer_, there are significant memory allocation details. In particular, you need to check every allocation attempt, and, if any one fails, back out of the ones that didn't fail, without leaking memory. And, fina...
I want to authorize customer xero accounts via .net core 6 web api. Is this possible ? How I can I redirect the user to xero authorization page. I am trying to do this in swagger. I am getting following error Failed to fetch. Possible Reasons: CORS Network Failure URL scheme must be "http" or "https" for C...
null
I want to use GLFW in my Kotlin/Native project so I created a `.def` file at `src/nativeInterop/cinterop/glfw3.def`: ``` headers = \ glfw3.h \ glfw3native.h headerFilter = /usr/include/GLFW/* compilerOpts.linux = \ -I/usr/include \ -I/usr/include/GLFW linkerOpts.linux = \ -L/usr/lib \ ...
i'm trying to play a short sound clip when a usr click on a javafx canvas, i have followed the attach audio documentation provided by gluon yet no sound is being played when i install the app on android phone the following is my implementation based on gluon documentation ``` graphicContext.getCanvas().setOnMousePr...
In the case you cannot use 'firstWhere' directly, the right way to use the method... `_cities.map((element) => element.id).firstWhere((elementId) => elementId == 1, orElse: () => null);`
``` const myDiv = document.getelementByID(`DivId`) myDiv.setAtribute(`Id`,`UniqueId`) ```
Any update on disabling the 2 finger swipe on `TabView` in SwiftUI when using page style? I have been facing the same issue and not able to disable it for TabView in SwiftUI. But I changed my implementation using ScrollView to implement the TabView effect in one of my App. # Implementation of TabView using Scrol...
When I enter long text into my TextFormField A and jump to another widget (like another TextFormField) my TextFormField A sustains the cursor position at the end of the long text. I want the text to appear from starting position when I unfocus the widget. **situation** email field unfocused [![enter image desc...
I'm trying to test the onload function of a custom hook to load image, but when i run the test, it skips the onload. Hook: ``` import { useEffect, useState } from "react"; const useImage = (src: string) => { const [loaded, setLoaded] = useState(false); useEffect(() => { const image = new Image(); ...
Test ReactJS custom hook to load images with Jest
|reactjs|jestjs|
null
This issue is resolved after change the pattern of getting order->id. Instead of calling the order->id in form action, I call the order->id in jquery function. Then it works. Let me share code what I did. **Form** <form action="javascript:void(0)" method="post" id="order_form" enctype="multipart/form-data"> ...
Since you are using a viewModel to store the player, you are most likely preserving the same player between different videos. Based on the AndroidView [docs][1] you can use the update method to fix this: ``` // Adds view to Compose Box( modifier = Modifier ...
For a sample array of integers: In [225]: arr = np.arange(90); x=rolling_sum_with_reset(arr,3) In [226]: x Out[226]: array([ 0., 1., 3., 3., 7., 12., 6., 13., 21., 9., 19., 30., 12., 25., 39., 15., 31., 48., 18., 37., 57., 21., 43., 66...
I have an ansible playbook that runs for about 20 hosts. I'm trying to edit the pass option only for entries that are mounted as root ('/'). Here's what I had that changes every pass option that isn't '0', which I don't want. ```yaml - name: Modify mount options in /etc/fstab replace: path: /etc/fstab ...
{"OriginalQuestionIds":[8163061],"Voters":[{"Id":3832970,"DisplayName":"Wiktor Stribiżew","BindingReason":{"GoldTagBadge":"regex"}}]}
so i have really "small" problem. ``` MyList = ["test","test2","test3","test4","test5","test6","test7"] for item in MyList: print(item) # output: [test, test2, test3, test4, test5, test6, test7] if item == "test7": #now in here i want to go back to the item 3 and go count up again p...
python list iteration| going back in index
|python|list|for-loop|iteration|
null
VS Code Terminal: Manage (gear icon bottom-left) -->Settings--> Code-runner: Run in Terminal--> X Whether to run code in Integrated Terminal. This will stop the [running] cd .... in the OUTPUT and the ERR message:> pid must be a number < will disappear.
I am trying to add a column to an existing table with a max() function to populate the column in postgresql. Example: Alter table stable Add column max_veggie INTEGER; --populate the column max_veggie--- Insert into stable (max_veggie) Values(Max(veggie_id)); FROM stable; ...