问:
Point of Task.Run if it will be awaited immediately
I have this method:

```<code>public async Task DoSomething()
{
    string token = string.Empty;

    await Task.Run(() =>
    {
        using (var sc = _dbManager.CreateSession())
        {
            // somework...
        }
    });

    using (var resp = await client.PostAsync(authenticationEndpoint,
        new FormUrlEncodedContent(authenticateRequest), stoppingToken))
    {
        resp.EnsureSuccessStatusCode();
        string stringResponse = await resp.Content.ReadAsStringAsync(stoppingToken);
        var response = JsonConvert.DeserializeObject<Response>(stringResponse);
        token = response.AccessToken;
    }
}
</code>```

Now I do not understand why I need to use await Task.Run? It's confusing for me to understand logic behind this, as I'm awaiting the task to finish anyway, so why should I put it in the Task in the first place?

My lead told me that this was the way to go, and also explained to me that if I don't put that in Task, the code will be executed again from the top, after await client.PostAsync.

Body:
I have this method:

public async Task DoSomething()
{
    string token = string.Empty;

    await Task.Run(() =>
    {
        using (var sc = _dbManager.CreateSession())
        {
            // somework...
        }
    });

    using (var resp = await client.PostAsync(authenticationEndpoint,
        new FormUrlEncodedContent(authenticateRequest), stoppingToken))
    {
        resp.EnsureSuccessStatusCode();
        string stringResponse = await resp.Content.ReadAsStringAsync(stoppingToken);
        var response = JsonConvert.DeserializeObject<Response>(stringResponse);
        token = response.AccessToken;
    }
}

Now I do not understand why I need to use await Task.Run? It's confusing for me to understand logic behind this, as I'm awaiting the task to finish anyway, so why should I put it in the Task in the first place?

My lead told me that this was the way to go, and also explained to me that if I don't put that in Task, the code will be executed again from the top, after await client.PostAsync.


来源: stackexchange

问:
Property or method "navigationLinks" is not defined on the instance but referenced during render. Make sure that this property is reactive
Am stack in calling data from vuex module to component.

Am calling Navigation links where I have created a module navigation.js. I have imported the module in the main store.

Am using the getters to call the data in the component.

My navigation component looks like this

```<code><template>
  <nav>
    <ul>
      <li v-for="link in navigationLinks" :key="link.label">
        <router-link :to="link.route">{{ link.label }}</router-link>
      </li>
    </ul>
  </nav>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import store from '@/store';
import navigation from '@/store/navigation';

  export default {
  name: 'Navbar',
  data: {

  },
  computed: {
    ...mapGetters(['navigationLinks'])
  }
}
</code>```

In my main store.js

```<code>import Vue from 'vue'
import Vuex from 'vuex'
import auth from './auth'
import navigation from './navigation'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    auth,
    navigation
  }
})
</code>```

In my navigation.js I have

```<code>const state = {
  links: [
    { label: 'Home', route: '/', icon: 'home' },
    { label: 'About', route: '/about', icon: 'info' },
    { label: 'Contact', route: '/contact', icon: 'envelope' },
  ]
}

const getters = {
  navigationLinks: state => state.links
}

export default {
  state,
  getters
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Am stack in calling data from vuex module to component.

Am calling Navigation links where I have created a module navigation.js. I have imported the module in the main store.

Am using the getters to call the data in the component.

My navigation component looks like this

<template>

        <router-link :to="link.route">{{ link.label }}</router-link>

</template>


问:
Elementor custom widget default font family
I'm creating custom widget of Elementor

I can set default font color using below code

```<code>   $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
             'name' => 'countdown_text',
             'label' => __( 'Countdown day', 'plugin-domain' ),
             'scheme' => Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
             'default' => '#733D1F',
             'selector' => '{{WRAPPER}} .sp-hero-countdown .sp-hero-countdown-text',
        ]
   );

</code>```

I would like to set default font-family for custom title widget.font-family select drop-down

We have checked elementor developers documentation, but haven't found any solution, We want to add a default font family for the custom title widget, Please help us to resolve this issue. your help will be highly appreciated.

Body:
I'm creating custom widget of Elementor

I can set default font color using below code

   $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
             'name' => 'countdown_text',
             'label' => __( 'Countdown day', 'plugin-domain' ),
             'scheme' => Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
             'default' => '#733D1F',
             'selector' => '{{WRAPPER}} .sp-hero-countdown .sp-hero-countdown-text',
        ]
   );

I would like to set default font-family for custom title widget.font-family select drop-down

We have checked elementor developers documentation, but haven't found any solution, We want to add a default font family for the custom title widget, Please help us to resolve this issue. your help will be highly appreciated.


问:
Selecting random rows from table with sqlalchemy gives not random results
I have, on a pgsql backend, a table and an (allegedly) random access version of it:

class Topic(db.Model):
    id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    question_id = db.Column(UUID(as_uuid=True), db.ForeignKey("question.id"))
    topic = db.Column(Enum(QuestionTopicsChoices))

# Create an alias for Topic that uses BERNOULLI sampling method
Topic_rnd = db.aliased(Topic, tablesample(Topic, func.bernoulli(2.5), 10))
```
<p>I'd expect, then, that these two queries return with different results:</p>
<pre class="lang-py prettyprint-override"><code>topics_linear = Topic.query.filter_by(topic='emotion').all()
topics_random = Topic_rnd.query.filter_by(topic='emotion').all()
</code>```

but they return the records in the same order. What am I doing wrong?

Body:
I have, on a pgsql backend, a table and an (allegedly) random access version of it:

class Topic(db.Model):
    id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    question_id = db.Column(UUID(as_uuid=True), db.ForeignKey("question.id"))
    topic = db.Column(Enum(QuestionTopicsChoices))

# Create an alias for Topic that uses BERNOULLI sampling method
Topic_rnd = db.aliased(Topic, tablesample(Topic, func.bernoulli(2.5), 10))

I'd expect, then, that these two queries return with different results:

topics_linear = Topic.query.filter_by(topic='emotion').all()
topics_random = Topic_rnd.query.filter_by(topic='emotion').all()

but they return the records in the same order. What am I doing wrong?


问:
Symfony 6.2 witch docker php-fpm
i have a problem with my production environnement.

In local i'm using php-cli and in production php-fpm and in production when $Response->send() is excecuted, i pass in the first if(\function_exists('fastcgi_finish_request'))) and this show me a white page instead of my render.

In my PublicController.php i have this :

```<code>    #[Route('/user/validate/account', name: 'user_validate_account', methods: ['GET'])]
    public function validateEmail(Request $request, SecurityService $securityService): Response
    {
        if($this->getUser() && $this->getUser()->getIsEmailVerified() && !$tokenRequested = $request->get('token')) return $this->redirectToRoute('public_home');

        $securityService->forceLogout();
        $session = $request->getSession();
        $session->remove('_user_validate_account_security_token');

        if($tokenRequested = $request->get('token')) {
            $securityToken = $this->securityTokenRepository->findOneByToken($tokenRequested);

            if(!$securityToken) {
                $this->addFlash('globalInfo', "Le token de sécurité est invalide !");
                return $this->redirectToRoute('public_user_validate_account');
            } elseif($securityToken->getTokenType() === SecurityToken::_VALIDATION_EMAIL) {
                if ($securityToken->getExpiresAt() < DateUtility::now()) {
                    $this->addFlash('globalInfo', "Votre token de sécurité à expiré, merci renouveler votre demande !");
                    $this->securityTokenRepository->remove($securityToken, true);
                    return $this->redirectToRoute('public_user_validate_account');
                }

                $securityToken->getUser()->setIsEmailVerified(true);
                $this->securityTokenRepository->flush();
                if ($securityToken->getUser()->getIsPasswordNeedToChange()) {
                    $session->set('_user_validate_account_security_token', $securityToken);
                    return $this->redirectToRoute('public_user_validate_password');
                } else {
                    $this->addFlash('globalInfo', "Votre compte est vérifié, bonne gestion :)");
                    return $this->redirectToRoute('public_home');
                }
            }
        }

        return $this->render('security/user_validate/account.html.twig');
    }
</code>```

In local, with php cli when

```<code>    $securityService->forceLogout();

</code>```

is executed, script will continue and show my render. But in production i'm using php-fpm and i have a white page.

My $securityService->forceLogout(); use Response from HttpRequest of Symfony:

```<code>    <?php

    namespace App\Service;

    use Symfony\Component\HttpFoundation\RequestStack;
    use Symfony\Component\HttpFoundation\Response;
    use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
    use Symfony\Component\Security\Http\Event\LogoutEvent;
    use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

    class SecurityService
    {

        public function __construct(
            private readonly RequestStack             $requestStack,
            private readonly EventDispatcherInterface $eventDispatcher,
            private readonly TokenStorageInterface    $tokenStorage
        )
        {}

        public function forceLogout() : void
        {
            $logoutEvent = new LogoutEvent($this->requestStack->getCurrentRequest(), $this->tokenStorage->getToken());
            $this->eventDispatcher->dispatch($logoutEvent);
            $this->tokenStorage->setToken(null);
            $response = new Response();
            $response->headers->clearCookie('REMEMBERME');
            $response->send();
        }
    }

</code>```

When $response-send(); :

```<code>    /**
     * Sends HTTP headers and content.
     *
     * @return $this
     */
    public function send(): static
    {
        $this->sendHeaders();
        $this->sendContent();

        if (\function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif (\function_exists('litespeed_finish_request')) {
            litespeed_finish_request();
        } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
            static::closeOutputBuffers(0, true);
            flush();
        }

        return $this;
    }
