问:
Accessing desktop equivalent viewport size while on mobile
I've got a function which exports a React component to a PDF, which is as follows:

```<code>const exportToPdf = () => {

        const input = document.getElementById(active)

        if (input != null) {

            html2canvas(input, {
                scale: 5
            })
            .then((canvas) => {
                const imgData = canvas.toDataURL('image/png', 2.0)

                const componentWidth = canvas.offsetWidth
                const componentHeight = canvas.offsetHeight

                const orientation = componentWidth >= componentHeight ? 'l' : 'p'

                const pdf = new jsPDF({
                    orientation,
                    unit: "px"
                })

                pdf.internal.pageSize.width = width
                pdf.internal.pageSize.height = height

                pdf.addImage(imgData, 'PNG', 0, 0, width, height)
                pdf.save(`${name}.pdf`)

            })
            .then(() => {
                setDisplay(false)
            })
        }
    }
</code>```

To determine the height / width of the PDF export, it takes the width / height of the component, which is stored as state and set in a useEffect:

```<code>const [height, setHeight] = useState(0)
const [width, setWidth] = useState(0)

useEffect(() => {
    setHeight(modernTemplate.current.clientHeight)
    setWidth(modernTemplate.current.clientWidth)

}, [active])
</code>```

To do this, I use the useRef hook.

However, with this approach, it means that if a user is viewing the page on mobile, that the component measurements are calculated with a mobile viewport.

What I want to do instead is set the height / width to be what it is on a desktop device, while on a mobile device.

Is there a way for me to refactor my code to access what the clientHeight / clientWidth would be while looking on a desktop device?

Body:
I've got a function which exports a React component to a PDF, which is as follows:

const exportToPdf = () => {

        const input = document.getElementById(active)

        if (input != null) {

            html2canvas(input, {
                scale: 5
            })
            .then((canvas) => {
                const imgData = canvas.toDataURL('image/png', 2.0)

                const componentWidth = canvas.offsetWidth
                const componentHeight = canvas.offsetHeight

                const orientation = componentWidth >= componentHeight ? 'l' : 'p'

                const pdf = new jsPDF({
                    orientation,
                    unit: "px"
                })

                pdf.internal.pageSize.width = width
                pdf.internal.pageSize.height = height

                pdf.addImage(imgData, 'PNG', 0, 0, width, height)
                pdf.save(`${name}.pdf`)

            })
            .then(() => {
                setDisplay(false)
            })
        }
    }

To determine the height / width of the PDF export, it takes the width / height of the component, which is stored as state and set in a useEffect:

const [height, setHeight] = useState(0)
const [width, setWidth] = useState(0)

useEffect(() => {
    setHeight(modernTemplate.current.clientHeight)
    setWidth(modernTemplate.current.clientWidth)

}, [active])

To do this, I use the useRef hook.

However, with this approach, it means that if a user is viewing the page on mobile, that the component measurements are calculated with a mobile viewport.

What I want to do instead is set the height / width to be what it is on a desktop device, while on a mobile device.

Is there a way for me to refactor my code to access what the clientHeight / clientWidth would be while looking on a desktop device?


来源: stackexchange

问:
I am trying to exclude null fields from json response
I tried possible ways like
@JsonInclude(value = Include.nonnull, content = Include.nonempty)
@jsonserialize annotation as well but nothing seems to suppressing null fields from response i am using jackson core version 2.9.9 not sure what I am missing here.

Jackson annotations

ContentLicense: CC BY-SA 4.0


