instruction stringlengths 0 30k ⌀ |
|---|
|marquee| |
null |
![Unwanted text on icon][1]
I created a return icon while designing, but this text appeared on it. What is this text and how do I solve this?
There does not seem to be an error in my code, I searched the internet but could not find any results.I don't know how to investigate.
[1]: https://i.stack.imgur.com/V1z9V.png |
Unwanted text on created icon |
null |
This is kinda late but if you want to change the desktop icon and the overall icon when you open the .jar file, you can use the Launch4j and this.
`
ClassLoader classLoader = Main.class.getClassLoader();
URL resourceURL = classLoader.getResource("nameOfYourPackage/nameOfImage.png");
ImageIcon thisIsTheName = new ImageIcon(resourceURL);
frame.setIconImage(thisIsTheName);
`
This works with in audio too
|
```
static ArrayList<Integer> LinearSearch(int[] arr,int index,int target) {
ArrayList<Integer> iList = new ArrayList<>();
if(index == arr.length){
return iList;
}
if(arr[index] == target){
iList.add(index);
}
ArrayList<Integer> temp = LinearSearch(arr,index+1,target);
iList.addAll(temp);
return iList;
}
```
above code is my instructors code i don't understand temp part. what is going on stack anyone can help me understand.
this is my code. I can understand this. we collect items. but i cant understand above code.
```
static ArrayList<Integer> LinearSearch(int[] arr,int index,int target) {
ArrayList<Integer> iList = new ArrayList<>();
if(index == arr.length){
return iList;
}
iList = LinearSearch(arr,index+1,target);
if(arr[index] == target){
iList.addFirst(index);
}
return iList;
}
``` |
i have the following block of code that checks if the field with id=streetNumber contains either the values 23 or 45 and adds a value depending on what it finds
```
async function replace(page: Page) {
if (await page.locator('id=streetNumber'), { hasText: "23"}) {
await page.locator('id=streetNumber').fill('45');
}
else {
await page.locator('id=streetNumber').fill('23');
}
}
```
My problem is that every time it fills in 45, even if instructed to fill in 45 only if 23 is already there and to fill in 23 if anything else is there. What is going wrong here ? |
Playwright checking the text of a locator and replacing values |
|typescript|function|if-statement|playwright| |
I'm trying to ggplot2 as facet_wrap box plot, but I'm having trouble in few things:
1- triangle symbol isn't showing in the graph but it shows in the environment window and console
2- in facet_wrap I'm using theme_lindraw and I want to remove x axis labels and leave it at the bottom panel only
3- I want to add geom_signif for each panel separately but it keeps labelling all panels same annotations which I don't want
4- How to increase y axis to have a space between annotations and the border of the plot
here's my coding
```
strains<-rep(c("wt","dfg1\u25b3","asd1\u25b3","dfg1\u25b3 asd1\u25b3"),each=6)
x<-rep(c("0mM","4mM"),each=3)
y<-c(12,12.91,12.5,15,15.1,14,12,12.2,12.3,15.,15.3,15.9,7.1,7.7,7.3,11.5,11.6,11.1,7.5,7.4,7.3,12,11,10)
df<-data.frame(x,y,strains)
df$strains<-factor(df$strains,levels = c("wt","dfg1\u25b3","asd1\u25b3","dfg1\u25b3 asd1\u25b3"),ordered = TRUE)
ggplot(df)+
aes(x=x,y=y,fill=x)+
geom_boxplot()+
geom_point()+
geom_signif(comparisons = list(c("omM","4mM"),c("omM","4mM"),c("omM","4mM"),c("omM","4mM")), map_signif_level = TRUE,annotations = c("*","**","**","*"),y=c(16,17,12,13))+
facet_wrap(~strains,scales = "free",ncol = 1)+
xlab("")+
ylab("("*mu~"m)")+
scale_fill_manual(values = c("0mM"="gray","4mM"="pink"))+
theme_linedraw(base_size = 16)+
theme(axis.line = element_blank(),plot.background = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),legend.position = "none",strip.background = element_rect(fill = "black"))
```

