instruction
stringlengths
0
30k
Almost got it. You missed referencing the second value. ```python values = ['done 0.0', 'done 3.9', 'failed system busy'] for v in values: match v.split(): case 'done', x if float(x) > 0: print('Well done') case 'done', x if float(x) == 0: print('It is okay') ...
**I was facing the same issue**, Here is how I resolved this error: I installed `styled-components.macro` using `npm`. `npm i styled-components.macro --dev` [![enter image description here][1]][1] **And then use it like this:** `import styled from 'styled-components/macro';` [1]: https://i.stack.img...
I am experimenting with `crash` utility that is used to decode linux kdump files. My setup consists of linux kernel 6.5 running on `qemu-system-aarch64`. The rootfs used is buildroot. I have edited the `/etc/init.d/rcS` to setup crashkernel and generate kdumps. ``` #hackish way of achieving things # Check if /p...
crash utility itself crashes while decoding kdump generated from null pointer dereference in kernel module
|c|linux-kernel|crash|gdb|kernel-module|
My Android app uses Fragments and includes Google signin authorization via Firebase. After signing in and starting a Fragment transaction, the following appears, overlaying the Fragment underneath it: [![enter image description here][1]][1] It's as if the gray screen was a Dialog window. When I touch the screen, ...
{"Voters":[{"Id":298225,"DisplayName":"Eric Postpischil"},{"Id":1377097,"DisplayName":"beaker"},{"Id":9952196,"DisplayName":"Shawn"}]}
I’m trying to figure out an algorithm to distribute a set of 20 to 5000 items into a variable number of boxes (2 to 50). Items are identified by a number of properties, and we need to distribute them into the boxes as evenly as possible by their properties (evenly, not randomly). Each item has (in order of priority)...
Selenium Wire webdriver cannot browse site
|python|selenium-webdriver|http2|mitmproxy|seleniumwire|
null
I've been working on addressing a specific constraint in OPL and attempted to write code to solve it. However, it's not functioning as expected. Could anyone provide guidance on the correct approach to do that. Here is the constraint: [![constraint image][1]][1] ``` range J = 1..5; range R = 1..3; range T...
Implementing Constraints in OPL Using CPLEX
|javascript|python|php|
The accepted answer is wrong because the crypto/rand [rand.Int][2] function: > returns a uniform random value in [0, max). It panics if max <= 0. Here is an answer that doesn't skip the 2^130 - 1 value. // Max value, a 130-bits integer, i.e 2^130 - 1 var max *big.Int = big.NewInt(0).Exp(big.NewInt(2), big.N...
When starting the training of yolov9-e or yolov9-c I always get this error: `your text`Traceback (most recent call last): File "/content/yolov9/train.py", line 634, in <module> main(opt) File "/content/yolov9/train.py", line 528, in main train(opt.hyp, opt, device, callb...
Attribute error of train.py file while training YOLOv9-e
|yolo|
null
Why isn't corepack enabled
|node.js|yarnpkg|
The slow (but reliable) method is to read all of the lines in the file and return the last one. Something like: ```csharp static string? GetLastLine(string filename) { using StreamReader reader = new(filename); string? last = null; while (reader.ReadLine() is string line) last = line; return last; } `...
How can I initialize my functions to use second database instead of the default one? I use the following code, but noticed a slower response while accessing the database. const admin = require('firebase-admin'); admin.initializeApp({ databaseURL: "https://newdatabaseurl" }); var database =...
|javascript|firebase|firebase-realtime-database|google-cloud-functions|
null
> Could an unitialized pointer be a NULL pointer? An uninitialized pointer could be a null pointer. (Do not use “NULL” for a null pointer. `NULL` is a specific macro defined by standard C headers with some different implications.) > From what I have read a NULL pointer points to the memory location "0"… Man...
{"OriginalQuestionIds":[47648775],"Voters":[{"Id":874188,"DisplayName":"tripleee","BindingReason":{"GoldTagBadge":"shell"}}]}
Far from perfect. This one: * wraps each word in a ``<span>`` * calculates by ``offsetHeight`` if a SPAN spans multiple lines * of so it found a hyphened word * it then **removes** each _last_ character from the ``<span>`` to find when the word wrapped to a new line <!-- begin snippet: js hide: false consol...
Consider something like [Google Input Tools](https://www.google.com/inputtools/) for instance, which can transliterate text in multiple languages using the Latin script. As you type a word, it interactively autocompletes it, showing you multiple possible results. My question is, do the major OSs (i.e. Linux, macOS a...
OS-wide text autocomplete service with popup
|user-interface|autocomplete|operating-system|popup|transliteration|
I want to create a masonry layout layout with infinity scrolling. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/kVaHh.png
I'm using `emotion/react: ^11.10.5`, `mui/material: ^5.11.0` and `Next.js v13.1.2`; And I've used MUI `sx` and Emotion/React `css` to style my react components, also most of the pages are SSR. <br/><br/> Problem is that styles are applied with delay, so the page is rendered, or loaded without any style, and after a...
I recently chose to remake the popular game called "soccer physics" but in pygame instead of its original engine, unity. However, I have a quite limited understanding of pygame and implementing game physics, so I've only managed to create [this][1] so far with characters and sprites I found online (I know it's quite ba...
The repository Jammy Release does not have a Release file
I have a requirement to upload over API a video and embed it to a WordPress page, which needs to be one-time viewable and then never accessible again. Also the video needs to have no buttons to stop/pause/rewind/rewatch; once you land on the page, it will start playing and you will not see the video ever again. The acc...
Password protected or private URL one-time viewable video access
|wordpress|password-protection|one-time-password|vimeo-player|video-embedding|
null
I want to install solr 9.x on a fresh linux server in order to run a pretty old application, migrating from solr 8.x. As of 9.x the data-import handler is no longer part of solr, therefore I installed https://github.com/SearchScale/dataimporthandler to overcome the issue. Solr is running but the core will not load ...
Upgrading to Solr 9 failes due to NoSuchFileException
|solr|
{"OriginalQuestionIds":[25751453],"Voters":[{"Id":16343464,"DisplayName":"mozway","BindingReason":{"GoldTagBadge":"pandas"}}]}
Check the data element of field BILD in table ZPROJECT_24035. Case handling is done through the domain of the data element in SE11->Domain->TEXT10->Definition Tab->output properties->Lowercase checkbox. for example: - Domain CHAR10: lowercase checkbox unchecked. Any value in this field is always converted to upperca...
1. Add a click event to detect which element was clicked (`svgElem.onclick`) 2. Create a panel (`div`) 3. For each attribute ([attributes](https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes) can get all current attributes), add an `input` field in the panel 4. Add an `input.onchange` event handl...
i have string ```"This auction will run from Friday 28 July - Monday 7 August. It will close from 7pm (GMT) on Monday 7 August 2023. Read here for information on how our auctions end."``` and im trying to get dates from this string ``` const regex = /(\d{1,2} \w+(?: \d{4})?)/g; const dates = str.match(regex) `...
I try to extract the state of a switch from a mqtt message I get when the switch toggles. The mqtt message I get is: >{"src":"shellyplus1-08b61fd9e540","dst":"shellyplus1-08b61fd9e540/events","method":"NotifyStatus","params":{"ts":1711558165.32,"input:0":{"id":0,"state":true}} I need to know the value of the key...
I'm creating a slider using Swiper JS which reveals the next slider partially as following ![1][] However it's work great until end of original slides and when the loop mode enabled duplicate slides start next slide is disapear and appear on next one Following is what I tried so far in JS Fiddle: ``` <!DOC...
{"Voters":[{"Id":3527297,"DisplayName":"Gustav"},{"Id":7607190,"DisplayName":"June7"},{"Id":2422778,"DisplayName":"Mike Szyndel"}],"SiteSpecificCloseReasonIds":[16]}
I was just trying to run HTML Code on vs code through google chrome. Its working correctly on other browsers. [![enter image description here][1]][1] What can be the problem, the other html files are running correctly which I have made before. [1]: https://i.stack.imgur.com/3kWBO.png
The Python 3.12 embedding documentation for embedding gives this example: ``` #define PY_SSIZE_T_CLEAN #include <Python.h> int main(int argc, char *argv[]) { wchar_t *program = Py_DecodeLocale(argv[0], NULL); if (program == NULL) { fprintf(stderr, "Fatal error: cannot decode argv[0]\n"); ...
How to set the Python executable name, now that Py_SetProgramName() is deprecated?
|python|c|python-c-api|
Following the alternatives mentioned in the documentation for `Py_SetProgramName` and succesfully merging code from [Initialization with PyConfig](https://docs.python.org/3/c-api/init_config.html#initialization-with-pyconfig) I got this working program: ``` #define PY_SSIZE_T_CLEAN #include <Python.h> int main...
**WHEN USING SSR IMPLEMENTATION WITH NEXTJS 13** When following the implementation enforced on TanStack's docs, you would be encouraged to create a request based client for Server Side and a singleton client for Client Side. But when using `queryClient.invalidateQueries`, be sure to use queryClient from `useQuery...
I have upgraded an ASP.NET MVC project, written in C# and running on .NET 4.7.2, to .NET 8.0. I get this error: > The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?) I have tried to install `System.ServiceModel.Primitive` and it didn'...
Upgraded C# / ASP.NET MVC project from .NET 4.7.2 to .NET 8.0
Something with the terminal is caching those .env values, I don't know if that's technically what's going on. But killing the terminal instance and running the process again from a new terminal should bring in the latest values.
I want to `require` a Ruby file in another file. These two files are in two different directories. I have `require second_file` at the top of the first file. Ruby says it can't load such file. Is that because it's in a different directory? I tried writing the full path to the second file but it still can't load the fil...
How to require a Ruby file from another directory
|ruby|require|
Two steps: 1. use 'complete' from '[tidyr][1]' to create the fake data (e.g., 'max(Data$Height) * 1000') for the missing combination(s) of 'Month' and 'Site': `library(dplyr); library(tidyr); new_data <- Data %>% complete(Month, Site, fill = list(Height = max(Data$Height) * 1000));` 2. plot *without* the fake ...
While you can't have a `box-shadow: linear-gradient(#9198E5, #E66465)`, you could take advantage of [Pseudo-elements](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements) to have the same gradient mixing it with `filter: blur(10px);` to have the same effect of shadow, note that `#back` must have `z-index: ...
Next js delay before applying Emotion and MUI styles
The transposition table uses keys from the position of player 0 and player 1 from bitboards and includes the player turn at the end, I did that to guarantee unique keys for all states. But this seems to be slow because of fmt.Sprintf. I have two functions where I store and retrieve, and in each of them I build the k...
|javascript|css|next.js|material-ui|emotion|
Does anyone know why `getById` and `getReferenceById` work differently? I'm using `JpaRepository` and the method `getReferenceById` doesn't throw `EntityNotFoundException` but getById throws this exception when the object doesn't exist
I have some questions about some concepts, and they are not well solved through search engines and gpt, so I hope you can explain them to me. I don't understand "nn layout" and "nt layout" of neural network memory layout. There are two explanations, but I don't know which one is correct. One explanation is that "NN" s...
what's the difference between "nn layout" and "nt layout"
|computer-vision|computer-science|cpu-architecture|
You can add this code to your theme's `functions.php` file: ``` <?php // functions.php function display_category_post_counts_atakanau() { $categories = get_categories(); $category_list = array(); foreach ($categories as $category) { if ($category->category_parent == 0) { ...
This looks like a bug. I've [opened issue #27](https://github.com/statnet/ergm.multi/issues/27) for it.
I try to run a multi-layered ERGM with the **ergm.multi** package in R with two layers. Before, I ran an ERGM for each layer, which all worked our perfectly. However, when trying to run the respective multi-layer ERGM, I get the error message concerning nodal attributes: > Error in \`ergm_Init_abort()\`:! In term ‘...
In c++, It's possible to use some tricks with the help of constexpr, to write a MACRO that encrypts strings in compile-time, and decrypts them in runtime, and we could use something like ENCRYPT("MyString") to achieve this. An example is the following header file: https://github.com/skadro-official/skCrypter/blob/ma...
How to encrypt a string at compile-time and decrypt it at runtime in Rust, similar to constexpr encryption in c++?
|rust|
I'm encountering difficulties implementing a MEJS audio player on my WordPress website. Although the player container is displaying correctly, the player itself is not appearing. So here are the functions (first one is designed to generate a list of clickable tracks based on the provided product ID, it's the A1, A2,...
I have a Leaflet control that I add to the map using the code below. ``` ... var FilterControl = L.Control.extend({ options: { position: 'topleft' }, onAdd: function(map) { this._div = L.DomUtil.create('div', 'leaflet-formcontrol'); L.DomEvent.disableClickPropagation(t...
Stop propagation of javasript/leaflet click event that starts in one element and ends in another
|javascript|events|leaflet|event-bubbling|
null
I have a page in Laravel that includes a start date, a deadline, and an end date. I aim to calculate and display the final date when I input the number of days (deadline). I've utilized Laravel Collective for the controls. Start date: ```php {!! Form::text('StartDate', jdate($task->StartDate)->format('Y-m-d'), [...
JavaScript change event issue in calculating new date with deadline
My instance of func app currently under consumption plan. There is one timer trigger logic that needs to make bunch on http requests - 10k and fails due to consumption plan "connections" limitation. Is it possible to automatically switch to premium plan for 1 hour daily and then switch it back to consumption? Or...
I have a code for Arduino Nano RP2040 written with the usage of Raspberry Pi SDK (it was written to use with Raspberry Pi Pico, but then I switched to Arduino Nano Connect RP2040). Now I want to add WiFi functionality to it, so I want to control the WiFi NINA which is on the board. I'm trying to port Arduino's WIFIN...
Check the **Trackpad** settings on the Mac: ![Screenshot](https://i.stack.imgur.com/yyaWP.png) With the settings shown here, it works for me when I hold using three fingers.
Although your method worked, I still wouldn’t recommend doing it that way. In general, I would leave the explicit creation of threads for cases of extreme necessity, when it is impossible to do otherwise. The same applies to all UI elements. You should create and work with them only in the main application thread. ...
**TL;DR** ```python X_train_permuted = ( X_train_permuted.with_columns( pl.DataFrame(shuffle_arr, schema=features) ) ) ``` ----- Let's work with a simple example. **X_train_permuted** ```python import polars as pl import numpy as np np.random.seed(0) data = {f'feature_{i}': n...
regex working not as expected javascript, displays wrong values
|javascript|regex|
null
``` FROM node:19.5.0-alpine RUN npm i -g nodemon WORKDIR /app COPY package* . RUN pwd RUN apk update && apk add npm RUN npm install COPY . . RUN pwd RUN npm run build EXPOSE 3007 CMD [ "npm", "run", "preview" ] ``` In terminal ``` docker build -t saathi . ``` Getting error ``` ...
Facing error in creating image of my react+vite project . Dockerfile error
|reactjs|docker|dockerfile|vite|
null
Coroutines can be used in the main thread for network calls, but network calls may take more time because of multiple reasons, and for that time the main thread is blocked. Because the main thread is responsible for rendering the UI, it will give a bad user experience as well as it may result in ANR (Application Not ...
In my Flutter Web Application, I have the following created tables for an address in Supabase: ``` -- Table for Region CREATE TABLE regions ( id SERIAL PRIMARY KEY, region_name TEXT NOT NULL ); -- Table for Province CREATE TABLE provinces ( id SERIAL PRIMARY KEY, province_name TEXT NOT NULL, region_id...
Embed a mjes player on footer
|wordpress|mediaelement|mediaelement.js|
null