问:
How to automatically identify dependencies in cs files and generate ts files with correct dependencies？
I have two class in two different file, if I only add the TsInterface attribute in Person.cs, the exported ts file will not automatically import Address unless I also add [TsInterface] attribute to the Address.cs file. Is there any way to automatically parse out all the references? (Build a dependency tree from one entry） Thanks!

```<code>// Person.cs:
[TsInterface]
public class Person {
   public Address { get; set; }
}

// Address.cs:
public class Person {
    public Address { get; set; }

}
</code>```

Body:
I have two class in two different file, if I only add the TsInterface attribute in Person.cs, the exported ts file will not automatically import Address unless I also add [TsInterface] attribute to the Address.cs file. Is there any way to automatically parse out all the references? (Build a dependency tree from one entry） Thanks!

// Person.cs:
[TsInterface]
public class Person {
   public Address { get; set; }
}

// Address.cs:
public class Person {
    public Address { get; set; }

}


问:
Namespace has no exported member "User" error in my project
I was writing a code for auth guard, but I am getting an error in the part I write as User, I wonder what should I do?

Here is my code

```<code>import { Injectable } from '@angular/core';
import { AngularFireAuth} from '@angular/fire/compat/auth'
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class AuthService {

  user: Observable<firebase.User>

  constructor(private fa: AngularFireAuth) {
    this.user = this.fa.user
  }

    signUp(email: string,password: string){
     return this.fa.createUserWithEmailAndPassword(email,password)
    }
  signIn(email: string, password: string) {
      return this.fa.signInWithEmailAndPassword(email,password);
    }
}
</code>```

ScreenShot

Even though I changed versions from package.json, nothing changed, what should I do?

Body:
I was writing a code for auth guard, but I am getting an error in the part I write as User, I wonder what should I do?

Here is my code

import { Injectable } from '@angular/core';
import { AngularFireAuth} from '@angular/fire/compat/auth'
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class AuthService {

  user: Observable<firebase.User>

  constructor(private fa: AngularFireAuth) {
    this.user = this.fa.user
  }

    signUp(email: string,password: string){
     return this.fa.createUserWithEmailAndPassword(email,password)
    }
  signIn(email: string, password: string) {
      return this.fa.signInWithEmailAndPassword(email,password);
    }
}

ScreenShot

Even though I changed versions from package.json, nothing changed, what should I do?


问:
How to delegate blur event?
Is it possible to delegate blur event?

I have this code and want to add only one event listener to whole div where are my inputs:

const inputs = document.querySelectorAll('div.div input[type="number"]');

inputs.forEach(input => {
  input.addEventListener('blur', () => {
    const value = +input.value;
    const [min, max] = [+input.min, +input.max];

    if (!(value < min || value > max)) return;

    input.value = Math.max(min, Math.min(value, max));
    showRangeError(input);
  })
})

function showRangeError(input) {
  const error = document.createElement('p');

  error.className = "erorr-m";
  error.innerHTML = `Value must be between ${input.min} and ${input.max}`;

  input.after(error);

  setTimeout(() => error.remove(), 3000);
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.div {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: flex-start;
}

.erorr {
  border: solid 2px #e66565;
}

.erorr-m {
  margin-bottom: 10px;
  padding: 10px;
  color: #e66565;
  border-left: solid 2px #e66565;
  animation: 1s fadeIn;
}</code>```

  <input name="one" type="number" min="10" max="24" placeholder="One">
  <input name="two" type="number" min="5" max="7" placeholder="Two">

```
</div>
</div>
</p>
<p>I tried to add even listener to <code>div</code> but nothing happens when I click outside of <code>div</code></p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const inputsDiv = document.querySelector('div.div');

inputsDiv.addEventListener('blur', console.log);</code>```

.div {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: flex-start;
  outline: 1px solid black;
}

.erorr {
  border: solid 2px #e66565;
}

.erorr-m {
  margin-bottom: 10px;
  padding: 10px;
  color: #e66565;
  border-left: solid 2px #e66565;
  animation: 1s fadeIn;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="div">
  <input name="one" type="number" min="10" max="24" placeholder="One">
  <input name="two" type="number" min="5" max="7" placeholder="Two">
</div></code>```

Only if I add tabindex="0" attribute to div I can see event target but it always is div:

const inputsDiv = document.querySelector('div.div');

inputsDiv.addEventListener('blur', (e) => console.log(e.target, e.currentTarget));```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.div {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: flex-start;
  outline: 1px solid black;
}

.erorr {
  border: solid 2px #e66565;
}

.erorr-m {
  margin-bottom: 10px;
  padding: 10px;
  color: #e66565;
  border-left: solid 2px #e66565;
  animation: 1s fadeIn;
}</code>```

  <input name="one" type="number" min="10" max="24" placeholder="One">
  <input name="two" type="number" min="5" max="7" placeholder="Two">

```

Title: How to delegate blur event?

Body:
Is it possible to delegate blur event?

I have this code and want to add only one event listener to whole div where are my inputs:

const inputs = document.querySelectorAll('div.div input[type="number"]');

inputs.forEach(input => {
  input.addEventListener('blur', () => {
    const value = +input.value;
    const [min, max] = [+input.min, +input.max];

    if (!(value < min || value > max)) return;

    input.value = Math.max(min, Math.min(value, max));
    showRangeError(input);
  })
})

function showRangeError(input) {
  const error = document.createElement('p');

  error.className = "erorr-m";
  error.innerHTML = `Value must be between ${input.min} and ${input.max}`;

  input.after(error);

  setTimeout(() => error.remove(), 3000);
}

.div {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: flex-start;
}

.erorr {
  border: solid 2px #e66565;
}

.erorr-m {
  margin-bottom: 10px;
  padding: 10px;
  color: #e66565;
  border-left: solid 2px #e66565;
  animation: 1s fadeIn;
}

  <input name="one" type="number" min="10" max="24" placeholder="One">
  <input name="two" type="number" min="5" max="7" placeholder="Two">

I tried to add even listener to div but nothing happens when I click outside of div

const inputsDiv = document.querySelector('div.div');

inputsDiv.addEventListener('blur', console.log);

.div {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: flex-start;
  outline: 1px solid black;
}

.erorr {
  border: solid 2px #e66565;
}

.erorr-m {
  margin-bottom: 10px;
  padding: 10px;
  color: #e66565;
  border-left: solid 2px #e66565;
  animation: 1s fadeIn;
}

  <input name="one" type="number" min="10" max="24" placeholder="One">
  <input name="two" type="number" min="5" max="7" placeholder="Two">

Only if I add tabindex="0" attribute to div I can see event target but it always is div:

const inputsDiv = document.querySelector('div.div');

inputsDiv.addEventListener('blur', (e) => console.log(e.target, e.currentTarget));

.div {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: flex-start;
  outline: 1px solid black;
}

.erorr {
  border: solid 2px #e66565;
}

.erorr-m {
  margin-bottom: 10px;
  padding: 10px;
  color: #e66565;
  border-left: solid 2px #e66565;
  animation: 1s fadeIn;
}

  <input name="one" type="number" min="10" max="24" placeholder="One">
  <input name="two" type="number" min="5" max="7" placeholder="Two">


问:
How to import 3 different POM.xlm to make them work together
I have a project which is based on 3 different projects, which are connected to each other (one has objects, other two are frameworks with methods). I have issue with connecting them to each other in IntelliJ Community.

In Eclipse it is a simple case - open new project, import maven project, again with 2nd, again with 3rd, cooperating perfectly.

However I cannot find that kind of an option in Intellij. I am trying to open File->New->Module from Existing source it gives me error:

```<code>Exception in thread “main” java.lang.ExceptionInInitializerError
</code>```

it is like those 2 projects cannot see each other.

Body:
I have a project which is based on 3 different projects, which are connected to each other (one has objects, other two are frameworks with methods). I have issue with connecting them to each other in IntelliJ Community.

In Eclipse it is a simple case - open new project, import maven project, again with 2nd, again with 3rd, cooperating perfectly.

However I cannot find that kind of an option in Intellij. I am trying to open File->New->Module from Existing source it gives me error:

Exception in thread “main” java.lang.ExceptionInInitializerError

it is like those 2 projects cannot see each other.


问:
Connecting to react HOST from outside docker
I am running a react application in development inside the docker file and this is the docker compose file

```<code>version: '3.8'
services:
  my_frontend:
    build:
      context: ../
      dockerfile: ./deployment/Dockerfile.dev
    ports:
      - 80:80
    extra_hosts:
      - "app.my-host.com:127.0.0.1"
    env_file:
      - ../src/environment/.env.local.dev
    volumes:
      - ../src:/app/src
      - /app/node_modules
    stdin_open: true
    tty: true
</code>```

The react application runs on the HOST app.my-host.com as host is provided in the environment file. This docker file builds and works properly and I can access the application from inside the docker shell using docker exec

```<code>curl http://app.my-host.com
</code>```

will give correct result, but I can't access this from outside the docker container. I have tried different methods using extra_hosts but to no success,
http:app.my-host.com will give page not found on my windows laptop.
[EDIT: Adding dockerfile]

```<code>FROM node:18-alpine

RUN apk update && apk upgrade && \
    apk add --no-cache bash git openssh curl

WORKDIR /app

COPY package.json /app/

RUN npm install

COPY . /app/

EXPOSE 80

CMD [ "npm", "start" ]
</code>```

Requirement: access http://app.my-host.com from windows laptop

Any leads will be greatly helpful. Thanks in advance.

Body:
I am running a react application in development inside the docker file and this is the docker compose file

version: '3.8'
services:
  my_frontend:
    build:
      context: ../
      dockerfile: ./deployment/Dockerfile.dev
    ports:
      - 80:80
    extra_hosts:
      - "app.my-host.com:127.0.0.1"
    env_file:
      - ../src/environment/.env.local.dev
    volumes:
      - ../src:/app/src
      - /app/node_modules
    stdin_open: true
    tty: true

The react application runs on the HOST app.my-host.com as host is provided in the environment file. This docker file builds and works properly and I can access the application from inside the docker shell using docker exec

curl http://app.my-host.com

will give correct result, but I can't access this from outside the docker container. I have tried different methods using extra_hosts but to no success,
http:app.my-host.com will give page not found on my windows laptop.
[EDIT: Adding dockerfile]

FROM node:18-alpine

RUN apk update && apk upgrade && \
    apk add --no-cache bash git openssh curl

WORKDIR /app

COPY package.json /app/

RUN npm install

COPY . /app/

EXPOSE 80

CMD [ "npm", "start" ]

Requirement: access http://app.my-host.com from windows laptop

Any leads will be greatly helpful. Thanks in advance.


问:
driver.switch_to.alert.text throws exepction: no such alerts but there is an alert
I'm trying to open a https://drive.inditex.com/drfrcomr/login with Selenium.

It opens a prompt with username and password fields, & submit and cancel buttons. I am trying to close the prompt. It can be closed by clicking the cancel button or clicking the escape key.

Note: ignore irrelevant imports please

```<code>from selenium import webdriver
from selenium.webdriver.common.alert import Alert
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

options = webdriver.ChromeOptions()
options.headless = False
options.page_load_strategy = 'none'
chrome_path = ChromeDriverManager().install()
chrome_service = Service(chrome_path)
driver = Chrome(options=options, service=chrome_service)
driver.implicitly_wait(5)

url = "https://drive.inditex.com/drfrcomr/sales/home?brand=2"
driver.get(url)

print("printing alert text:", driver.switch_to.alert.text)
ActionChains(driver).send_keys(Keys.ESCAPE).perform()
</code>```

The WebDriver is not picking the prompt box.

Body:
I'm trying to open a https://drive.inditex.com/drfrcomr/login with Selenium.

It opens a prompt with username and password fields, & submit and cancel buttons. I am trying to close the prompt. It can be closed by clicking the cancel button or clicking the escape key.

Note: ignore irrelevant imports please

from selenium import webdriver
from selenium.webdriver.common.alert import Alert
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

options = webdriver.ChromeOptions()
options.headless = False
options.page_load_strategy = 'none'
chrome_path = ChromeDriverManager().install()
chrome_service = Service(chrome_path)
driver = Chrome(options=options, service=chrome_service)
driver.implicitly_wait(5)

url = "https://drive.inditex.com/drfrcomr/sales/home?brand=2"
driver.get(url)

print("printing alert text:", driver.switch_to.alert.text)
ActionChains(driver).send_keys(Keys.ESCAPE).perform()

The WebDriver is not picking the prompt box.


问:
apply_filters('the_content', get_the_content()) gives server error 500 in backend
I've been searching the web and getting crazy, so my last resort is asking for help :-)

I made a simple custom shortcode to display the content of a post.

```<code>function postcontent_shortcode(){

  return apply_filters('the_content', get_the_content());

}

add_shortcode('postcontent', 'postcontent_shortcode');
</code>```

The shortcode works. But in the backend it returns a 500 server error.

I can get around it by using
if(!is_admin())

But when clicking on 'Update', I get the error 'Updating failed.'. I tried adding wp_doing_ajax() in my if else statement, but it doesn't do anything.

Any ideas?

Best,
Jordy

Body:
I've been searching the web and getting crazy, so my last resort is asking for help :-)

I made a simple custom shortcode to display the content of a post.

function postcontent_shortcode(){

  return apply_filters('the_content', get_the_content());

}

add_shortcode('postcontent', 'postcontent_shortcode');

The shortcode works. But in the backend it returns a 500 server error.

I can get around it by using
if(!is_admin())

But when clicking on 'Update', I get the error 'Updating failed.'. I tried adding wp_doing_ajax() in my if else statement, but it doesn't do anything.

Any ideas?

Best,
Jordy


问:
jackson no such method error for getReadCapabilities while JIB image creation
jib-gradle 3.2.1
gradle 6.6
java 8

In main build.gradle

```<code>buildscript {

dependencies {

classpath("com.fasterxml.jackson.core:jackson-databind") {
            version{ strictly("2.13.2") }
        }
        classpath("com.fasterxml.jackson.core:jackson-core") {
            version{ strictly("2.13.2") }
        }
        classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.2.1"
}}
</code>```

In module gradle

```<code>apply plugin: "com.google.cloud.tools.jib"

</code>```

while running build jibBuildTar task, I am getting the following error. I have extracted the dependency graph and no other version of jackson is there. Even I have forced the 2.13.2 version of jackson which has this erroring method.
Build is fine with normal build task.

```<code>Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.getReadCapabilities()Lcom/fasterxml/jackson/core/util/JacksonFeatureSet;
        at com.fasterxml.jackson.databind.DeserializationContext.<init>(DeserializationContext.java:212)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.<init>(DefaultDeserializationContext.java:50)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext$Impl.<init>(DefaultDeserializationContext.java:391)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext$Impl.createInstance(DefaultDeserializationContext.java:413)
        at com.fasterxml.jackson.databind.ObjectMapper.createDeserializationContext(ObjectMapper.java:4737)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4666)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3666)
        at com.google.cloud.tools.jib.json.JsonTemplateMapper.readJsonFromFile(JsonTemplateMapper.java:72)
        at com.google.cloud.tools.jib.plugins.common.globalconfig.GlobalConfig.readConfig(GlobalConfig.java:49)
        at com.google.cloud.tools.jib.plugins.common.globalconfig.GlobalConfig.readConfig(GlobalConfig.java:39)
        at com.google.cloud.tools.jib.gradle.BuildTarTask.buildTar(BuildTarTask.java:136)

</code>```

Body:
jib-gradle 3.2.1
gradle 6.6
java 8

In main build.gradle

buildscript {

dependencies {

classpath("com.fasterxml.jackson.core:jackson-databind") {
            version{ strictly("2.13.2") }
        }
        classpath("com.fasterxml.jackson.core:jackson-core") {
            version{ strictly("2.13.2") }
        }
        classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.2.1"
}}

In module gradle

apply plugin: "com.google.cloud.tools.jib"

while running build jibBuildTar task, I am getting the following error. I have extracted the dependency graph and no other version of jackson is there. Even I have forced the 2.13.2 version of jackson which has this erroring method.
Build is fine with normal build task.

Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.getReadCapabilities()Lcom/fasterxml/jackson/core/util/JacksonFeatureSet;
        at com.fasterxml.jackson.databind.DeserializationContext.<init>(DeserializationContext.java:212)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.<init>(DefaultDeserializationContext.java:50)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext$Impl.<init>(DefaultDeserializationContext.java:391)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext$Impl.createInstance(DefaultDeserializationContext.java:413)
        at com.fasterxml.jackson.databind.ObjectMapper.createDeserializationContext(ObjectMapper.java:4737)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4666)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3666)
        at com.google.cloud.tools.jib.json.JsonTemplateMapper.readJsonFromFile(JsonTemplateMapper.java:72)
        at com.google.cloud.tools.jib.plugins.common.globalconfig.GlobalConfig.readConfig(GlobalConfig.java:49)
        at com.google.cloud.tools.jib.plugins.common.globalconfig.GlobalConfig.readConfig(GlobalConfig.java:39)
        at com.google.cloud.tools.jib.gradle.BuildTarTask.buildTar(BuildTarTask.java:136)


问:
ActivityScenario.launch forced finish
```<code>import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class MainActivityTest {
    @Test
    fun setupData() {
        var activityScenario = ActivityScenario.launch(MainActivity::class.java)
        activityScenario.onActivity {

        }
    }
}

</code>```

I don't know why it forces finish() is called.

I override finish method, but it called twice and force closing.

Title: ActivityScenario.launch forced finish

Body:
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class MainActivityTest {
    @Test
    fun setupData() {
        var activityScenario = ActivityScenario.launch(MainActivity::class.java)
        activityScenario.onActivity {

        }
    }
}

I don't know why it forces finish() is called.

I override finish method, but it called twice and force closing.


问:
One cell multiple updating values, extract only first one
how would I extract in excel first value in a given cell,eg A1 that updates constantly generating new values every second.

SaY in cell A1, a value 123, then it changes to 135 a second later, then 145, then 150 etc. Am only interested in the first value 123 within that cell before it changes to 135.

Is there a spreadsheet formula to extract that first value and ignore the rest?

I have tried but failed my attempt.


问:
react JS implement image Drag and Drop
in my react app I'm using a package react-dropzone. and it works quite nice. but I can't figure out to prevent duplicate images.

```<code>const [files, setFiles] = useState([]);
 const [found, setFound] = useState(false);
 const { getRootProps, getInputProps } = useDropzone({
    accept: {
      "image/*": [],
    },

    onDrop: (acceptedFiles) => {
      acceptedFiles.filter(
        (el, idx) =>
          idx ===
          files.findIndex((elm) => elm.name === el.name && setFound(true))
      );
      if (!found) {
        setFiles((prev) => [
          ...prev,
          ...acceptedFiles.map((file) =>
            Object.assign(file, {
              preview: URL.createObjectURL(file),
            })
          ),
        ]);
      }
    },
  });
</code>```

how can I prevent image duplication? and also make limitations on it? only 4 - 9 images can be uploaded?

Title: react JS implement image Drag and Drop

Body:
in my react app I'm using a package react-dropzone. and it works quite nice. but I can't figure out to prevent duplicate images.

const [files, setFiles] = useState([]);
 const [found, setFound] = useState(false);
 const { getRootProps, getInputProps } = useDropzone({
    accept: {
      "image/*": [],
    },

    onDrop: (acceptedFiles) => {
      acceptedFiles.filter(
        (el, idx) =>
          idx ===
          files.findIndex((elm) => elm.name === el.name && setFound(true))
      );
      if (!found) {
        setFiles((prev) => [
          ...prev,
          ...acceptedFiles.map((file) =>
            Object.assign(file, {
              preview: URL.createObjectURL(file),
            })
          ),
        ]);
      }
    },
  });

how can I prevent image duplication? and also make limitations on it? only 4 - 9 images can be uploaded?


问:
is the temporaryDirectory of FileManager automatically removed by iOS? if so when?
I am adding an option in my App to backup everything to a file.

For that, I am serializing all my objects to a dictionary that I save in a single file in the path provided by FileManager.default.temporaryDirectory. Then I ask the user for a path to save this file using a UIDocumentPickerViewController.

Everything works fine, but I wonder what happens with the temporal file that I created in the temporaryDirectory. Is this automatically removed by the operating system? should I take care of removing it by myself?

This is how I get the path of the temporary directory for my file:

```<code>private var exportURL: URL {
    let documentURL = FileManager.default.temporaryDirectory
    let fileName = "archive"
    let filePath = "\(fileName).backup"
    return documentURL.appendingPathComponent(filePath)
}
</code>```

Body:
I am adding an option in my App to backup everything to a file.

For that, I am serializing all my objects to a dictionary that I save in a single file in the path provided by FileManager.default.temporaryDirectory. Then I ask the user for a path to save this file using a UIDocumentPickerViewController.

Everything works fine, but I wonder what happens with the temporal file that I created in the temporaryDirectory. Is this automatically removed by the operating system? should I take care of removing it by myself?

This is how I get the path of the temporary directory for my file:

private var exportURL: URL {
    let documentURL = FileManager.default.temporaryDirectory
    let fileName = "archive"
    let filePath = "\(fileName).backup"
    return documentURL.appendingPathComponent(filePath)
}


问:
docker container(image is 'ubuntu') run apt install mysql-server stuck in "mysqld is running as pid 1093"
it raise error:

```<code>mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 1093
</code>```

/var/log/mysql/error.log has not error

```<code>2023-01-07T14:50:57.429666Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 79
2023-01-07T14:50:57.446241Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-01-07T14:50:57.652670Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-01-07T14:50:57.969864Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-01-07T14:50:57.969912Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-01-07T14:50:57.975125Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-01-07T14:50:58.020928Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2'  socket: '/tmp/tmp.w20Da79Bp3/mysqld.sock'  port: 0  (Ubuntu).
2023-01-07T14:50:58.020951Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-01-07T14:50:58.050622Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.20.04.2).
2023-01-07T14:50:59.624386Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.20.04.2)  (Ubuntu).
2023-01-07T14:55:36.704313Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 917
2023-01-07T14:55:36.720344Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-01-07T14:55:36.931845Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-01-07T14:55:37.211724Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-01-07T14:55:37.211825Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-01-07T14:55:37.217542Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-01-07T14:55:37.273322Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-01-07T14:55:37.273427Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2'  socket: '/tmp/tmp.z26iMb3yPE/mysqld.sock'  port: 0  (Ubuntu).
2023-01-07T14:55:37.299087Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.20.04.2).
2023-01-07T14:55:38.866927Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.20.04.2)  (Ubuntu).
2023-01-07T14:56:04.408746Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 1091
2023-01-07T14:56:04.424281Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-01-07T14:56:04.629819Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-01-07T14:56:04.873567Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-01-07T14:56:04.873655Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-01-07T14:56:04.881583Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-01-07T14:56:04.926664Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-01-07T14:56:04.926719Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2'  socket: '/tmp/tmp.MvdPXRuiEw/mysqld.sock'  port: 0  (Ubuntu).
2023-01-07T14:56:04.948472Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.20.04.2).
2023-01-07T14:56:06.514479Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.20.04.2)  (Ubuntu).
</code>```

Body:
it raise error:

mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 1093

/var/log/mysql/error.log has not error

2023-01-07T14:50:57.429666Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 79
2023-01-07T14:50:57.446241Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-01-07T14:50:57.652670Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-01-07T14:50:57.969864Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-01-07T14:50:57.969912Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-01-07T14:50:57.975125Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-01-07T14:50:58.020928Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2'  socket: '/tmp/tmp.w20Da79Bp3/mysqld.sock'  port: 0  (Ubuntu).
2023-01-07T14:50:58.020951Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-01-07T14:50:58.050622Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.20.04.2).
2023-01-07T14:50:59.624386Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.20.04.2)  (Ubuntu).
2023-01-07T14:55:36.704313Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 917
2023-01-07T14:55:36.720344Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-01-07T14:55:36.931845Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-01-07T14:55:37.211724Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-01-07T14:55:37.211825Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-01-07T14:55:37.217542Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-01-07T14:55:37.273322Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-01-07T14:55:37.273427Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2'  socket: '/tmp/tmp.z26iMb3yPE/mysqld.sock'  port: 0  (Ubuntu).
2023-01-07T14:55:37.299087Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.20.04.2).
2023-01-07T14:55:38.866927Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.20.04.2)  (Ubuntu).
2023-01-07T14:56:04.408746Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 1091
2023-01-07T14:56:04.424281Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-01-07T14:56:04.629819Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-01-07T14:56:04.873567Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-01-07T14:56:04.873655Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-01-07T14:56:04.881583Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-01-07T14:56:04.926664Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-01-07T14:56:04.926719Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2'  socket: '/tmp/tmp.MvdPXRuiEw/mysqld.sock'  port: 0  (Ubuntu).
2023-01-07T14:56:04.948472Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.31-0ubuntu0.20.04.2).
2023-01-07T14:56:06.514479Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.20.04.2)  (Ubuntu).


问:
How can I convert daily data to weekly and monthly data in R
I need to calculate daily, weekly and monthly rates of return (r_t=ln(P_t⁄P_(t-1) ) for all series, but I have daily data. How can I convert daily data to weekly and monthly data?

I tried to do it in R but I could not


问:
Laravel Livewire validation won't allow me to output dynamic field names
I have a Livewire component that contains a booking form. I have some dynamic form fields
that are generated when a wired up button is pressed. The fields are displayed on the page by  using array keys to make them unique:

     Contact Phone
        <input class="rounded border-gray-300 text-sm"
                type="text"
               name="attendee[{{ $key }}][contact_phone]">

```
<p>Here are the validation rules inside the component controller:</p>
<pre class="lang-php prettyprint-override"><code> $this->validate([
            'course_date' => 'bail|required',
            'attendee' => 'array|required',
            'attendee.*.title' => 'required',
            'attendee.*.first_name' => 'required',
            'attendee.*.last_name' => 'required',
            'attendee.*.email' => 'required|email:rfc,dns',
            'attendee.*.contact_phone' => 'required|numeric|digits_between:10,13',
        ], [
            'course_date.required' => 'You must select a date.',
            'attendee.required' => 'Your booking must have at least one attendee.',
            'attendee.*.title.required' => 'Title cannot be blank.',
            'attendee.*.first_name.required' => 'First name cannot be blank.',
            'attendee.*.last_name.required' => 'Last name cannot be blank.',
            'attendee.*.email.required' => 'Please provide an email address.',
            'attendee.*.email.email' => 'Please provide a valid email address.',
            'attendee.*.contact_phone.required' => 'Please provide a contact phone number.',
            'attendee.*.contact_phone.numeric' => 'Please provide a valid phone number.',
            'attendee.*.contact_phone.digits_between' => 'Please provide a valid phone number.'
        ]);
