instruction stringlengths 0 30k ⌀ |
|---|
|c#|regexp-replace| |
null |
when i click on link it is taking me to '/product/api/product/2' URL but I have defined /api/product/<str:pk>/
for backend I'm using django.
```
import React from 'react'
import { Card } from 'react-bootstrap'
import Rating from './Rating'
import { Link } from 'react-router-dom' // we are using this to ... |
Could be an issue you might have duplicated value on the Graphql definition.
remove on of them
example
```gql
query GetUsers {
users {
username
full_name
full_name # remove duplication
email
}
}
``` |
I wrote the following program that has a template parameter pack `Indices` for academic purposes. But the problem is that msvc rejects it but gcc and clang accepts it.
I want to know which compiler is right here? [Demo](https://godbolt.org/z/hdx75jjfK)
```
#include<cstddef>
template <typename T, std::size_t..... |
Template parameter pack works in gcc but not in msvc |
|c++| |
{"Voters":[{"Id":6243352,"DisplayName":"ggorlen"},{"Id":17562044,"DisplayName":"Sunderam Dubey"},{"Id":20292589,"DisplayName":"Yaroslavm"}],"SiteSpecificCloseReasonIds":[13]} |
I was just learning the front-end, then I came up with a way to create a module using IIFE and register it to the namespace. From the code below, I still don't understand a few things:
1. Why does the function need a window as an argument?
2. What does this variable declaration mean: `var App = window.App || { };... |
Adding Modules to a Namespace using IIFE |
|javascript|function|frontend|web-frontend|iife| |
null |
Using the :active pseudo-class isn't the right approach for toggling visibility in the way you're describing. Instead, you can use HTML anchor links and the :target pseudo-class to achieve this effect. Here's how you can do it:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-... |
Here is a fragment of my code:
```python
import numpy as np
from copy import copy
from random import randint
# With this matrix it doesn't give an error
matriz_aux = [
[None, 6, None, 9],
[ 9, None, 3, None],
[None, 5, 4, None]
]
# With this matrix it gives an error
matriz_aux = [
... |
Why does the following code detect this matrix as a non-singular matrix? |
|python|python-3.x|list|numpy|matrix| |
An element with "position: fixed" must remain fixed to the viewport. But in the below example, the fixed element moves along with its parent. Can anyone explain why the element isn't fixed to the viewport?
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div s... |
null |
Connection timed out error with smtp.gmail.com |
|amazon-web-services|gmail|sendmail|rhel| |
I'm attempting to upload video files to Dustloop, a mediawiki page for ArcSys games, and I've managed to get all the way to acquiring a CSRF token to be able to upload, but I'm struggling on the last part. I believe I have correctly done everything else, But I'm not able to get the file part correctly.
```rs
async ... |
I am a beginner trying to build very simple inventory system using PHP + SQL
I have 2 warehouse. I added 2 tables, 1 for each warehouse contains (item id)-(in)- (out) like shown below
table1
| item id | in | out |
| -------- | -- |-----|
| item1 | 10 | 0 |
| item1 | 5 | 0 |
| item2 | 0 | 3... |
How can I disable TypeScript in VS code. Even though I have installed any plugins for TypeScript, I still get TypeScript warning messages in my Javascript. I referenced the [MS VS Code Documentation](https://code.visualstudio.com/docs/languages/typescript), but it doesn't specify disabling TypeScript. |
Disable typescript in VS Code |
|visual-studio-code| |
I have my own CMS system with settings for an multi language website and I save this in my database. But I can't check that variable in my htacces so I want to check my request url like this:
cms2024.nl/nl/home or cms2024.nl/home and then give different RewriteRules to get my right url order
If there is an langua... |
null |
I want to store my object into MongoDB in golang.
The object 'A' contains a field:
`Messages []*Message `bson:"messages,omitempty" json:"messages"``
This array is an array of interface pointers. This is my interface:
`type Message interface {
GetType() enums.MessageType
GetId() string
}`
How can I save ... |
Save Interface in DB golang |
|mongodb|go|interface|repository| |
null |
{"Voters":[{"Id":207421,"DisplayName":"user207421"},{"Id":3745413,"DisplayName":"Ron Maupin"},{"Id":1940850,"DisplayName":"karel"}],"SiteSpecificCloseReasonIds":[13]} |
I’m making an in app purchase for my game on Steam. On my server I use python 3. I’m trying to make an https request as follows:
conn = http.client.HTTPSConnection("partner.steam-api.com")
orderid = uuid.uuid4().int & (1<<64)-1
print("orderid = ", orderid)
key = "xxxxxxxxxxxxxxxxxxx" # omitted for... |
Assuming you are talking about a DLL or static library with a v142 toolkit and you want to use it as a dependency of a project (DLL or EXE) with other toolkits, there are several cases:
- if the dependant is a static library, both must use the same toolkit, because the static lib must be linked with the same toolkit i... |
### About `I would like it to return tab/sheet name "Park Letter" instead.`
When I saw your showing script, `var sheetName = SpreadsheetApp.getActiveSpreadsheet().getName();` is used as the filename of PDF file at `MailApp.sendEmail (emailAddress, subject ,body, {attachments:[{fileName:sheetName+".pdf", content:conten... |
My name is Eduardo sorry for my bad English not my native language.
Im playing with Databricks with DLT and I have a question.
When a Play with regular ETL I can full manage the compute resource. I can tur on/off. But when a create a DLT Pipeline the 'job compute' is always on.
If there is an explanation about ... |
Moving some functions from `generateObjects()` to `Sphere` constructor solved this issue.
>The error comes from the use of `objectReleaseCount` instead of `objects.size()`, for its name and use in other places, `objectReleaseCount` was meant for a totally different usage. Use `objects.size()` as an upper limit for loo... |
I'm trying to build a web backend for a chat app using the runtime Bun, the library Elysia to write a REST API and the library socket.io to deliver the messages in realtime.
I went through the documentation of those 3 components, but I can't find a way to make them work together, either my GET requests are discarded... |
Using Bun+Elysia+socket.io together |
|web|socket.io|backend|bun| |
null |
I'm encountering an issue in Code::Blocks where attempting to build C++ code results in the error message "Error: id returned 5 exit status," even when there are no syntax errors present in the code. Here's an example:
```
#include <iostream>
int main() {
std::cout<<"hello world";
}
```
Even for this... |
After I plugged my iPhone into my mac, I started debugging my app. For the first few days, it all seemed smooth.
But after a few days, things changed.
The Debug -> Attach to process menu is empty, as shown below. I can't figure out why.
But the weirder thing is that when I debugged my app three months later, the p... |
I am making auto white balance calibration application.
I have a chromameter and api. So my application can measure CIExyY and CIEXYZ.
And my app can set R,G,B output value of my devices's LED panel.
I set R,G,B value combination and measureed CIEXYZ three times.
And then I evaluated follow matrix.
[1]: http... |
I want write code to predict CIE XYZ from LED driver R,G,B output value |
|colors|led|color-space| |
Here:
```
g++.exe -o bin\Release\GraphicsC++.exe obj\Release\main.o -s ..\..\..\..\Windows\SysWOW64\glu32.dll
```
You are trying to statically link a DLL (glu32.dll). You cannot do that, and your "simple code snippet" does not need OpenGL in any event! Moreover you cannot normally statically link code built ... |
I am trying to extract some links and text in a .json file from a web-page.
I have parsed the HTML tbody > tr > td, and each td contains `<a href="TextWithUrlBehind">Something</a>`
But this `TextWithUrlBehind` in Inspect Element is clickable, it has a link attached to it.
It is not a well-known `<a href=https//... |
How to extract url from <a href="TextWithUrlBehind">Something</a> using BeautifulSoup? |
|python|html|beautifulsoup| |
#### _Is it possible to stop the task initiated by system() on stopping the control script?_
As the `system` call simply passes the desired _command_ to the operating system, the operating system will decide whether you specified something that has to be wrapped and executed in a shell (like a batch file) or can b... |
```
var dt_filter = dt_filter_table.DataTable({
ajax: {
url: '/banner/data',
error: function (xhr, error, thrown) {
console.error('DataTables AJAX error:', error);
console.log('XHR response:', xhr.responseText);
}... |
Assuming the data has been stored in table named Numbers
``` SQL
WITH NUM AS
(
SELECT
A.*,
ROW_NUMBER() OVER(PARTITION BY ID1, ID2 ORDER BY VALUE) AS RN
FROM
NUMBERS A
)
SELECT
A.ID1, A.ID2, A.LOWER, A.VALUE,A.UPPER,
SUM(COALESCE(B.MEASUREMENT, 0) AS DESIRED
F... |
if all the images are inside the `public` folder, you can directly refer the images like below.
const imageArray = [
{
name: "choso",
text: "i hate the rain",
file: "/choso.jpg",
},
{
name: "pink planet",
text: "the garden",
... |
The thing you should know is that the size of a pointer is independent of its data type and it is based on the computer architecture; for example, on a 64-bit machine this code snippet always returns 8 which means whatever the type of pointer is it always takes 8 bytes;
int main()
{
int *p;
... |
### Problem description
I'm writing a python library and I am planning to upload both sdist (.tar.gz) and wheel to PyPI. The [build docs say](https://build.pypa.io/) that running
```
python -m build
```
I get sdist created from the source tree and *wheel created from the sdist*, which is nice since I get th... |
For eg:
* if today's date is 03/39/2024, it should print after 60 days -05/28/2024
Code to get today's date:
$fromMillis($toMillis($now()), '[M01]/[D01]/[Y0001]')
But how to print for 60 calendar days in jsonata? Can anyone please help?` |
Databricks Delta table / Compute job |
|apache-spark|databricks|delta-live-tables| |
null |
I have to work with the learning history of a Keras model. This is a basic task, but I've measured the performance of the Python built-in min() function, the numpy.min() function, and the numpy ndarray.min() function. The performance of the built-in Python min() function is nothing compared to that of Numpy. However, t... |
Numpy array methods are faster than numpy functions? |
|python|arrays|numpy|multidimensional-array|min| |
null |
You can do this in the following ways.
Using PySpark:
```lang-py
import requests
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
response = requests.get("https://www.imf.org/external/datamapper/api/v1/GG_DEBT_GDP")
json_data = response.json()["values"]["GG_DEBT_GDP"]
data... |
|python|cupy| |
Accessing displayed hyphens of an HTML element with JavaScript |
For python 2.7:
```pip install glob2```
For python 3.7:
```pip3 install glob2```
|
**I want to fetch data from Amazon's website, list the products, and then navigate to Amazon's site by tapping on the listed items in the application. However, I encountered the following error;**
E/flutter (15082): \[ERROR:flutter/runtime/dart_vm_initializer.cc(41)\] Unhandled Exception: Could not launch /sspa/clic... |
In the following piece of code:
type
TDoubleDWORD = record
L, H: Longint;
end;
function BitSelection(const Block: Integer; const A;
const ASize: Integer): Longint;
var
H, L: Longint;
begin
H := TDoubleDWORD(Block).H;
L := TDo... |
null |
null |
null |
null |
null |
null |
I have the following input-file (p) ($inputFile)
```
PING 8.8.8.8 (8.8.8.8): 56 data bytes
11:36:27.996138 64 bytes from 8.8.8.8: icmp_seq=1 ttl=109 time=48.066 ms
11:36:28.991554 64 bytes from 8.8.8.8: icmp_seq=2 ttl=109 time=39.374 ms
Request timeout for icmp_seq 3
11:36:31.000927 64 bytes from 8.8.8.8: icmp... |
{"Voters":[{"Id":367865,"DisplayName":"Ouroborus"},{"Id":476,"DisplayName":"deceze"}],"SiteSpecificCloseReasonIds":[13]} |
1. Return a pointer to the `Node` of interest instead of updating the out parameter `head_dest`. The stack will implicitly hold `cur_list_dest`.
1. The original implementation changes the original list. To create a new list you need to return a pointer to *copy* of the smallest node or NULL. To emphasize that I m... |
There were some mentions about higher version doesn't work.
So, I installed **python 3.8.**
Then, I installed as below.
**conda install -y pytorch==1.12.0 torchvision==0.13.0 -c pytorch**
CUDA 11.2 with pytorch gpu works fine.
I confirmed it with nvidia-smi. |
Try implementing Serializable
public class AccountDTO implements Serializable {
//your fields, constructors, methods etc.
}
|
How to find out what rights a user has in a telegram group using an aiogram bot?
I am using the latest version of aiogram 3.4.1 |
How to find out what rights a user has in a telegram group using an aiogram bot |
|python|aiogram| |
there are two files in current dir
```
[root@workspace tmp]# ll
total 8
-rw-------. 1 root root 6 Mar 31 13:18 *
-rw-------. 1 root root 6 Mar 31 13:18 ?
[root@workspace tmp]# for f in "`find . -type f`";do echo "$f";done
./*
./?
[root@workspace tmp]# for f in "`find . -type f`";do echo $f;done
./* ./? ./... |
I would like to add a little bit of info to the Ermiya excellent answer. His changes work for me also but in 2 of my 3 scenarios. You will see that the 403 error you got could be misleading in some cases...
Case 1: Local stack
If you are doing all the above but working locally with the Lambda emulator as in my ca... |
Can anyone tell me why we should set the counter j in the inner for loop to (i+1) not (i=0) (beacause I think setting j to i = 0 will get all elements in the array).
And why we using break;
I am new in programming.
Thanks in advance.
Here I check for the duplicates and if I set (j = i+1) the first element in the ... |
Setting the counter (j) for (inner for loop) |
|arrays|for-loop|iteration|nested-loops| |
null |
use
from albumentations.augmentations.crops.functional import crop
|
I want to store my object into MongoDB in golang.
The object 'A' contains a field:
`Messages []*Message `bson:"messages,omitempty" json:"messages"``
This array is an array of interface pointers. This is my interface:
`type Message interface {
GetType() enums.MessageType
GetId() string
}`
How can I... |
Bootstrap component does not want to render in Datatables function |
|php|jquery|laravel|datatables|bootstrap-5| |
null |
I was just learning the front-end, then I came up with a way to create a module using IIFE and register it to the namespace. From the code below, I still don't understand a few things:
1. Why does the function need a window as an argument?
2. What does this variable declaration mean: `var App = window.App || { };... |
I am learning Spring boot JPA hibernate mapping. I am trying to create 2 tables Employee and Address. It is a unidirectional OneToOne mapping. I am creating foreign key in Employee table. Employee contains address and it is a strong association. Without Employee, Address doesn't exist.
My createEmployee controller i... |
The answer was not to as suggested.
The application.properties on **consumer** module was redefined to
```
#spring.kafka.consumer.bootstrap-servers=kafka:9092
spring.kafka.consumer.group-id=groupid
spring.kafka.bootstrap-servers=kafka:9092
product.kafkaServer= ${spring.kafka.bootstrap-servers}
spring.kafka.p... |
Realm Swift - collection changes listener in SwiftUI |
|swift|swiftui|realm| |