</code>```

In production, i go to the 2nd elsif, and this show my page with my render, but in production i enter in the first if (\function_exists('fastcgi_finish_request')) and this show me a white page 200.

Someone can help me to fixe this please ?

```<code></code>```

Title: Symfony 6.2 witch docker php-fpm

Body:
i have a problem with my production environnement.

In local i'm using php-cli and in production php-fpm and in production when $Response->send() is excecuted, i pass in the first if(\function_exists('fastcgi_finish_request'))) and this show me a white page instead of my render.

In my PublicController.php i have this :

    #[Route('/user/validate/account', name: 'user_validate_account', methods: ['GET'])]
    public function validateEmail(Request $request, SecurityService $securityService): Response
    {
        if($this->getUser() && $this->getUser()->getIsEmailVerified() && !$tokenRequested = $request->get('token')) return $this->redirectToRoute('public_home');

        $securityService->forceLogout();
        $session = $request->getSession();
        $session->remove('_user_validate_account_security_token');

        if($tokenRequested = $request->get('token')) {
            $securityToken = $this->securityTokenRepository->findOneByToken($tokenRequested);

            if(!$securityToken) {
                $this->addFlash('globalInfo', "Le token de sécurité est invalide !");
                return $this->redirectToRoute('public_user_validate_account');
            } elseif($securityToken->getTokenType() === SecurityToken::_VALIDATION_EMAIL) {
                if ($securityToken->getExpiresAt() < DateUtility::now()) {
                    $this->addFlash('globalInfo', "Votre token de sécurité à expiré, merci renouveler votre demande !");
                    $this->securityTokenRepository->remove($securityToken, true);
                    return $this->redirectToRoute('public_user_validate_account');
                }

                $securityToken->getUser()->setIsEmailVerified(true);
                $this->securityTokenRepository->flush();
                if ($securityToken->getUser()->getIsPasswordNeedToChange()) {
                    $session->set('_user_validate_account_security_token', $securityToken);
                    return $this->redirectToRoute('public_user_validate_password');
                } else {
                    $this->addFlash('globalInfo', "Votre compte est vérifié, bonne gestion :)");
                    return $this->redirectToRoute('public_home');
                }
            }
        }

        return $this->render('security/user_validate/account.html.twig');
    }

In local, with php cli when

    $securityService->forceLogout();

is executed, script will continue and show my render. But in production i'm using php-fpm and i have a white page.

My $securityService->forceLogout(); use Response from HttpRequest of Symfony:

    <?php

    namespace App\Service;

    use Symfony\Component\HttpFoundation\RequestStack;
    use Symfony\Component\HttpFoundation\Response;
    use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
    use Symfony\Component\Security\Http\Event\LogoutEvent;
    use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

    class SecurityService
    {

        public function __construct(
            private readonly RequestStack             $requestStack,
            private readonly EventDispatcherInterface $eventDispatcher,
            private readonly TokenStorageInterface    $tokenStorage
        )
        {}

        public function forceLogout() : void
        {
            $logoutEvent = new LogoutEvent($this->requestStack->getCurrentRequest(), $this->tokenStorage->getToken());
            $this->eventDispatcher->dispatch($logoutEvent);
            $this->tokenStorage->setToken(null);
            $response = new Response();
            $response->headers->clearCookie('REMEMBERME');
            $response->send();
        }
    }

When $response-send(); :

    /**
     * Sends HTTP headers and content.
     *
     * @return $this
     */
    public function send(): static
    {
        $this->sendHeaders();
        $this->sendContent();

        if (\function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif (\function_exists('litespeed_finish_request')) {
            litespeed_finish_request();
        } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
            static::closeOutputBuffers(0, true);
            flush();
        }

        return $this;
    }

In production, i go to the 2nd elsif, and this show my page with my render, but in production i enter in the first if (\function_exists('fastcgi_finish_request')) and this show me a white page 200.

Someone can help me to fixe this please ?


问:
Regex - why these brackets influence on result?
I have the following regex:

```<code>(?<=<(.{1,100})>)[^<][^>].+[^<][^>](?=<\/\1>)
</code>```

and the string
some
. I want my result to be the insides of a tag, but I can't understand why [^>] (3-rd bracket) influences on result.

I tried to process it in my positive lookbehind '>)'. If I delete [^>], it works ok, but I don't understand why it counts.
https://regex101.com/r/t25vJh/1

Body:
I have the following regex:

(?<=<(.{1,100})>)[^<][^>].+[^<][^>](?=<\/\1>)

and the string
some
. I want my result to be the insides of a tag, but I can't understand why [^>] (3-rd bracket) influences on result.

I tried to process it in my positive lookbehind '>)'. If I delete [^>], it works ok, but I don't understand why it counts.
https://regex101.com/r/t25vJh/1


问:
Flutter Future Filtered Data
I'm pulling my data from MongoDB with a Future. However, I want to pull only some of the data, not the whole data. How can I filter this?

I will put the data I filtered into the list. I added the readMongo and lessonModel codes.

In addition, although my codes work very well, I think that I did not do something according to the rules, if I am missing, I would be very happy if you could point out.

```<code>  Future<List<Map<String, dynamic>>> _getData() async {
    values = MongoDatabase.readMongo(MongoDatabase.lessonCollection);
    return values!;
  }
</code>```

readMongo

```<code>static Future<List<Map<String, dynamic>>> readMongo(collectionName) async {
    final data = await collectionName.find().toList();
    return data;
  }
</code>```

LessonModel

```<code>import 'dart:convert';

LessonModel lessonModelFromMap(String str) => LessonModel.fromMap(json.decode(str));

String lessonModelToMap(LessonModel data) => json.encode(data.toMap());

class LessonModel {
  LessonModel({this.id, this.info, this.subject});

  final Id? id;
  final Info? info;
  final List<Subject>? subject;

  factory LessonModel.fromMap(Map<String, dynamic> json) => LessonModel(
        info: json["info"] == null ? null : Info.fromMap(json["info"]),
        subject: json["subject"] == null ? null : List<Subject>.from(json["subject"].map((x) => Subject.fromMap(x))),
      );

  Map<String, dynamic> toMap() => {
        "_id": id == null ? null : id!.toMap(),
        "info": info == null ? null : info!.toMap(),
        "subject": subject == null ? null : List<dynamic>.from(subject!.map((x) => x.toMap())),
      };
}

class Id {
  Id({this.oid});

  final String? oid;

  factory Id.fromMap(Map<String, dynamic> json) => Id(oid: json["\u0024oid"]);

  Map<String, dynamic> toMap() => {"\u0024oid": oid};
}

class Info {
  Info({this.name, this.infoClass, this.semester, this.credit, this.icon});

  final String? name;
  final String? infoClass;
  final String? semester;
  final int? credit;
  final String? icon;

  factory Info.fromMap(Map<String, dynamic> json) => Info(
      name: json["name"],
      infoClass: json["class"],
      semester: json["semester"],
      credit: json["credit"],
      icon: json["icon"]);

  Map<String, dynamic> toMap() =>
      {"name": name, "class": infoClass, "semester": semester, "credit": credit, "icon": icon};
}

class Subject {
  Subject({this.subjectId, this.name, this.text, this.video, this.trainer});

  final int? subjectId;
  final String? name;
  final String? text;
  final String? video;
  final String? trainer;

  factory Subject.fromMap(Map<String, dynamic> json) => Subject(
      subjectId: json["subjectId"],
      name: json["name"],
      text: json["text"],
      video: json["video"],
      trainer: json["trainer"]);

  Map<String, dynamic> toMap() =>
      {"subjectId": subjectId, "name": name, "text": text, "video": video, "trainer": trainer};
}
</code>```

Title: Flutter Future Filtered Data

Body:
I'm pulling my data from MongoDB with a Future. However, I want to pull only some of the data, not the whole data. How can I filter this?

I will put the data I filtered into the list. I added the readMongo and lessonModel codes.

In addition, although my codes work very well, I think that I did not do something according to the rules, if I am missing, I would be very happy if you could point out.

  Future<List<Map<String, dynamic>>> _getData() async {
    values = MongoDatabase.readMongo(MongoDatabase.lessonCollection);
    return values!;
  }

readMongo

static Future<List<Map<String, dynamic>>> readMongo(collectionName) async {
    final data = await collectionName.find().toList();
    return data;
  }

LessonModel

import 'dart:convert';

LessonModel lessonModelFromMap(String str) => LessonModel.fromMap(json.decode(str));

String lessonModelToMap(LessonModel data) => json.encode(data.toMap());

class LessonModel {
  LessonModel({this.id, this.info, this.subject});

  final Id? id;
  final Info? info;
  final List<Subject>? subject;

  factory LessonModel.fromMap(Map<String, dynamic> json) => LessonModel(
        info: json["info"] == null ? null : Info.fromMap(json["info"]),
        subject: json["subject"] == null ? null : List<Subject>.from(json["subject"].map((x) => Subject.fromMap(x))),
      );

  Map<String, dynamic> toMap() => {
        "_id": id == null ? null : id!.toMap(),
        "info": info == null ? null : info!.toMap(),
        "subject": subject == null ? null : List<dynamic>.from(subject!.map((x) => x.toMap())),
      };
}

class Id {
  Id({this.oid});

  final String? oid;

  factory Id.fromMap(Map<String, dynamic> json) => Id(oid: json["\u0024oid"]);

  Map<String, dynamic> toMap() => {"\u0024oid": oid};
}

class Info {
  Info({this.name, this.infoClass, this.semester, this.credit, this.icon});

  final String? name;
  final String? infoClass;
  final String? semester;
  final int? credit;
  final String? icon;

  factory Info.fromMap(Map<String, dynamic> json) => Info(
      name: json["name"],
      infoClass: json["class"],
      semester: json["semester"],
      credit: json["credit"],
      icon: json["icon"]);

  Map<String, dynamic> toMap() =>
      {"name": name, "class": infoClass, "semester": semester, "credit": credit, "icon": icon};
}

class Subject {
  Subject({this.subjectId, this.name, this.text, this.video, this.trainer});

  final int? subjectId;
  final String? name;
  final String? text;
  final String? video;
  final String? trainer;

  factory Subject.fromMap(Map<String, dynamic> json) => Subject(
      subjectId: json["subjectId"],
      name: json["name"],
      text: json["text"],
      video: json["video"],
      trainer: json["trainer"]);

  Map<String, dynamic> toMap() =>
      {"subjectId": subjectId, "name": name, "text": text, "video": video, "trainer": trainer};
}


问:
JSON, data can have object and array and use data class for all
When trying to process JSON, I recive Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

This JSON is a client with array in data but i want to use the same data class for other for example employee, but I need that data can store different classes

{
    "data": [
        {
            "client": "PAL",
            "organization": "*",
            "organization_info": {
                "name": "*",
                "searchKey": "0",
                "id": "0"
            },
            "id": "*****",
            "searchKey": "AJ23",
            "commercialName": "MANOLO",
            "fiscalName": "MANOLO",
            "locations": [{
                    "address": "NUEVA",
                    "city": "SEVILLA",
                    "zipCode": "00000",
                    "country": "ES"}]
        },
        {
            "client": "LAC",
            "organization": "*",
            "organization_info": {
                "name": "*",
                "searchKey": "0",
                "id": "0"
            },
            "id": "*****",
            "searchKey": "0ASD13",
            "commercialName": "DANI",
            "fiscalName": "DANI",
            "locations": [{
                    "address": "FONTANA",
                    "city": "VALLADOLID",
                    "zipCode": "00000",
                    "country": "ES"
                }]
        }]
}
```
<p>This JSON has a data object since it only has one result</p>
<pre class="lang-json prettyprint-override"><code>{
    "data": {
        "client": "PAL",
            "organization": "*",
            "organization_info": {
                "name": "*",
                "searchKey": "0",
                "id": "0"
            },
            "id": "*****",
            "searchKey": "AJ2",
            "commercialName": "MANOLO",
            "fiscalName": "MANOLO",
            "locations": [
                    "address": "NUEVA",
                    "city": "SEVILLA",
                    "zipCode": "00000",
                    "country": "ES"
             }]
       }
}
</code>```

The idea of the Data class is that it be generic to be able to call different classes Customer, Provider, etc. from the main class.

public class Data<T> {
    @SerializedName("data")
    private final List<T> data;
    String links;

    public Data(List<T> data) {
        super();
        this.data = data;
    }

    public List<T> getData() {
        return data;
    }

    //get and set method
```
<pre class="lang-java prettyprint-override"><code>public class Client {
    private String client;
    private String organization;
    private Org_info organization_info;
    private String id;
    private String fiscalName;
    private String searchKey;
    private String commercialName;
    private String phone;
    private String email;
    private ArrayList<Locations> locations;

    public Cliente(Org_info organization_info, String client, String organization, String id, String fiscalName, String searchKey,String phone, String email,
            String commercialName,ArrayList<Locations> locations) {
        super();
        this.organization_info=organization_info;
        this.client = client;
        this.organization = organization;
        this.id = id;
        this.fiscalName = fiscalName;
        this.searchKey = searchKey;
        this.commercialName = commercialName;
        this.locations = locations;
    }
    //get and set method
</code>```

How can I make the data class generic, and be able to store JSON data with the data node from both clients and providers, while receiving an array of data or a data object?

public static void main(String[] args){
    conection();
    InputStreamReader inputStreamReader = new InputStreamReader(http.getInputStream(), "UTF-8");
    BufferedReader br = new BufferedReader(inputStreamReader);
    StringBuilder sb = new StringBuilder();
    int cp;
    while ((cp = br.read()) != -1) {
        sb.append((char) cp);
    }
    String output = sb.toString();

    final Type tpEnvClient = new TypeToken<Data<Client>>(){}.getType();
    final Data<Client> envEmp = new Gson().fromJson(output, tpEnvClient);
```

When trying to store an array I get an error because I can't store a list of clients.

Body:
When trying to process JSON, I recive Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

This JSON is a client with array in data but i want to use the same data class for other for example employee, but I need that data can store different classes

{
    "data": [
        {
            "client": "PAL",
            "organization": "*",
            "organization_info": {
                "name": "*",
                "searchKey": "0",
                "id": "0"
            },
            "id": "*****",
            "searchKey": "AJ23",
            "commercialName": "MANOLO",
            "fiscalName": "MANOLO",
            "locations": [{
                    "address": "NUEVA",
                    "city": "SEVILLA",
                    "zipCode": "00000",
                    "country": "ES"}]
        },
        {
            "client": "LAC",
            "organization": "*",
            "organization_info": {
                "name": "*",
                "searchKey": "0",
                "id": "0"
            },
            "id": "*****",
            "searchKey": "0ASD13",
            "commercialName": "DANI",
            "fiscalName": "DANI",
            "locations": [{
                    "address": "FONTANA",
                    "city": "VALLADOLID",
                    "zipCode": "00000",
                    "country": "ES"
                }]
        }]
}

This JSON has a data object since it only has one result

{
    "data": {
        "client": "PAL",
            "organization": "*",
            "organization_info": {
                "name": "*",
                "searchKey": "0",
                "id": "0"
            },
            "id": "*****",
            "searchKey": "AJ2",
            "commercialName": "MANOLO",
            "fiscalName": "MANOLO",
            "locations": [
                    "address": "NUEVA",
                    "city": "SEVILLA",
                    "zipCode": "00000",
                    "country": "ES"
             }]
       }
}