</code>```

If I display the errors all together at the top of the form like this:

@if ($errors->any())

                @foreach ($errors->all() as $error)

{{ $error }}

                @endforeach

    @endif
```
<p>they work fine, and if I display the errors for the nested fields like this:</p>
<pre class="lang-php prettyprint-override"><code> @error('attendee.0.title')
    <span class="text-xs font-bold text-pink-900">{{ $message }}</span>
 @enderror
</code>```

However if I want to do this so I can have it work dynamically:

 @error('attendee.{{ $key }}.title')
    {{ $message }}
 @enderror
```

it doesn't work. The error doesnt display at all.

Body:
I have a Livewire component that contains a booking form. I have some dynamic form fields
that are generated when a wired up button is pressed. The fields are displayed on the page by  using array keys to make them unique:

     Contact Phone
        <input class="rounded border-gray-300 text-sm"
                type="text"
               name="attendee[{{ $key }}][contact_phone]">

Here are the validation rules inside the component controller:

 $this->validate([
            'course_date' => 'bail|required',
            'attendee' => 'array|required',
            'attendee.*.title' => 'required',
            'attendee.*.first_name' => 'required',
            'attendee.*.last_name' => 'required',
            'attendee.*.email' => 'required|email:rfc,dns',
            'attendee.*.contact_phone' => 'required|numeric|digits_between:10,13',
        ], [
            'course_date.required' => 'You must select a date.',
            'attendee.required' => 'Your booking must have at least one attendee.',
            'attendee.*.title.required' => 'Title cannot be blank.',
            'attendee.*.first_name.required' => 'First name cannot be blank.',
            'attendee.*.last_name.required' => 'Last name cannot be blank.',
            'attendee.*.email.required' => 'Please provide an email address.',
            'attendee.*.email.email' => 'Please provide a valid email address.',
            'attendee.*.contact_phone.required' => 'Please provide a contact phone number.',
            'attendee.*.contact_phone.numeric' => 'Please provide a valid phone number.',
            'attendee.*.contact_phone.digits_between' => 'Please provide a valid phone number.'
        ]);

