instruction
stringlengths 0
30k
⌀ |
---|
Getting "error: Multiple commands produce" ... <App_Name>.app/PrivacyInfo.xcprivacy while adding in Target Membership |
|ios|swift|react-native|policy|privacy| |
to avoid graphQL, you can parse the github html
for example of https://github.com/rails/rails/tags
```sh
repo=rails/rails
curl -s "https://github.com/$repo/tags" |
grep -oE \
-e ' href="/'"$repo"'/releases/tag/[^"]+" data-' \
-e ' datetime="[^"]+"' \
-e ' href="/'"$repo"'/commit/[0-9a-f]{40,}"' |
cut -d'"' -f2 |
sed -E 's,^.*/(commit|releases/tag)/,,' |
while read name && read time && read hash; do
echo "$time $hash $name"
done
```
|
My config with attempts, i try to change with unbind and unbind-key and this doesnt work, i cant use escape in neovim btw.
```
set -g default-terminal "screen-256color"
set -g prefix C-a
unbind C-b
bind C-a send-prefix
bind s choose-tree -sZ -O name
set -g base-index 1
setw -g pane-base-index 1
unbind %
bind = split-window -h
unbind '"'
bind - split-window -v
bind-key -n C-t new-window
bind-key -n C-w kill-window
bind-key -n C-q next-window
# this doesnt work
unbind-key Escape
unbind Escape
bind-key -T root C-[ switch-client -n
# this ok
bind-key -n C-[ switch-client -n
bind-key -n C-] switch-client -p
bind -n C-e choose-tree
unbind r
bind r source-file ~/.tmux.conf
set -g mouse on
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @themepack 'powerline/default/blue'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
run '~/.tmux/plugins/tpm/tpm'
`
```
I try to change escape keybind to another, and it doesnt work, I use macos sonoma, nvim latest version |
How to unbind escape with change session |
|macos|tmux|macos-sonoma|sonoma| |
null |
This is some kind of bug in SwiftData since you are not doing anything wrong. The issue is that your `CarMakeView` has a property `make` of type `CarMake` but you are not updating that property directly but via the relationship and this means that the view doesn't see anything dependent being updated and has no reason to update itself.
This is the bug then because `make` is actually update when a new car model is added but somehow this change to the relationship property isn't observed properly.
There are some workarounds for this
The one I use if the relationship properties are optional is to append the new CarModel object to the `make` property instead because then we update the `make` property directly
private func addItem(name: String) {
let newItem = CarModel(name: name)
make.models.append(newItem)
}
For your case we need to make the relationship property optional in `CarModel` though for this to work
```
@Model
final class CarModel {
var name: String
var make: CarMake?
init(name: String, make: CarMake? = nil) {
self.name = name
self.make = make
}
}
```
Another solution is make the view update for some other reason, in your example I simply made use of an existing property
@State var count: Int = 1
and added it to the body in a Text which will cause the view to redraw
var body: some View {
VStack {
Text("\(count)")
List {
ForEach(make.models) { item in
//...
|
if (document.getElementById('actionId').value == 'recommendWithFin')
{
var curRevSeqId = document.getElementById('currentReviewerSequence').value;
var allRevLen = allReviewersArray.length;
if (allRevLen <= curRevSeqId) {
alert('You must select the next approver before recommending the quote.');
valid= valid && false;
}
else {
for (var i= curRevSeqId;i<=allRevLen;i++)
{
if (allReviewersArray[i]==null || allReviewersArray[i]=='') {
alert("Please do not skip approver");
valid= valid && false;
}
}
}
}
I am trying to modify this code from the else part to generate an alert when a user skips any drop-down between previously selected drop-down. To provide more context, consider a scenario where there are 10 drop-downs. The user selects a value in the first drop-down and skips drop-downs 2 to 5, instead selecting the 6th drop-down. In this case, an alert should be triggered, indicating that no drop-down should be skipped between previously selected drop-down. However, it is important to note that the user is not required to select all 10 drop-down; it is their choice. Therefore, the alert should only appear when there is a drop-down skipped between already selected drop-down, and not when the user decides not to select every drop-down present. Can you please modify the code to incorporate this functionality?
Tried many logics but the array is considering all the drop downs and alert message is triggered
|
Need to modify the code so that alert appears when user skips a drop down between already selected dropdowns |
|javascript|arrays|dropdown| |
null |
I don't do Go development, so I might be wrong, but looking at the gopls docs, the only formatting settings are `local` and `gofumpt`, and [`go.formatFlags`](https://github.com/golang/vscode-go/wiki/settings#goformatflags) and [`go.formatTool`](https://github.com/golang/vscode-go/wiki/settings#goformattool). And `go.formatFlags` is only relevant when not using the language server for formatting.
- https://github.com/golang/tools/blob/master/gopls/doc/settings.md#formatting
- https://cs.opensource.google/go/x/tools/+/master:gopls/doc/settings.md
- https://github.com/golang/vscode-go/wiki/settings
So I think you'd need to use some other formatting option (`go.formatTool`) to have more control over how formatting works.
Though again, I'm no Go dev, so take what I say with a grain of salt. I'd be happy to be wrong. |
Download the video using filetransfer and then that video i try to open in <video> tag but not loading
```
this.fileTransferDownload.download(this.videoUrl + this.videoObj.video_file_path, path + "Downloads/" + `${filename}`).then((entry: any) => {
console.log('download complete: ' + entry.nativeURL);
console.log('download complete: ', entry);
let localurl: any = this.ionicView.convertFileSrc(entry.nativeURL);
this.downloadURL = localurl;
<video id="singleVideo" style="width: 100%;"
```
```
loop webkit-playsinline="webkit-playsinline" poster="{{mediaUrl+videoObj.video_thumb}}"
playsinline="true" controls preload="none" >
<source *ngIf="downloadURL" src="{{downloadURL}}" type="video/mp4">
<source *ngIf="!downloadURL" src="{{videoUrl+videoObj.video_file_path}}" type="video/mp4">
</video>
```
downloadURl loads in android but not in`your text` ios
In ios showing white blank screen
Convert a file:// URL to a URL that is compatible with the local web server in the Web View plugin.
this works in android but not works in ios, need any solution for ios |
<video> tag with downloaded path in ionic ios not loads the video |
|ios|ionic-framework|html5-video|ionic7| |
null |
When using gopls, how to increase the length at which the line is wrapped? |
I have an issue about Keras.
```
import pandas as pd
import numpy as np
from keras.models import Sequential
from keras.layers import LSTM, Dense, Embedding
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
```
There is an Error message if the code is executed,
`from keras.preprocessing.text import Tokenizer
ModuleNotFoundError: No module named 'keras.preprocessing.text'`
Is there a solution for this error? Thank you. |
Import "keras.preprocessing.text" could not be resolved |
|python| |
null |
If you are familiar with #region you can still use this tag in vscode.
You could add `#region` and `#endregion` before and after the code that needs to be folder, such as:
# region
print("HelloWorld")
#endregion
[![enter image description here][1]][1]
You can manually click on the arrows, or use the shortcuts **ctr+8** and **ctrl+9** to collapse or expand.
[1]: https://i.stack.imgur.com/lGWf3.png |
In the GUI 1, there is a dropdown1 and a name field. When the user selects 'value1' from dropdown1, it will display dropdown2 and a number field(GUI 2). I need to create various test scenarios such as:
1. If the user selects 'value 1' from dropdown1, they should provide a new name. Then, the user needs to select 'DD Value 1' from dropdown2 and fill in the number field.
2. If user selects 'value 1' from dropdown1, they should provide a new name. Then, the user needs to select 'DD Value 2' from dropdown2 and fill the number field
This process should iterate to create all possible scenarios.
[GUI 1](https://i.stack.imgur.com/eCEUD.png)
[GUI 2](https://i.stack.imgur.com/YC0TL.png)
I've added for loops to run through the dropdowns and get values but I'm getting Error: locator.click: Error: strict mode violation: getByRole('option') resolved to 3 elements: in Playwright typescript and I'm unable to seect the exact item from the dropdown. |
Getting - Error: locator.click: Error: strict mode violation: getByRole('option') resolved to 3 elements: in Playwright typescript |
|playwright-typescript| |
null |
A possible workaround to prevent `.` from typing:
```js
$input.addEventListener('keydown', (e) => {
if(e.key === "."){
e.preventDefault();
// Optional alert message for a user:
// alert('Dot is not allowed, use comma instead');
}
});
``` |
I want to install the C compiler for the LC3. I am following this guide:
https://users.ece.utexas.edu/~ryerraballi/ConLC3.html
I am on the part where it is written:
> At the command prompt (shown as $) type in (Do not type the dollar)
> $ cd c:lc3/lcc-1.3
> to change directory to the directory that you previously downloaded the lcc software to.
> Run these three commands in order. Do not worry about warnings
> $ ./configure --installdir /bin
> $ make
> $ make install
> These commands will take a few minutes to complete at the end of which you will have the software built and installed
The specific part I am having trouble with is the command:
$ ./configure --installdir /bin
When I run it this happens:
/cygdrive/c/lc3/lcc-1.3
$ ./configure --installdir /bin
Cannot locate make binary.
I have removed my computer name from the start.
Do you know how to fix this?
|
According to my expirience, you'r right.
It looks like 'create_datagram_endpoint' creates a single connection and then works with it.
It confused me a lot when I started to experiment with asyncio.DatagramProtocol and expected that an every new connection will call 'connection_made', but instead of that, a connection was made once, when the listener started.
<br>
And if you will try to call
> transport.get_extra_info('socket')
in your 'connection_made' method you will see that it refers to a socket which was used to starting the listener.
I hope whis answer will help someone who came across this problem and was confused as I was.
|
In the GUI 1, there is a dropdown1 and a name field. When the user selects 'value1' from dropdown1, it will display dropdown2 and a number field(GUI 2). I need to create various test scenarios such as:
1. If the user selects 'value 1' from dropdown1, they should provide a new name. Then, the user needs to select 'DD Value 1' from dropdown2 and fill in the number field.
2. If user selects 'value 1' from dropdown1, they should provide a new name. Then, the user needs to select 'DD Value 2' from dropdown2 and fill the number field
This process should iterate to create all possible scenarios.
[GUI 1](https://i.stack.imgur.com/eCEUD.png)
[GUI 2](https://i.stack.imgur.com/YC0TL.png)
I've added for loops to run through the dropdowns and get values but I'm getting Error: locator.click: Error: strict mode violation: getByRole('option') resolved to 3 elements: in Playwright typescript and I'm unable to select the exact item from the dropdown. |
{"OriginalQuestionIds":[5187530],"Voters":[{"Id":476,"DisplayName":"deceze","BindingReason":{"GoldTagBadge":"javascript"}}]} |
UWP Apps run in a protected environment. As a result, many Win32, COM, and CRT API calls that might compromise platform security aren't allowed. The /ZW compiler option can detect such calls and generate an error.
The third-party libraries cannot be used in UWP,you can check the [Win32API supported in UWP.][1]
If you want to use the native C++ library which include third-party libraries in UWP project, you can try **Desktop Bridge technologies**. For more infromation, you can search Stefan Wick's blog [UWP with Desktop Extension – Part 1][2].
[1]: https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis.
[2]: https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/ |
I'm currently developing a React Native application using Expo and aiming to implement authentication via Sign in with Apple. My goal is to keep the authentication flow entirely within the app, avoiding any redirection to web browsers for a smoother user experience. After successfully signing in with Apple, I receive a JWT token, which I then want to use to authenticate with AWS Cognito.
I've set up Apple as an identity provider in the AWS Cognito console, including the creation of an App ID and Service ID in my Apple Developer account. However, I'm struggling with the next steps, specifically how to exchange the JWT token received from Apple for AWS Cognito credentials directly within my React Native application.
### Note : I don't want to use amplify hosted ui signInRedirect currently it has a bug on IOS platform. such as like this https://github.com/aws-amplify/amplify-ui/issues/4975
Here's what I've done so far in my React Native app using Expo:
1. Implemented Sign in with Apple using `expo-apple-authentication`.
```
const getAppleAuthContent = () => {
if (!userToken) {
return <AppleAuthentication.AppleAuthenticationButton
buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
cornerRadius={5}
style={ { height: 44, marginTop:5}}
onPress={ loginApple }
/>
} else {
const decoded = userToken.identityToken;
console.log(decoded); // How can I make upload user to cognito via issued token from apple
const current = Date.now() / 1000;
return (
<View>
<Text>{decoded.email}</Text>
<Text>Expired: {(current >= decoded.exp).toString()}</Text>
<Button title="Logout" onPress={logout} />
<Button title="Refresh" onPress={refresh} />
<Button title="Get Credential State" onPress={getCredentialState} />
</View>
)
}
};
```
2. Obtained the JWT token after a successful sign-in.
What I need help with is how to properly use this JWT token to authenticate with AWS Cognito. I'm aware that AWS Amplify or the AWS SDK for JavaScript could be involved in this process, but I'm unclear on the specifics, such as the correct API calls or methods to use.
Could someone provide guidance or a code snippet on how to achieve this? Specifically, how can I take the JWT token from the Apple sign-in process and use it to authenticate a user with AWS Cognito within a React Native application?
Thank you in advance for your assistance!
I am currently expecting platform specific solutions to sign in without hosted ui. |
Integrating Sign in with Apple into React Native App with AWS Cognito Authentication |
|amazon-web-services|authentication|amazon-cognito|aws-amplify|aws-identitypools| |
null |
I also faced this error. What I did was to first create the debug.log file under the wp-content directory. I realized that errors were not logging in this file. Eventually, I decided to change the permission for this file (right-click on the created debug.log file in cPanel, and click on Change Permissions). I changed to 777 (This enables write rule for the file).
I hope it helps! |
{"Voters":[{"Id":6752050,"DisplayName":"273K"},{"Id":44729,"DisplayName":"genpfault"},{"Id":1362568,"DisplayName":"Mike Kinghan"}]} |
You must use a pretty outdated version of Spring Data Elasticsearch. SpEL support for index names in the `@Document` annotation was introduced 4 years ago, you can see how this can be used in my post at https://www.sothawo.com/2020/07/how-to-provide-a-dynamic-index-name-in-spring-data-elasticsearch-using-spel/.
As for the reactive thing: you must never block a thread in reactive code. And the reactive code does this scrolling under the hood, I don't see why you want to do this by yourself. |
You can use this rule for first two steps.
rules:
- if: '$CI_MERGE_REQUEST && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
when: never
- when: always
And for only frontend changes just filter the folder structure like this;
only:
- changes:
- web/**/*
- master |
I'm currently developing a React Native application using Expo and aiming to implement authentication via Sign in with Apple. My goal is to keep the authentication flow entirely within the app, avoiding any redirection to web browsers for a smoother user experience. After successfully signing in with Apple, I receive a JWT token, which I then want to use to authenticate with AWS Cognito.
I've set up Apple as an identity provider in the AWS Cognito console, including the creation of an App ID and Service ID in my Apple Developer account. However, I'm struggling with the next steps, specifically how to exchange the JWT token received from Apple for AWS Cognito credentials directly within my React Native application.
### Note : I don't want to use amplify hosted ui signInRedirect currently it has a bug on IOS platform. such as like this https://github.com/aws-amplify/amplify-ui/issues/4975
Here's what I've done so far in my React Native app using Expo:
1. Implemented Sign in with Apple using `expo-apple-authentication`.
```javascript
const getAppleAuthContent = () => {
if (!userToken) {
return <AppleAuthentication.AppleAuthenticationButton
buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
cornerRadius={5}
style={ { height: 44, marginTop:5}}
onPress={ loginApple }
/>
} else {
const decoded = userToken.identityToken;
console.log(decoded); // How can I make upload user to cognito via issued token from apple
const current = Date.now() / 1000;
return (
<View>
<Text>{decoded.email}</Text>
<Text>Expired: {(current >= decoded.exp).toString()}</Text>
<Button title="Logout" onPress={logout} />
<Button title="Refresh" onPress={refresh} />
<Button title="Get Credential State" onPress={getCredentialState} />
</View>
)
}
};
```
2. Obtained the JWT token after a successful sign-in.
What I need help with is how to properly use this JWT token to authenticate with AWS Cognito. I'm aware that AWS Amplify or the AWS SDK for JavaScript could be involved in this process, but I'm unclear on the specifics, such as the correct API calls or methods to use.
Could someone provide guidance or a code snippet on how to achieve this? Specifically, how can I take the JWT token from the Apple sign-in process and use it to authenticate a user with AWS Cognito within a React Native application?
Thank you in advance for your assistance!
I am currently expecting platform specific solutions to sign in without hosted ui. |
None of the above worked for me.
Go to **System settings** > **Storage settings**. Click Developer, From the list delete Xcode Cache.
Worked for me |
|r|shiny|survival-analysis| |
Using @Bindable with a Observable type in SwiftUI |
|swift|swiftui|observation| |
iOS SwiftUI - URLSession requesting json array from server not working |
|ios|swift|swiftui| |
Technically, it _should_ be okay.
> Is it ok to push code with the Client ID in it?
The question you should ask yourself is, _what information does the client ID give away?_ According to the [Microsoft identity platform and the OAuth 2.0 client credentials flow](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) a `client_id` is,
> The Application (client) ID that the Azure portal – App registrations experience assigned to your app.
It is essentially like your name. It won't be the end of the world if you give it away but you probably should not where there is no reason to.
Quoting, [Should the OAuth client_id be kept confidential?](https://security.stackexchange.com/q/112615)
> Your client_id is like your username or e-mail address you use to authenticate your application/service to OAuth. It's not exactly top-secret, but putting it out in the public domain might also be undesirable.
Further,
> Can someone else use my Client ID?
Yes, but even in the [confidential client apps](https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-client-applications), _"The client ID is exposed through the web browser."_
Note that we can actually see the [Thunderbird](https://www.thunderbird.net/en-GB/)'s client id exposed in their [source code](https://github.com/mozilla/releases-comm-central/blob/84b21c33aa78df0ac4d0a83d42c37b22d955e5e7/mailnews/base/src/OAuth2Providers.jsm#L143). It isn't really meant to be private information.
> If I can't safely push this to a public GitHub, how do I handle it?
You can use a password manager if you are the only user of your extension. |
pytest command used in gitlab CICD pipeline does not automatically pick test_* script and throws error "CoverageWarning: No data was collected." |
|python-3.x|gitlab|pytest|code-coverage|cicd| |
null |
[Here are the errors I get](https://i.stack.imgur.com/IjOXn.png)
I wrote a web application that fetches data from LinkedIn badges when a user enters their username and clicks the "fetch data" button. The application displays the badge at the bottom and extracts data from its class elements (such as name, surname, and title). I want to convert this web application into a Google Chrome extension, so I wrote a manifest file. When I load it in developer mode, I get the errors attached. Does anyone know how to solve this?
I asked ChatGPT for help with my extension errors, and it suggested that I move the code to a server. However, after moving the code to a server, the errors persisted since it is a web application. I was unable to resolve these errors. |
> Whether a thread created using Linux's pthread library is a user-level thread or a kernel-level thread?
If it's created using a program or library hosted on top of the OS, then it is a user-level thread.
> [...] I've heard that different versions of the Linux kernel as well as different compiler versions can have an impact on the answer to the question.
No, they don't. Threads that run in userspace are user-level threads. Threads that run in the kernel are kernel-level threads. Unless you are writing kernel code, user-level threads are the only kind you can directly start or interact with. And if you are writing kernel code, then you don't have pthreads or other libraries to draw on, just the kernel itself.
You may be confused about historically there having been multiple Pthreads implementations for Linux, primarily:
- [LinuxThreads][1], the original Pthreads implementation for Linux. It runs on kernel 2.4+ (and perhaps earlier), and may still be running on a few legacy systems.
- the [Native Posix Thread Library (NPTL)][2], the prevailing replacement for LinuxThreads. It is widely considered superior to LinuxThreads in several important ways, but it does require facilities introduced in kernel 2.6.
Both those implementations create threads as entities that are scheduled by the kernel, but that does not make them kernel-level threads.
More generally, there have been threading implementations scheduled entirely in userspace, so-called "[green threads][3]". I'm not aware of any Linux pthreads implementation using this approach, but if there were, they would certainly provide user-level threads.
Linux does have kernel-level threads, but your user-level programs will not see them or interact directly with them.
[1]: https://en.wikipedia.org/wiki/LinuxThreads
[2]: https://en.wikipedia.org/wiki/Native_POSIX_Thread_Library
[3]: https://en.wikipedia.org/wiki/Green_thread |
from bs4 import BeautifulSoup
# Assuming you have your HTML content in 'html_content'
soup = BeautifulSoup(html_content, 'html.parser')
# Find the parent span and extract the text, excluding the nested span's text
rain_forecast = soup.find("span", {"class": "Column--precip--3JCDO"}).contents[-1].strip()
print(rain_forecast)
|
My program utilizes a 'for' loop parallelized with two methods: OpenMP and oneTBB, with oneTBB executing faster.
What's the difference between OpenMP and oneTBB at a low level (memory organization, thread creation, cache)?
I use a parallel 'for' loop in the Gauss algorithm, and regardless of the matrix size, oneTBB executes faster than OpenMP. |
OpenMP & oneTbb difference |
|c++|multithreading|openmp|tbb|intel-oneapi| |
null |
* PYPI Page: https://pypi.org/project/wfastcgi/
* Source Code: [PTVS on GitHub](https://github.com/Microsoft/PTVS/tree/master/Python/Product/WFastCgi)
* Issues: [PTVS on GitHub](https://github.com/microsoft/PTVS/issues?q=is:issue+wfastcgi)
Microsoft developed this component as part of the Python extensions for Azure App Service on Windows initially but has deprecated it as the Python extensions, so you should either completely switch to Linux or use HttpPlatformHandler with IIS.
https://learn.microsoft.com/visualstudio/python/configure-web-apps-for-iis-windows#configure-the-fastcgi-handler
> **Important**
>
> We recommend using **HttpPlatformHandler** to configure your apps, as the WFastCGI project is no longer maintained.
|
**Don't use wfastcgi for Python web apps as it is deprecated**
wfastcgi.py provides a bridge between IIS and Python using WSGI and FastCGI, similar to what mod_python provides for Apache HTTP Server.
It can be used with any Python web application or framework that supports WSGI, and provides an efficient way to handle requests and process pools through IIS. |
Entry field values are not getting printed - Python |
|python|tkinter|pycharm| |
null |
It should work like this
```
library(terra)
# do not make a list
red <- list.files(pattern = "red")
nir <- list.files(pattern = "nir")
calc_ndvi <- function(nir, red) {
(nir-red)/(nir+red)
}
ndvi <- list()
for (i in 1:9){
ndvi[[i]] <- calc_ndvi(rast(nir[i]), rast(red[i]))
}
ndvi <- rast(ndvi)
```
But you can also do them all at once like this
```
ndvi <- calc_ndvi(rast(nir), rast(red))
```
Or like this
```
ndvi <- lapp(sds(red, nir), calc_ndvi)
```
|
When using google colab with python language. How exactly do I copy specific amount of data like 100 file (from 900 file) from downloaded directory to another directory? Since I use this command it copying all file din directory
```
!cp /content/dataset/train/rottenapples/*.png /content/fresh_rotten/rotten_pic
```
Is it using loop with specific range? |
Copying specific file amount |
I just restored Android Studio to default settings and it's working fine now. This is the solution to This Error and it's simple and easy. |
Bot for investing |
|python|selenium-chromedriver| |
null |
It is strange that `OUTER` cannot be used as a label name for loop control in Raku. For example,
```
OUTER:
loop {
loop { state $c = 0; say $c++; last OUTER if $c > 2 }
}
```
The output and the error message is as follow:
```
0
1
2
Cannot resolve caller last(OUTER:U); none of these signatures matches:
( --> Nil)
(Label:D $x --> Nil)
in block at <unknown file> line 1
in block <unit> at <unknown file> line 1
in any <main> at /opt/homebrew/Cellar/rakudo-star/2024.03/bin/../share/perl6/runtime/perl6.moarvm line 1
in any <entry> at /opt/homebrew/Cellar/rakudo-star/2024.03/bin/../share/perl6/runtime/perl6.moarvm line 1
```
Changing `OUTER` to `OUT`, `OUTE`, `OUTA`, etc. will work just fine. Is `OUTER` a type name which cannot be used as a label name? I have searched for it but cannot find any mention of `OUTER` in docs.raku.org. |
cannot use `OUTER` as label name for loop control in Raku |
|raku| |
This is a common problem and here is the solution: After completion of that object's usage we have to nullify the object. This worked for me.
|
Try this:
df['variableType'] = df['firstName'] + '_' + df['names']
pvt = pd.pivot_table(df, index=['variableType'], values='variableValue', columns=['variableName'])
pvt
variableName varX varY
variableType
abc123_v_001 1.0 3.0
abc123_v_002 2.0 4.0
efg456_v_001 1.0 3.0
efg456_v_002 2.0 4.0 |
{"OriginalQuestionIds":[2960772],"Voters":[{"Id":523612,"DisplayName":"Karl Knechtel","BindingReason":{"GoldTagBadge":"python"}}]} |
Please provide your viewset/serializer code and the error you're getting, it is hard to try to help you with this information. But the "No active account found with the given credentials" error is not saying that there isn't an account, it's saying no ACTIVE account so check if you have `is_active` field in your models and check if it's set to False then set it to True to fix the problem. |
I am trying to perform multiple counts based on different conditions and group the results by year and month.
I have a complaints table, and I want to count:
* Total Received complaints per year and month
* Received complaints per year and month which got Cancelled
* Received complaints per year and month which got Resolved, etc...
I am using multiple nested select statements to do a count for each scenario and they work on their own.
However, when I run the whole query I get an error:
Column 'db.CustomerComplaints.id_Contact' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Please see my code below:
```
SELECT
YEAR(ReceivedDate) AS 'Year',
FORMAT(ReceivedDate, 'MMMM') AS 'Month name',
COUNT(*) AS 'Received Complaints'
,
(SELECT COUNT(*)
FROM db.CustomerComplaints t
WHERE t.status = 'Resolved'
AND t.id_Contact = cc.id_Contact
) AS 'Resolved Complaints'
,
(
SELECT COUNT(*)
FROM db.CustomerComplaints t
WHERE t.status = 'New'
AND t.id_Contact = cc.id_Contact
) AS 'New Complaints'
FROM hug2.CustomerComplaints cc
LEFT JOIN hug2.ReferralUpdates r
ON cc.id_Contact = r.Reference
WHERE r.ReferenceCode = 'Project1'
GROUP BY YEAR(ReceivedDate), FORMAT(ReceivedDate, 'MMMM')
```
What I want to get as a results is:
| Year | Month | Received Complaints | Resolved Complaints | New Complaints |
|------|-------|---------------------|---------------------|----------------|
| 2023 | March | 5 | 5 | 0 |
| 2023 | April | 15 | 10 | 5 |
| 2024 | March | 7 | 4 | 3 |
I hope my question make sense.
|
|bash|terminal|cron|xterm| |
null |
null |
null |
null |
null |
To delete only one token, use `git credential-store erase`.
For example, to delete the currently used GitHub token, use:
```sh
echo -e "protocol=https\nhost=github.com" | git credential-store erase
``` |
So, if you run the command that the build script is trying to run - `pkg-config --libs --cflags libseat` - and it will tell you that libsystemd is missing. The package for this is `libsystemd-dev`
This means that you need to run `sudo apt install libsystemd-dev`
This is a dependencies error somewhere along the lines - probably by the `libseat-dev` packager. |
I recently ran into a very similar problem with a .NET 8 forms application on all the latest stuff. When started by Visual Studio (Debugger or Release build) no issues. When run outside Visual Studio, the only way it would not hang is if the rate of UI events being processed was extremely slow. Clicking a checkbox, OK. Moving a slider, hang.
1. Create a debug build of the application that hangs
2. Start it outside of Visual Studio
3. With VS running, attach the debugger to the running process
4. Reproduce the hang conditions and
5. Pause the application from Visual Studio Debugger
6. Open Diagnostic Tools (if it isn't already open)
7. Click on the parallel stacks tab
8. Even if you are running another application in the debugger already, poke around the threads and async stacks until you find the ones from the process to which the debugger was attached.
9. Look at each one until you find the line where your hung
For me it was a Console.WriteLine call leftover from someone's lousy debugging. I learned a long time ago, to avoid, whenever possible, using Console.WriteLine to debug. That line was in a common method called by nearly all UI event handlers. That probably isn't everyone's problem, my response is more about the recipe above used on VS 2022 to very quickly get to the heart of the problem. Cheers.
|
I am using the product function of polars.
I have a dataframe with 1458644 rows and one of its column is 'vendor_id' and has unique values = [1,2].
While trying to run the product function on the entire df, it return 0.
However, if i run the product function on unique values it returns 2.
Any reason as to why this is happening?
|
Product aggregation does not work as expected |
if you are facing this issue for the react after creating the react app then always check for the folder are you in is correct or not .....? run cd "project name" then again try "npm start" command |
|python|subprocess|pipe|xterm| |
I created a code with he help of AI to help predict NBA outcomes. Here's part of my code that calculates the differences:
```
def calculate_differences(team_data, opponent_data):
return (
team_data['ORtg'].values[0] - opponent_data['ORtg'].values[0],
team_data['DRtg'].values[0] - opponent_data['DRtg'].values[0],
team_data['SOS'].values[0] - opponent_data['SOS'].values[0],
team_data['SRS'].values[0] - opponent_data['SRS'].values[0],
team_data['TS%'].values[0] - opponent_data['TS%'].values[0],
team_data['TOV%'].values[0] - opponent_data['TOV%'].values[0],
team_data['Age'].values[0] - opponent_data['Age'].values[0],
team_data['ORB%'].values[0] - opponent_data['ORB%'].values[0],
team_data['W'].values[0] - opponent_data['W'].values[0],
team_data['3PAr'].values[0] - opponent_data['3PAr'].values[0],
team_data['Pace'].values[0] - opponent_data['Pace'].values[0]
)
```
The differences between each team is calculated and put in my regression equation:
```
def predict_outcome(ortg_difference, drtg_difference, sos_difference, srs_difference, ts_difference, tov_difference, threepar_difference, pace_difference,
intercept_win, coef_ortg_difference, coef_drtg_difference, coef_sos_difference, coef_srs_difference,
coef_ts_difference_win, coef_tov_difference_win, coef_threepar_difference_win, coef_pace_difference_win):
log_odds = (
intercept_win +
coef_ortg_difference_win * ortg_difference +
coef_drtg_difference_win * drtg_difference +
coef_sos_difference_win * sos_difference +
coef_srs_difference_win * srs_difference +
coef_ts_difference_win * ts_difference +
coef_pace_difference_win * pace_difference +
coef_tov_difference_win * tov_difference +
coef_threepar_difference_win * threepar_difference
)
probability_win = 1 / (1 + math.exp(-log_odds))
return probability_win, log_odds
```
This is part of my
def(main):
ortg_diff, drtg_diff, sos_diff, srs_diff, ts_diff, pace_diff, tov_diff, threepar_diff, age_diff, orb_diff, win_diff = calculate_differences(team_data, opponent_data)
probability_win_main_first, log_odds_win_main_first = predict_outcome(
ortg_diff, drtg_diff, sos_diff, srs_diff, ts_diff, pace_diff, tov_diff, threepar_diff,
intercept_win, coef_ortg_difference_win, coef_drtg_difference_win, coef_sos_difference_win,
coef_srs_difference_win, coef_ts_difference_win, coef_pace_difference_win, coef_tov_difference_win, coef_threepar_difference_win
)
These are different parts of my code that all have to do with predicting just the outcome and the probability.
My main issue was I was getting really crazy numbers and probabilities:
Team: Magic
Opponent: Heat
\-Magic BEATS Heat: 100.00%
Odds for Win: **840568.56** (higher = better)
Regression for Win: 13.64
Win (1) Distance: -12.64
Predicted Margin: 1.02
Halftime Lead Probability: 54.53%
Team: Heat
Opponent: Magic
\-Heat BEATS Magic: 0.00%
Odds for Win: **0.00** (higher = better)
Regression for Win: -13.64
Win (1) Distance: 14.64
Predicted Margin: -1.02
Halftime Lead Probability: 45.68%
I added some code to help debug and point out any issues. I wanted code to tell me what values the code used to get its calculations. This is what was returned:
```
WinLoss Regression Formula:
Log Odds (Win) = 1.0330e-17 + -2.2130 * ORtg Difference + 2.0735 * DRtg Difference + -2.0870 * SOS Difference + 2.1643 * SRS Difference + 27.2186 * TS% Difference + -0.1440 * Pace Difference + -0.1907 * TOV% Difference + 4.0731 * 3PAr Difference
Differences:
ORtg Difference: -2.2000
DRtg Difference: -3.0000
SOS Difference: 0.9100
SRS Difference: 1.7900
TS% Difference: -0.0120
Pace Difference: 1.1000
TOV% Difference: -4.6000
3PAr Difference: 3.1000
2.0999999999999943
```
the number at the very bottom represents the actual Pace difference between teams. this is what I used to see that:
```
# Print Differences
print("\nDifferences:")
print(f"ORtg Difference: {ortg_diff:.4f}")
print(f"DRtg Difference: {drtg_diff:.4f}")
print(f"SOS Difference: {sos_diff:.4f}")
print(f"SRS Difference: {srs_diff:.4f}")
print(f"TS% Difference: {ts_diff:.4f}")
print(f"Pace Difference: {pace_diff:.4f}")
print(f"TOV% Difference: {tov_diff:.4f}")
print(f"3PAr Difference: {threepar_diff:.4f}")
print(team_data['Pace'].values[0] - opponent_data['Pace'].values[0])
```
As you can see the correct Pace Difference is 2.09. However the pace_diff used in the formula is 1.1
I'd just like to know what could have gone wrong between the calculation of the Pace difference to def(main) where pace_diff becomes a completely different value. |
I have a form with an InfiniteContainer(bodyCnt) which contains 3 containers.
All of the 3 containers have their client properties.
I search for a container in bodyCnt with client property = 'search_tag' by programming.
while (n<20){
((InfiniteContainer)cnt).continueFetching();
for (int i=0; i<cnt.getComponentCount();i++){
if (cnt.getComponentAt(i).getClientProperty(tag)!=null){
if (cnt.getComponentAt(i).getClientProperty(tag).equals(search_tag)){
cmp = cnt.getComponentAt(i);
}
}
}
n++;
}
The last container shows two times in the `InfiniteContainer`.
|
If you don't want to create custom Property Decorators, this is the solution I came up with.
Simply set the fields to optional and then add an additional field that will check if one of them has been provided
export class GetGuildDto {
@IsInt()
@Type(() => Number)
@IsOptional()
@ApiProperty({required: false, ...exampleId})
id?: number;
@IsString()
@Type(() => String)
@IsOptional()
@ApiProperty({required: false, ...exampleDiscordId})
discordId?: string;
@ValidateIf(o => o.id === undefined && o.discordId === undefined)
@IsDefined({message: 'At least one of id or discordId must be provided'})
readonly atLeastOne = (this.id || this.discordId)
}
ps. @Type is from class-transformer, the rest are from nestjs & class-validator |
What am I doing wrong here? I have a data set with date values formatted mm-dd-yyyy.
<br>ex.
[![Date column sample data][1]][1]
I am creating a new column with the day extracted from each date, but when I use DAY() function I get #VALUE. I've set the Date column to Date type but to no avail. Any insight would be appreciated.
[1]: https://i.stack.imgur.com/46sZZ.png |
How to properly use the Excel DAY function |
|excel|data-analysis| |
First of all here is my code:
My controller:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using DataBase.Data;
using DataBase.Data.Models;
namespace DataBase.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FoodDatabasesController : ControllerBase
{
private readonly FoodDbContext _context;
public FoodDatabasesController(FoodDbContext context)
{
_context = context;
}
// GET: api/FoodDatabases
[HttpGet]
public async Task<ActionResult<IEnumerable<FoodDatabase>>> GetFoodDatabases()
{
return await _context.FoodDatabases.ToListAsync();
}
// GET: api/FoodDatabases/5
[HttpGet("{id}")]
public async Task<ActionResult<FoodDatabase>> GetFoodDatabase(int id)
{
var foodDatabase = await _context.FoodDatabases.FindAsync(id);
if (foodDatabase == null)
{
return NotFound();
}
return foodDatabase;
}
// PUT: api/FoodDatabases/5
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPut("{id}")]
public async Task<IActionResult> PutFoodDatabase(int id, FoodDatabase foodDatabase)
{
if (id != foodDatabase.Id)
{
return BadRequest();
}
_context.Entry(foodDatabase).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!FoodDatabaseExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
// POST: api/FoodDatabases
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPost]
public async Task<ActionResult<FoodDatabase>> PostFoodDatabase(FoodDatabase foodDatabase)
{
_context.FoodDatabases.Add(foodDatabase);
await _context.SaveChangesAsync();
return CreatedAtAction("GetFoodDatabase", new { id = foodDatabase.Id }, foodDatabase);
}
// DELETE: api/FoodDatabases/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteFoodDatabase(int id)
{
var foodDatabase = await _context.FoodDatabases.FindAsync(id);
if (foodDatabase == null)
{
return NotFound();
}
_context.FoodDatabases.Remove(foodDatabase);
await _context.SaveChangesAsync();
return NoContent();
}
private bool FoodDatabaseExists(int id)
{
return _context.FoodDatabases.Any(e => e.Id == id);
}
}
}
```
here is my data base and db context
```
public class FoodDatabase
{
[Key]
public int Id { get; set; }
[MaxLength(150), Column(TypeName = "nvarchar(150)")]
public string Food { get; set; } = "Food Name";
[MaxLength(150), Column(TypeName = "nvarchar(300)")]
public string Description { get; set; } = "Description";
}
```
```
public class FoodDbContext : DbContext
{
public FoodDbContext(DbContextOptions<FoodDbContext> options)
: base(options)
{
}
public DbSet<FoodDatabase> FoodDatabases { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Seed data
modelBuilder.Entity<FoodDatabase>().HasData(
new FoodDatabase
{
Id = 1,
Food = "Foodbread",
Description = "A delicious bread made for food lovers"
});
}
}
```
and below are my 2 migrations
```
using Microsoft.EntityFrameworkCore.Migrations;
namespace DataBase.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "FoodDatabases",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Food = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
Description = table.Column<string>(type: "nvarchar(300)", maxLength: 150, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FoodDatabases", x => x.Id);
});
// Seed data
migrationBuilder.InsertData(
table: "FoodDatabases",
columns: new[] { "Id", "Food", "Description" },
values: new object[] { 1, "Foodbread", "A delicious bread made for food lovers" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FoodDatabases");
}
}
}
```
```
// <auto-generated />
using DataBase.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DataBase.Migrations
{
[DbContext(typeof(FoodDbContext))]
partial class FoodDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DataBase.Data.Models.FoodDatabase", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(300)");
b.Property<string>("Food")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.HasKey("Id");
b.ToTable("FoodDatabases");
});
#pragma warning restore 612, 618
}
}
}
```
lastly here is program.cs and app settings with connection string
```
using DataBase.Data;
using DataBase.Data.Models;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<FoodDbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
// Configure CORS
builder.Services.AddCors(options =>
{
options.AddPolicy("CORSPolicy",
builder =>
{
builder
.AllowAnyMethod()
.AllowAnyHeader()
.AllowAnyOrigin();
});
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseRouting(); // <- This is required for routing
app.UseCors("CORSPolicy"); // Apply CORS policy
app.UseAuthorization();
app.MapControllers();
app.Run();
```
```
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Data Source=(localdb)\\MSSQLLocalDB;Database = WebApiReact,Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
}
}
```
The problem I'm currently facing is that when i open the solution in swagger, and i want to try out the get, post and put functions they always give the same error, I'm confused as to why and looking for some guidance on where i can improve on it |
My ASP.NET server does not work and i wondering on whats missing, when i open the swagger i get error 500 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.