instruction stringlengths 0 30k ⌀ |
|---|
I am trying to contruct a new `NetworkManager` from a function, but it takes a reference to another variable which is also created in the same scope.
```rust
fn test() -> NetworkManager<'_> {
let dbus = Connection::new_system().unwrap();
NetworkManager::new(&dbus)
}
```
How can I return this Networ... |
It appears Intl.DateTimeFormat() only accepts `"narrow", "short", "long"` as the `weekday` option. I would like it to return as a `number`. i.e. Sunday = 0, Monday = 1 and so on. If I'm correct in reading "numerical" is not an option, what would be an easy way to return the value weekday as a number?
```
const day ... |
Intl.DateTimeFormat() - return weekday as number? |
|javascript|datetime| |
null |
[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 am confused about the output... |
why variable substitution is so different? |
|bash|shell| |
null |
@Chukwujiobi_Canon's answer is excellent, and scalable, though it did take me a whole day to almost get it working, and it's still not quite there. I expect it may take me another day to perfect it, however given my files are under 1mb in size, I decided to explore my original thought: embed the file content in base64 ... |
I know, that it's been a few years, but I wanted to share my solution, that I've been using for a while. I just came about this post, because I was searching for a better way.
```Python
import aiohttp
import http
from bs4 import BeautifulSoup
async def playercount(gameid):
url = f'https://steamcharts.... |
I am trying to convert string of mathematical expression to lambda function in C++17. How can I do this type of conversion with function?
std::function<void()> str2lambda(const std::string& str) {
// Code
}
Example:
> Input Mathematical function:
> "x^2+1"
>
> Output Lambda Function:
... |
The problem is occurring because `adapter` is not set to the `RecyclerView`.
**Solution:**
Set the `stockPriceAdapter` to the `stockPriceList` before notifying it for the dataset changed.
**Updated Code:**
```java
public void StockPrice() {
String name = Name;
String Symbol = symbol;
String pric... |
{"Voters":[{"Id":23528,"DisplayName":"Daniel A. White"},{"Id":13808319,"DisplayName":"Mike Organek"},{"Id":839601,"DisplayName":"gnat"}]} |
I am following this [tutorial][1] to fetch the auth token for the HERE maps. I am able to fetch the token with my iOS app, However I cannot seem to get the token with Android. I keep getting the error `errorCode: '401300'. Signature mismatch. Authorization signature or client credential is wrong."`
Below is my code ... |
I try to use FocusNode() in TextFormField so it will detect when I focus on the TextFormField, the text above will have it's color changed. But it seems not working, what seems to be the problem?
```
import 'package:flutter/material.dart';
class SignIn extends StatefulWidget {
const SignIn({Key? key}) : super... |
Text Color didn't change |
|flutter|flutter-textformfield| |
null |
What I do is
npm i @tanstack/react-query @tanstack/react-query-devtools && npm i -D @tanstack/eslint-plugin-query
Here what I did was install all dependencies with **npm i with space** to **separate packages** and when **I want to download dev dependencies** I use **&&** and npm i -D with space to instal... |
I want to create progress bars to see my advancements during the year in different topics along the year in Obsidian.
I've checked several options, like this tutorial, but don't seem clear to me:
[Progress Bar on Tasks](https://obsidianttrpgtutorials.com/Obsidian+TTRPG+Tutorials/Plugin+Tutorials/Dataview/DataviewJS... |
|javascript|obsidian|obsidian-dataview| |
null |
I want to create progress bars to see my advancements during the year in different topics along the year in Obsidian.
I've checked several options, like this tutorial, but don't seem clear to me:
[Progress Bar on Tasks](https://obsidianttrpgtutorials.com/Obsidian+TTRPG+Tutorials/Plugin+Tutorials/Dataview/DataviewJS... |
My code segment is this:
```
<>
<Divider orientation="left">{resultLinkTitle}</Divider>
<Intension />
<Form form={form} name="auditForm" ref={auditFormRef}>
<Form.Item label="files">
<Button type="link" onClick={() => handleDownLoadFile(aduitInfo?.fileUrl)}>
download
... |
How to use swc to make ast restore be code segment |
null |
Seeking to get some help around the cidrsubents functionality in terraform. I have a vpc cidr, 10.0.0.0/16, I wanted to get three private database subnets /25, four public /26 subnets and four other private /23 subnets. How can I achieve this dynamically using cidrsubnets? Also, in future if I need to add an extra data... |
I am trying to scrape my instagram followers, but I am having issues with the scrolling mechanism to load more followers.
```
dialog_box = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "(//div[@class='_aano'])[1]/div[1]"))
)
driver.execute_script("arguments[0].scrollTop = a... |
Scrolling Instagram Followers Not Working |
|python|selenium-webdriver|scroll|instagram| |
When running the command: "pip3 install pyaudio", I get this error:
"Collecting pyaudio
Using cached PyAudio-0.2.14.tar.gz (47 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collecte... |
|installation|pip|subprocess|pyaudio| |
null |
Your code wouldn't work for me in the code snippet, but did as soon as I copied it out to a local html file and ran it there.
The iframe is messing with the intersection observer's root.
Your code was useful to me, I hadn't been able to find an example combining the :enter and :leave modifiers.
(I had to write... |
A web project does not need to run on the whole World Wide Web. A very large amount of questions we get about website projects are for training only - usually from following a tutorial or a course.
Another thing is that serving the project is not hard at all. For simple sites with just static assets, you can even run... |
null |
{"Voters":[{"Id":3001761,"DisplayName":"jonrsharpe"},{"Id":8017690,"DisplayName":"Yong Shun"},{"Id":839601,"DisplayName":"gnat"}],"SiteSpecificCloseReasonIds":[13]} |
I have two tables one for Credit and the second for those who have paid their credits
Table 1
credit_id customer_id total_amount_given disbursement_date
1 1 50000 2020-09-02
2 2 60000 2020-09-02
3 1 10000 ... |
I'm trying a solution to resolve a duplication of requests happening in my Ruby on Rails 6 project deployed to Heroku.
This seems to occur when those anchors with hyperlinks are used, so it loads 2x.
As a result, it ends up generating duplicate logs because it also calls the controller (GET -> Controller -> Model... |
Duplicate GET requests - Rails & Heroku |
|ruby-on-rails|ruby|heroku|deployment| |
null |
`/apps/postgres` directory is created when your container is created. The `volumes` parameter in the Docker Compose file maps a directory from the host file system to a directory within the container.
If you didn't delete the `/apps/postgres` directory, your database won't be cleared. You can delete the `/apps/postg... |
I have a problem such that $F(G(x))=G(x)$, where $x$ is real numbers and I know that function $F$ can be computed if value $G(x)$ is given. $F$ is a probability function.
I want to obtain a function form $G$ (or an algorithm G).
What is the problem? Is there any knowledge about "finding a function that give... |
How to find function G(x), and make for every x, G(x) always returns fixed point for another function F(G(x)) |
Terraform cidrsubnets |
|terraform|terraform-provider-aws| |
1. If the variable is in the TAB menu then `Stats` is supposed to be named `leaderstats`
2. If the variable is a Gui then change the text in the gui |
This is an interesting problem, but I'm not sure you're approach is going to get to a solution.
This is an ordinary differential equation (ODE), where the position of a particle at any time depends upon its acceleration and velocity (and previous position).
By considering a 10x10x10 grid, you are forcing the bod... |
i dockerized my mern app (Next js, node js , mongodb) and trying to deploy it on aws ec2 instance. when i try to access my backend on port 5000 via aws public ip then it works fine when i try to access frontend then terminal stuck and if i try to reload the terminal then ssh gives error.
this is error i am seeing if i... |
Good morning...
need help...
I'm trying to use inno setup. But I don't have much experience in programming.
The idea was... to install the program and in the end, the necessary components for it (.net, mysql connector, mysql server...)
There was a program for it (first see if the programs existed and then install... |
InnoSetup error 193 afeter install Mysql Connector |
|mysql| |
null |
{"Voters":[{"Id":3689450,"DisplayName":"VLAZ"},{"Id":11683,"DisplayName":"GSerg"},{"Id":839601,"DisplayName":"gnat"}]} |
The shell _expands_ the commands before executing them. There are 7 consecutive expansions: brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, word splitting, and pathname expansion (see [this section of the bash manual](https://www.gnu.org/software/bash/manu... |
You should use serverless-offline to run serverless locally.
1) npm i serverless-offline
2) add serverless-offline in plugins of your serverless.yml file
```yaml
plugins:
- serverless-offline
```
3) then you can run it locally as `serverless offline start`
|
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... |
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... |
Check REQUEST_URI for any /nl/ or /en/ to change my RewriteRules |
|php|.htaccess|content-management-system| |
null |
What about using `usePathname` in `next/navigation`? |
|optimization|fixed-point| |
null |
I got the same error in production build when I tried to upload an image through an input, although everything worked fine in the dev mode. Upon studying, I found out that's because the public folder is inaccessible during the production build and in order to load the newly generated image, you can make use of services... |
The data structure for this is a [Trie][1] (Prefix Tree):
* Time Efficiency: Search, Insertion & Deletion: With a time complexity of O(m) where m is the length of the string.
* Space Efficiency: Store the unique characters present in the strings. This can be a space advantage compared to storing the entire string... |
{"Voters":[{"Id":147356,"DisplayName":"larsks"},{"Id":1394729,"DisplayName":"tink"},{"Id":18157,"DisplayName":"Jim Garrison"}],"SiteSpecificCloseReasonIds":[18]} |
I am trying to learn the dataverse API using C#. I am following the code in this github: https://github.com/microsoft/PowerApps-Samples/blob/master/dataverse/orgsvc/C%23-NETCore/GetStarted/ConsoleApp%20(public)/Program.cs
I changed the login information and the appID to my app registration's client id and added a re... |
You can use ModuleType:
from types import ModuleType
a = ModuleType("some") # name of obj
a.foo = 123
print(a.foo)
print(a.__name__) # some
a.__dict__
# {'__name__': 'some', '__doc__': None, '__package__': None, '__loader__': None, '__spec__': None, 'foo': 123}
|
Adding my own take here because none of the answers were acceptable to me:
```kotlin
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
private fun closeChain(items: List<AutoCloseable>) {
if (resources.isEmpty()) return
try {
... |
[enter image description here][1]I try to use FocusNode() in TextFormField so it will detect when I focus on the TextFormField, the text above will have it's color changed. But it seems not working, what seems to be the problem?
```
import 'package:flutter/material.dart';
class SignIn extends StatefulWidget {
... |
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... |
{"Voters":[{"Id":6119582,"DisplayName":"sweenish"},{"Id":12002570,"DisplayName":"user12002570"},{"Id":5494370,"DisplayName":"Alan Birtles"}]} |
I want to add a local image to the array products like this
(https://i.stack.imgur.com/Mckgm.png)
I've tried to do like chatpgt said but I still can't do it
This is the coding that chatgpt gave me
```
//This is in component
uploadImg(event){
const image = event.target.files[0];
this.addImage(image).then... |
Failed to connect to your instance after deploying mern app on aws ec2 instance when i try to access frontend |
|amazon-web-services|docker|amazon-ec2|docker-compose| |
As of Angular 15, [tick](https://angular.io/api/core/testing/tick) and [flush](https://angular.io/api/core/testing/flush) call Zone.js's [FakeAsyncTestZoneSpec](https://github.com/angular/angular/blob/67f0cf5fc8a2be4a48c6cd15db53ce9c9c4cd014/packages/core/testing/src/fake_async.ts#L127).
- `tick` and `flush` [flush ... |
I encountered a error
```
PS C:\\Users\\91789\\Desktop\\Underwater-Image-Enhancement\\WPFNet\> python Underwater_test.py C:\\Users\\91789\\Desktop\\input C:\\Users\\91789\\Desktop\\New folder ./checkpoint/generator_600.pth
C:\\Users\\91789\\AppData\\Local\\Programs\\Python\\Python312\\python.exe: can't open file '... |
{"OriginalQuestionIds":[59762996],"Voters":[{"Id":7329832,"DisplayName":"jps"},{"Id":874188,"DisplayName":"tripleee","BindingReason":{"GoldTagBadge":"python"}}]} |
A quick and easy way to do that is to overwrite the current contents with an empty string from a Bash console. Let's say that the log you want to clear is `/var/log/someusername.pythonanywhere.com.error.log` -- with that you would run this command:
echo > /var/log/someusername.pythonanywhere.com.error.log |
Figured it out, though I've no idea why this is what it takes to make it work (if anyone could explain I'd really appreciate it!):
First, adding `DT::datatable(matrix())` before reading in the data - without doing this, or adding it somewhere after reading in the data, doesn't seem to help at all.
Then when it co... |
I have an Admin area in my asp.net core MVC app and when I try to reach to /Admin/Category/Add it says No webpage was found for the web address: https://localhost:7002/Category/Add?area=Admin.
My routing in program.cs:
```
app.MapDefaultControllerRoute();
app.MapAreaControllerRoute(
name: "Admin",
... |
No webpage was found for the web address: https://localhost:7002/Category/Add?area=Admin. Why is my URL generated like ?area=Admin instead of /Admin/ |
|c#|asp.net-mvc|asp.net-core|model-view-controller| |
null |
|javascript|reactjs| |
I have developed an Android application that includes a background service (MainService) designed to run automatically after the device restarts. To achieve this functionality, I have implemented a BootReceiver class and added it to the AndroidManifest.xml file to handle the ACTION_BOOT_COMPLETED intent. However, despi... |
When knitting the below `Rmd` **with a landscape page** and viewing the word output produced by it, it becomes apparent that **page two seems to be missing**. Also, page numbering in the footer of the page only starts after the landscape page has been included.
Conversely, when knitting the below `Rmd` **without a... |
Why are landscape pages causing issues with page numbers/section headers in officeverse? |
|r|r-markdown|officer|officedown| |
The `location` object is available only in the browser's environment. If your code relies on `location` for server-side rendering in Next.js, you'll encounter errors during the build or prerendering phases because `location` is undefined in Node.js.
Wrap any code using `location` in a condition that checks if `windo... |
{"OriginalQuestionIds":[902408],"Voters":[{"Id":5320906,"DisplayName":"snakecharmerb","BindingReason":{"GoldTagBadge":"python"}}]} |
|ITEM | OPEN BAL | IN | OUT | CLOS BAL |
|---- | -------- | --- | --- | -------- |
|A | 10 | 10 | 0 | 20 |
|B |200 | 200|300 |100 |
|C |50 |100 |100 |50 |
|D |20 |20 |40 |0 |
|E |100 |0 |50 |50 |
|B | | | | ... |
I have a website created with ReactJS and React Router Dom. I use `createBrowserRouter` for routing pages. However, when I refresh any page, I encounter a 404 error ("page not found"). This issue arises when I deploy the project on server platforms like Domain.com. Does anyone have a solution?
I've tried usi... |
null |
I encountered a error
```
PS C:\\Users\\91789\\Desktop\\Underwater-Image-Enhancement\\WPFNet\> python Underwater_test.py C:\\Users\\91789\\Desktop\\input C:\\Users\\91789\\Desktop\\New folder ./checkpoint/generator_600.pth
C:\\Users\\91789\\AppData\\Local\\Programs\\Python\\Python312\\python.exe: can't open file '... |
I created an .env.development file in order to store my api key and other environment variables. I got an issue that when i use my api key defined in .env.development file and retrieved with the help of dotenvx dependencies, the website failed to load resources with a status of 401. However, if i used my api key direct... |