If I display the errors all together at the top of the form like this:

@if ($errors->any())

                @foreach ($errors->all() as $error)

{{ $error }}

                @endforeach

    @endif

they work fine, and if I display the errors for the nested fields like this:

 @error('attendee.0.title')
    {{ $message }}
 @enderror

However if I want to do this so I can have it work dynamically:

 @error('attendee.{{ $key }}.title')
    {{ $message }}
 @enderror

it doesn't work. The error doesnt display at all.


问:
Edit Target on *.lnk with PowerShell
I have a shortcut at C:\Users\Public\Desktop\Shortcut.lnk. The current target is:

```<code>"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" https://localhost:443/WebApp
</code>```

My goal is to change the target to:

```<code>"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" https://FullyQualifiedDomainName/WebApp
</code>```

My Google searches are coming up almost empty when I try to find a way to do this via PowerShell. Has anyone figured out a way to make this happen?  I followed the steps here:

https://www.winhelponline.com/blog/how-to-change-shortcut-lnk-targets-in-bulk-using-script/

and came up with:

```<code>$oldPrefix = "localhost:443"
$newPrefix = "FullyQualifiedDomainName"
$searchPath = "C:\Users\Public\Desktop"

$shell = new-object -com wscript.shell
write-host "Updating shortcut target" -foregroundcolor red -backgroundcolor black

dir $searchPath -filter *.lnk -recurse | foreach {
$lnk = $shell.createShortcut( $_.fullname )
$oldPath= $lnk.targetPath
$lnkRegex = "^" + [regex]::escape( $oldPrefix )

if ( $oldPath -match $lnkRegex ) {
$newPath = $oldPath -replace $lnkRegex, $newPrefix

write-host "Found: " + $_.fullname -foregroundcolor yellow -backgroundcolor black
write-host " Replace: " + $oldPath
write-host " With: " + $newPath
$lnk.targetPath = $newPath
$lnk.Save()
}
}
</code>```

