instruction stringlengths 0 30k ⌀ |
|---|
|python|pycharm|cpython|micropython|raspberry-pi-pico| |
null |
I have two tables: Schedules and Tasks, with a one-to-one relation
```
class Schedule extends Model
{
public function task() {
return $this->belongsTo(Task::class, 'task_id');
}
```
And the Task model has a one-to-many relation with Spatie Roles with a task_role pivot table:
```
class Task... |
I am having hard time wrapping my head around types and references in rust. For eg., I have this code:
let my_arr = [3, 5, 4, 88, 77];
let my_slice1 = &my_arr;
let my_slice2: &[i32] = &my_arr;
IDE suggests my_slice1 is of type &[i32, 5] ie reference type to array of type [i32, 5].
If this suggest... |
Different types even though same value assigned |
|rust| |
**Notifications work differently in (Android and iOS) and (Foreground and background).**
> 1. Notifications within Android depend on the **notification channel
setup and channel ID passed** in the payload.
> 2. Notification customization within iOS depends on the **sound file
passed in the payload**.
... |
Since you only want the side menu to show when a left-to-right drag happens on the first tab view, I would suggest applying the drag gesture to the content of view 1 only. And since we are talking about a left-to-right drag, it is probably reasonable to expect it to start on the left-side of the screen. In fact, I woul... |
I'm looking for an equivalent to x86/64's FTZ/DAZ instructions found in <immintrin.h>, but for M1/M2/M3. Also, is it safe to assume that "apple silicon" equals ARM? |
How to flush denormal numbers to zero for apple silicon? |
|apple-silicon|denormal-numbers| |
I want to install pydantic_core package in Pythonista app on iOS.
I have installed stash in Pythonista. Than I run stash and do:
pip install pydantic_core
I get the following error message:
```
15:03 Sun 31 Mar
StaSh
Console
stash: `C
KeyboardInterrupt: Exit: 0
StaSh v0.7.5 on python 3.10.4
Warni... |
How to install pydantic_core in Pythonista? |
|pip|pydantic|pythonista| |
null |
I want to design python web scraping code to scrape these data (https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page).
Here is the code:
```
import os
import requests
import random
import time
import pyarrow.parquet as pq
from bs4 import BeautifulSoup
from urllib.parse import urljoin
from fake_us... |
Async functions return a resolved promise if the return statement intends to return a regular value other than a promise.
This return value should be handled with await or via the Promise mechanism.
let res = await myAsyncFunc()
console.log(res)
//or
let res = myAsyncFunc()
res.then... |
You should see html pages as completely isolated programs. Every time you click a link, or reload a page, the following thing happens:
- the current page is removed
- all the javascript code in the current page stops running
- all the variables your code created, stop existing
then
- the new html page is downl... |
My Delphi Alexandria program associates certain file extensions in Registry with the Application's Exename, such that Windows shows the right icon. But I am struggling to get my program to notice a request when I double-click on a file of the correct type in Explorer. What I want is to intercept the call depending on i... |
How to detect file open requests from Explorer in Delphi? |
|delphi|file-extension|paramstr| |
I can try to explain it in plain English...
First you should have a look at the [link][1] Jean-Francois Corbett wrote as a comment.
### Definition
(from Wikipedia)
> A system is self-stabilizing if and only if:
>
> - Starting from any state, it is guaranteed that the system will eventually reach a cor... |
How to create beans of the same class for multiple template parameters in Spring |
|java|spring|apache-kafka|spring-bean| |
A modified version of Matteo Antolini's answer:
import 'package:flutter/material.dart';
class ScreenNavigator {
final BuildContext cx;
ScreenNavigator({
required this.cx,
});
navigate(Widget page, Tween<Offset> tween) {
Navigator.push(
cx,
... |
I am experiencing the following problem. When I setup an ADC with DMA for 5 channels, I get lower readings than the expected ones.
We have PCBs of the same batch in 3 countries, but only the ones tested in China are failing. At all times the ADC readings read lower than the expected values for all the ADC channels, ... |
For RFC 9110, the current HTTP Semantics spec as of 2024-03-31, responses with the following statuses MUST NOT contain content:
## [Informational 1xx](https://datatracker.ietf.org/doc/html/rfc9110#name-informational-1xx)
> A 1xx response is terminated by the end of the header section; it cannot contain content or... |
Laravel spatie permission many to many query |
|laravel|eloquent|permissions| |
My problem is that, after successful login, the session is being created successfully, but redirect is not working. Why? \<br\>
\[route\](<https://i.stack.imgur.com/4Skqa.png>)\<br\>
\[form html\](<https://i.stack.imgur.com/U6prc.png>)
\[authenticationcontrol\](<https://i.stack.imgur.com/gTLvk.png>)
\[l... |
Is there anybody who can help me in node.js authentication? |
|javascript|node.js|node-modules| |
null |
For me, using a .json file rather than a .js file for .eslintrc allowed `eslint .` to operate as it should in a module-based project.
Failed attempts (.eslintrc.js):
```js
export default {
// also tried: export {
// also tried: module.exports = {
"env": {
"browser": true,
"es2021": true
},
"... |
{"Voters":[{"Id":243925,"DisplayName":"Tony"},{"Id":157957,"DisplayName":"IMSoP"},{"Id":269970,"DisplayName":"esqew"}]} |
Could someone explain what was the common usage of the `PhantomReference` class before Java 9? This class was introduced at December 1998 in Java 1.2 by Mark Reinhold and it's not clear what was the intention of the author. At September 2017 in Java 9 the `finalize()` method was deprecated and marked for removal but it... |
What was the common usage of the PhantomReference class before Java 9? |
`selectedBook = aStoreItems[i];` is never executed. It is dead code. When `return` is executed, the function exits and no other statements in that function are executed.
You should just not have that `selectedBook` variable. Instead *use* what the function returns at the calling side. So in the second part of your c... |
I have modified the [Ananke](https://themes.gohugo.io/themes/gohugo-theme-ananke/) theme for [Hugo](https://gohugo.io) for my own purposes, the modifications are [here](https://github.com/ltrubov/gohugo-theme-ananke-customizatiion).
The key change was that I wanted a list of linkable tags (that the theme already put... |
|java| |
Using Pycharm Community Edition 2023.3.2 with Micropython 1.4.3-2023.3 installed and enabled in Pycharm. I want to utilize the 2 core multithreading on a Raspberry Pi Pico W using the experimental "_thread" library. When I try to use a method from the module, Pycharm says there is no reference to the method, [even thou... |
Got the same error, when trying to upload from local machine. Reason - luck of permissions. Same code on server works fine |
I'm currently working on a react native application, and for one of my features I'll need to create an image from a selection of images chosen by the user. How do I go about generating such an image and storing it in firebase?
Is it possible to do this directly in my application, or would I need to set up an external ... |
Create and combine several images into a single image for my react native App |
|reactjs|react-native|image| |
null |
I'm trying to visualize the data coming through the API with Sigma.JS, but I can't always get results. When I tried to visualize the dynamic incoming data without mock data by writing a simple API with Flask, it worked, but this data is slightly different from the real json data of the project, I can't integrate the ne... |
I have a large structure:
```rs
#[derive(Debug)]
pub struct OuterStruct {
pub big_array_0: [u32; 108],
pub big_array_1: std::sync::Mutex<[Option<SomeStruct>; 65536]>,
pub big_array_2: [AtomicUsize; 65536],
}
```
The size of arrays is known at compile time and I will not use a `Vec<_>`.
This curr... |
Why does Hugo generate different taxonomy-related HTML on different OS's? |
|linux|macos|hugo|static-site-generation|hugo-theme| |
I use a 3rd party library which has 4 localized strings I need to overwrite. It's not my library so I have no access to the source code. I do know the reference keys for the 4 strings.
Is there a way, on startup in my code, to overwrite those localized string values? |
How can I overwrite the localization strings in a library |
|c#|.net-core|blazor-server-side| |
I'm working with a game called "Pixels". My goal is to programmatically monitor when trees respawn within the game. A developer provided me with Java code for this, and I've attempted to convert it to Python. I'm able to successfully retrieve my session ID, room ID, and other relevant server details.When I attempt to... |
You could have the `-exec` run each line via `bash -c` instead of echoing it to a file to be run later. That would also enable (require, in fact) adjusting your quoting, ultimately allowing a simpler and clearer command. For example:
```
find ./build/html -name '*.html' \
-exec bash -c '../emojize_pngorsvg.py "{... |
This is a great general question that deserves a general answer. Althgouh Stackoverflow is a great place to get answers, I don't believe an answer here no matter how good would be a substitute for more a more substantial reading, courses and hands-on experience. Nonetheless, I will try to be thorough.
Test automatio... |
If you took a look at `Loaded Configuration File` section in phpinfo() output you would probably see an empty value there which means no php.ini was loaded.
So, my guess you need to create the config file firstly and then you will be able to modify its values.
Here is how your Dockerfile should look like:
```
...... |
Given h, k, and r, the (x, y) values in the circle will satisfy
`h - r <= x <= h + r` and `k - r <= y <= k + r`.
Hence, the simplest way to do this is to use double for-loop with x, and y values in the range.
In the for-loop, you can use `if` to check whether (x - h)^2 + (y - k)^2 <= r^2.
Example code
```g... |
I have this request, on my node.js application :
```js
return new Promise((resolve, reject) => {
const options = {
hostname: 'py', <== docker container
port: 8000,
path: '/resume',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},... |
{"Voters":[{"Id":6296561,"DisplayName":"Zoe is on strike"}],"SiteSpecificCloseReasonIds":[18]} |
Is there any way to tell Notepad please do this...
FROM THIS
15.63387,46.42795,1,130,1,210,Sele pri Polskavi
TO THIS
15.63387,46.42795,1,130,1,210
I would like to remove everything after the last , (after number 210)
So that in the end it looks like
15.63387,46.42795,1,130,1,210
Thing is when I try it... |
.bashrc not found, but I was able to configure it to start zsh by making the change in the file bash_profile.sh.
C:\Program Files\Git\etc\profile.d/bash_profile.sh
# add ~/.bash_profile if needed for executing ~/.bashrc
if [ -e ~/.bashrc -a ! -e ~/.bash_profile -a ! -e ~/.bash_login -a ! -e
~/.pro... |
afterly i have a problem to us reslove
then this is error
in todolist(RootComponent), js engine: hermes
ERROR Error: Text strings must be rendered within a <Text> component.
This error is located at:
in text (created by HomeScreen)
in RCTView (created by View)
in View (created by ScrollView... |
I have a problem with my react-native project |
|react-native|react-navigation| |
null |
First of all, VBA has no sort method. The only way to sort something is to use worksheet functions.
Second, Excell correctly sorts ranges with formulas. You need to estimate the references in those formulas. They can contain references to the same row or absolute references. And all referenced columns should be incl... |
null |
I am experiencing the following problem. When I setup an ADC with DMA for 5 channels, I get lower readings than the expected ones.
We have PCBs of the same batch in 3 countries, but only the ones tested in China are failing. At all times the ADC readings read lower than the expected values for all the ADC channels, ... |
I'm developing a JavaEE application on Glasfish Application Server. I'm developing so I'm continously deployig/undeploying the application.
Everything worked great until a few hours ago when I got this error while deploying:
GRAVE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepa... |
null |
BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
@SuppressLint("MissingPermission")
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
super.onConnectionStateChange(gatt, status, newState);
Log.i(TAG, ... |
To *"limit the number of elements in the following `string_agg()`"*, use [`LIMIT`][1] in a subquery:
<pre><code>SELECT string_agg(tag, ', ') AS tags
FROM (
SELECT DISTINCT tag
FROM tbl
-- ORDER BY tag -- optionally order to get deterministic result
<b>LIMIT 123</b> -- add your limit here
... |
RecyclerView in Fragment Resets with ViewPager Tab Updated |
Dude, you have a lot of mistakes in the code, and the main thing in the key of the question is that you don't pass the `pattern` to the `input` component.
I created a simple [**example**](https://play.vuejs.org/#eNp9U8Fu2zAM/RVBl7ZAEgPbTplXYB166IBtxbLbtINjM646WdIkKs1g+N9LKXZso0FOpvgeySfxueWfrV3tA/A1z33ppEXmAYO9FVo21jh... |
How to allocate a structure on heap without stack overflow in Rust? |
|rust|stack-overflow| |
we were given a defined protocol for a project. We were asked to write server and client code using this protocol in Python. I have written server and client code, but I am encountering some errors. Can you help me correct the code?
[[enter image description here](https://i.stack.imgur.com/IB8xh.png)](https://i.st... |
Python Client-Server Communication with Protocol |
|python|sockets|networking|protocols|serversocket| |
null |
{"Voters":[{"Id":666221,"DisplayName":"diegoveloper"},{"Id":807126,"DisplayName":"Doug Stevenson"},{"Id":209103,"DisplayName":"Frank van Puffelen"}]} |
adb shell dumpsys dropbox --print system_server_watchdog |
I found this iframe code and deleted it which solved the problem for me.
`<iframe id="orderFrame" name="orderFrame" src="#" style="visibility:hidden;width:0px;height:0px;"></iframe>`
Check the iframes. |
# Issue
The issue here is that you have managed to use Javascript's [Comma Operator][1] unintentionally.
> The comma (`,`) operator evaluates each of its operands (from left to
> right) and returns the value of the last operand. This is commonly
> used to provide multiple updaters to a [for][2] loop's afterthou... |
I think best would be just to set `left` and `top` using `%` units.
You can do the same for the `width`.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
window.addEventListener("load", function() {
document.getElementById('map1').onclick = function(eve... |
I have developed a simple telegram bot using the telebot library in python. I want to deploy it somewhere so it's always running, preferably for free. I was thinking vercel, but can't get it to work, what is the easiest way to do this and the best place to deploy? Is there a template that I can use somewhere and then j... |
Deploying telegram bot |
|python|deployment|bots|telegram|telegram-bot| |
null |
{"Voters":[{"Id":5641669,"DisplayName":"Johannes"},{"Id":2802040,"DisplayName":"Paulie_D"},{"Id":1940850,"DisplayName":"karel"}],"SiteSpecificCloseReasonIds":[13]} |
This error is unrelated to Turtle. It's raised by `mendeleev.element(element)`, although the error message is a bit confusing. A [minimal example](https://stackoverflow.com/help/minimal-reproducible-example) is:
```none
>>> import mendeleev
>>> mendeleev.element("si")
Traceback (most recent call last):
File "<... |
I have such violet color for options which I would like to choose:
[![enter image description here][1]][1]
in all tutorials which I reviewed options which I'm trying to use like `From Neuroscal .EEG file` are black. But Neuroscanio is installed as I see for eeglab:
[![enter image description here][2]][2]
so... |
Why options are not available in EEGLAB menu options? |
|matlab|eeglab| |
Working bilingual, Shortcut Ctrl+' used to work for me for years in both languages (English and Hebrew), but not in 2016. Is there a way to make Ctrl+, (the second language equivalent of Ctrl+') do the same copy-from-previous-record action? Thanks! |
Ctrl+' for copying from previous record in MS Access not working bilingual in Access 2016 |
Getting "422 Unprocessable Entity" error when positing stringified body from node.js to Python FastAPI |
|python|node.js|json|fastapi|stringify| |
I just start working with Ant Design and I encounter a problem with Table. Here is my code
```
<div className="main-table">
<Table
rowSelection={{
type: 'checkbox',
...rowSelection,
}}
columns={dataColumns}
dataSource={dataOrder}
bordered
pagination={{ pageSize: 50 }}
... |