attached image to clarify what I did and what codes aren't working |
null |
Instead of going for `valueChanges` which seems to be tedious for form array, instead try the below approach, where we listen for the input changes using `(input)` event and also reset the autocomplete using `(opened)` and `(click)` event where we reset the inputs latest value, by passing the fields as arguments to the functions, please refer the below code/stackblitz for your reference!
ts
import { Component, OnInit } from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
FormGroup,
FormControl,
FormArray,
FormBuilder,
Validators,
} from '@angular/forms';
import { AsyncPipe, CommonModule } from '@angular/common';
import {
MatAutocomplete,
MatAutocompleteModule,
} from '@angular/material/autocomplete';
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field';
import { Observable, map, of, startWith } from 'rxjs';
/**
* @title Highlight the first autocomplete option
*/
@Component({
selector: 'autocomplete-auto-active-first-option-example',
templateUrl: 'autocomplete-auto-active-first-option-example.html',
styleUrl: 'autocomplete-auto-active-first-option-example.css',
standalone: true,
imports: [
FormsModule,
MatFormFieldModule,
MatInputModule,
MatAutocompleteModule,
ReactiveFormsModule,
AsyncPipe,
CommonModule,
],
})
export class AutocompleteAutoActiveFirstOptionExample implements OnInit {
productFormarray: any;
quantitylist = [0.5, 1, 1.5];
items!: FormArray;
totalGstPrice: number = 0;
totalProductPrice: number = 0;
productlist = [
{ productname: 'apple', price: 10, gst: 10 },
{ productname: 'orange', price: 20, gst: 12 },
{ productname: 'lemon', price: 30, gst: 20 },
];
productlistss = ['apple', 'lemon', 'orange'];
filteroptions!: Observable<string[]>;
resetFilters() {
this.filteroptions = of(this.productlistss);
}
constructor(private fb: FormBuilder) {
this.productFormarray = new FormGroup({
customername: new FormControl('', Validators.required),
productdetails: new FormArray([]),
remember: new FormControl('true'),
totalprice: new FormControl(''),
});
}
private _filter(value: string): string[] {
const searchvalue = value.toLocaleLowerCase();
return this.productlistss.filter((option) =>
option.toLocaleLowerCase().includes(searchvalue)
);
}
onProductChange(selectedProductName: string, index: number) {
const selectedProduct = this.productlist.find(
(product) => product.productname === selectedProductName
);
if (selectedProduct) {
const productDetailsArray = this.productFormarray.get(
'productdetails'
) as FormArray;
if (productDetailsArray && productDetailsArray.at(index)) {
const quantityControl = productDetailsArray.at(index).get('quantit');
if (quantityControl) {
const quantity = quantityControl.value;
const price = selectedProduct.price * quantity;
const priceControl = productDetailsArray.at(index).get('price');
if (priceControl) {
priceControl.setValue(price);
}
}
}
}
}
onQuantityChange(selectedQuantity: number, index: number) {
const productDetailsArray = this.productFormarray.get(
'productdetails'
) as FormArray;
if (productDetailsArray && productDetailsArray.at(index)) {
const productNameControl = productDetailsArray
.at(index)
.get('productname');
if (productNameControl) {
const selectedProductName = productNameControl.value;
const selectedProduct = this.productlist.find(
(product) => product.productname === selectedProductName
);
if (selectedProduct) {
const price = selectedProduct.price * selectedQuantity;
const priceControl = productDetailsArray.at(index).get('price');
if (priceControl) {
priceControl.setValue(price);
}
}
}
}
}
onPriceChange(selectedQuantity: number, index: number) {
const productDetailsArray = this.productFormarray.get(
'productdetails'
) as FormArray;
if (productDetailsArray && productDetailsArray.at(index)) {
const productNameControl = productDetailsArray
.at(index)
.get('productname');
if (productNameControl) {
const selectedProductName = productNameControl.value;
const selectedProduct = this.productlist.find(
(product) => product.productname === selectedProductName
);
if (selectedProduct) {
const priceControl = productDetailsArray.at(index).get('price');
const gst = (selectedProduct.gst * priceControl?.value) / 100;
const gstControl = productDetailsArray.at(index).get('gst');
gstControl?.setValue(gst);
}
}
}
}
addNewProduct() {
debugger;
this.items = this.productFormarray.get('productdetails') as FormArray;
const newProduct = this.createNewProduct();
this.items.push(newProduct);
const indexvalue = this.items.length - 1;
this.productFormarray
.get('productdetails')
.controls[indexvalue].get('quantit')
.setValue(this.quantitylist[1]);
const productNameControl = newProduct.get('productname');
if (productNameControl) {
productNameControl.valueChanges.subscribe((selectedProductName) => {
this.onProductChange(selectedProductName, indexvalue);
});
}
const quantityControl = newProduct.get('quantit');
if (quantityControl) {
quantityControl.valueChanges.subscribe((selectedQuantity) => {
this.onQuantityChange(selectedQuantity, indexvalue);
});
}
const priceControl = newProduct.get('price');
if (priceControl) {
priceControl.valueChanges.subscribe((selectedProductName) =>
this.onPriceChange(selectedProductName, indexvalue)
);
}
}
createNewProduct(): FormGroup {
return new FormGroup({
productname: new FormControl('', Validators.required),
quantit: new FormControl('1', Validators.required),
price: new FormControl('', Validators.required),
gst: new FormControl('', Validators.required),
});
}
removeProduct(index: any) {
this.items = this.productFormarray.get('productdetails') as FormArray;
this.items.removeAt(index);
}
get productdetailsarray() {
return this.productFormarray.get('productdetails') as FormArray;
}
ngOnInit() {
this.addNewProduct();
console.log('filteroption--- = ' + this.filteroptions);
}
performFiltering(input: any) {
if (input.value) {
this.filteroptions = of(this._filter(input.value));
} else {
this.filteroptions = of(this.productlistss);
}
}
clicked(input: any) {
this.filteroptions = of(this.productlistss);
if (input.value) {
this.performFiltering(input);
}
}
onSubmit() {}
}
html
<form [formGroup]="productFormarray" (ngSubmit)="onSubmit()">
<div class="reg-right">
<div class="formGroup">
<label for="customername" class="form-label">Customer Name</label>
<input
type="text"
class="form-control"
id="customername"
placeholder="Customer Name"
formControlName="customername"
/>
</div>
<div class="formGroup" formArrayName="productdetails">
<div class="table-responsive">
<table class="table table-bordered" style="margin-top: 20px">
<thead>
<tr>
<td style="width: 40%">Product Name</td>
<td style="width: 15%">Quantity</td>
<td style="width: 15%">Price</td>
<td style="width: 15%">Gst</td>
<td></td>
</tr>
</thead>
<tr
*ngFor="let product of productdetailsarray.controls; let i=index"
[formGroupName]="i"
>
<td>
<div class="formGroup">
<input
formControlName="productname"
[id]="'productname_' + i"
[name]="'productname_' + i"
matInput
#input
type="text"
[matAutocomplete]="auto"
class="form-control"
(click)="clicked(input)"
(input)="performFiltering(input)"
(opened)="performFiltering(input)"
/>
<mat-autocomplete #auto="matAutocomplete">
<mat-option
*ngFor="let product of filteroptions | async"
[value]="product"
>
{{product}}
</mat-option>
</mat-autocomplete>
</div>
</td>
<td>
<div class="formGroup">
<select
class="form-control"
[id]="'quantit_' + i"
[name]="'quantit_' + i"
formControlName="quantit"
>
<option
*ngFor="let quantity of quantitylist"
[ngValue]="quantity"
>
{{quantity}}
</option>
</select>
</div>
</td>
<td>
<div class="formGroup">
<input
type="text"
class="form-control"
[id]="'price_' + i"
[name]="'price_' + i"
formControlName="price"
placeholder="Price "
readonly
/>
</div>
</td>
<td>
<div class="formGroup">
<input
type="text"
class="form-control"
id="gst"
formControlName="gst"
placeholder="Gst"
name="gst"
readonly
/>
</div>
</td>
<td>
<a
type="button"
class="form-control btn btn-primary"
style="background-color: red"
(click)="removeProduct(i)"
>Remove (-)</a
>
</td>
</tr>
</table>
</div>
<a
type="button"
class="btn btn-secondary"
style="background-color: green"
(click)="addNewProduct()"
>Add(+)</a
>
<br />
</div>
<br />
<br />
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6">
<div class="formGroup">
<label for="totalprice" class="form-label" style="margin-top: 10pt"
>Total Product Price</label
>
<input
type="text"
class="form-control form-control1"
id="totalprice"
formControlName="totalprice"
placeholder="totalprice"
name="totalprice"
style="margin-left: 20pt; float: right"
readonly
/>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
[Stackblitz Demo](https://stackblitz.com/edit/oapfjm) |
As far as I understand it, the `await` keyword prevents a function from continuing until the called asynchronous function completes. Essentially, it makes the asynchronous function synchronous. So that the following holds:
```c#
await MyAsyncMethod(); // first this is called
await MyOtherAsyncMethod(); // only when the above completes, this is called
MyNonAsyncMethod(); // similarly, this is only called when the above completes
```
Now in most code editors, omitting the `await` keyword results in a warning. This is baffling to me given my understanding of what `async` is supposed to accomplish. For if we await every asynchronous method, are we not thereby making them all synchronous, and thus defeating the very purpose of asynchronous programming?
For example, in my specific use-case, I have a function that saves a blogpost to a database, and emails all of the blog's subscribers to notify them that a new post has been created. From the perspective of the user that creates the blogpost, it is pointless to wait for the result of the mailing. The mailing logic is a simple `for` loop that just sends emails out to the subscribers and returns no information worth considering. The user only cares that the blogpost has been created, and that the mailing logic has initiated, and he wants to receive this information promptly. I have therefore left out the `await` keyword and have allowed the process to continue in the background, while returning to the user a value that indicates that all is OK.
```c#
public async Task<IActionResult> Create(Blogpost blogpost)
{
try
{
// save to db
await CreateBlogPostAsync(blogpost);
// initiate mailing logic
NotifySubscribersAsync();
return Ok(blogpost);
}
catch
{
// return error code
return StatusCode(500);
}
}
```
This works perfectly for my use-case. I don't want the user to have to wait a long time for the sending process to complete before he receives an OK signal. I thought that this is precisely what asynchronous programming was meant to accomplish: allowing processes to happen in the background while the function continues. Yet, though the code compiles and runs alright for my purposes, VSCode warns me that I should be using the await keyword.
What is it I am not understanding here? |
.NET: How to add launch on startup option to ClickOnce installer |
|c#|.net|wpf|visual-studio|clickonce| |
use pandas and duckdb
def function1(dd:pd.DataFrame):
dd1=df1.sql().filter("date<='{}'".format(dd.Date.iloc[0])).select("*,case when date='{}' then Home_Team else Winner end as winner2".format(dd.Date.iloc[0])).order("date desc").df()
dd2=dd1.groupby(['winner2'],as_index=False).agg(col2=("col1",lambda x:x.diff(-1).eq(1).cumprod().sum()))
return dd.sql().join(dd2.sql().select("winner2,col2"),"home_team=winner2",'left').select("* exclude(index,winner2)").df()
df1.assign(col1=df1.Date.rank(method='dense')).groupby(['Date'],as_index=False).apply(function1).reset_index(drop=1).fillna(0)
:
Date Home_Team Away_Team Winner col2
0 2005-08-06 A G A 0
1 2005-08-06 B H H 0
2 2005-08-06 C I C 0
3 2005-08-06 D J J 0
4 2005-08-06 E K K 0
5 2005-08-06 F L F 0
6 2005-08-13 A B A 1
7 2005-08-13 C D D 1
8 2005-08-13 E F F 0
9 2005-08-13 G H H 0
10 2005-08-13 I J J 0
11 2005-08-13 K L K 1
12 2005-08-20 B C B 0
13 2005-08-20 A D A 2
14 2005-08-20 G K K 0
15 2005-08-20 I E E 0
16 2005-08-20 F H F 2
17 2005-08-20 J L J 2
18 2005-08-27 A H A 3
19 2005-08-27 B F B 1
20 2005-08-27 J C C 3
21 2005-08-27 D E D 0
22 2005-08-27 I K K 0
23 2005-08-27 L G G 0
24 2005-09-05 B A A 2
25 2005-09-05 D C D 1
26 2005-09-05 F E F 0
27 2005-09-05 H G H 0
28 2005-09-05 J I I 0
29 2005-09-05 K L K 4 |
The two required steps are:
1. `gcloud auth login`
2. Setting up authentication for docker, as described [here][1]
`gcloud auth configure docker asia-south1-docker.pkg.dev`.
The exact command for your repo can also be seen by logging in to the Google Cloud console, entering the repo and clicking on `SETUP INSTRUCTIONS`
[![enter image description here][2]][2]
[1]: https://cloud.google.com/artifact-registry/docs/docker/authentication
[2]: https://i.stack.imgur.com/3YeGh.png |
I would like to check if files or folder exist in my current project.
I have try using react-native-fs but this not take the files in the project but on the phone.
So for exemple, i would like to get the names of the files like App.js
Thank you in advance |
Check if a path exist in React Native |
|javascript|react-native|path|verification| |
Return an arraylist without passing an argument |
|javascript|java|recursion|stack| |
null |
Why you don't import that python file in nodejs only once and i use it,
for all of your nodejs app lifecycle,
BTW i have written this library for that: [Py3][1]
Simple usage:
# simple.py
import json
def validate():
# props are auto json-ed
return {'hi': 'hello', 'num': 10, 'bool': True}
Other side:
// index.js
import { Py } from "py3";
// Create a Py instance
const python = new Py({
cwd: import.meta.dirname
});
// Execute a simple Python instruction
(async () => {
await python.waitStart();
await python.exec("from simple import validate");
// props are auto unjson-ed
console.log((await python.exec(`validate()`)).hi);
})();
[1]: https://github.com/obaydmerz/py3/ |
{"Voters":[{"Id":23096025,"DisplayName":"CarlKilla"}],"DeleteType":1} |
There is an important difference in assignment. These two assignments are not equivalent:
df['j'] = pd.Series(...)
df.loc[:,'j'] = pd.Series(...)
- Indexing with `[...]` replaces the series. The new series comes with its own `dtype`, the existing `dtype` is discarded.
- Indexing with `loc[...]` replaces values, but reuses the existing series and its `dtype`, upcasting may occur to fit new values.
See how the old `int32` is ignored when using `[...]`:
import pandas as pd
import numpy.random as npr
n = 4
# NumPy returns dtype int32
df = pd.DataFrame({
'j': npr.randint(1, 10, n),
'k': npr.randint(1, 10, n)})
print(df.dtypes)
# uint8 series
s = pd.Series(npr.randint(1, 10, n), dtype='uint8')
# Using [...]: uint8 series replaces uint32 series
df2 = df.copy()
df2['j'] = s
print(df2.dtypes)
# Using loc[...]: uint8 data upcasted to existing uint32
df3 = df.copy()
df3.loc[:,'j'] = s
print(df3.dtypes)
----
j int32 ⇠ original dtype
k int32
dtype: object
j uint8 ⇠ with [...]
k int32
dtype: object
j int32 ⇠ with loc[...]
k int32
dtype: object
|
**addon** ensure envs are there before imports read them:
```
import { a} from "A.mjs";
console.log('env checks here')
import {b} from "B.mjs";
```
Despite log is before the import, nodejs will hoist all imports to the top and process respective modules. If any module eg B.mjs imports an env variable it will run before the env checks. thus one cannot use destructure `{ foo } = process.env` but use a preinit script or dynamically import:
```
import myEnvCheck ... from ...;
myEnvCheck(["env1","env2"])
// now use a dynamic import which is run when reached / not hoisted;
import("index.js").catch(...);
```
alternatively you can use `import "dotenv/config";` in index.js and put the envs in a file instead
|
How can I get the current model in the laravel nova actions field function? Can't find it out ...
public function fields(NovaRequest $request)
{
Log::info($request->model());
return [
//
];
} |
When is omitting await acceptable in asynchronous functions? |
|c#|.net|async-await| |
null |
I have been trying to reinstall anaconda navigator on my MacBook Pro M3 pro after I deleted the previous one fro system files. Now, while I install the package, every time it shows "chosen path already exists". I have also tried to install anaconda-clean package from terminal but it's not installing.
Any suggestions on this issue? Thank you.
I have tried to install it multiple times but not working. I have tried to install anaconda-clean package and tried to remove the files using command lines but nothing is working. |
Chosen path already exist: Reinstalling anaconda navigator on macOS |
|python|macos|installation|anaconda|uninstallation| |
null |
I think what you are asking is how to update the UseEffect in Sidebar so that it doesnt error?
If that is the case, it is erroring because the `currentUser` is null when trying to call `OnSnapshot`
To fix this you can simply check if `currentUser` is not null or undefined inside that `useEffect` :
useEffect(() => {
if(currentUser !== null && currentUser !== undefined)
{
const unsub = onSnapshot(doc(db, "userChats", currentUser.uid), (doc) => {
setUserChats(doc.data());
setLoading(false);
});
return () => unsub();
}
}, [currentUser.uid]);
|
I have a problem creating a project with Visual Studio 2022 Enterprise on Windows 10.
I try to create a project with the template "Angular and ASP.NET Core".
I dont change the default options (.NET 8.0,...). When creating the project I get the message "The version of Angular CLI was not valid." The template tries to call "ng version" from the project directory calling "c:\Users\<username>\AppData\Roaming\npm\ng.cmd"
At home (using Visual Studio Community) all works well - The ASP.NET Core server project gets created, and also the Angular client project.
At work (using Visual Studio Enterprise) I get this wired error directly after creating the project. The ASP.NET Core server projects gets created, the client project is completely empty.
I am able to call "ng version" from command line getting the expected result: Angular CLI: 17.3.2, Node: 20.11.1, npm 10.2.4.
I added some log "echos" to ng.cmd to make sure the right ng.cmd was called.
I uninstalled all components (Angular, Node.js), reinstalled them.
I uninstalled Visual Studio Enterprise, installed Visual Studio Community.
Nothing changed the behavior.
Do you have any ideas?
Thanks and best regards
Andy
|
Visual Studio 2022 getting error when creating "Angular and ASP.NET Core" project |
|asp.net|angular| |
null |
I'm currently working on managing role assignments in Terraform for Azure Storage Access, and I'm looking to streamline my code. Below is the snippet I'm working with,
locals {
sa_we = "0c975d82-85a2-4b3a-bb23-9be5c681b66f"
sa_gl = "9ee248b1-26f6-4d72-a3ac-7b77cf6c17f2"
}
resource "azurerm_role_assignment" "storage_account_access" {
scope = azurerm_storage_account.jd-messenger.id
role_definition_name = "Storage Blob Data Reader"
principal_id = local.sa_we
}
resource "azurerm_role_assignment" "storage_account_access" {
scope = azurerm_storage_account.jd-messenger.id
role_definition_name = "Storage Blob Data Reader"
principal_id = local.sa_gl
}
I'm wondering if there's a more efficient way to handle these role assignments. Specifically, I'm interested in consolidating these duplicate resource blocks into a single block, eliminating redundancy while still specifying different principal_id values.
Any insights or suggestions on how to achieve this would be greatly appreciated! |
Try Simple Query, without Array
SELECT request_at, COUNT(*) as total
FROM trip
GROUP BY request_at;
And here is With Array
WITH datas AS (
SELECT array_agg(distinct request_at) as request_dates
FROM trip
), counts AS (
SELECT unnest(request_dates) as request_date, COUNT(*) as total
FROM trip, datas
WHERE request_at = ANY(datas.request_dates)
GROUP BY unnest(request_dates)
)
SELECT * FROM counts;
|
I am trying to deploy a gcp function with custom entry point path. File at location `src/custom.js` relative to `package.json` contains delcarations that I'd like gcp to invoke:
functions.http('helloHttp', async (req, res) => {
//code
});
I tried specifying entry-point with:
gcloud functions deploy function-1 --entry-point=src/custom.js/helloHttp --runtime nodejs20 --trigger-http --project projectId
and
gcloud functions deploy function-1 --entry-point=helloHttp --runtime nodejs20 --trigger-http --project projectId
But I get an error:
> ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Could not create or update Cloud Run service function-1, Container Healthcheck failed. Revision 'function-1-00012-doj' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
Whats the correct way to specify custom entry point when running google cloud functions? |
|javascript|google-cloud-platform|google-cloud-functions| |
null |
I updated Flutter to 3.19. Then when I try to run the iphone15 simulator I get the following error. what should I do?
Error: The pod "Firebase/Firestore" required by the plugin "cloud_firestore" requires a higher minimum iOS deployment version than the plugin's reported minimum version.
To build, remove the plugin "cloud_firestore", or contact the plugin's developers for assistance.
Error running pod install
Error launching application on iPhone 15.
I think Flutter should be more careful before updating. Developers are wasting their time with such unsolvable problems. I can't tell you how much I regret updating Flutter to 3.19. |
The pod "Firebase/Firestore" required by the plugin "cloud_firestore" requires a higher minimum iOS deployment version |
|flutter|dart|google-cloud-firestore|flutter-dependencies| |
I guess what you want is to receive an object with three (or more) properties and in this case I would use a [calculated property](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_calculated_properties):
Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName $computername |
Select-Object @{Name = 'ComputerName'; Expression = {$_.Name}}, SerialNumber, UserName
By the way, [WMI is being deprecated](https://www.ipswitch.com/blog/get-ciminstance-vs-get-wmiobject-whats-the-difference), so I have used the newer `Get-CimInstance` instead |
This error is not a result of MLE. It's because #keyId is missing from the request header. You can generate a keyid from the dashboard -> project name -> credentials then scroll down to Encryption and Decryption. Click Generate keyId.
After getting the key, you must add a "keyId" header with a value of the generated key. Now send the request.
After the request is sent, this is where visa attempts to validate MLE with the keyId. you must now get an error like "Token validation failed"
|
Simple Counter as a webapp with increase and decrease buttons |
I am using transactionScoped but this error is generated: The transaction associated with the current connection has completed, but has not been discarded. It must be downloaded before using the connection to execute SQL statements.
I already increased the time out but it still generates the error. |
The transaction associated with the current connection has completed, but has not been discarded |
|c#| |
null |
I have macbook and iphone device and react native project, I want to know steps to do inorder to run that app on my real ios device without using xcode. |
How to run react native on real ios device (iphone) without using Xcode |
|ios|react-native|mobile-development|iosdeployment| |
|c#|.net|visual-studio|visual-studio-2022| |
I came with an updated answer. To get current status of all compose services, you can use [docker compose ps](https://docs.docker.com/engine/reference/commandline/compose_ps/) comand like this (I choose the easiest formatting to manipulate it in a script context, feel free to read the [format doc](https://docs.docker.com/config/formatting/)) :
```bash
docker compose ps --format "{{.Service}} {{.State}}"
```
This way you should get something like :
```
service1 running
service2 paused
```
Status can be one of `[paused | restarting | removing | running | dead | created | exited]`
NB :
If you only want to know which of your services are running, simply add a filter on status like this :
```bash
docker compose ps --services --status=running
```
To get
```
service1
```
I give you my makefile script if you need it :
```makefile
status: ## Show status of services ✔
@echo "`docker compose ps --all --format "#{{.State}}# \033[36m{{.Service}}\033[0m" | sed -e 's/#running#/✅/' | sed -r 's/#[a-z]+#/❌/'`"
|
I want to make my button to play and pause the track, is it possible? I use iframe,but i don't know how to make the control button to it, maybe there are other ways.
\<iframe className="w-50 absolute bottom-0 right-0" src={url} width="80%" height="100" frameBorder="0" allowFullScreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"\>
Also i have tried IFrameAPI. But i need to open this embeded component `https://open.spotify.com/embed/track/${id}?utm_source=generator&theme=0.`
And it doesn't work with this url, and there is the error with the script.
`window.onSpotifyIframeApiReady = (IFrameAPI) => { let element = document.getElementById('embed-iframe'); let options = { uri: 'spotify:episode:7makk4oTQel546B0PZlDM5' }; let callback = (EmbedController) => {}; IFrameAPI.createController(element, options, callback); }; ` |
Is it possible to link my button with the button of spotify embed player in react js? |
Get corresponding model in laravel nova action fields function |
|laravel|laravel-nova| |
I have a server and i'll connect using the ssh from my laptop , **Both the server and my laptop are in a same network** ! Is there any way to share files and videos from the server to my local laptop without any internet or data loss , but i don't any cable connection , need this to be wireless ! lets consider the file is over 2 GB which is in the server , i dont want to spend 2 GB data to download from the server , so anyway to get the file from the server where the systems are in the same network !
I need the file to be accessed without spending my data |
Share files from the server without data or internet usage |
|linux|networking|ssh|server| |
null |
When trying to minimise an objective through CVXPY, I have two different optimisation problems. When a parameter alpha is set to 0, both these objectives should give the same minimisation results. But for me it gives two different results.
These are the two problems
Problem 1 :
```
w = cp.Variable(shape = m)
alpha = cp.Parameter(nonneg=True)
w_sb = w[some_edge_indices]
w_ob = w[other_edge_indices]
MKw = MK @ w
MKsbwb = MK_sb @ w_sb
MKobwb = MK_ob @ w_ob
MKswm = MK_some @ w_some
MKowm = MK_other @ w_other
alpha.value = alph
obj1 = cp.sum_squares(MKw)
obj2 = cp.sum_squares(MKsbwb - MKswm)
obj3 = cp.sum_squares(MKobwb - MKowm)
reg = obj2 + obj3
objective = cp.Minimize(obj1 + alpha*(reg))
constraints = [AK@w >= np.ones((n,))]
prob = cp.Problem(objective, constraints)
result = prob.solve()
```
Consider all the unknows variables to be some given matrices. Also alph is a given value.
Problem 2:
```
w = cp.Variable(shape = m)
MKw = MK @ w
obj1 = cp.sum_squares(MKw)
objective = cp.Minimize(obj1)
constraints = [AK@w >= np.ones((n,))]
prob = cp.Problem(objective, constraints)
result = prob.solve()
```
Here, as we can see when alpha = 0, both the objectives should return the same w. But it is giving different w values. What could be the reason? |
|java|recursion| |
I made programm but it gives me error
"Access denied for user acer: using PASWORD "yes""
This happend when I run my program on another pc, it means that database does not exist on this pc . how I program my App to connect to the MySQL database on any other pc that doesn't have preior instalation of Mysql?
Do I have to create a new MySQL database that matches my database password and name for every pc by myself ? |
Connection with MySQL database on any other pc! Python |
|python|mysql| |
null |
{"Voters":[{"Id":23096025,"DisplayName":"CarlKilla"}]} |
{"Voters":[{"Id":1968182,"DisplayName":"Ulrich Eckhardt"},{"Id":17562044,"DisplayName":"Sunderam Dubey"},{"Id":466862,"DisplayName":"Mark Rotteveel"}],"SiteSpecificCloseReasonIds":[11]} |
How to consolidate duplicate blocks for Azure Role Assignments using Terraform? |
|terraform|terraform-provider-azure| |
Now this is more directed towards Svelte authors I suppose, but I just recently fully realized that derived stores are constantly recreated on `get`.
[Example][1]
<script>
import { derived, get, writable } from 'svelte/store'
const store = writable(0)
const derivedA = derived(store, s => {
console.log('derivedA recreated!')
return { name: 'A', s }
})
const derivedB = derived(derivedA, d => {
console.log('derivedB recreated!')
return {
name: 'B',
s: d.s
}
})
function getB() {
console.log(get(derivedB))
}
</script>
<section class="mx-4 md:mx-0">
<button on:click={getB}>GetB</button>
</section>
I thought they'd only be recreated when the inputs would change — not every time a `get` is called. Especially weird is that if the derived stores are linked, the whole tree is traversed. I assumed `get` returned a reference to the value which, sure, you could mutate and cause all kinds of bugs if you were that foolish.
I do get that the derived stores should always return the exact same value for the same input but if _someone_, with no time to think too deeply about it, would depend on the derived store to only be recomputed on the original store change it would cause rather strange bugs.
[1]: https://svelte.dev/repl/142e6716b65647f69f660613b39d0386?version=4.2.12 |
I tried the 'fa-meh-blank' Remove. When I clicked it worked. And when I clicked again, my icon disappeared completely.
I managed to find the solution. I think I expressed myself badly. I wanted to alternate the icons with each click. The following javascript works perfectly.
My new JavaScript:
```
icone.addEventListener('click', function(){
//console.log('icône cliqué');
icone.classList.toggle('happy');
icone.classList.toggle('fa-meh-blank');
icone.classList.toggle('fa-smile-wink');
});
```
---
<!-- begin snippet: js hide: false console: true babel: null -->
<!-- language: lang-js -->
const icone = document.querySelector("i");
console.log(icone);
//Je soumets
icone.addEventListener('click', function(){
//console.log('icône cliqué');
icone.classList.toggle('happy');
icone.classList.toggle('fa-meh-blank');
icone.classList.toggle('fa-smile-wink');
});
<!-- language: lang-html -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<div class="container">
<div class="bloc-central">
<h1>Projet Abonnez-vous</h1>
<div class="bloc-btn">
<i class="far fa-meh-blank"></i>
<button class="btn">Abonnez-vous</button>
</div>
</div>
</div>
<!-- end snippet -->
|
If you use the standard Blazor form controls it will work as you expect.
Here's a demo page:
```csharp
@page "/"
<PageTitle>Home</PageTitle>
<h1>Demo ToDo</h1>
<EditForm Model="_model" OnValidSubmit="HandleValidSubmit">
<div class="form-group col-md-4 mb-3">
<label>ToDo</label>
<InputText class="form-control" @bind-Value="_model.Value" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</EditForm>
<div class="bg-dark text-white m-2 p-2">
<pre>Value : @_model.Value</pre>
<pre>Message : @_message</pre>
</div>
@code{
private ToDo _model = new();
private string? _message;
private async Task HandleValidSubmit()
{
// Fake some async activity
await Task.Delay(100);
_message = $"Submitted at {DateTime.Now.ToLongTimeString()}";
}
public class ToDo
{
public Guid Uid { get; set; } = Guid.NewGuid();
public string? Value { get; set; }
}
}
``` |
{"Voters":[{"Id":1974224,"DisplayName":"Cristik"},{"Id":2756409,"DisplayName":"TylerH"},{"Id":522444,"DisplayName":"Hovercraft Full Of Eels"}]} |
To get the real path from a content URI, you can use the ContentResolver to query the MediaStore and obtain the file path. Here's an updated version of your onActivityResult method:
@Override
public void onActivityResult(ActivityResult result) {
if (result.getResultCode() == Activity.RESULT_OK) {
Intent data = result.getData();
if (data != null) {
if (data.getClipData() != null) {
int count = data.getClipData().getItemCount();
int cItem = 0;
while (cItem < count) {
Uri uri = data.getClipData().getItemAt(cItem).getUri();
String filePath = getRealPathFromUri(uri);
if (filePath != null) {
File f = new File(filePath);
files.add(f);
}
cItem++;
}
} else if (data.getData() != null) {
String path = getRealPathFromUri(data.getData());
if (path != null) {
File f = new File(path);
files.add(f);
}
}
}
}
}
private String getRealPathFromUri(Uri uri) {
String[] projection = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
if (cursor != null) {
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String filePath = cursor.getString(column_index);
cursor.close();
return filePath;
} else {
return uri.getPath(); // For non-MediaStore URIs, like FileProvider
}
}
This getRealPathFromUri method uses a ContentResolver to query the MediaStore and obtain the real file path from the content URI. If the URI is not a MediaStore URI, it falls back to using the URI's path. This should work for both single and multiple selections.
|
I am developing an API with nodejs and I am using Sequelize as ORM.
I have the following many to many relationship within User and UserType.
User.model.js
const { Sequelize, DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const User = sequelize.define('User', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
name: {
type: DataTypes.STRING,
allowNull: false
},
lastname: {
type: DataTypes.STRING,
allowNull: false
},
email: {
type: DataTypes.STRING,
allowNull: false,
unique: true
},
password: {
type: DataTypes.STRING,
allowNull: false
}
});
User.addHook('beforeCreate', async (user, options) => {
if (user.password) {
console.log('Original Password:', user.password);
const salt = await bcrypt.genSalt(10);
console.log('Generated Salt:', salt);
user.password = await bcrypt.hash(user.password, salt);
console.log('Hashed Password:', user.password);
}
});
User.prototype.getSignedJwtToken = function() {
return jwt.sign({ id: this.id }, process.env.JWT_SECRET, {
expiresIn: process.env.JWT_EXPIRE
});
};
User.prototype.matchPassword = function(enteredPassword) {
console.log('Entered Password:', enteredPassword);
console.log('Stored Password:', this.password);
try {
const isMatch = bcrypt.compareSync(enteredPassword.trim(), this.password.trim());
console.log('Password Match Result:', isMatch);
return isMatch;
} catch (error) {
console.error('Error in matchPassword:', error);
return false;
}
};
module.exports = User;
UserType.model.js
const { Sequelize, DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const User = require('./User.model');
const UserType = sequelize.define('UserType', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
type: {
type: DataTypes.ENUM('House Sitter', 'Pet Sitter'),
allowNull: false
}
});
module.exports = UserType;
index.js where I stablish the relationships:
const User = require('./User.model');
const UserType = require('./UserType.model');
UserType.belongsToMany(User, { through: 'User_Types' });
User.belongsToMany(UserType, { through: 'User_Types' });
I am syncing my tables in server.js
sequelize.sync()
.then(() => console.log('Users table synced'))
.catch(error => console.error('Error while syncronizing Users table:', error));
By default Sequelize creates the pivot table named `user_types`
The table has `createdAt, updatedAt, userId, userTypeId` but it doesn´t have a `id` column why is this? Should I added myself somehow?
|
I am making a custom keras Model. I want to customize the training loop so I implemented a custom train_step method. I want to understand the logic of the fit method. As of my understanding, train_step is used in the fit method and test_step in the evaluate method and predict_step in the predict method. How does the fit function handle the validation data set in the fit call? I tried asking gemini and the answer was **"it is not the train_step because there are no updates on the gradient but it is not the test_step because it's used only in the evaluate method. but it is handled using a similar way to the train_step."** I tried looking into the documentation and the source code but didn't get any useful information.
I want to know what is the function that handles the validation data set and if you can explain the whole logic of the fit method. |
how keras.Model.fit works? |
|tensorflow|keras|deep-learning| |
Given a **host** compiler that supports it, you can use `std::bit_cast` in CUDA C++20 **device** code to initialize a `constexpr` variable. You just need to tell nvcc to make it possible by passing [`--expt-relaxed-constexpr`][1].
This flag is labeled as an "Experimental flag", but to me it sounds more like "this flag might be removed/renamed in a future release" than a "here be dragons" in terms of its results. It is also already quite old, which gives me some confidence. See the [CUDA 8.0 nvcc docs][2] from 2016 (docs for even older versions are not available online, so I didn't check further back).
[1]: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#expt-relaxed-constexpr-expt-relaxed-constexpr
[2]: https://docs.nvidia.com/cuda/archive/8.0/cuda-compiler-driver-nvcc/index.html#options-for-altering-compiler-linker-behavior |
By default, `Data_free` is not a finite resource that will run out. It's only a count of the extents (1MB contiguous space) that has already been allocated in the physical file, but which contains no data.
InnoDB tablespaces usually are configured to auto-expand. The default in current versions of MySQL is to store data in a file-per-table manner, and all such tablespaces are auto-expanding. That means if `data_free` runs out, InnoDB increases the size of the file incrementally until your storage runs out of space.
When a file-per-table or general tablespace expands, it increases by small amounts initially, then by 4MB increments.
Also as you UPDATE and DELETE data, it can leave gaps in pages of your tablespace. Once these gaps cover whole extents, they are counted in the `Data_free` figure for that tablespace. So the `Data_free` can increase and decrease from time to time, even if the physical file isn't growing.
InnoDB can _address_ up to 64TB in a tablespace, but at least with current-generation servers, your storage is probably a lot smaller than that. You'll fill your storage much sooner than you will exceed InnoDB's addressable space.
There is one way that `Data_free` can be like a countdown to running out of space: if you store data in the system tablespace (`ibdata1`) by setting `innodb_file_per_table=OFF`, **AND** you have configured a system tablespace with a `max` size. See https://dev.mysql.com/doc/refman/8.0/en/innodb-init-startup-configuration.html#innodb-startup-data-file-configuration for details on that. If that tablespace fills up, then you can't store any more data. But neither of these configurations I mention are the default.
[1]: https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_autoextend_increment |
Depending on what exactly you mean by "the text", you probably want the [`get_body` method.](https://docs.python.org/3/library/email.message.html#email.message.EmailMessage.get_body) But you are thoroughly mangling the email before you get to that point. What you receive from the server isn't "HTML" and converting it to a string to then call `message_from_string` on it is roundabout and error-prone. What you get are bytes; use the `message_from_bytes` method directly. (This avoids all kinds of problems when the bytes are not UTF-8; the `message_from_string` method only really made sense back in Python 2, which didn't have explicit `bytes`.)
```
from email.policy import default
...
_, response = imap.uid(
'fetch', e_id, '(RFC822)')
email_message = email.message_from_bytes(
response[0][1], policy=default)
body = email_message.get_body(
'html', 'text').get_content()
```
The use of a `policy` selects the (no longer very) new `EmailMessage`; you need Python 3.3+ for this to be available. The older legacy `email.Message` class did not have this method, but should be avoided in new code for many other reasons as well.
This could fail for multipart messages with nontrivial nested structures; the `get_body` method without arguments can return a `multipart/alternative` message part and then you have to take it from there. You haven't specified what your messages are expected to look like so I won't delve further into that. |
`
final String uid = FirebaseAuth.instance.currentUser!.uid;
Padding(
padding: const EdgeInsets.all(20),
child: StreamBuilder(
stream: FirebaseFirestore.instance.collection('Users').doc(uid).snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data?["name"]);
} else {
return CircularProgressIndicator();
}
},
),
),`
I want to display the name data saved in Firebase on the screen, but even though I type it according to the documentation, CircularProgressIndicator keeps returning. Where am I doing wrong?
|
I'm trying to get the name from the database but I can't get it [Flutter] |
|flutter|firebase| |
null |
I'm not sure if i understand you fully and also not sure how your vsCode is setup. My first instinct is that you need to install an extension thats specifically does SQL linting that detects syntax errors and enforcing code style.
search for SQLFluff and install it as as extension.
|
felixolszewski@Felixs-MacBook-Pro-2 SMART TV % ares-install --device emulator "/Users/felixolszewski/Desktop/SMART TV/com.felixolszewski.app1_1.0.0_all.ipk"
ares-install ERR! [syscall failure]: connect ECONNREFUSED 127.0.0.1:6622
ares-install ERR! [Tips]: Connection refused. Please check the device IP address or the port number
felixolszewski@Felixs-MacBook-Pro-2 SMART TV % ares-setup-device --list
name deviceinfo connection profile
------------------ ------------------------ ---------- -------
emulator (default) developer@127.0.0.1:6622 ssh tv
felixolszewski@Felixs-MacBook-Pro-2 SMART TV %
Do I need to link my simulator manually? Or does the emulator device in the list refer to the simulator? If manually: how exactly? I would have no clue what to set as:
1. name
2. deviceinfo
3. ssh
4. tv
Why do I want to execute this command?
I want to create an app from a static Angular15 website. I also tried simply opening the unpackaged app build folder, as shown in the lg web os tutorial: https://webostv.developer.lge.com/develop/getting-started/build-your-first-web-app
But then I got this error when inspecting my app:
[![enter image description here][1]][1]
FAILED TO LOAD RESOURCE: ERR_FILE_NOT_FOUND, for those four filenames:
1. runtimemefa9a14c71368959.js:1
2. polyfillssc5a6162cac4767e2mjs:1
3. main.607e420b5eadbc63.js:1
4. styles.56a9653a72393d06scss:1
[1]: https://i.stack.imgur.com/2QDDI.png
Hence I tried deploying the packaged app, as this might resolve the error. But maybe I also have to be able to launch my unpackaged app? If so, then why am I getting the error? I think it could be related to:
https://forum.webostv.developer.lge.com/t/failed-to-load-module-script-error-on-webos-5-lg-tvs/2351
Can anyone help? I am not too familiar with specifc js/es version things. Here is my tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"esModuleInterop": true,
"strictPropertyInitialization": false,
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2019",
"module": "es2020",
"lib": [
"es2019",
"dom"
],
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
},
"exclude": [
"./cypress.config.ts",
"node_modules",
"cypress"
]
}
|
I have an array state variable `flashingBoxLoaderItems` that will collect the "receipts" of individual async fetches happening in the component, to let me know when all the fetches are complete. There's also a boolean variable `flashingBoxLoaderComplete` that is set on an `Effect` monitoring any changes on `flashingBoxLoaderItems` to hide the loader when everything's done.
const [flashingBoxLoaderItems, setFlashingBoxLoaderItems] = useState<string[]>([]);
const [flashingBoxLoaderComplete, setFlashingBoxLoaderComplete] = useState(false);
Example of fetches. Note that the state variable is correctly updated for the Effect using the spread ... syntax, so the effect does pick it up.
const fetch1 = async() => {
try {
//...
} catch {
//...
} finally {
setFlashingBoxLoaderItems([...flashingBoxLoaderItems, 'fetch1']);
}
}
// ETC. - Same for fetch2(), fetch(3), etc.
Effect to check all the receipts and set the final `complete` variable:
useEffect(() => {
let fetchesExpected = ['fetch1','fetch2','fetch3','fetch4','fetch5'];
let result = fetchesExpected.every(i => flashingBoxLoaderItems.includes(i));
setFlashingBoxLoaderComplete(result);
}, [flashingBoxLoaderItems]);
But this doesn't work correctly. The debugger shows that my `flashingBoxLoaderItems` doesn't grow incrementally as expected. Sometimes it has 1 or 2 strings instead of the expected 4 or 5 on the 4th or 5th fetch. My suspicion is the fetches all happen at different times and the array isn't being synchronously maintained. So the `complete` variable at the end never gets set to TRUE after the 5th fetch as it should.
The code that does work is if I simply `flashingBoxLoaderItems.push('fetchN')` after each fetch. But in that case, since there's no state variable change, so there's no re-render. I never get the chance to re-render and hide/show the loader. |
React: Multiple async fetches writing to an array state variable |
|reactjs| |