I then ran:

```<code>powershell -noexit -executionpolicy bypass -file .\lnk_change.ps1
</code>```

It just sits at:

```<code>Updating shortcut target
</code>```

And never seems to do anything. Anyone know of a better way to do this that will actually work?

Update:  I found that I can actually view the argument of the target with:

```<code>$sh = New-Object -ComObject WScript.Shell
$arguments = $sh.CreateShortcut('C:\Users\Public\Desktop\Shortcut.lnk').Arguments
</code>```

But I'm still not quite sure of how I could change it.

Title: Edit Target on *.lnk with PowerShell

Body:
I have a shortcut at C:\Users\Public\Desktop\Shortcut.lnk. The current target is:

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" https://localhost:443/WebApp

My goal is to change the target to:

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" https://FullyQualifiedDomainName/WebApp

My Google searches are coming up almost empty when I try to find a way to do this via PowerShell. Has anyone figured out a way to make this happen?  I followed the steps here:

https://www.winhelponline.com/blog/how-to-change-shortcut-lnk-targets-in-bulk-using-script/

and came up with:

$oldPrefix = "localhost:443"
$newPrefix = "FullyQualifiedDomainName"
$searchPath = "C:\Users\Public\Desktop"

$shell = new-object -com wscript.shell
write-host "Updating shortcut target" -foregroundcolor red -backgroundcolor black

dir $searchPath -filter *.lnk -recurse | foreach {
$lnk = $shell.createShortcut( $_.fullname )
$oldPath= $lnk.targetPath
$lnkRegex = "^" + [regex]::escape( $oldPrefix )

if ( $oldPath -match $lnkRegex ) {
$newPath = $oldPath -replace $lnkRegex, $newPrefix

write-host "Found: " + $_.fullname -foregroundcolor yellow -backgroundcolor black
write-host " Replace: " + $oldPath
write-host " With: " + $newPath
$lnk.targetPath = $newPath
$lnk.Save()
}
}

I then ran:

powershell -noexit -executionpolicy bypass -file .\lnk_change.ps1

It just sits at:

Updating shortcut target

And never seems to do anything. Anyone know of a better way to do this that will actually work?

Update:  I found that I can actually view the argument of the target with:

$sh = New-Object -ComObject WScript.Shell
$arguments = $sh.CreateShortcut('C:\Users\Public\Desktop\Shortcut.lnk').Arguments

But I'm still not quite sure of how I could change it.


问:
Export compiled php (sessions-related) page as html to be reused as cached version
I have a massive php script that allows me to generate the sidebar menu according to the permissions given to the individual user. These permissions mainly come from $_SESSION and from PHP functions verifications.

The sidebar menu is always present in every page, so the problem is that this script re-works every time a page in my dashboard is changed. The problem is especially the fact that the page this way now takes 7-9 seconds to be opened.

What I am trying to achieve is this:

script is launched only one time at login

the sidebar menu is compiled and saved as HTML in a separate file (i.g. /user/1/menu.html)

all the following times, until login/logout, the menu that is included is the static HTML version and not the PHP script

I tried with cURL, file_get_contents(), fopen() and everything - but what Is retrieved is the PHP code, and not the compiled version.

Do you have any ideas on how I can get this solved? I simply would like to retrieve the compiled version and save it, so that I can include() that file instead of the PHP code every time.

edit: I am also available for front-side solutions, but with jQuery I just get an error 500, maybe because sessions are not taken into consideration in that way.

Thanks in advance. Have a nice day!