The idea of the Data class is that it be generic to be able to call different classes Customer, Provider, etc. from the main class.

public class Data<T> {
    @SerializedName("data")
    private final List<T> data;
    String links;

    public Data(List<T> data) {
        super();
        this.data = data;
    }

    public List<T> getData() {
        return data;
    }

    //get and set method

public class Client {
    private String client;
    private String organization;
    private Org_info organization_info;
    private String id;
    private String fiscalName;
    private String searchKey;
    private String commercialName;
    private String phone;
    private String email;
    private ArrayList<Locations> locations;

    public Cliente(Org_info organization_info, String client, String organization, String id, String fiscalName, String searchKey,String phone, String email,
            String commercialName,ArrayList<Locations> locations) {
        super();
        this.organization_info=organization_info;
        this.client = client;
        this.organization = organization;
        this.id = id;
        this.fiscalName = fiscalName;
        this.searchKey = searchKey;
        this.commercialName = commercialName;
        this.locations = locations;
    }
    //get and set method

How can I make the data class generic, and be able to store JSON data with the data node from both clients and providers, while receiving an array of data or a data object?

public static void main(String[] args){
    conection();
    InputStreamReader inputStreamReader = new InputStreamReader(http.getInputStream(), "UTF-8");
    BufferedReader br = new BufferedReader(inputStreamReader);
    StringBuilder sb = new StringBuilder();
    int cp;
    while ((cp = br.read()) != -1) {
        sb.append((char) cp);
    }
    String output = sb.toString();

    final Type tpEnvClient = new TypeToken<Data<Client>>(){}.getType();
    final Data<Client> envEmp = new Gson().fromJson(output, tpEnvClient);

When trying to store an array I get an error because I can't store a list of clients.


问:
Why is it allowed to std::move a const reference?
Consider this example:

```<code>#include <vector>
void addRow(std::vector<std::vector<double>>& matrix, const std::vector<double>& row) {
    matrix.push_back(std::move(row));
}
</code>```

I would've expected issues with std::move and a const & as std::move basically invalidates that reference since it's contents are moved and it is set to a clean state, and this is the exact behavior const must prevent.

This was compiled using:
g++ -std=c++20 -Ofast  *.cpp -o test with no warnings or errors and runs fine.

I've looked at other posts:
Move construction from const reference
-> apparently this didn't use to work

Const reference VS move semantics  -> no answer

Why can we use `std::move` on a `const` object? -> apparently it works on a const as well, though that's not concerning

What's concerning about the reference, is it's invalidating an object it's promising not to modify.

The mostly frustrating thing about my post being labeled a duplicate is that I linked the 'duplicate' and explicitly stated it didn't answer my question, also expressing the reason why. Thanks.

Body:
Consider this example:

#include <vector>
void addRow(std::vector<std::vector<double>>& matrix, const std::vector<double>& row) {
    matrix.push_back(std::move(row));
}

I would've expected issues with std::move and a const & as std::move basically invalidates that reference since it's contents are moved and it is set to a clean state, and this is the exact behavior const must prevent.

This was compiled using:
g++ -std=c++20 -Ofast  *.cpp -o test with no warnings or errors and runs fine.

I've looked at other posts:
Move construction from const reference
-> apparently this didn't use to work

Const reference VS move semantics  -> no answer

Why can we use `std::move` on a `const` object? -> apparently it works on a const as well, though that's not concerning

What's concerning about the reference, is it's invalidating an object it's promising not to modify.

The mostly frustrating thing about my post being labeled a duplicate is that I linked the 'duplicate' and explicitly stated it didn't answer my question, also expressing the reason why. Thanks.


问:
JSoup parse web page to read thead and tbody of Table
Need: Parse a web page and read the details presented in a table (Web Page to parse - Link)

Issue: I am unable to get the details under tbody section. At present I am only able to get thead details.

Research: I checked with this Link on stack overflow, but unable to figure out in my case.

The HTML table which I need to extract

```<code><table id="industryInfo" class="eq-series tbl-securityinfo cap-hide">
           <caption></caption>
           <thead>
                    <tr>
                          <th>Macro-Economic Sector</th>
                          <th>Sector</th>
                          <th>Industry</th>
                          <th>Basic Industry</th>
                    </tr>
           </thead>
           <tbody class="">
                    <tr>
                         <td>Commodities</td>
                         <td>Metals & Mining</td>
                         <td>Ferrous Metals</td>
                         <td>Pig Iron</td>
                    </tr>
           </tbody>
</table>
</code>```

Code:

```<code>    String url = "https://www.nseindia.com/get-quotes/equity?symbol=ADANIENT";
    Document document = new Document(url);
        try {
               document = Jsoup.connect(url).userAgent("Mozilla/5.0").get();
        } catch (IOException e) {
            e.printStackTrace();
        }
//        System.out.println(document);
        Elements elements = document.select("#industryInfo");
        for (Element element : elements) {
            System.out.println(element);
        }
</code>```

Hope the issue faced is clear, any pointers to what I am missing will be helpful

Body:
Need: Parse a web page and read the details presented in a table (Web Page to parse - Link)

Issue: I am unable to get the details under tbody section. At present I am only able to get thead details.

Research: I checked with this Link on stack overflow, but unable to figure out in my case.

The HTML table which I need to extract

                          Macro-Economic Sector
                          Sector
                          Industry
                          Basic Industry

                         Commodities
                         Metals & Mining
                         Ferrous Metals
                         Pig Iron

Code:

    String url = "https://www.nseindia.com/get-quotes/equity?symbol=ADANIENT";
    Document document = new Document(url);
        try {
               document = Jsoup.connect(url).userAgent("Mozilla/5.0").get();
        } catch (IOException e) {
            e.printStackTrace();
        }
//        System.out.println(document);
        Elements elements = document.select("#industryInfo");
        for (Element element : elements) {
            System.out.println(element);
        }

Hope the issue faced is clear, any pointers to what I am missing will be helpful


问:
Laravel Passport::Route in version 11
Just upgrade Laravel Passport from v10 to v11.
It seems like it does not support Passport::Route anymore.

I did read the documentation but did not understand how to rewrite te code below.

```<code>Passport::routes(
        function (RouteRegistrar $router) {
            $router->forAccessTokens();
            $router->forTransientTokens();
        },
        [
            'prefix' => 'api/oauth',
        ]
    );
</code>```

So this worked fine in v10. Does anyone know how i need to write the code, to make it work with v11?

Title: Laravel Passport::Route in version 11

Body:
Just upgrade Laravel Passport from v10 to v11.
It seems like it does not support Passport::Route anymore.

I did read the documentation but did not understand how to rewrite te code below.

Passport::routes(
        function (RouteRegistrar $router) {
            $router->forAccessTokens();
            $router->forTransientTokens();
        },
        [
            'prefix' => 'api/oauth',
        ]
    );

So this worked fine in v10. Does anyone know how i need to write the code, to make it work with v11?


问:
Dynamically Calculating values in React JS Form using Hooks
I am working on PG finder application and I want that on the owner side on adding the shared number he/she automatically gets the total capacity of the rooms (i.e like we have 2 sharing and total no of rooms available are 3 so total capacity/ beds will be 6)
So I want that column to generate value dynamically
Image Reference for query
As you can see the totalcapacity value is getting copied for the next dynamic generated form field also. I want them to be separate.

```<code>import React, { useEffect, useState } from "react";
import './roominfo.css';
import { ImBin } from 'react-icons/im';

const RoomInfo = () => {

    let handleChange = (i, e) => {
        let newFormValues = [...formValues]; /** makes a copy of the current form values and assign it to newFormValues **/
        newFormValues[i][e.target.name] = e.target.value;
        setFormValues(newFormValues);

    }

    let addFormFields = () => {
        setFormValues([...formValues, { shared_no: "", no_of_rooms: "", rent_per_month: "", vacancy: "",total_capacity: 0}])
    };

    let removeFormFields = (i) => {
        let newFormValues = [...formValues];
        newFormValues.splice(i, 1);
        setFormValues(newFormValues)
    }

    const [formValues, setFormValues] = useState([{ shared_no: "", no_of_rooms: "", rent_per_month: "", total_capacity: "", vacancy: "" }])

    const [total_no_of_rooms, settotal_no_of_rooms] = useState('1');
    const [rooms_entered, setrooms_entered] = useState('');

    const getTotalCapacity = () => {

        return formValues.reduce((total,element) => {
            return total + Number(element.shared_no) * Number(element.no_of_rooms);
        }, 0);
    };

    const Total_no_of_rooms_entered = () => {
        return formValues.reduce((total, element) => {
            return total + Number(element.no_of_rooms);
        }, 0);
    };

    useEffect(() => {
        if (rooms_entered > total_no_of_rooms) {
           window.alert("No more rooms can be added");
        }
    },)

    return (
        <>
            <div className='heading'>
                <h1 style={{ marginBottom: '50px' }}>Enter Your PG Room Details</h1>
            </div>
            <form>

                <div className="form-inline" style={{ marginBottom: '50px' }}>
                    <label>Total of Rooms:    </label>
                    <input type="number" name="total_no_of_rooms" style={{ width: '90px' }} onClick={(e) => settotal_no_of_rooms(e.target.value)} defaultValue={1} />
                    <label>Rooms Entered:</label>
                    <div><input type="number" name="rooms_entered" value={Total_no_of_rooms_entered()} onClick={(e) => setrooms_entered(e.target.value)} readOnly></input></div>
                </div>

            </form>
            <div>
                <form>
                    {formValues.map((element, index) => (
                        <div className="form-inline" key={index} style={{ borderBottom: '1px solid black' }}>
                            <label>Sharing Number</label>
                            <select id="shared_no" name="shared_no" title="no of shared rooms" value={element.shared_no || ""} onChange={e => handleChange(index, e)} >
                                <option value="">---Select---</option>
                                <option value="1">Single Sharing</option>
                                <option value="2">Two Bed Sharing</option>
                                <option value="3">Three Bed Sharing</option>
                                <option value="4">Four Bed Sharing</option>
                                <option value="5">Five Bed Sharing</option>
                            </select>

                            <label>   No of Rooms:</label>
                            <input type="number" name="no_of_rooms" value={element.no_of_rooms || ""} onChange={e => handleChange(index, e)}></input>

                            <label>   Rent per month:</label>
                            <input type="number" style={{ width: '100px' }} name="rent_per_month" value={element.rent_per_month || ""} onChange={e => handleChange(index, e)}></input>

                            <label>   Total Capacity:</label>
                            <input type="number" style={{ width: '50px' }} name="total_capacity" value={getTotalCapacity()} onChange={e => handleChange(index, e)}></input>

                            <label>   Vacancy:</label>
                            <input type="number" style={{ width: '50px' }} name="vacancy" value={element.vacancy || ""} onChange={e => handleChange(index, e)}></input>
                            {
                                index ?
                                    <button type="button" className="button remove" onClick={() => removeFormFields(index)}><ImBin /></button>
                                    : null
                            }
                        </div>
                    ))}
                    <div className="button-section">
                        <button className="button add" type="button" onClick={() => addFormFields()}>Add</button>
                        <button className="button submit" type="submit">Submit</button>
                    </div>
                </form>
            </div>
        </>
    )
}

export default RoomInfo

</code>```

This is the code. Can you please help me with how to solve it.Thank you

Body:
I am working on PG finder application and I want that on the owner side on adding the shared number he/she automatically gets the total capacity of the rooms (i.e like we have 2 sharing and total no of rooms available are 3 so total capacity/ beds will be 6)
So I want that column to generate value dynamically
Image Reference for query
As you can see the totalcapacity value is getting copied for the next dynamic generated form field also. I want them to be separate.

import React, { useEffect, useState } from "react";
import './roominfo.css';
import { ImBin } from 'react-icons/im';

const RoomInfo = () => {

    let handleChange = (i, e) => {
        let newFormValues = [...formValues]; /** makes a copy of the current form values and assign it to newFormValues **/
        newFormValues[i][e.target.name] = e.target.value;
        setFormValues(newFormValues);

    }

    let addFormFields = () => {
        setFormValues([...formValues, { shared_no: "", no_of_rooms: "", rent_per_month: "", vacancy: "",total_capacity: 0}])
    };

    let removeFormFields = (i) => {
        let newFormValues = [...formValues];
        newFormValues.splice(i, 1);
        setFormValues(newFormValues)
    }

    const [formValues, setFormValues] = useState([{ shared_no: "", no_of_rooms: "", rent_per_month: "", total_capacity: "", vacancy: "" }])

    const [total_no_of_rooms, settotal_no_of_rooms] = useState('1');
    const [rooms_entered, setrooms_entered] = useState('');

    const getTotalCapacity = () => {

        return formValues.reduce((total,element) => {
            return total + Number(element.shared_no) * Number(element.no_of_rooms);
        }, 0);
    };

    const Total_no_of_rooms_entered = () => {
        return formValues.reduce((total, element) => {
            return total + Number(element.no_of_rooms);
        }, 0);
    };

    useEffect(() => {
        if (rooms_entered > total_no_of_rooms) {
           window.alert("No more rooms can be added");
        }
    },)

    return (
        <>

Enter Your PG Room Details

            <form>

                    Total of Rooms:
                    <input type="number" name="total_no_of_rooms" style={{ width: '90px' }} onClick={(e) => settotal_no_of_rooms(e.target.value)} defaultValue={1} />
                    Rooms Entered:

<input type="number" name="rooms_entered" value={Total_no_of_rooms_entered()} onClick={(e) => setrooms_entered(e.target.value)} readOnly></input>

            </form>

                <form>
                    {formValues.map((element, index) => (

                            Sharing Number
                            <select id="shared_no" name="shared_no" title="no of shared rooms" value={element.shared_no || ""} onChange={e => handleChange(index, e)} >
                                <option value="">---Select---</option>
                                <option value="1">Single Sharing</option>
                                <option value="2">Two Bed Sharing</option>
                                <option value="3">Three Bed Sharing</option>
                                <option value="4">Four Bed Sharing</option>
                                <option value="5">Five Bed Sharing</option>
                            </select>

                               No of Rooms:
                            <input type="number" name="no_of_rooms" value={element.no_of_rooms || ""} onChange={e => handleChange(index, e)}></input>

                               Rent per month:
                            <input type="number" style={{ width: '100px' }} name="rent_per_month" value={element.rent_per_month || ""} onChange={e => handleChange(index, e)}></input>

                               Total Capacity:
                            <input type="number" style={{ width: '50px' }} name="total_capacity" value={getTotalCapacity()} onChange={e => handleChange(index, e)}></input>

                               Vacancy:
                            <input type="number" style={{ width: '50px' }} name="vacancy" value={element.vacancy || ""} onChange={e => handleChange(index, e)}></input>
                            {
                                index ?
                                    <button type="button" className="button remove" onClick={() => removeFormFields(index)}><ImBin /></button>
                                    : null
                            }

                    ))}

                        <button className="button add" type="button" onClick={() => addFormFields()}>Add</button>
                        <button className="button submit" type="submit">Submit</button>

                </form>

        </>
    )
}

export default RoomInfo

This is the code. Can you please help me with how to solve it.Thank you


问:
Dynamic Query Instead of @subselect when giving an Entity data
I got the following entity:

```<code>@Entity
@Immutable
@Subselect("select distinct r.code, r.dsc\r\n"
        + "from  roles r, accesses a\r\n"
        + "where r.code = '12'\r\n")

@MasterEntity(labelCode = "Scenario")

public class Scenario implements java.io.Serializable {
</code>```

I want to use a dynamic query (or parameterized) instead of this static query.
for example: r.code should be equal to a parameter variable not "12"

is there a replacement for @Subselect while I use @Immutable?

Body:
I got the following entity:

@Entity
@Immutable
@Subselect("select distinct r.code, r.dsc\r\n"
        + "from  roles r, accesses a\r\n"
        + "where r.code = '12'\r\n")

@MasterEntity(labelCode = "Scenario")

public class Scenario implements java.io.Serializable {

I want to use a dynamic query (or parameterized) instead of this static query.
for example: r.code should be equal to a parameter variable not "12"

is there a replacement for @Subselect while I use @Immutable?


问:
Node Addon node-gyp build error C2872 'byte': ambiguous symbol
As part of upgrading a C++ (Microsoft Visual Studio 2010) with nodejs application from node 0.10.26 to node LTS 18.12.1, to compile and build C++ addons, we used node-gyp(node-gyp@9.3.1., Python version 3.11.1. and VS2019 (16.11.32929.386)), when doing node-gyp build, getting below errors:

```<code>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(192,14): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(191,23): message : could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\cstddef(28,12): message : or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(962,25): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(191,23): message : could be 'unsigned char byte'
</code>```

Please suggest possible solutions.

referred below link and tried suggestions from below link, but nothing worked.

https://developercommunity.visualstudio.com/t/error-C2872:-byte:-ambiguous-symbol/93889?ftype=problem&q=C%3A%5CProgram+Files+%28x86%29%5CWindows+Kits%5C10%5CInclude%5C10.0.19041.0%5Cshared%5Crpcndr.h%28192%2C14%29%3A+error+C2872%3A+%27byte%27%3A+ambiguous+symbol

Body:
As part of upgrading a C++ (Microsoft Visual Studio 2010) with nodejs application from node 0.10.26 to node LTS 18.12.1, to compile and build C++ addons, we used node-gyp(node-gyp@9.3.1., Python version 3.11.1. and VS2019 (16.11.32929.386)), when doing node-gyp build, getting below errors:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(192,14): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(191,23): message : could be 'unsigned char byte'
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\cstddef(28,12): message : or       'std::byte'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(962,25): error C2872: 'byte': ambiguous symbol
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\rpcndr.h(191,23): message : could be 'unsigned char byte'

Please suggest possible solutions.

referred below link and tried suggestions from below link, but nothing worked.

https://developercommunity.visualstudio.com/t/error-C2872:-byte:-ambiguous-symbol/93889?ftype=problem&q=C%3A%5CProgram+Files+%28x86%29%5CWindows+Kits%5C10%5CInclude%5C10.0.19041.0%5Cshared%5Crpcndr.h%28192%2C14%29%3A+error+C2872%3A+%27byte%27%3A+ambiguous+symbol


问:
Froala rich text editor
Is there a way to capture the Froala rich text editor content and write to sql database. How does the data transforms if I attach an image to the body of the rich text? I have been struggling to capture this on my webapp using C#. Please let me know if anyone managed to do this. I currently have this editor enabled on my webpage and I'm trying to capture the content to the database when I press the submit button.

this is how I implemented the editor https://froala.com/wysiwyg-editor/docs/overview/

Title: Froala rich text editor


问:
Filtering list from LiveData in observe method. Is it ok to using LiveData placed in companion object in the Service?
Is it possible to use LiveData in this way? LiveData placed in a companion object in my TrackerService? It has fields such as timer, location list, distance, etc. I did it this way because moving the timer to the database and loading it into the ViewModel was causing a delay. If not, how else can I move the data from Service to ViewModel and put it in LiveData?

```<code>@AndroidEntryPoint
class TrackerService: LifecycleService() {

    @Inject
    lateinit var notification: NotificationCompat.Builder
    @Inject
    lateinit var notificationManager: NotificationManager

    private lateinit var fusedLocationProviderClient: FusedLocationProviderClient
    private val timer = Timer()

    companion object {
        val started = MutableLiveData<Boolean>()
        val distanceMeters = MutableLiveData<Double>()
        val runningTime = MutableLiveData<Int>()
        val date = MutableLiveData<Long>()
        val locationList = MutableLiveData<MutableList<LatLng>>()
        val kilometerReached = MutableLiveData<Boolean>()
        val paceTimes = MutableLiveData<MutableList<Int>>()
        val avgPaceTime = MutableLiveData<Double>()
        val burnedKcal = MutableLiveData<Int>()

        fun timerReset() {
            runTime.postValue(0)
        }
    }

[...]
</code>```

The second thing I'm struggling with is filtering the list from the observed liveData. Is it a good idea to filter it in the observe method? Or should I do it differently?

```<code>mainViewModel.readRuns.observe(viewLifecycleOwner) { runs ->
            mAdapter.setData(runs.sortedWith (
                when(historyViewModel.selectedChip){
                    binding.dateChip.id ->
                        if(desc) compareByDescending {it.date}
                        else compareBy {it.date}
                    binding.timeChip.id -> if(desc) compareByDescending {it.runTime}
                        else compareBy {it.runTime}
                    binding.distanceChip.id -> if(desc) compareByDescending {it.distanceMeters}
                        else compareBy {it.distanceMeters}
                    binding.caloriesChip.id -> if(desc) compareByDescending {it.burnedKcal}
                        else compareBy {it.burnedKcal}
                    else -> if(desc) compareByDescending {it.date} else compareBy {it.burnedKcal}
                }
            ))
        }

</code>```

I was trying using database as i said before and this doesnt work.

Body:
Is it possible to use LiveData in this way? LiveData placed in a companion object in my TrackerService? It has fields such as timer, location list, distance, etc. I did it this way because moving the timer to the database and loading it into the ViewModel was causing a delay. If not, how else can I move the data from Service to ViewModel and put it in LiveData?

@AndroidEntryPoint
class TrackerService: LifecycleService() {

    @Inject
    lateinit var notification: NotificationCompat.Builder
    @Inject
    lateinit var notificationManager: NotificationManager

    private lateinit var fusedLocationProviderClient: FusedLocationProviderClient
    private val timer = Timer()

    companion object {
        val started = MutableLiveData<Boolean>()
        val distanceMeters = MutableLiveData<Double>()
        val runningTime = MutableLiveData<Int>()
        val date = MutableLiveData<Long>()
        val locationList = MutableLiveData<MutableList<LatLng>>()
        val kilometerReached = MutableLiveData<Boolean>()
        val paceTimes = MutableLiveData<MutableList<Int>>()
        val avgPaceTime = MutableLiveData<Double>()
        val burnedKcal = MutableLiveData<Int>()

        fun timerReset() {
            runTime.postValue(0)
        }
    }

[...]

The second thing I'm struggling with is filtering the list from the observed liveData. Is it a good idea to filter it in the observe method? Or should I do it differently?

mainViewModel.readRuns.observe(viewLifecycleOwner) { runs ->
            mAdapter.setData(runs.sortedWith (
                when(historyViewModel.selectedChip){
                    binding.dateChip.id ->
                        if(desc) compareByDescending {it.date}
                        else compareBy {it.date}
                    binding.timeChip.id -> if(desc) compareByDescending {it.runTime}
                        else compareBy {it.runTime}
                    binding.distanceChip.id -> if(desc) compareByDescending {it.distanceMeters}
                        else compareBy {it.distanceMeters}
                    binding.caloriesChip.id -> if(desc) compareByDescending {it.burnedKcal}
                        else compareBy {it.burnedKcal}
                    else -> if(desc) compareByDescending {it.date} else compareBy {it.burnedKcal}
                }
            ))
        }

I was trying using database as i said before and this doesnt work.


问:
Auto fillin a list of value to output of complicated input combination
I am new to js and i am now trying to listening to the change events and then auto fillin a list of data to a input field with a sequence.
For example. The output sequence is   [DeliveryFee ,Apple ,Banana,selections]

Case 1:  (all null,default)

```<code>Apple :____
Banana:____

- selectPercentage: -null      selectItem: -null
                    -10%off                -fruits
                    -20%off                -toys
                    -30%off
  checkboxDeliveryFee: []

outPut: _____________
</code>```

Case 2: (input 8,tick a checkbox, select two selectionBox)

```<code>Apple : __8__
Banana: _____
selectPercentage: -10%off      selectItem: -fruits
checkboxFreeDeliveryFee: [checked]

outPut: ["FreeDeliveryFee" ,"8Apple","10%offFruit"]
</code>```

I get the input values to construct a object and output some expected Text to the output array. However, I am stuck at creating a good Constructor in order to perform the following codes.

```<code>
//The array to list the output sequence

var sequence={"DeliveryFee" : 1 , "Apple" :2 ,"Banana": 3 ,"selections":4};

//NEED TO BE MODIFIED !!!
const outputObject=function(input,fieldName){
  this.input=input;
  this.fieldName=fieldName;
  this.sequence=    ??;
  this.outputText=  ??;
}

//just ignore the syntax error and difference between inputText,checkbox and select
//just a presudo code
$('#apple,#Banana,#selectPercentage,#selectItem,checkboxDeliveryFee').change(function()=>{
   let input=[];
   if (this.tagName=='select'){
   input.push($('#selectPercentage').val(),$('#selectItem').val())
   } else {
   input.push(this.value)
   }
   let tmpObject=new outputObject(input,this.fieldName);
   outPutList.push(tmpObject);
   outPutList.sort((a,b)=\>{
   if (a.sequence \>b.sequence){
       return 1;
   }  else {
       return -1;
   }
   });
//output the array
   $('#output').val(outPutList.map(e=\>e.outputText));
})
</code>```

Body:
I am new to js and i am now trying to listening to the change events and then auto fillin a list of data to a input field with a sequence.
For example. The output sequence is   [DeliveryFee ,Apple ,Banana,selections]

Case 1:  (all null,default)

Apple :____
Banana:____

- selectPercentage: -null      selectItem: -null
                    -10%off                -fruits
                    -20%off                -toys
                    -30%off
  checkboxDeliveryFee: []

outPut: _____________

Case 2: (input 8,tick a checkbox, select two selectionBox)

Apple : __8__
Banana: _____
selectPercentage: -10%off      selectItem: -fruits
checkboxFreeDeliveryFee: [checked]

outPut: ["FreeDeliveryFee" ,"8Apple","10%offFruit"]

I get the input values to construct a object and output some expected Text to the output array. However, I am stuck at creating a good Constructor in order to perform the following codes.

//The array to list the output sequence

var sequence={"DeliveryFee" : 1 , "Apple" :2 ,"Banana": 3 ,"selections":4};

//NEED TO BE MODIFIED !!!
const outputObject=function(input,fieldName){
  this.input=input;
  this.fieldName=fieldName;
  this.sequence=    ??;
  this.outputText=  ??;
}

//just ignore the syntax error and difference between inputText,checkbox and select
//just a presudo code
$('#apple,#Banana,#selectPercentage,#selectItem,checkboxDeliveryFee').change(function()=>{
   let input=[];
   if (this.tagName=='select'){
   input.push($('#selectPercentage').val(),$('#selectItem').val())
   } else {
   input.push(this.value)
   }
   let tmpObject=new outputObject(input,this.fieldName);
   outPutList.push(tmpObject);
   outPutList.sort((a,b)=\>{
   if (a.sequence \>b.sequence){
       return 1;
   }  else {
       return -1;
   }
   });
//output the array
   $('#output').val(outPutList.map(e=\>e.outputText));
})


问:
How can I show in the map the name or id of a Polygon as a label
I'm trying to make a map with some markers and polygons in Flutter with the google maps package, and I want to display label for them, for the markers it was easy I can do it like this.

I want something similar for some polygons I'm going to display, how could I do this? The polygon class as opposed to the marker class does not count with a "infoWindow" variable, so how could I do it?

Something like this is what I'm looking after, the red zone being the polygon, and in the center a label to display the name of the polygon

This is how I create new polygons, zones is a list, where I store the information for all polygons.

```<code>Polygon(
        polygonId: PolygonId(zones[i].name),
        points: zones[i].points,
        fillColor: Colors.black.withOpacity(0.3),
        strokeColor: Colors.black,
        geodesic: true,
        strokeWidth: 4,
      )
</code>```

This is how I create new Markers, landmarks is a list where I store the information for all my markers

```<code>Marker(
          markerId: MarkerId(landmarks[i].id),
          position: landmarks[i].point,
          infoWindow: InfoWindow(
            title: landmarks[i].name,
          ))
</code>```

Body:
I'm trying to make a map with some markers and polygons in Flutter with the google maps package, and I want to display label for them, for the markers it was easy I can do it like this.

I want something similar for some polygons I'm going to display, how could I do this? The polygon class as opposed to the marker class does not count with a "infoWindow" variable, so how could I do it?

Something like this is what I'm looking after, the red zone being the polygon, and in the center a label to display the name of the polygon

This is how I create new polygons, zones is a list, where I store the information for all polygons.

Polygon(
        polygonId: PolygonId(zones[i].name),
        points: zones[i].points,
        fillColor: Colors.black.withOpacity(0.3),
        strokeColor: Colors.black,
        geodesic: true,
        strokeWidth: 4,
      )

This is how I create new Markers, landmarks is a list where I store the information for all my markers

Marker(
          markerId: MarkerId(landmarks[i].id),
          position: landmarks[i].point,
          infoWindow: InfoWindow(
            title: landmarks[i].name,
          ))


问:
Angular - Running all unit tests fails, succeeds when ran in isolation
I am writing unit tests for my Angular project (Jasmine Karma).

All tests pass indidividually, but if I run all the tests some are failing.
I'll give you the 5 tests where there is the problem.
If i let the first one with anoter one and all the tests succeeds but if i add another test of the list, one or many test will fail so the first test seems to not be a part of the problem.
I tried many things like adding fixture.destroy() in afterall but it doesn't fixed the problem.
I tried to do one describe for each test and it doesn't fixed the problem either...

```<code>  it('should search', () => {
    console.log('1');
    expect(component).toBeTruthy();
    fixture.detectChanges();
    expect(component.dataSource.data.length).toBe(18);
    const filterBtn = fixture.debugElement.query(
      By.css('#filter-search-btn')
    ).nativeElement;
    expect(filterBtn).toBeTruthy();
    filterBtn.click();
    fixture.detectChanges();
    const filterInput = fixture.debugElement.query(
      By.css('#filter-search-input')
    ).nativeElement;
    expect(filterInput).toBeTruthy();
    filterInput.value = 'test';
    filterInput.dispatchEvent(new Event('input'));
    fixture.detectChanges();
    expect(component.dataSource.data.length).toBe(9);
    filterBtn.click();
    fixture.detectChanges();
    expect(component.dataSource.data.length).toBe(18);
  });

  it('should select and check buttons are disabled or not', () => {
    console.log('2');
    expect(component).toBeTruthy();
    fixture.detectChanges();
    let checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    let checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    expect(checkBox4.checked).toBeFalsy();
    expect(checkBox6.checked).toBeFalsy();
    let multipleReopenBtn = fixture.nativeElement.querySelector(
      '#multiple-reopen-btn'
    );
    let multipleCloseBtn = fixture.nativeElement.querySelector(
      '#multiple-close-btn'
    );
    let multipleDuplicateBtn = fixture.nativeElement.querySelector(
      '#multiple-duplicate-btn'
    );
    let multipleRecycleBtn = fixture.nativeElement.querySelector(
      '#multiple-recycle-btn'
    );
    let multipleScratchBtn = fixture.nativeElement.querySelector(
      '#multiple-scratch-btn'
    );
    let multipleVerifyBtn = fixture.nativeElement.querySelector(
      '#multiple-verify-btn'
    );
    let multipleEjectBtn = fixture.nativeElement.querySelector(
      '#multiple-eject-btn'
    );
    let multipleRefreshBtn = fixture.nativeElement.querySelector(
      '#multiple-refresh-btn'
    );
    let customizeColumnsBtn = fixture.nativeElement.querySelector(
      '#customize-columns-btn'
    );
    expect(multipleReopenBtn.disabled).toBeTruthy();
    expect(multipleCloseBtn.disabled).toBeTruthy();
    expect(multipleDuplicateBtn.disabled).toBeTruthy();
    expect(multipleRecycleBtn.disabled).toBeTruthy();
    expect(multipleScratchBtn.disabled).toBeTruthy();
    expect(multipleVerifyBtn.disabled).toBeTruthy();
    expect(multipleEjectBtn.disabled).toBeTruthy();
    expect(multipleRefreshBtn.disabled).toBeFalsy();
    expect(customizeColumnsBtn.disabled).toBeFalsy();
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    checkBox4 = fixture.nativeElement.querySelector('#mat-checkbox-4-input');
    checkBox6 = fixture.nativeElement.querySelector('#mat-checkbox-6-input');
    expect(checkBox4.checked).toBeTruthy();
    expect(checkBox6.checked).toBeTruthy();
    multipleReopenBtn = fixture.nativeElement.querySelector(
      '#multiple-reopen-btn'
    );
    multipleCloseBtn = fixture.nativeElement.querySelector(
      '#multiple-close-btn'
    );
    multipleDuplicateBtn = fixture.nativeElement.querySelector(
      '#multiple-duplicate-btn'
    );
    multipleRecycleBtn = fixture.nativeElement.querySelector(
      '#multiple-recycle-btn'
    );
    multipleScratchBtn = fixture.nativeElement.querySelector(
      '#multiple-scratch-btn'
    );
    multipleVerifyBtn = fixture.nativeElement.querySelector(
      '#multiple-verify-btn'
    );
    multipleEjectBtn = fixture.nativeElement.querySelector(
      '#multiple-eject-btn'
    );
    multipleRefreshBtn = fixture.nativeElement.querySelector(
      '#multiple-refresh-btn'
    );
    customizeColumnsBtn = fixture.nativeElement.querySelector(
      '#customize-columns-btn'
    );
    expect(multipleReopenBtn.disabled).toBeTruthy();
    expect(multipleCloseBtn.disabled).toBeTruthy();
    expect(multipleDuplicateBtn.disabled).toBeFalsy();
    expect(multipleRecycleBtn.disabled).toBeTruthy();
    expect(multipleScratchBtn.disabled).toBeTruthy();
    expect(multipleVerifyBtn.disabled).toBeFalsy();
    expect(multipleEjectBtn.disabled).toBeFalsy();
    expect(multipleRefreshBtn.disabled).toBeFalsy();
    expect(customizeColumnsBtn.disabled).toBeFalsy();
  });

  it('should select and duplicate', () => {
    console.log('3');
    expect(component).toBeTruthy();
    const checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    const checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    const multipleDuplicateBtn = fixture.nativeElement.querySelector(
      '#multiple-duplicate-btn'
    );
    multipleDuplicateBtn.click();
    fixture.detectChanges();
    expect(
      overlayContainerElement.querySelector('.mm-media-duplicate-modal-title')
    ).toBeTruthy();
    const buttons = overlayContainerElement.querySelectorAll('button');
    const submitButton = buttons[1];
    expect(submitButton).toBeTruthy();
    submitButton.click();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      const buttons2 = overlayContainerElement.querySelectorAll('button');
      const confirmButton = buttons2[2];
      expect(confirmButton).toBeTruthy();
      confirmButton.click();
    });
  });

  it('should select and verify', () => {
    console.log('4');
    expect(component).toBeTruthy();
    const checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    const checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    const multipleVerifyBtn = fixture.nativeElement.querySelector(
      '#multiple-verify-btn'
    );
    multipleVerifyBtn.click();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      expect(
        overlayContainerElement.querySelector('.mm-media-verify-modal-title')
      ).toBeTruthy();
      const buttons = overlayContainerElement.querySelectorAll('button');
      const cancelButton = buttons[0];
      expect(cancelButton).toBeTruthy();
      cancelButton.click();
    });
  });

  it('should select and eject', () => {
    console.log('5');
    expect(component).toBeTruthy();
    const checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    const checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    const multipleEjectBtn = fixture.nativeElement.querySelector(
      '#multiple-eject-btn'
    );
    multipleEjectBtn.click();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      const buttons = overlayContainerElement.querySelectorAll('button');
      const confirmButton = buttons[1];
      expect(confirmButton).toBeTruthy();
      confirmButton.click();
    });
  });
</code>```

I want to make all these tests succeeds together and adding some more after but i don't know why they are not succeeds when all together.

Body:
I am writing unit tests for my Angular project (Jasmine Karma).

All tests pass indidividually, but if I run all the tests some are failing.
I'll give you the 5 tests where there is the problem.
If i let the first one with anoter one and all the tests succeeds but if i add another test of the list, one or many test will fail so the first test seems to not be a part of the problem.
I tried many things like adding fixture.destroy() in afterall but it doesn't fixed the problem.
I tried to do one describe for each test and it doesn't fixed the problem either...

  it('should search', () => {
    console.log('1');
    expect(component).toBeTruthy();
    fixture.detectChanges();
    expect(component.dataSource.data.length).toBe(18);
    const filterBtn = fixture.debugElement.query(
      By.css('#filter-search-btn')
    ).nativeElement;
    expect(filterBtn).toBeTruthy();
    filterBtn.click();
    fixture.detectChanges();
    const filterInput = fixture.debugElement.query(
      By.css('#filter-search-input')
    ).nativeElement;
    expect(filterInput).toBeTruthy();
    filterInput.value = 'test';
    filterInput.dispatchEvent(new Event('input'));
    fixture.detectChanges();
    expect(component.dataSource.data.length).toBe(9);
    filterBtn.click();
    fixture.detectChanges();
    expect(component.dataSource.data.length).toBe(18);
  });

  it('should select and check buttons are disabled or not', () => {
    console.log('2');
    expect(component).toBeTruthy();
    fixture.detectChanges();
    let checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    let checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    expect(checkBox4.checked).toBeFalsy();
    expect(checkBox6.checked).toBeFalsy();
    let multipleReopenBtn = fixture.nativeElement.querySelector(
      '#multiple-reopen-btn'
    );
    let multipleCloseBtn = fixture.nativeElement.querySelector(
      '#multiple-close-btn'
    );
    let multipleDuplicateBtn = fixture.nativeElement.querySelector(
      '#multiple-duplicate-btn'
    );
    let multipleRecycleBtn = fixture.nativeElement.querySelector(
      '#multiple-recycle-btn'
    );
    let multipleScratchBtn = fixture.nativeElement.querySelector(
      '#multiple-scratch-btn'
    );
    let multipleVerifyBtn = fixture.nativeElement.querySelector(
      '#multiple-verify-btn'
    );
    let multipleEjectBtn = fixture.nativeElement.querySelector(
      '#multiple-eject-btn'
    );
    let multipleRefreshBtn = fixture.nativeElement.querySelector(
      '#multiple-refresh-btn'
    );
    let customizeColumnsBtn = fixture.nativeElement.querySelector(
      '#customize-columns-btn'
    );
    expect(multipleReopenBtn.disabled).toBeTruthy();
    expect(multipleCloseBtn.disabled).toBeTruthy();
    expect(multipleDuplicateBtn.disabled).toBeTruthy();
    expect(multipleRecycleBtn.disabled).toBeTruthy();
    expect(multipleScratchBtn.disabled).toBeTruthy();
    expect(multipleVerifyBtn.disabled).toBeTruthy();
    expect(multipleEjectBtn.disabled).toBeTruthy();
    expect(multipleRefreshBtn.disabled).toBeFalsy();
    expect(customizeColumnsBtn.disabled).toBeFalsy();
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    checkBox4 = fixture.nativeElement.querySelector('#mat-checkbox-4-input');
    checkBox6 = fixture.nativeElement.querySelector('#mat-checkbox-6-input');
    expect(checkBox4.checked).toBeTruthy();
    expect(checkBox6.checked).toBeTruthy();
    multipleReopenBtn = fixture.nativeElement.querySelector(
      '#multiple-reopen-btn'
    );
    multipleCloseBtn = fixture.nativeElement.querySelector(
      '#multiple-close-btn'
    );
    multipleDuplicateBtn = fixture.nativeElement.querySelector(
      '#multiple-duplicate-btn'
    );
    multipleRecycleBtn = fixture.nativeElement.querySelector(
      '#multiple-recycle-btn'
    );
    multipleScratchBtn = fixture.nativeElement.querySelector(
      '#multiple-scratch-btn'
    );
    multipleVerifyBtn = fixture.nativeElement.querySelector(
      '#multiple-verify-btn'
    );
    multipleEjectBtn = fixture.nativeElement.querySelector(
      '#multiple-eject-btn'
    );
    multipleRefreshBtn = fixture.nativeElement.querySelector(
      '#multiple-refresh-btn'
    );
    customizeColumnsBtn = fixture.nativeElement.querySelector(
      '#customize-columns-btn'
    );
    expect(multipleReopenBtn.disabled).toBeTruthy();
    expect(multipleCloseBtn.disabled).toBeTruthy();
    expect(multipleDuplicateBtn.disabled).toBeFalsy();
    expect(multipleRecycleBtn.disabled).toBeTruthy();
    expect(multipleScratchBtn.disabled).toBeTruthy();
    expect(multipleVerifyBtn.disabled).toBeFalsy();
    expect(multipleEjectBtn.disabled).toBeFalsy();
    expect(multipleRefreshBtn.disabled).toBeFalsy();
    expect(customizeColumnsBtn.disabled).toBeFalsy();
  });

  it('should select and duplicate', () => {
    console.log('3');
    expect(component).toBeTruthy();
    const checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    const checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    const multipleDuplicateBtn = fixture.nativeElement.querySelector(
      '#multiple-duplicate-btn'
    );
    multipleDuplicateBtn.click();
    fixture.detectChanges();
    expect(
      overlayContainerElement.querySelector('.mm-media-duplicate-modal-title')
    ).toBeTruthy();
    const buttons = overlayContainerElement.querySelectorAll('button');
    const submitButton = buttons[1];
    expect(submitButton).toBeTruthy();
    submitButton.click();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      const buttons2 = overlayContainerElement.querySelectorAll('button');
      const confirmButton = buttons2[2];
      expect(confirmButton).toBeTruthy();
      confirmButton.click();
    });
  });

  it('should select and verify', () => {
    console.log('4');
    expect(component).toBeTruthy();
    const checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    const checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    const multipleVerifyBtn = fixture.nativeElement.querySelector(
      '#multiple-verify-btn'
    );
    multipleVerifyBtn.click();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      expect(
        overlayContainerElement.querySelector('.mm-media-verify-modal-title')
      ).toBeTruthy();
      const buttons = overlayContainerElement.querySelectorAll('button');
      const cancelButton = buttons[0];
      expect(cancelButton).toBeTruthy();
      cancelButton.click();
    });
  });