问:
is there a faster Way to display massive amounts of ascii (with font size and font type) than JTextPane
I have a video to ASCII animation converter and the pre-processing and compiling I do outside is fast but when I start displaying text it lags a lot in the beginning I thought it was that bad to calculate text size but using system.out.prinln was superfast and even if the carriage return works (which it doesn't) I'd like to have a sperate GUI/CLI panel for it

here is sample code that turns an image into ASCII

```<code>import javax.swing.*;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

public class Main {
    static short width;
    static short height;
    public static BufferedImage mytoBufferedImage(Image img){
        if (img instanceof BufferedImage)
        {
            return (BufferedImage) img;
        }
        BufferedImage buffImage = new BufferedImage(img.getWidth(null),
                img.getHeight(null), BufferedImage.TYPE_INT_RGB);

        Graphics2D bGr = buffImage.createGraphics();
        bGr.drawImage(img, 0, 0, null);
        bGr.dispose();

        return buffImage;
    }
    public static BufferedImage scaleApple(BufferedImage image){
        return mytoBufferedImage(
                image.getScaledInstance(width, height, BufferedImage.SCALE_FAST));
    }
    public static void main(String[] args) throws IOException, FontFormatException, InterruptedException {
        width = 256;
        height = 192;

        BufferedImage Frame;

        ArrayList<String> FrameBuffer = new ArrayList<>();
        StringBuilder ASCIIFrame;
        ArrayList<Byte> Bright;
        final String[] Rendered;

        byte R;
        byte G;
        byte B;

        Frame = mytoBufferedImage(new ImageIcon("example.jpg").getImage());

        Bright = new ArrayList<>();

        int[] data =((DataBufferInt)
                scaleApple(Frame)
                        .getRaster()
                        .getDataBuffer())
                .getData();
        for (int datum : data) {
            Color c = new Color(datum);
            R = (byte) c.getRed();
            G = (byte) c.getGreen();
            B = (byte) c.getBlue();
            Bright.add((byte) Math.round(Math.sqrt( 0.299*((R&0xFF)^2) + 0.587*((G&0xFF)^2) + 0.114*((B&0xFF)^2))));
        }

        ASCIIFrame = new StringBuilder();
        // j+(width*i) is cords
        for (int i = 0; i < Main.height; i++) {
            for (int j = 0; j < Main.width; j++) {
                byte bright = Bright.get((j + (width * i)));
                if ((bright <= 16) && (bright >= 12)) {
                    ASCIIFrame.append('█');
                    ASCIIFrame.append('█');
                }else if ((bright <= 12) && (bright >= 8)) {
                    ASCIIFrame.append('▓');
                    ASCIIFrame.append('▓');
                }else if ((bright <= 8) && (bright >= 4)) {
                    ASCIIFrame.append('▒');
                    ASCIIFrame.append('▒');
                }else {
                    ASCIIFrame.append(' ');
                    ASCIIFrame.append(' ');
                }
            }
            ASCIIFrame.append('\n');
        }
        FrameBuffer.add(ASCIIFrame.toString());

        Rendered = FrameBuffer.toArray(String[]::new);

        JTextPane render = new JTextPane();
        render.setDoubleBuffered(false);

        InputStream fontIS = new FileInputStream("JetBrainsMonoNL-Regular.ttf");

        Font font = Font.createFont(Font.TRUETYPE_FONT, fontIS).deriveFont(3f);
        render.setFont(font);

        StyledDocument doc = render.getStyledDocument();
        SimpleAttributeSet center = new SimpleAttributeSet();

        StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
        doc.setParagraphAttributes(0, doc.getLength(), center, false);

        JFrame Jframe = new JFrame();

        JPanel MainPanel = new JPanel();
        MainPanel.add(render);
        render.setBackground(new Color(255,255,255));

        Jframe.setTitle("Ascii");
        Jframe.setSize(730, 645);
        Jframe.setLocationRelativeTo(null);
        Jframe.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
        Jframe.setContentPane(MainPanel);
        Jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        Jframe.setVisible(true);

        for (String Rendered_frame: Rendered){
            System.out.println(Rendered_frame); // FAST
            render.setText(Rendered_frame); // 99%GPU usage on rtx 3060
            Thread.sleep(300);// timer methode in actual code
        }
    }
}
</code>```

I tried carriage return, to make it easy to see System.out.println('\r'+Rendered_frame); and it didn't work

and Making A buffered Image and drawing on it with Graphics2D then displaying it on a Jlabel, is inaccurate, the display flickers and chops even with double Buffered set to true

Body:
I have a video to ASCII animation converter and the pre-processing and compiling I do outside is fast but when I start displaying text it lags a lot in the beginning I thought it was that bad to calculate text size but using system.out.prinln was superfast and even if the carriage return works (which it doesn't) I'd like to have a sperate GUI/CLI panel for it

here is sample code that turns an image into ASCII

import javax.swing.*;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

public class Main {
    static short width;
    static short height;
    public static BufferedImage mytoBufferedImage(Image img){
        if (img instanceof BufferedImage)
        {
            return (BufferedImage) img;
        }
        BufferedImage buffImage = new BufferedImage(img.getWidth(null),
                img.getHeight(null), BufferedImage.TYPE_INT_RGB);

        Graphics2D bGr = buffImage.createGraphics();
        bGr.drawImage(img, 0, 0, null);
        bGr.dispose();

        return buffImage;
    }
    public static BufferedImage scaleApple(BufferedImage image){
        return mytoBufferedImage(
                image.getScaledInstance(width, height, BufferedImage.SCALE_FAST));
    }
    public static void main(String[] args) throws IOException, FontFormatException, InterruptedException {
        width = 256;
        height = 192;

        BufferedImage Frame;

        ArrayList<String> FrameBuffer = new ArrayList<>();
        StringBuilder ASCIIFrame;
        ArrayList<Byte> Bright;
        final String[] Rendered;

        byte R;
        byte G;
        byte B;

        Frame = mytoBufferedImage(new ImageIcon("example.jpg").getImage());

        Bright = new ArrayList<>();

        int[] data =((DataBufferInt)
                scaleApple(Frame)
                        .getRaster()
                        .getDataBuffer())
                .getData();
        for (int datum : data) {
            Color c = new Color(datum);
            R = (byte) c.getRed();
            G = (byte) c.getGreen();
            B = (byte) c.getBlue();
            Bright.add((byte) Math.round(Math.sqrt( 0.299*((R&0xFF)^2) + 0.587*((G&0xFF)^2) + 0.114*((B&0xFF)^2))));
        }

        ASCIIFrame = new StringBuilder();
        // j+(width*i) is cords
        for (int i = 0; i < Main.height; i++) {
            for (int j = 0; j < Main.width; j++) {
                byte bright = Bright.get((j + (width * i)));
                if ((bright <= 16) && (bright >= 12)) {
                    ASCIIFrame.append('█');
                    ASCIIFrame.append('█');
                }else if ((bright <= 12) && (bright >= 8)) {
                    ASCIIFrame.append('▓');
                    ASCIIFrame.append('▓');
                }else if ((bright <= 8) && (bright >= 4)) {
                    ASCIIFrame.append('▒');
                    ASCIIFrame.append('▒');
                }else {
                    ASCIIFrame.append(' ');
                    ASCIIFrame.append(' ');
                }
            }
            ASCIIFrame.append('\n');
        }
        FrameBuffer.add(ASCIIFrame.toString());

        Rendered = FrameBuffer.toArray(String[]::new);

        JTextPane render = new JTextPane();
        render.setDoubleBuffered(false);

        InputStream fontIS = new FileInputStream("JetBrainsMonoNL-Regular.ttf");

        Font font = Font.createFont(Font.TRUETYPE_FONT, fontIS).deriveFont(3f);
        render.setFont(font);

        StyledDocument doc = render.getStyledDocument();
        SimpleAttributeSet center = new SimpleAttributeSet();

        StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
        doc.setParagraphAttributes(0, doc.getLength(), center, false);

        JFrame Jframe = new JFrame();

        JPanel MainPanel = new JPanel();
        MainPanel.add(render);
        render.setBackground(new Color(255,255,255));

        Jframe.setTitle("Ascii");
        Jframe.setSize(730, 645);
        Jframe.setLocationRelativeTo(null);
        Jframe.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
        Jframe.setContentPane(MainPanel);
        Jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        Jframe.setVisible(true);

        for (String Rendered_frame: Rendered){
            System.out.println(Rendered_frame); // FAST
            render.setText(Rendered_frame); // 99%GPU usage on rtx 3060
            Thread.sleep(300);// timer methode in actual code
        }
    }
}

I tried carriage return, to make it easy to see System.out.println('\r'+Rendered_frame); and it didn't work

and Making A buffered Image and drawing on it with Graphics2D then displaying it on a Jlabel, is inaccurate, the display flickers and chops even with double Buffered set to true


问:
Showing error code :'ERR_OSSL_EVP_UNSUPPORTERD' in metro bundler in React Native through Visual Studio
```<code>[this is screenshot of error showing my  visual studio
code]https://i.stack.imgur.com/prBF3.png
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
return (
<View style={styles.container}>
  <Text>hello world</Text>
  <StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
</code>```

My Code is
I tried changing the port to 80 in inbound in firewall setting ,tried searching the web for solution

Body:
[this is screenshot of error showing my  visual studio
code]https://i.stack.imgur.com/prBF3.png
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
return (
<View style={styles.container}>
  <Text>hello world</Text>
  <StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});

My Code is
I tried changing the port to 80 in inbound in firewall setting ,tried searching the web for solution


问:
Request ongoing host permissions in a manifest v3 browser extension
I have a manifest v3 browser extension that has a content script, which I want to be automatically injected into certain pages, without the user explicitly interacting with the extension each time they open it. Normally this would require host permissions, which I want to avoid. Is it possible to have an extension that initially starts with no host permissions, then when the user interacts with the extension and accepts the permissions, it permanently gains host permissions to that page? If so, how can I do this?

I am aware of optional_host_permissions in the manifest, so I realise that an extension can request host permissions, but my understanding is that these increased permissions are only temporary. If this is true, then optional_host_permissions won't suit my need. Also, the requesting can only be done after the user interacts with the extension, but I don't want the user to have to manually click the action button each time they want to enable my extension, it should start automatically.


问:
how to convert a message from a telegram bot to a telegram group
I have a problem with a telegram bot, I need a scrypt that processes a specific message from this bot and sends it to a telegram group, do you know how to help me??
tks

I've tried several times but I can't get a good result


问:
How to populate two text input with different types of date using keith wood jq
I use a text input to show the date from Keith Wood datepicker jq. I'm using ('ummalqura', 'ar') as the type of date.

so far so good.

The problem is that I want to populate another text input with the equivilant date in ('gregorian', 'en').

in another word, one click on the calendar to genrate two different set of dates, one in (ummalqura) and the other in (gregorian).

any help will be appreciated.

here is the html code:

```<code><div class="container ">
        ummalqura date type: <input id="ah" class="form-control" type="text" name="datePicker">

        <br>
        gregorian date type: <input type="text" id="ad" >
    </div>
</code>```

and here is the js to the calendar datepicker in the first text input:

```<code><script>
$("#ah").calendarsPicker({
            calendar:
            $.calendars.instance('ummalqura', 'ar'),
            startDate: '0d',
            minDate: 0,

            onSelect: function (dates) {
                $(this).trigger('change');
            }
        });
</script>
</code>```

Body:
I use a text input to show the date from Keith Wood datepicker jq. I'm using ('ummalqura', 'ar') as the type of date.

so far so good.

The problem is that I want to populate another text input with the equivilant date in ('gregorian', 'en').

in another word, one click on the calendar to genrate two different set of dates, one in (ummalqura) and the other in (gregorian).

any help will be appreciated.

here is the html code:

        ummalqura date type: <input id="ah" class="form-control" type="text" name="datePicker">

        gregorian date type: <input type="text" id="ad" >

and here is the js to the calendar datepicker in the first text input:


问:
Remove border from charts if charts is present on excel sheet using xlsxwriter or openpyxl in python
I am trying to remove border from charts which is present on my excel sheet so how can i remove using xlsxwriter library or openpyxl library can anyone help?

I have gone through Xlsxwriter documentation and openpyxl documentation but in both libraries i can see they have given us functions to create charts(graph) but i am not able to get what if graph is already present in excel file and if we want to change the formatting or style of charts then what should we do.


问:
Failure to refresh function Regextract(Filename()) every time Google sheet opens from a mobile. How to trigger onOpen from a mobile?
Google sheet that fails to load filename()

I use daily sheets with the name of each day like this:

01 January 2023 Oncall_Endorsement_Sheet

02 January 2023 Oncall_Endorsement_Sheet

03 January 2023 Oncall_Endorsement_Sheet, and so on..

I used to add the date in each sheet by using the function of :
=REGEXEXTRACT(FILENAME(), "\d{2} .* \d{4}")

Where filename function is suggested by @Tanaike in the Appscript:

```<code>function Filename() {
  return SpreadsheetApp.getActiveSpreadsheet().getName();
}

const sample = _ => "Loading..."; // Dummy.

function onOpen(e) {
  const sheet = e.source.getSheetByName("CASES LIST");
  const range = sheet.getRange("C6");
  const formula = `=REGEXEXTRACT(FILENAME(), "\\d{2} .* \\d{4}")`;
  range.setFormula("=sample()");
  SpreadsheetApp.flush();
  range.setFormula(formula);
}
</code>```

It works well when the sheet is opened from any PC, but fails to run if the sheet is opened from a mobile phone like android.

Body:
Google sheet that fails to load filename()

I use daily sheets with the name of each day like this:

01 January 2023 Oncall_Endorsement_Sheet

02 January 2023 Oncall_Endorsement_Sheet

03 January 2023 Oncall_Endorsement_Sheet, and so on..

I used to add the date in each sheet by using the function of :
=REGEXEXTRACT(FILENAME(), "\d{2} .* \d{4}")

Where filename function is suggested by @Tanaike in the Appscript:

function Filename() {
  return SpreadsheetApp.getActiveSpreadsheet().getName();
}

const sample = _ => "Loading..."; // Dummy.

function onOpen(e) {
  const sheet = e.source.getSheetByName("CASES LIST");
  const range = sheet.getRange("C6");
  const formula = `=REGEXEXTRACT(FILENAME(), "\\d{2} .* \\d{4}")`;
  range.setFormula("=sample()");
  SpreadsheetApp.flush();
  range.setFormula(formula);
}

It works well when the sheet is opened from any PC, but fails to run if the sheet is opened from a mobile phone like android.


问:
My login screen doesn't redirect me to the new screen after I successfully login in flutter
when I try to login it doesn't redirect me to my authenticated page(the state doesn't update) but it stays as it is, it redirects me only after I hot restart the app. I don't know what is wrong with my code.I control the user =null in landing page but landingPage cant  return home page.

this is Landing Page

```<code>import '/material.dart';
import '/provider.dart';
import '/login-directory/home_page.dart';
import '/login-directory/sign_in_page.dart';
import '/model/user_model.dart' as usr;
import '/viewmodel/viewusermodel.dart';

    class LandingPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final _userModel = Provider.of<UserModel>(context,listen: false);
  if (_userModel.state == ViewState.Idle) {
    if (_userModel.user == null) {
    return SignInPage();//user==null
  } else {
    return HomePage(user: _userModel.user as usr.User);
  }
}
else {
  return Scaffold(
    body: Center(child: CircularProgressIndicator(),),
  );
    }
  }
}
</code>```

this is User Repository:

```<code>import '/locator.dart';
import '/model/user_model.dart';
import '/services/auth_base.dart';
import '/services/fake_auth_service.dart';
import '/services/firebase_auth_service.dart';

enum AppMode{DEBUG,RELEASE}
class UserRepository implements AuthBase {
  FirebaseAuthService _firebaseAuthService = locator<FirebaseAuthService>();
  final FakeAuthService _fakeAuthService = locator<FakeAuthService>();
  AppMode appMode = AppMode.RELEASE;

  @override
  Future<User?> currentUser() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.currentUser();
    }
    else {
      return await _firebaseAuthService.currentUser();
    }
  }

  @override
  Future<bool> logOut() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.logOut();
    }
    else {
      return await _firebaseAuthService.logOut();
    }
  }

  @override
  Future<User?> singInAnonymously() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.singInAnonymously();
    }
    else {
      return await _firebaseAuthService.singInAnonymously();
    }
  }

  @override
  Future<User?> signInWithGoogle() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.singInAnonymously();
    }
    else {
      return await _firebaseAuthService.signInWithGoogle();
    }
  }
}
</code>```

Authbase :

```<code> abstract class AuthBase{

 Future<User?> currentUser();
 Future<User?> singInAnonymously();
 Future<bool> logOut();
 Future<User?> signInWithGoogle();

 }
</code>```

ViewUserModel:

```<code>import 'package:flutter/material.dart';
import 'package:/locator.dart';
import 'package:/model/user_model.dart' as usr;
import 'package:/repository/user_repository.dart';
import 'package:/services/auth_base.dart';

enum ViewState{Idle,Busy}
class UserModel with ChangeNotifier implements AuthBase {
  ViewState _state = ViewState.Idle;
  final UserRepository _userRepository = locator<UserRepository>();
  usr.User? _user;
  usr.User? get user =>_user;

  ViewState get state => _state;

  set state(ViewState value) {
    _state = value;
    notifyListeners(); //
  }

  UserModel(){
    currentUser();
  }

  @override
  Future<usr.User?> currentUser() async {
    try {
      state = ViewState
          .Busy; //kullanıcı verisi cekilirken ekran verisini guncelliyorum
      _user = (await _userRepository.currentUser())!;
      return _user;
    } catch (e) {
      debugPrint("ViewModel currentUser is error $e" );
      return null;
    } finally {
      state = ViewState.Idle;
    }
  }

  @override
  Future<bool> logOut() async {
    try {
      state = ViewState.Busy;
      bool result =await _userRepository.logOut();
      _user= null;
      return result;
    } catch (e) {
      debugPrint("ViewModel currentUser is error $e" );
      return false;
    } finally {
      state = ViewState.Idle;
    }
  }

  @override
  Future<usr.User?> singInAnonymously() async {
    try {
      state = ViewState
          .Busy;
      _user = (await _userRepository.singInAnonymously())!;
      return _user;
    } catch (e) {
      debugPrint("ViewModel currentUser is error $e");
      return null;
    } finally {
      state = ViewState.Idle;
    }
  }

  @override
  Future<usr.User?> signInWithGoogle() async {
    try {
      state = ViewState
          .Busy;
      _user = (await _userRepository.signInWithGoogle())!;
    return _user;
    } catch (e) {
    debugPrint("ViewModel currentUser is error $e");
    return null;
    } finally {
    state = ViewState.Idle;
    }
  }
}
</code>```

GetIt locator:

```<code> GetIt locator=GetIt.instance;
 void setupLocator(){
 locator.registerLazySingleton(() => FirebaseAuthService());
 locator.registerLazySingleton(() => UserRepository());
 }
</code>```

this is main.dart:

```<code>    import '/viewmodel/viewusermodel.dart';

void main() async{
  WidgetsFlutterBinding.ensureInitialized();;
  await Firebase.initializeApp();
  setupLocator();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title:'Title',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch:Colors.purple,
      ),
      home:ChangeNotifierProvider(
          create:(context)=>UserModel(),
          child: LandingPage()),
    );
  }
}
</code>```

Body:
when I try to login it doesn't redirect me to my authenticated page(the state doesn't update) but it stays as it is, it redirects me only after I hot restart the app. I don't know what is wrong with my code.I control the user =null in landing page but landingPage cant  return home page.

this is Landing Page

import '/material.dart';
import '/provider.dart';
import '/login-directory/home_page.dart';
import '/login-directory/sign_in_page.dart';
import '/model/user_model.dart' as usr;
import '/viewmodel/viewusermodel.dart';

    class LandingPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final _userModel = Provider.of<UserModel>(context,listen: false);
  if (_userModel.state == ViewState.Idle) {
    if (_userModel.user == null) {
    return SignInPage();//user==null
  } else {
    return HomePage(user: _userModel.user as usr.User);
  }
}
else {
  return Scaffold(
    body: Center(child: CircularProgressIndicator(),),
  );
    }
  }
}

this is User Repository:

import '/locator.dart';
import '/model/user_model.dart';
import '/services/auth_base.dart';
import '/services/fake_auth_service.dart';
import '/services/firebase_auth_service.dart';

enum AppMode{DEBUG,RELEASE}
class UserRepository implements AuthBase {
  FirebaseAuthService _firebaseAuthService = locator<FirebaseAuthService>();
  final FakeAuthService _fakeAuthService = locator<FakeAuthService>();
  AppMode appMode = AppMode.RELEASE;

  @override
  Future<User?> currentUser() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.currentUser();
    }
    else {
      return await _firebaseAuthService.currentUser();
    }
  }

  @override
  Future<bool> logOut() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.logOut();
    }
    else {
      return await _firebaseAuthService.logOut();
    }
  }

  @override
  Future<User?> singInAnonymously() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.singInAnonymously();
    }
    else {
      return await _firebaseAuthService.singInAnonymously();
    }
  }

  @override
  Future<User?> signInWithGoogle() async {
    if (appMode == AppMode.DEBUG) {
      return await _fakeAuthService.singInAnonymously();
    }
    else {
      return await _firebaseAuthService.signInWithGoogle();
    }
  }
}

Authbase :

 abstract class AuthBase{

 Future<User?> currentUser();
 Future<User?> singInAnonymously();
 Future<bool> logOut();
 Future<User?> signInWithGoogle();

 }

ViewUserModel:

import 'package:flutter/material.dart';
import 'package:/locator.dart';
import 'package:/model/user_model.dart' as usr;
import 'package:/repository/user_repository.dart';
import 'package:/services/auth_base.dart';

enum ViewState{Idle,Busy}
class UserModel with ChangeNotifier implements AuthBase {
  ViewState _state = ViewState.Idle;
  final UserRepository _userRepository = locator<UserRepository>();
  usr.User? _user;
  usr.User? get user =>_user;

  ViewState get state => _state;

  set state(ViewState value) {
    _state = value;
    notifyListeners(); //
  }

  UserModel(){
    currentUser();
  }

  @override
  Future<usr.User?> currentUser() async {
    try {
      state = ViewState
          .Busy; //kullanıcı verisi cekilirken ekran verisini guncelliyorum
      _user = (await _userRepository.currentUser())!;
      return _user;
    } catch (e) {
      debugPrint("ViewModel currentUser is error $e" );
      return null;
    } finally {
      state = ViewState.Idle;
    }
  }

  @override
  Future<bool> logOut() async {
    try {
      state = ViewState.Busy;
      bool result =await _userRepository.logOut();
      _user= null;
      return result;
    } catch (e) {
      debugPrint("ViewModel currentUser is error $e" );
      return false;
    } finally {
      state = ViewState.Idle;
    }
  }

  @override
  Future<usr.User?> singInAnonymously() async {
    try {
      state = ViewState
          .Busy;
      _user = (await _userRepository.singInAnonymously())!;
      return _user;
    } catch (e) {
      debugPrint("ViewModel currentUser is error $e");
      return null;
    } finally {
      state = ViewState.Idle;
    }
  }

  @override
  Future<usr.User?> signInWithGoogle() async {
    try {
      state = ViewState
          .Busy;
      _user = (await _userRepository.signInWithGoogle())!;
    return _user;
    } catch (e) {
    debugPrint("ViewModel currentUser is error $e");
    return null;
    } finally {
    state = ViewState.Idle;
    }
  }
}

GetIt locator:

 GetIt locator=GetIt.instance;
 void setupLocator(){
 locator.registerLazySingleton(() => FirebaseAuthService());
 locator.registerLazySingleton(() => UserRepository());
 }

this is main.dart:

    import '/viewmodel/viewusermodel.dart';

void main() async{
  WidgetsFlutterBinding.ensureInitialized();;
  await Firebase.initializeApp();
  setupLocator();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title:'Title',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch:Colors.purple,
      ),
      home:ChangeNotifierProvider(
          create:(context)=>UserModel(),
          child: LandingPage()),
    );
  }
}


问:
How to reload canceling and auto reload? blueprints
Hi i have a reload function in unreal but i cant figure out how to cancel the reload and how to make it automatic when the mag has 0 ammo. Can someone help me out with that.


问:
Does Uber provide API to access Scooter and bike data?
I am integrating JUMP scooters in my application. Till now I was using gbfs urls to get the bike status, pricing etc. After JUMP was acquired by Uber gbfs urls do not work anymore. Uber because of the privacy & data securit policy are not posting the data to gbfs anymore

Does Uber provide API to access Scooter and bike data ?

Can somebody help

I am trying  WoBike/JUMP.md but it is tedious process. Still havent been able to get it