  it('should select and eject', () => {
    console.log('5');
    expect(component).toBeTruthy();
    const checkBox4 = fixture.nativeElement.querySelector(
      '#mat-checkbox-4-input'
    );
    const checkBox6 = fixture.nativeElement.querySelector(
      '#mat-checkbox-6-input'
    );
    checkBox4.click();
    checkBox6.click();
    fixture.detectChanges();
    const multipleEjectBtn = fixture.nativeElement.querySelector(
      '#multiple-eject-btn'
    );
    multipleEjectBtn.click();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      const buttons = overlayContainerElement.querySelectorAll('button');
      const confirmButton = buttons[1];
      expect(confirmButton).toBeTruthy();
      confirmButton.click();
    });
  });

I want to make all these tests succeeds together and adding some more after but i don't know why they are not succeeds when all together.


问:
What is best way to find count grouped by month in sequalize
Any one can help me to find count of entries grouped by month of createdAt in sequalize module.

I have tried to find on other article to solve this issue. but i could'nt

Thanks in advance

Sequalize script to find module.count({group: ['MONTH(createdAt')]}) but getting the error. how can find the count group by created months


问:
Unable to resolve module in React Native Expo app
I'm using 'babel-plugin-root-import' and typescript to configure absolute path.

When I'm trying to import files from root directory with import {Config} from "~/Config/Config" the "Unable to resolve module" appears.

```<code>Unable to resolve module ./src/Config/Config from D:\project\src\api\mos-api\fetchMosDataAsync.ts:
</code>```

None of these files exist:

src\api\mos-api\src\Config\Config(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

src\api\mos-api\src\Config\Config\index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

Somehow typescript or babel concats paths but doesnt make them absolute. What am I doing wrong or maybe I'm missing some dependencies?

pacakge.json

```<code>"dependencies": {
    "@babel/runtime": "^7.20.7",
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.2",
    "babel": "^6.23.0",
    "expo": "~45.0.0",
    "expo-font": "latest",
    "expo-linear-gradient": "~11.3.0",
    "expo-network": "~4.2.0",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.4",
    "html-entities": "^2.3.3",
    "lodash": "^4.17.21",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-app-intro-slider": "^4.0.4",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-modal-datetime-picker": "^13.1.2",
    "react-native-reanimated": "~2.8.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-svg": "12.3.0",
    "react-native-web": "0.17.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/lodash": "^4.14.182",
    "@types/react": "~17.0.21",
    "@types/react-native": "~0.66.13",
    "babel-plugin-root-import": "^6.6.0",
    "typescript": "^4.8.4"
  },
</code>```

babel.config.js

```<code>module.exports = function(api) {
api.cache(true);
return {
  presets: ['babel-preset-expo'],
  plugins: [
    'react-native-reanimated/plugin',
    [
        'babel-plugin-root-import',
        {
            rootPathPrefix: '~',
            rootPathSuffix: 'src',
        }
    ]
  ],
};
</code>```

tsconfig.json

```<code>{
"extends": "expo/tsconfig.base",
"compilerOptions": {
  "strict": true,
  "baseUrl": "src",
  "rootDir": "src",
  "paths": {
    "~/*": ["*"]
  }
}
</code>```

Body:
I'm using 'babel-plugin-root-import' and typescript to configure absolute path.

When I'm trying to import files from root directory with import {Config} from "~/Config/Config" the "Unable to resolve module" appears.

Unable to resolve module ./src/Config/Config from D:\project\src\api\mos-api\fetchMosDataAsync.ts:

None of these files exist:

src\api\mos-api\src\Config\Config(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

src\api\mos-api\src\Config\Config\index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

Somehow typescript or babel concats paths but doesnt make them absolute. What am I doing wrong or maybe I'm missing some dependencies?

pacakge.json

"dependencies": {
    "@babel/runtime": "^7.20.7",
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.2",
    "babel": "^6.23.0",
    "expo": "~45.0.0",
    "expo-font": "latest",
    "expo-linear-gradient": "~11.3.0",
    "expo-network": "~4.2.0",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.4",
    "html-entities": "^2.3.3",
    "lodash": "^4.17.21",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-app-intro-slider": "^4.0.4",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-modal-datetime-picker": "^13.1.2",
    "react-native-reanimated": "~2.8.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-svg": "12.3.0",
    "react-native-web": "0.17.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/lodash": "^4.14.182",
    "@types/react": "~17.0.21",
    "@types/react-native": "~0.66.13",
    "babel-plugin-root-import": "^6.6.0",
    "typescript": "^4.8.4"
  },

babel.config.js

module.exports = function(api) {
api.cache(true);
return {
  presets: ['babel-preset-expo'],
  plugins: [
    'react-native-reanimated/plugin',
    [
        'babel-plugin-root-import',
        {
            rootPathPrefix: '~',
            rootPathSuffix: 'src',
        }
    ]
  ],
};

tsconfig.json

{
"extends": "expo/tsconfig.base",
"compilerOptions": {
  "strict": true,
  "baseUrl": "src",
  "rootDir": "src",
  "paths": {
    "~/*": ["*"]
  }
}


问:
the best way to have multiple notifications using flutter local notifications
im working on a reminder app
and lets say the user add 200 reminders which means 200 notifications , whats the best way to implement that ?
is it okey to have 200 notifications id's
i was thinking maybe when a notification appears it triggers the next one ?
is there a way to know when a notification appeared?</p>


问:
search jpg file name in folders and subfolders and copy result file names
I am trying to get all the jpg file names related to 1 product. e.g. this is the product name 37004378_TM search this in file explorer & copy all the result file names like

37004378_TM-99999999_01.jpg 37004378_TM.jpg 37004378_TM_B.jpg 37004378_TM_B3.jpg 37004378_TM_D1.jpg 37004378_TM_D2.jpg 37004378_TM_D3.jpg 37004378_TM_D4.jpg 37004378_TM_D5.jpg 37004378_TM_D8.jpg

Tried a lot of things and already.

```<code>Sub jec()
Dim xp As String, a As Variant
dim TargetAddress as string

xp = "C:\Users\xxxx\Documents\37004378_TM*.jpg"
TargetAddress = activecell.value
xp = "C:\Users\xxxx\Documents\TargetAddress*.jpg"
a = Split(CreateObject("wscript.shell").exec("cmd /c dir """ & xp & """ /b/s").stdout.readall, vbCrLf)
Cells(1).Resize(UBound(a)) = Application.Transpose(a)
End Sub
</code>```

I tried this it's very slow and I have a list 150 images. It's not working with variable

Body:
I am trying to get all the jpg file names related to 1 product. e.g. this is the product name 37004378_TM search this in file explorer & copy all the result file names like

37004378_TM-99999999_01.jpg 37004378_TM.jpg 37004378_TM_B.jpg 37004378_TM_B3.jpg 37004378_TM_D1.jpg 37004378_TM_D2.jpg 37004378_TM_D3.jpg 37004378_TM_D4.jpg 37004378_TM_D5.jpg 37004378_TM_D8.jpg

Tried a lot of things and already.

Sub jec()
Dim xp As String, a As Variant
dim TargetAddress as string

xp = "C:\Users\xxxx\Documents\37004378_TM*.jpg"
TargetAddress = activecell.value
xp = "C:\Users\xxxx\Documents\TargetAddress*.jpg"
a = Split(CreateObject("wscript.shell").exec("cmd /c dir """ & xp & """ /b/s").stdout.readall, vbCrLf)
Cells(1).Resize(UBound(a)) = Application.Transpose(a)
End Sub

I tried this it's very slow and I have a list 150 images. It's not working with variable


问:
Generate native headers from kotlin file
im trying to write JNI app and want to use kotlin in it.

As i understand kotlin equivalent of this:

private static native void hi();
```
<p>is:</p>
```private external fun hi()
```
<p>but the problemm is that i cant gen .h files with gradle in my project:</p>
<pre class="lang-kotlin prettyprint-override"><code>compileJava{
    options.headerOutputDirectory.set(file('src/main/java/idk/bluecross/JMM/natives'))
}
</code>```

how can i do this?

here is my build.gradle by the way:

```<code>plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.8.0-RC2'
    id 'application'
    id 'cpp'
}

group 'idk.bluecross'
version '1.0-SNAPSHOT'
application.mainClass = 'idk.bluecross.example.Main'

application {
    applicationDefaultJvmArgs +=
            ["-Djava.library.path=" + file("${buildDir}/libs/jMM/shared").absolutePath]
}

compileJava{
    options.headerOutputDirectory.set(file('src/main/java/idk/bluecross/JMM/natives'))
}

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

model {
    platforms {
        x64 {
            architecture "x86_64"
        }
    }

    components {
        JMM(NativeLibrarySpec) {
            sources {
                cpp {
                    source {
                        srcDir "src/main/java/idk/bluecross/JMM/natives"
                    }
                }
            }
            targetPlatform "x64"
            binaries.all {
                def jvmHome = System.properties['java.home']
                if (targetPlatform.operatingSystem.macOsX) {
                    cppCompiler.args '-I', "${jvmHome}/include"
                    cppCompiler.args '-I', "${jvmHome}/include/darwin"
                    cppCompiler.args '-mmacosx-version-min=10.4'
                    linker.args '-mmacosx-version-min=10.4'
                } else if (targetPlatform.operatingSystem.linux) {
                    cppCompiler.args '-I', "${jvmHome}/include"
                    cppCompiler.args '-I', "${jvmHome}/include/linux"
                    cppCompiler.args '-D_FILE_OFFSET_BITS=64'
                } else if (targetPlatform.operatingSystem.windows) {
                    cppCompiler.args "-I${jvmHome}/include"
                    cppCompiler.args "-I${jvmHome}/include/win32"
                } else if (targetPlatform.operatingSystem.freeBSD) {
                    cppCompiler.args '-I', "${jvmHome}/include"
                    cppCompiler.args '-I', "${jvmHome}/include/freebsd"
                }
            }
        }
    }
}

classes.dependsOn 'JMMSharedLibrary'
</code>```

Body:
im trying to write JNI app and want to use kotlin in it.

As i understand kotlin equivalent of this:

private static native void hi();

is:

private external fun hi()

but the problemm is that i cant gen .h files with gradle in my project:

compileJava{
    options.headerOutputDirectory.set(file('src/main/java/idk/bluecross/JMM/natives'))
}

how can i do this?

here is my build.gradle by the way:

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.8.0-RC2'
    id 'application'
    id 'cpp'
}

group 'idk.bluecross'
version '1.0-SNAPSHOT'
application.mainClass = 'idk.bluecross.example.Main'

application {
    applicationDefaultJvmArgs +=
            ["-Djava.library.path=" + file("${buildDir}/libs/jMM/shared").absolutePath]
}

compileJava{
    options.headerOutputDirectory.set(file('src/main/java/idk/bluecross/JMM/natives'))
}

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

model {
    platforms {
        x64 {
            architecture "x86_64"
        }
    }

    components {
        JMM(NativeLibrarySpec) {
            sources {
                cpp {
                    source {
                        srcDir "src/main/java/idk/bluecross/JMM/natives"
                    }
                }
            }
            targetPlatform "x64"
            binaries.all {
                def jvmHome = System.properties['java.home']
                if (targetPlatform.operatingSystem.macOsX) {
                    cppCompiler.args '-I', "${jvmHome}/include"
                    cppCompiler.args '-I', "${jvmHome}/include/darwin"
                    cppCompiler.args '-mmacosx-version-min=10.4'
                    linker.args '-mmacosx-version-min=10.4'
                } else if (targetPlatform.operatingSystem.linux) {
                    cppCompiler.args '-I', "${jvmHome}/include"
                    cppCompiler.args '-I', "${jvmHome}/include/linux"
                    cppCompiler.args '-D_FILE_OFFSET_BITS=64'
                } else if (targetPlatform.operatingSystem.windows) {
                    cppCompiler.args "-I${jvmHome}/include"
                    cppCompiler.args "-I${jvmHome}/include/win32"
                } else if (targetPlatform.operatingSystem.freeBSD) {
                    cppCompiler.args '-I', "${jvmHome}/include"
                    cppCompiler.args '-I', "${jvmHome}/include/freebsd"
                }
            }
        }
    }
}

classes.dependsOn 'JMMSharedLibrary'


问:
embarcadero 11 c++, How do I run an external program from my code
How do I run an external program from my code

I am using embarcadero 11 c++, How do I run an external program from my code,
tried using shellexec and code errors and does not compile.
cant find <windows.h> or <shellexecuteapi.h>.  I was trying to add a donate £1 button to my application to see how it works.
Any answers greatfully recieved.
A.


问:
No registered env with id: PongNoFrameskip-v4
I'm using Stable Baselines3 for my project. I'm a newbie and haven't used Stable Baselines3 before. But unfortunately, I'm not able to continue due to the following error,

```<code>No registered env with id: PongNoFrameskip-v4
</code>```

I installed Stable Baselines3 using conda instead of pip because when I used pip to install Stable Baselines3, the installation stuck for a hours. (See the attached images)

Building wheel for AutoROM.accept-rom-license (pyproject.toml) (See attached image

```<code>[here](https://i.stack.imgur.com/dy7f6.png)
</code>```

)

After a bit of googling, I came to know the issue is with AutoROM license. Then I tried installing Stable Baselines3 using pip, but again installation was not moving forward and is stuck in the same position. Any help would be highly appreciated. Thanks in advance

Body:
I'm using Stable Baselines3 for my project. I'm a newbie and haven't used Stable Baselines3 before. But unfortunately, I'm not able to continue due to the following error,

No registered env with id: PongNoFrameskip-v4

I installed Stable Baselines3 using conda instead of pip because when I used pip to install Stable Baselines3, the installation stuck for a hours. (See the attached images)

Building wheel for AutoROM.accept-rom-license (pyproject.toml) (See attached image

[here](https://i.stack.imgur.com/dy7f6.png)

)

After a bit of googling, I came to know the issue is with AutoROM license. Then I tried installing Stable Baselines3 using pip, but again installation was not moving forward and is stuck in the same position. Any help would be highly appreciated. Thanks in advance


问:
how to create laravel-echo connection in nodejs with pusher?
I want to communicate my nodejs backend with frontend with laravel-echo and pusher
I need to use laravel because backend developer has created a php backend with laravel, and he passed me the pusher information and i put them in .env

the doc of laravel isnt very helpful on this, maybe i am too new to this, I followed the way in the doc to create an echo connection with pusher with the code the below. But i got an error saying Echo is not a constructor.

The flow goes like this, frontend A.html will call a fetch to trigger the nodejs backend to run a python script. upon the python script returned stdout, will trigger nodejs backend to post a message to a frontend B.html that is listening to the laravel channel.

in the frontend B.html:

```<code><script>
var channel = Echo.channel('chat');
        channel.listen('response', function (data) {
            console.log(JSON.stringify(data));
            <<do sth with the data>>
</script>
</code>```

in the nodejs backend index.js:

```<code>import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
import axios from 'axios';

global.axios = axios;
global.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
global.pusher = Pusher;

global.Echo = new Echo({ //throw 'Echo is not a constructor' error
    broadcaster: 'pusher',
    key: VITE_PUSHER_APP_KEY,
    cluster: VITE_PUSHER_APP_CLUSTER,
    forceTLS: VITE_PUSHER_SCHEME,
    wsPort: 80,
    wssPort: 443,
});

var channel = Echo.channel('chat');
channel.listen('response', function (data) {
    console.log(JSON.stringify(data));

app.get('/record', (req, res) => {
    const pyProg = spawn('python', ['script.py']);
    pyProg.stdout.on('data', function (data) {
        const data_string = data.toString();
        const data_json = JSON.parse(data_string);
        const message = data_json.message;
        axios.post('/api/post', {
            type: 'MESSAGE',
            value: message,
        }).then(function (response) {
            console.log(response);
            message.value = "";
        }).catch(function (error) {
            console.log(error);
        });
        return res.json({ success: true, data: data_string });
    });
});
</code>```

My questions are

How can i connect to the laravel backend with laravel-echo and pusher and then broadcast a message from node backend to frontend that is listening to the channel?

What is the proper way to create the echo channel in nodejs backend?

Thanks

Body:
I want to communicate my nodejs backend with frontend with laravel-echo and pusher
I need to use laravel because backend developer has created a php backend with laravel, and he passed me the pusher information and i put them in .env

the doc of laravel isnt very helpful on this, maybe i am too new to this, I followed the way in the doc to create an echo connection with pusher with the code the below. But i got an error saying Echo is not a constructor.

The flow goes like this, frontend A.html will call a fetch to trigger the nodejs backend to run a python script. upon the python script returned stdout, will trigger nodejs backend to post a message to a frontend B.html that is listening to the laravel channel.

in the frontend B.html:

in the nodejs backend index.js:

import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
import axios from 'axios';

global.axios = axios;
global.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
global.pusher = Pusher;

global.Echo = new Echo({ //throw 'Echo is not a constructor' error
    broadcaster: 'pusher',
    key: VITE_PUSHER_APP_KEY,
    cluster: VITE_PUSHER_APP_CLUSTER,
    forceTLS: VITE_PUSHER_SCHEME,
    wsPort: 80,
    wssPort: 443,
});

var channel = Echo.channel('chat');
channel.listen('response', function (data) {
    console.log(JSON.stringify(data));

app.get('/record', (req, res) => {
    const pyProg = spawn('python', ['script.py']);
    pyProg.stdout.on('data', function (data) {
        const data_string = data.toString();
        const data_json = JSON.parse(data_string);
        const message = data_json.message;
        axios.post('/api/post', {
            type: 'MESSAGE',
            value: message,
        }).then(function (response) {
            console.log(response);
            message.value = "";
        }).catch(function (error) {
            console.log(error);
        });
        return res.json({ success: true, data: data_string });
    });
});

My questions are

How can i connect to the laravel backend with laravel-echo and pusher and then broadcast a message from node backend to frontend that is listening to the channel?

What is the proper way to create the echo channel in nodejs backend?

Thanks