问:
How can I make a class extend a specific instance of another class?
As an example: Here are two classes, Entity and Character. Entity makes an object on a game map, and it has rest parameters to set where you can interact with it.

```<code>class Entity {
  constructor(sprite, pos, func, ...intcoords) {
    this.sprite = sprite;
    this.func = func;
    move(pos, ...intcoords);
  }

  move(pos, ...intcoords) {
    this.y = pos[0]; this.x = pos[1];
    this.sprite = drawImg(this.sprite, this.y, this.x);
    for (let i in intcoords) {
      // process coordinates that should execute this.func: [y, x], [y, x]...
    }
  }
}
</code>```

Meanwhile, Character makes an object that is able to talk with a pre-defined template.

```<code>class Character {
  constructor(name, talkimg = name + "webp", talkpos = [70, 20], talkflip = false) {
    this.name = name; this.talkimg = talkimg;
    this.talkpos = talkpos; this.talkflip = talkflip;
  }

  async talk(...strings) {
    speechSet(this.name, this.talkimg, this.talkpos, this.talkflip);
    await speech(...strings);
  }
}
</code>```

In reality, characters will be activated because of a matching entity. So I believe the cleanest and most logical thing to do is have Character extend Entity. That way, I could have a single object like ben that I could call both ben.move() and ben.talk() with.

However, this would require using 7 parameters for Character, and sacrificing either default or rest parameters, which sucks. I could do it, and it would work, but it would suck and I would hate it. Ideally, I could define these parameters separately while still having a single object. I believe the best way would be if I could make an Entity separately, and then make that instance the super of a new Character.

One idea I had was making a single parameter at the beginning of Character, which could be passed an instance of Entity, and I could use that when declaring super(). That would allow me to define it this way and save it to a single variable:

```<code>ben = new Character(
  new Entity("ben.webp", [10, 6], benEvent, [9, 6], [9, 5]),
  "Ben", "ben-angry.webp", [60, 30]);
</code>```

The problem is that this creates and draws a new Entity, and then a duplicate is created inside Character. That's not going to work. Even if it didn't do that, Entity would have to save every parameter passed into it as a unique variable (which isn't used for any other purpose), then Character must reference those individually. That doesn't suck as bad, but I'd still prefer if I didn't do that.

Body:
As an example: Here are two classes, Entity and Character. Entity makes an object on a game map, and it has rest parameters to set where you can interact with it.

class Entity {
  constructor(sprite, pos, func, ...intcoords) {
    this.sprite = sprite;
    this.func = func;
    move(pos, ...intcoords);
  }

  move(pos, ...intcoords) {
    this.y = pos[0]; this.x = pos[1];
    this.sprite = drawImg(this.sprite, this.y, this.x);
    for (let i in intcoords) {
      // process coordinates that should execute this.func: [y, x], [y, x]...
    }
  }
}

Meanwhile, Character makes an object that is able to talk with a pre-defined template.

class Character {
  constructor(name, talkimg = name + "webp", talkpos = [70, 20], talkflip = false) {
    this.name = name; this.talkimg = talkimg;
    this.talkpos = talkpos; this.talkflip = talkflip;
  }

  async talk(...strings) {
    speechSet(this.name, this.talkimg, this.talkpos, this.talkflip);
    await speech(...strings);
  }
}

In reality, characters will be activated because of a matching entity. So I believe the cleanest and most logical thing to do is have Character extend Entity. That way, I could have a single object like ben that I could call both ben.move() and ben.talk() with.

However, this would require using 7 parameters for Character, and sacrificing either default or rest parameters, which sucks. I could do it, and it would work, but it would suck and I would hate it. Ideally, I could define these parameters separately while still having a single object. I believe the best way would be if I could make an Entity separately, and then make that instance the super of a new Character.

One idea I had was making a single parameter at the beginning of Character, which could be passed an instance of Entity, and I could use that when declaring super(). That would allow me to define it this way and save it to a single variable:

ben = new Character(
  new Entity("ben.webp", [10, 6], benEvent, [9, 6], [9, 5]),
  "Ben", "ben-angry.webp", [60, 30]);

The problem is that this creates and draws a new Entity, and then a duplicate is created inside Character. That's not going to work. Even if it didn't do that, Entity would have to save every parameter passed into it as a unique variable (which isn't used for any other purpose), then Character must reference those individually. That doesn't suck as bad, but I'd still prefer if I didn't do that.


来源: stackexchange

问:
Creating an "allowed-users" list in Next.Js while implementing Google Auth
I am fairly new to Next and React, and I really don't know a whole lot about backend anything except very basic knowledge for how models and using the data works.

Ok, so far the method I have used is working. However, I went to the client side and the login.js file obviously showed the JSON file items in the allowed-users.json because I imported it and checked the array for the allowed users. The logic works and only the emails on the list can login with Google Auth.

This is not a major issue because the app idea I am coming up with is not supposed to be a site pushed to production with a lot of publicity, but I still would like to know something I could do to make this secure to learn.

I am open to any suggestions, or any correction on anything I am doing that is not good practice. I am here to learn. What I did in this code is just a test to get it to work, and the whole project is just to test out using the NextAuth with Google to give users permissions on the site to implement an Admin, Employee, Client system for the accounts.

My Code:

```<code>import React from "react";
import { useSession, signIn, signOut } from "next-auth/react";
import GoogleButton from "react-google-button";
import { useRouter } from "next/router";
import allowedUsers from "./api/allowed-users.json";

const Login = () => {
  const { data: session } = useSession();
  const router = useRouter();

  console.log(session);

  if (!session) {
    return (
      <div className="flex justify-center items-center content-center h-full">
        <div>
          <GoogleButton onClick={() => signIn()} />
        </div>
      </div>
    );
  }
  if (session && allowedUsers.includes(session.user.email) ) {
    router.push("/account");
  } else {
    const exitLogin = () => signOut();
    exitLogin();
  }
};

export default Login;

</code>```

I have tried reading Next documentation on handling JSON and also API calls, but like I said, I am fairly new to this. I come from old school HTML / CSS / with simple JavaScript for simple sites. I am trying to broaden my knowledge to learn how to develop apps and sites that are viable nowadays.

If anyone has good documentation I should read please link it, or if you know a tutorial somewhere I can read through or watch that covers a topic similar to this.

Thanks!

Knight

ContentLicense: CC BY-SA 4.0

Body:
I am fairly new to Next and React, and I really don't know a whole lot about backend anything except very basic knowledge for how models and using the data works.

Ok, so far the method I have used is working. However, I went to the client side and the login.js file obviously showed the JSON file items in the allowed-users.json because I imported it and checked the array for the allowed users. The logic works and only the emails on the list can login with Google Auth.

This is not a major issue because the app idea I am coming up with is not supposed to be a site pushed to production with a lot of publicity, but I still would like to know something I could do to make this secure to learn.

I am open to any suggestions, or any correction on anything I am doing that is not good practice. I am here to learn. What I did in this code is just a test to get it to work, and the whole project is just to test out using the NextAuth with Google to give users permissions on the site to implement an Admin, Employee, Client system for the accounts.

My Code:

import React from "react";
import { useSession, signIn, signOut } from "next-auth/react";
import GoogleButton from "react-google-button";
import { useRouter } from "next/router";
import allowedUsers from "./api/allowed-users.json";

const Login = () => {
  const { data: session } = useSession();
  const router = useRouter();

  console.log(session);

  if (!session) {
    return (

          <GoogleButton onClick={() => signIn()} />

    );
  }
  if (session && allowedUsers.includes(session.user.email) ) {
    router.push("/account");
  } else {
    const exitLogin = () => signOut();
    exitLogin();
  }
};

export default Login;

I have tried reading Next documentation on handling JSON and also API calls, but like I said, I am fairly new to this. I come from old school HTML / CSS / with simple JavaScript for simple sites. I am trying to broaden my knowledge to learn how to develop apps and sites that are viable nowadays.

If anyone has good documentation I should read please link it, or if you know a tutorial somewhere I can read through or watch that covers a topic similar to this.

Thanks!

Knight


问:
How docker network works when setting container IP address different from the docker assigned one

Background

I'm currently running OpenWrt inside a docker container. I created a macvlan network with subnet 172.19.0.0/16, and the OpenWrt container which connects to the macvlan network.

The docker automatically assigned one Ip address 172.19.0.2 when creating the openwrt container with Mac address 02:42:ac:13:00:02 or mac1 for short. When I login the openwrt container, and run ip addr, I get the following output, where it has IP address 192.168.50.123 bound to mac1.

Problem

The inconsistency of IP addresses makes me extremely confused, because normally I'd access the container with the docker assigned IP. In this case, the assigned IP 172.19.0.2 is un-ping-able. I can access the container through 192.168.50.123 which is a completely different network from the macvlan network this container connects to. I also edited the openwrt ip address through in /etc/config/network and no matter what ip address I choose, the I can only connect to the container through that IP address instead of the one docker assigned.

My initial thought on this is that, macvlan is all about l2 layer and Mac address, thus IP addresses don't play roles, if so why specify --subnet in the first place when creating a macvlan network as docker doc says. I'm new to docker, and don't have much experience in networking, hope any of you can help me explain this,please


问:
Apex test class for Page Reference and Static methods
I am new to write Apex test class. Can anyone help me or suggest how to start writing apex text. Below is my Apex Class

```<code>public   class RadioBtn_SmileyTable_Apex
{

    public RB_Rating__c ratobj {get;set;}
    public user lgflag {get;set;}
    public string Selected {get;set;}
    public string EnteredText {get;set;}
    public string Redirect {get;set;}
    public string QAppname {get;set;}
    public string Qimprove {get;set;}

    public RadioBtn_SmileyTable_Apex()
    {
      QAppname = 'How satisified you are with '+getAppName();
      Qimprove = 'How could we improve?';
    }

    Public void SelectedAnswer()
    {

        Selected = Apexpages.currentPage().getParameters().get('conid');
    }

    public pagereference savefeedback()
    {
            system.debug('Submit Started : '+ Redirect);
            RB_Rating__c ratobj = new RB_Rating__c();

            ratobj.Application_Name__c = getAppName();

            if(string.isBlank(Redirect))
                  {
                    ratobj.Application_Rating__c = Selected;
              }
            else
              {
                     ratobj.Application_Rating__c = Redirect;

              }

        ratobj.Description__c = EnteredText;
        insert ratobj;

        updateflgusertb();
        return Auth.SessionManagement.FinishLoginflow('/'+ratobj.Id);

    }

    public static void updateflgusertb()
    {
        List<user> userupdate = new List<user>();

        for(user usr : [SELECT id,Login_Flows_YN__c FROM USER WHERE ID = :UserInfo.getUserId() LIMIT 1])
        {
           usr.Login_Flows_YN__c = true;
            userupdate.add(usr);
        }
        update userupdate;
    }

    public pagereference feedbackexit()
    {
        updateexitcount();

        return Auth.SessionManagement.FinishLoginflow('/');
    }

    public void updateexitcount()
    {
        integer exitcnt;

        List<user> updatecnt = new List<user>();

        for(user cnt : [SELECT Rating_Exit_Count__c FROM USER WHERE ID = :UserInfo.getUserId() LIMIT 1])
        {

            if (cnt.Rating_Exit_Count__c == null)
            {
                cnt.Rating_Exit_Count__c = 0;
            }

            exitcnt = Integer.valueOf(cnt.Rating_Exit_Count__c) + 1;

            cnt.Rating_Exit_Count__c = exitcnt;
            updatecnt.add(cnt);

        }

        update updatecnt;

        if (exitcnt ==3)
        {
          insertzerorating();
        }

    }

    public pagereference loginflowsexornot()
    {

         lgflag =[SELECT Login_Flows_YN__c FROM USER WHERE ID = :UserInfo.getUserId() LIMIT 1];

        if (lgflag.Login_Flows_YN__c == true)
        {
           return Auth.SessionManagement.FinishLoginflow('/');
        }
        else
        {
            return null;
        }

    }

    public pagereference redirect()
    {
       PageReference pg = new PageReference('/apex/Slider_Rating_Redir_VF?retURL='+Selected);
       Redirect = ApexPages.currentPage().getparameters().get('retURL');
       pg.setRedirect(false);
       return pg;

    }

    public static String getAppName()
    {
        UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() LIMIT 1];
        AppDefinition appDefinition = [SELECT DurableId, Label FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];

        return appDefinition.Label;
    }

    public pagereference insertzerorating()
    {

        RB_Rating__c ratobjZero = new RB_Rating__c();
        ratobjZero.Application_Name__c = getAppName();
        ratobjZero.Application_Rating__c = '0';
        ratobjZero.Description__c = EnteredText;
        insert ratobjZero;

        updateflgusertb();

        return Auth.SessionManagement.FinishLoginflow('/'+ratobjZero.Id);

    }
}
</code>```

Wrote below test class. Please suggest to further:

```<code>@isTest (SeeAllData = FALSE)
public class Slider_VF_TestClass
{

    public static testmethod void SliderTestClass()
    {
        RB_Rating__c testRBRating = new RB_Rating__c();
        testRBRating.Application_Name__c = 'FoxiPedia';
        testRBRating.Application_Rating__c = '9';
        testRBRating.Description__c='Testing the testclass for the Rating 9';
        insert testRBRating;

        Test.startTest();
        RadioBtn_SmileyTable_Apex smileyapex = new RadioBtn_SmileyTable_Apex();
        PageReference page1 = page.Slider_Rating_VF;
        Test.setCurrentPage(page1);
        smileyapex.ratobj.Application_Name__c= 'FoxiPedia';
        smileyapex.ratobj.Application_Rating__c = '8';
        smileyapex.ratobj.Description__c = 'Testing the testclass for the Rating 9';

        PageReference pageRef = smileyapex.savefeedback();
        ApexPages.currentPage().getParameters().put('id',smileyapex.ratobj.Id);
        Test.setCurrentPage(pageRef);
        Test.stopTest();

    }

}
</code>```

Try to write Apex Test class. Need some sample code

Body:
I am new to write Apex test class. Can anyone help me or suggest how to start writing apex text. Below is my Apex Class

public   class RadioBtn_SmileyTable_Apex
{

    public RB_Rating__c ratobj {get;set;}
    public user lgflag {get;set;}
    public string Selected {get;set;}
    public string EnteredText {get;set;}
    public string Redirect {get;set;}
    public string QAppname {get;set;}
    public string Qimprove {get;set;}

    public RadioBtn_SmileyTable_Apex()
    {
      QAppname = 'How satisified you are with '+getAppName();
      Qimprove = 'How could we improve?';
    }

    Public void SelectedAnswer()
    {

        Selected = Apexpages.currentPage().getParameters().get('conid');
    }

    public pagereference savefeedback()
    {
            system.debug('Submit Started : '+ Redirect);
            RB_Rating__c ratobj = new RB_Rating__c();

            ratobj.Application_Name__c = getAppName();

            if(string.isBlank(Redirect))
                  {
                    ratobj.Application_Rating__c = Selected;
              }
            else
              {
                     ratobj.Application_Rating__c = Redirect;

              }

        ratobj.Description__c = EnteredText;
        insert ratobj;

        updateflgusertb();
        return Auth.SessionManagement.FinishLoginflow('/'+ratobj.Id);

    }

    public static void updateflgusertb()
    {
        List<user> userupdate = new List<user>();

        for(user usr : [SELECT id,Login_Flows_YN__c FROM USER WHERE ID = :UserInfo.getUserId() LIMIT 1])
        {
           usr.Login_Flows_YN__c = true;
            userupdate.add(usr);
        }
        update userupdate;
    }

    public pagereference feedbackexit()
    {
        updateexitcount();

        return Auth.SessionManagement.FinishLoginflow('/');
    }

    public void updateexitcount()
    {
        integer exitcnt;

        List<user> updatecnt = new List<user>();

        for(user cnt : [SELECT Rating_Exit_Count__c FROM USER WHERE ID = :UserInfo.getUserId() LIMIT 1])
        {

            if (cnt.Rating_Exit_Count__c == null)
            {
                cnt.Rating_Exit_Count__c = 0;
            }

            exitcnt = Integer.valueOf(cnt.Rating_Exit_Count__c) + 1;

            cnt.Rating_Exit_Count__c = exitcnt;
            updatecnt.add(cnt);

        }

        update updatecnt;

        if (exitcnt ==3)
        {
          insertzerorating();
        }

    }

    public pagereference loginflowsexornot()
    {

         lgflag =[SELECT Login_Flows_YN__c FROM USER WHERE ID = :UserInfo.getUserId() LIMIT 1];

        if (lgflag.Login_Flows_YN__c == true)
        {
           return Auth.SessionManagement.FinishLoginflow('/');
        }
        else
        {
            return null;
        }

    }

    public pagereference redirect()
    {
       PageReference pg = new PageReference('/apex/Slider_Rating_Redir_VF?retURL='+Selected);
       Redirect = ApexPages.currentPage().getparameters().get('retURL');
       pg.setRedirect(false);
       return pg;

    }

    public static String getAppName()
    {
        UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() LIMIT 1];
        AppDefinition appDefinition = [SELECT DurableId, Label FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];

        return appDefinition.Label;
    }

    public pagereference insertzerorating()
    {

        RB_Rating__c ratobjZero = new RB_Rating__c();
        ratobjZero.Application_Name__c = getAppName();
        ratobjZero.Application_Rating__c = '0';
        ratobjZero.Description__c = EnteredText;
        insert ratobjZero;

        updateflgusertb();

        return Auth.SessionManagement.FinishLoginflow('/'+ratobjZero.Id);

    }
}

Wrote below test class. Please suggest to further:

@isTest (SeeAllData = FALSE)
public class Slider_VF_TestClass
{

    public static testmethod void SliderTestClass()
    {
        RB_Rating__c testRBRating = new RB_Rating__c();
        testRBRating.Application_Name__c = 'FoxiPedia';
        testRBRating.Application_Rating__c = '9';
        testRBRating.Description__c='Testing the testclass for the Rating 9';
        insert testRBRating;

        Test.startTest();
        RadioBtn_SmileyTable_Apex smileyapex = new RadioBtn_SmileyTable_Apex();
        PageReference page1 = page.Slider_Rating_VF;
        Test.setCurrentPage(page1);
        smileyapex.ratobj.Application_Name__c= 'FoxiPedia';
        smileyapex.ratobj.Application_Rating__c = '8';
        smileyapex.ratobj.Description__c = 'Testing the testclass for the Rating 9';

        PageReference pageRef = smileyapex.savefeedback();
        ApexPages.currentPage().getParameters().put('id',smileyapex.ratobj.Id);
        Test.setCurrentPage(pageRef);
        Test.stopTest();

    }

}

Try to write Apex Test class. Need some sample code


问:
Vichuploader Entity is not uploadable
I have an issue with my vichuplader it triggers and exception Not uploadable knowing that I've followed all the setup I'm using easyadmin3 to insert data for my News entity that have an image attachement to it.
I've reinstalled VichBundel, rewrote the entity, tried diffrent fieldtype in my easyadmin config</p>
```<code>vich_uploader:
    db_driver: orm

    metadata:
        type: attribute

    mappings:
        news_image:
            uri_prefix: /images/news
            upload_destination: "%kernel.project_dir%/public/images/news"
            namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
</code>```
```<code>class NewsCrudController extends AbstractCrudController
{
    public static function getEntityFqcn(): string
    {
        return News::class;
    }

    public function configureFields(string $pageName): iterable
    {
        return [
            IdField::new('id')->onlyOnIndex(),
            TextField::new('title'),
            TextEditorField::new('description'),
            BooleanField::new('isActive', 'Actif'),
            ImageField::new('imagename')->setBasePath('images/news')->onlyOnIndex(),
            VichImageField::new('imageFile')->hideOnIndex()
        ];
    }
}
</code>```
```<code><?php

namespace App\Entity;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\NewsRepository;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ ORM\Entity( repositoryClass: NewsRepository::class ) ]
#[Vich\Uploadable]
class News {
    #[ ORM\Id ]
    #[ ORM\GeneratedValue ]
    #[ ORM\Column ]
    private ?int $id = null;

    #[ ORM\Column( length: 255 ) ]
    private ?string $title = null;

    #[ ORM\Column( type: Types::TEXT ) ]
    private ?string $description = null;

    #[ ORM\Column ]
    private ?bool $isActive = null;

    #[ ORM\Column( length: 255 ) ]
    private ?string $imageName = null;

    #[ Vich\UploadableField( mapping: 'news_image', fileNameProperty: 'imageName' ) ]
    private ?File $imageFile = null;

    #[ ORM\Column ]
    private ?\DateTimeImmutable $createdAt = null;

    #[ ORM\Column ]
    private ?\DateTimeImmutable $updatedAt = null;

    #[ ORM\Column( nullable: true ) ]
    private ?\DateTimeImmutable $publishedAt = null;

    public function __construct() {
        $this->createdAt = new \DateTimeImmutable();
        $this->updatedAt = new \DateTimeImmutable();
    }

    public function getId(): ?int {
        return $this->id;
    }

    public function getTitle(): ?string {
        return $this->title;
    }

    public function setTitle( string $title ): self {
        $this->title = $title;

        return $this;
    }

    public function getDescription(): ?string {
        return $this->description;
    }

    public function setDescription( string $description ): self {
        $this->description = $description;

        return $this;
    }

    public function isIsActive(): ?bool {
        return $this->isActive;
    }

    public function setIsActive( bool $isActive ): self {
        $this->isActive = $isActive;

        return $this;
    }

    public function getImageName(): ?string {
        return $this->imageName;
    }

    public function setImageName( ?string $imageName ): self {
        $this->imageName = $imageName;

        return $this;
    }

    public function setImageFile( ?File $imageFile = null ): void {
        $this->imageFile = $imageFile;
        if ($imageFile) {
            $this->updatedAt = new \DateTime( 'now' );
        }
    }

    public function getImageFile() {
        return $this->imageFile;
    }

    public function getCreatedAt(): ?\DateTimeImmutable {
        return $this->createdAt;
    }

    public function setCreatedAt( \DateTimeImmutable $createdAt ): self {
        $this->createdAt = $createdAt;

        return $this;
    }

    public function getUpdatedAt(): ?\DateTimeImmutable {
        return $this->updatedAt;
    }

    public function setUpdatedAt( \DateTimeImmutable $updatedAt ): self {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    public function getPublishedAt(): ?\DateTimeImmutable {
        return $this->publishedAt;
    }

    public function setPublishedAt( ?\DateTimeImmutable $publishedAt ): self {
        $this->publishedAt = $publishedAt;

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

Title: Vichuploader Entity is not uploadable

Body:
I have an issue with my vichuplader it triggers and exception Not uploadable knowing that I've followed all the setup I'm using easyadmin3 to insert data for my News entity that have an image attachement to it.
I've reinstalled VichBundel, rewrote the entity, tried diffrent fieldtype in my easyadmin config

vich_uploader:
    db_driver: orm

    metadata:
        type: attribute

    mappings:
        news_image:
            uri_prefix: /images/news
            upload_destination: "%kernel.project_dir%/public/images/news"
            namer: Vich\UploaderBundle\Naming\SmartUniqueNamer

class NewsCrudController extends AbstractCrudController
{
    public static function getEntityFqcn(): string
    {
        return News::class;
    }

    public function configureFields(string $pageName): iterable
    {
        return [
            IdField::new('id')->onlyOnIndex(),
            TextField::new('title'),
            TextEditorField::new('description'),
            BooleanField::new('isActive', 'Actif'),
            ImageField::new('imagename')->setBasePath('images/news')->onlyOnIndex(),
            VichImageField::new('imageFile')->hideOnIndex()
        ];
    }
}

<?php

namespace App\Entity;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\NewsRepository;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ ORM\Entity( repositoryClass: NewsRepository::class ) ]
#[Vich\Uploadable]
class News {
    #[ ORM\Id ]
    #[ ORM\GeneratedValue ]
    #[ ORM\Column ]
    private ?int $id = null;

    #[ ORM\Column( length: 255 ) ]
    private ?string $title = null;

    #[ ORM\Column( type: Types::TEXT ) ]
    private ?string $description = null;

    #[ ORM\Column ]
    private ?bool $isActive = null;

    #[ ORM\Column( length: 255 ) ]
    private ?string $imageName = null;

    #[ Vich\UploadableField( mapping: 'news_image', fileNameProperty: 'imageName' ) ]
    private ?File $imageFile = null;

    #[ ORM\Column ]
    private ?\DateTimeImmutable $createdAt = null;

    #[ ORM\Column ]
    private ?\DateTimeImmutable $updatedAt = null;

    #[ ORM\Column( nullable: true ) ]
    private ?\DateTimeImmutable $publishedAt = null;

    public function __construct() {
        $this->createdAt = new \DateTimeImmutable();
        $this->updatedAt = new \DateTimeImmutable();
    }

    public function getId(): ?int {
        return $this->id;
    }

    public function getTitle(): ?string {
        return $this->title;
    }

    public function setTitle( string $title ): self {
        $this->title = $title;

        return $this;
    }

    public function getDescription(): ?string {
        return $this->description;
    }

    public function setDescription( string $description ): self {
        $this->description = $description;

        return $this;
    }

    public function isIsActive(): ?bool {
        return $this->isActive;
    }

    public function setIsActive( bool $isActive ): self {
        $this->isActive = $isActive;

        return $this;
    }

    public function getImageName(): ?string {
        return $this->imageName;
    }

    public function setImageName( ?string $imageName ): self {
        $this->imageName = $imageName;

        return $this;
    }

    public function setImageFile( ?File $imageFile = null ): void {
        $this->imageFile = $imageFile;
        if ($imageFile) {
            $this->updatedAt = new \DateTime( 'now' );
        }
    }

    public function getImageFile() {
        return $this->imageFile;
    }

    public function getCreatedAt(): ?\DateTimeImmutable {
        return $this->createdAt;
    }

    public function setCreatedAt( \DateTimeImmutable $createdAt ): self {
        $this->createdAt = $createdAt;

        return $this;
    }

    public function getUpdatedAt(): ?\DateTimeImmutable {
        return $this->updatedAt;
    }

    public function setUpdatedAt( \DateTimeImmutable $updatedAt ): self {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    public function getPublishedAt(): ?\DateTimeImmutable {
        return $this->publishedAt;
    }

    public function setPublishedAt( ?\DateTimeImmutable $publishedAt ): self {
        $this->publishedAt = $publishedAt;

        return $this;
    }
}


问:
java uses "transferTo" to copy files more slowly than "RandomAccessFile"?why?
"transferTo" is 0 copy.
RandomAccessFile(ByteBuffer)is using user space.
Why is "transferTo" slow?
I don't think "transferTo" uses user space and does not copy file contents to user space
code:

public class Test {
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        test1();
        System.out.println("time1:" + (System.currentTimeMillis() - start));

        long start2 = System.currentTimeMillis();
        test2();
        System.out.println("time2:" + (System.currentTimeMillis() - start2));
    }

    public static void test1() throws IOException {

        File sourceFile = new File("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso");
        FileInputStream fis = new FileInputStream(sourceFile);
        FileChannel fisChannel = fis.getChannel();

        FileOutputStream fos = new FileOutputStream("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso2");
        FileChannel fosChannel = fos.getChannel();

        long size = fisChannel.size();
        long cpSize = 0;
        do {
            fisChannel.transferTo(cpSize, size - cpSize, fosChannel);
            cpSize = fosChannel.size();
            System.out.println(cpSize);
        } while (cpSize < size);

        System.out.println(fosChannel.size());
        fis.close();
        fos.flush();
        fos.close();

    }

    public static void test2() throws IOException {
        RandomAccessFile randomAccessFile1 = new RandomAccessFile("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso", "r");
        RandomAccessFile randomAccessFile2 = new RandomAccessFile("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso3", "rw");
        ByteBuffer byteBuffer = ByteBuffer.allocate(1024 * 1024);
        while (true) {
            byteBuffer.clear();
            int read = randomAccessFile1.getChannel().read(byteBuffer);
            if (read == -1) {
                break;
            }
            byteBuffer.flip();
            randomAccessFile2.getChannel().write(byteBuffer);
        }
        randomAccessFile1.close();
        randomAccessFile2.close();
    }
}
```

I expect it to be "transferTo" fast

Body:
"transferTo" is 0 copy.
RandomAccessFile(ByteBuffer)is using user space.
Why is "transferTo" slow?
I don't think "transferTo" uses user space and does not copy file contents to user space
code:

public class Test {
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        test1();
        System.out.println("time1:" + (System.currentTimeMillis() - start));

        long start2 = System.currentTimeMillis();
        test2();
        System.out.println("time2:" + (System.currentTimeMillis() - start2));
    }

    public static void test1() throws IOException {

        File sourceFile = new File("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso");
        FileInputStream fis = new FileInputStream(sourceFile);
        FileChannel fisChannel = fis.getChannel();

        FileOutputStream fos = new FileOutputStream("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso2");
        FileChannel fosChannel = fos.getChannel();

        long size = fisChannel.size();
        long cpSize = 0;
        do {
            fisChannel.transferTo(cpSize, size - cpSize, fosChannel);
            cpSize = fosChannel.size();
            System.out.println(cpSize);
        } while (cpSize < size);

        System.out.println(fosChannel.size());
        fis.close();
        fos.flush();
        fos.close();

    }

    public static void test2() throws IOException {
        RandomAccessFile randomAccessFile1 = new RandomAccessFile("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso", "r");
        RandomAccessFile randomAccessFile2 = new RandomAccessFile("D:\\iso\\CentOS-7-x86_64-DVD-2009.iso3", "rw");
        ByteBuffer byteBuffer = ByteBuffer.allocate(1024 * 1024);
        while (true) {
            byteBuffer.clear();
            int read = randomAccessFile1.getChannel().read(byteBuffer);
            if (read == -1) {
                break;
            }
            byteBuffer.flip();
            randomAccessFile2.getChannel().write(byteBuffer);
        }
        randomAccessFile1.close();
        randomAccessFile2.close();
    }
}

I expect it to be "transferTo" fast


问:
java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination cannot be found from the current destination null
I was using Jetpack Navigation Components, the problem occurred while rotating the device!

I was building an application that has three main features. These are onboarding, auth, and main. Every feature has its navigation graph. If it's the first time opening the app, I have to open go with the onboarding graph, If the user is not authenticated, go with auth. Otherwise to main. The problem keeps occurring while rotating the device.

The detailed exception is here:

Process: io.usdaves.chat, PID: 11247
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.usdaves.chat/io.usdaves.chat.application.HostActivity}: java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination io.usdaves.chat:id/navigation_auth cannot be found from the current destination null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4166)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4312)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6468)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6342)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination io.usdaves.chat:id/navigation_auth cannot be found from the current destination null
at androidx.navigation.NavController.onGraphCreated(NavController.kt:1128)
at androidx.navigation.NavController.setGraph(NavController.kt:1086)
at androidx.navigation.NavController.setGraph(NavController.kt:1039)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.kt:155)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:3090)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:2884)
at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:252)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:220)
at io.usdaves.chat.application.HostActivity.onCreate(HostActivity.kt:21)
at android.app.Activity.performCreate(Activity.java:8578)
at android.app.Activity.performCreate(Activity.java:8557)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4147)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4312)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6468)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6342)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
```
<p>The directions comes from viewModel:</p>
<pre class="lang-kotlin prettyprint-override"><code>private const val SHOULD_KEEP_SPLASH = "should_keep_splash_saved_state_handle_key"

@HiltViewModel
class HostViewModel @Inject constructor(
    preferences: UserPreferences,
    private val savedStateHandle: SavedStateHandle
) : ViewModel() {

    val shouldKeepSplash = savedStateHandle.getStateFlow(SHOULD_KEEP_SPLASH, true)

    val navigationDirections = combine(
        preferences.isOnboardingCompleted(),
        preferences.isLoggedIn()
    ) { isOnboardingCompleted, isLoggedIn ->
        when {
            isOnboardingCompleted && isLoggedIn -> NavigateToMainAction
            isOnboardingCompleted -> NavigateToAuthAction
            else -> NavigateToOnboardingAction
        }.also {
            savedStateHandle[SHOULD_KEEP_SPLASH] = false
        }
    }.distinctUntilChanged().shareIn(viewModelScope, Eagerly)
}
</code>```

I'was sing this sealed class to pass navigations.

sealed class HostNavigationDirections(@NavigationRes val navigationId: Int) {
    object NavigateToOnboardingAction : HostNavigationDirections(R.navigation.navigation_onboarding)
    object NavigateToAuthAction : HostNavigationDirections(R.navigation.navigation_auth)
    object NavigateToMainAction : HostNavigationDirections(R.navigation.navigation_main)
}
```
<p>Here is the Host Activity.</p>
<pre class="lang-kotlin prettyprint-override"><code>@AndroidEntryPoint
class HostActivity : AppCompatActivity() {

    private val viewModel: HostViewModel by viewModels()

    private lateinit var navController: NavController

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_host)

        val splashScreen = installSplashScreen()
        splashScreen.setKeepOnScreenCondition { viewModel.shouldKeepSplash.value }

        val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
        navController = navHostFragment.navController

        lifecycleScope.launch {
            repeatOnLifecycle(Lifecycle.State.STARTED) {
                viewModel.navigationDirections.collectLatest { direction ->
                    val authNavGraph = navController.navInflater.inflate(direction.navigationId)
                    navController.graph = authNavGraph
                }
            }
        }
    }

    override fun onSupportNavigateUp(): Boolean {
        return navController.navigateUp() || super.onSupportNavigateUp()
    }
}
</code>```

The xml is here:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/auth_fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"
        app:navGraph="@navigation/navigation_main" />

</FrameLayout>
```

I did a lot of researchers on this problem but nothing was found.

Body:
I was using Jetpack Navigation Components, the problem occurred while rotating the device!

I was building an application that has three main features. These are onboarding, auth, and main. Every feature has its navigation graph. If it's the first time opening the app, I have to open go with the onboarding graph, If the user is not authenticated, go with auth. Otherwise to main. The problem keeps occurring while rotating the device.

The detailed exception is here:

Process: io.usdaves.chat, PID: 11247
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.usdaves.chat/io.usdaves.chat.application.HostActivity}: java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination io.usdaves.chat:id/navigation_auth cannot be found from the current destination null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4166)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4312)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6468)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6342)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination io.usdaves.chat:id/navigation_auth cannot be found from the current destination null
at androidx.navigation.NavController.onGraphCreated(NavController.kt:1128)
at androidx.navigation.NavController.setGraph(NavController.kt:1086)
at androidx.navigation.NavController.setGraph(NavController.kt:1039)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.kt:155)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:3090)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:2884)
at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:252)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:220)
at io.usdaves.chat.application.HostActivity.onCreate(HostActivity.kt:21)
at android.app.Activity.performCreate(Activity.java:8578)
at android.app.Activity.performCreate(Activity.java:8557)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4147)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4312)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6468)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6342)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

The directions comes from viewModel:

private const val SHOULD_KEEP_SPLASH = "should_keep_splash_saved_state_handle_key"

@HiltViewModel
class HostViewModel @Inject constructor(
    preferences: UserPreferences,
    private val savedStateHandle: SavedStateHandle
) : ViewModel() {

    val shouldKeepSplash = savedStateHandle.getStateFlow(SHOULD_KEEP_SPLASH, true)

    val navigationDirections = combine(
        preferences.isOnboardingCompleted(),
        preferences.isLoggedIn()
    ) { isOnboardingCompleted, isLoggedIn ->
        when {
            isOnboardingCompleted && isLoggedIn -> NavigateToMainAction
            isOnboardingCompleted -> NavigateToAuthAction
            else -> NavigateToOnboardingAction
        }.also {
            savedStateHandle[SHOULD_KEEP_SPLASH] = false
        }
    }.distinctUntilChanged().shareIn(viewModelScope, Eagerly)
}

I'was sing this sealed class to pass navigations.

sealed class HostNavigationDirections(@NavigationRes val navigationId: Int) {
    object NavigateToOnboardingAction : HostNavigationDirections(R.navigation.navigation_onboarding)
    object NavigateToAuthAction : HostNavigationDirections(R.navigation.navigation_auth)
    object NavigateToMainAction : HostNavigationDirections(R.navigation.navigation_main)
}

Here is the Host Activity.

@AndroidEntryPoint
class HostActivity : AppCompatActivity() {

    private val viewModel: HostViewModel by viewModels()

    private lateinit var navController: NavController

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_host)

        val splashScreen = installSplashScreen()
        splashScreen.setKeepOnScreenCondition { viewModel.shouldKeepSplash.value }

        val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
        navController = navHostFragment.navController

        lifecycleScope.launch {
            repeatOnLifecycle(Lifecycle.State.STARTED) {
                viewModel.navigationDirections.collectLatest { direction ->
                    val authNavGraph = navController.navInflater.inflate(direction.navigationId)
                    navController.graph = authNavGraph
                }
            }
        }
    }

    override fun onSupportNavigateUp(): Boolean {
        return navController.navigateUp() || super.onSupportNavigateUp()
    }
}

The xml is here:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/auth_fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"
        app:navGraph="@navigation/navigation_main" />

</FrameLayout>

I did a lot of researchers on this problem but nothing was found.


问:
Upcoming changes to the App Store receipt signing certificate
I have recently got this news to the apple developer news channel,
https://developer.apple.com/news/?id=ytb7qj0x

So I want to know that will this affect my implementation to check the status of user purchase status.
I am currently using SwiftyStoreKit for IAP, and using this function to verify receipt, so that I can check the user's purchase status,

```<code>SwiftyStoreKit.verifyReceipt(using: AppleReceiptValidator)
</code>```

Response on this will be very helpful to me.

Body:
I have recently got this news to the apple developer news channel,
https://developer.apple.com/news/?id=ytb7qj0x

So I want to know that will this affect my implementation to check the status of user purchase status.
I am currently using SwiftyStoreKit for IAP, and using this function to verify receipt, so that I can check the user's purchase status,

SwiftyStoreKit.verifyReceipt(using: AppleReceiptValidator)

Response on this will be very helpful to me.


问:
svelte slider not rendering
dears,
I create a simple slider, but i have a problem in rendering the images, mor information:
i have slider.svelte, app.svelte, index.html.

In slider.svelte it has the process of creating the body of the slider with the dots, the code will be like this:

    <slot />

    {#if haveDots}

        {#each { length: totalDots } as _, i}

 go(i * currentPerPage)}
            class={isDotActive(currentIndex, i) ? "active" : ""}
          />
        {/each}

    {/if}

```
<p>In <code>app.svelte</code>:</p>
<pre class="lang-html prettyprint-override"><code><svelte:options tag="app-slider" />
<script lang="ts">
import Sliders from "./lib/Slider.svelte";
.
.//code
.
</script>
<Sliders>
 {#each sliderData["slides"] as slider}

       <img alt="" src={slider["img"]} />

  {/each}
</Sliders>
</code>```

In index.html it has:

<!DOCTYPE html>

        <meta charset="UTF-8" />
        <link rel="icon" type="image/svg+xml" href="/vite.svg" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Vite + Svelte + TS</title>

        <app-slider></app-slider>

```

I'm using custom components when I disable it the slider work when I enable it the part in <slot /> not rendering at all

I tried to use custom component for the slot tag it didn't work

Title: svelte slider not rendering

Body:
dears,
I create a simple slider, but i have a problem in rendering the images, mor information:
i have slider.svelte, app.svelte, index.html.

In slider.svelte it has the process of creating the body of the slider with the dots, the code will be like this:

    <slot />

    {#if haveDots}

        {#each { length: totalDots } as _, i}

 go(i * currentPerPage)}
            class={isDotActive(currentIndex, i) ? "active" : ""}
          />
        {/each}

    {/if}

In app.svelte:

<svelte:options tag="app-slider" />

<Sliders>
 {#each sliderData["slides"] as slider}

  {/each}
</Sliders>

In index.html it has:

<!DOCTYPE html>

        <meta charset="UTF-8" />
        <link rel="icon" type="image/svg+xml" href="/vite.svg" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Vite + Svelte + TS</title>

        <app-slider></app-slider>

I'm using custom components when I disable it the slider work when I enable it the part in <slot /> not rendering at all

I tried to use custom component for the slot tag it didn't work


问:
Image Component with nextjs
```<code>    <Image
          priority
          className="rounded-t-xl"
          src={imgsrc}
          alt="coverImage"
          quality={100}
          width={100}
          height={50}
          layout="responsive"
          objectFit="cover"
        />
</code>```

I see an warning like this:

may not render properly as a child of a flex container. Consider wrapping the image with a div to configure the width.

so I added div tag outside Image Component. But I don't know why add div tag.

Is there any next.js documentation I can refer to?

Title: Image Component with nextjs

Body:
    <Image
          priority
          className="rounded-t-xl"
          src={imgsrc}
          alt="coverImage"
          quality={100}
          width={100}
          height={50}
          layout="responsive"
          objectFit="cover"
        />

I see an warning like this:

may not render properly as a child of a flex container. Consider wrapping the image with a div to configure the width.

so I added div tag outside Image Component. But I don't know why add div tag.

Is there any next.js documentation I can refer to?


问:
VS Code not Opening
I am New to coding. I opened vs code 2-3 after today to start my coding journey but when i opened it.

It shows black screen totally blank . I watched some youtube videos then on this problem and reinstall my vs code app but nothing happens then i use disable gpu before its name in properties with proper spellings and syntax did 2-3 times but nothing happens again then i use compatable mode in vistra and windows 8 but nothing happens again.

I really want to learn programming Plzz help me in solving this problem and in easy language i didn't understand high programmers language.

I am attaching some screenshots for your help to understand my problem better.

reinstall my vs code app

disable GPU

compatable mode in vistra and windows 8

nothing happens it didn't showing anything

Title: VS Code not Opening


问:
Does metabase.com support SQL PIVOT and UN-PIVOT?
I am trying to do PIVOT in SQL in metabase.com. Facing multiple errors which executing. Any one tried SQL PIVOT in METABASE.

If anyone faced similar issue or any solution for the same


问:
Why am I missing data when using a proxy with puppeteer?
When using a proxy for my puppeteer request to scrape a page, some data is missing such as price but the rest is there. When I remove the proxy, everything loads correctly.

const getData = async () => {
  const browser = await puppeteer.launch({
    headless: true,
    args: ["--no-sandbox", "--disable-setuid-sandbox", "--ignore-certificate-errors", "--proxy-server=myproxy"],
  });
  const page = await browser.newPage();
  await page.authenticate({ username: "username", password: "password" });
  await page.goto(url, {
    timeout: 300000,
    waitUntil: "load",
  });
  const html = await page.evaluate(() => document.body.innerHTML);

  const $ = cheerio.load(html);

  const products = [];
  $("[data-automation=product-results] > div").each((index, el) => {
    const id = product.attr("data-product-id");
    const name = product.find("[data-automation=name]").text();
    const image = product.find("[data-automation=image]").attr("src");
    const price = product.find("[data-automation=current-price]").text();

    const data = {
      id,
      name,
      image,
      price,
    };
    products.push(data);
  });
  console.log(products);
};
```

I have tried: waitUntil: 'domcontentloaded' (same results), waitUntil: 'networkidle0' and waitUntil: 'networkidle2' both times out (5 minutes).

I don't quite understand why I am able to get all the data without using a proxy and only get partial data using a proxy.

Body:
When using a proxy for my puppeteer request to scrape a page, some data is missing such as price but the rest is there. When I remove the proxy, everything loads correctly.

const getData = async () => {
  const browser = await puppeteer.launch({
    headless: true,
    args: ["--no-sandbox", "--disable-setuid-sandbox", "--ignore-certificate-errors", "--proxy-server=myproxy"],
  });
  const page = await browser.newPage();
  await page.authenticate({ username: "username", password: "password" });
  await page.goto(url, {
    timeout: 300000,
    waitUntil: "load",
  });
  const html = await page.evaluate(() => document.body.innerHTML);

  const $ = cheerio.load(html);

  const products = [];
  $("[data-automation=product-results] > div").each((index, el) => {
    const id = product.attr("data-product-id");
    const name = product.find("[data-automation=name]").text();
    const image = product.find("[data-automation=image]").attr("src");
    const price = product.find("[data-automation=current-price]").text();

    const data = {
      id,
      name,
      image,
      price,
    };
    products.push(data);
  });
  console.log(products);
};

I have tried: waitUntil: 'domcontentloaded' (same results), waitUntil: 'networkidle0' and waitUntil: 'networkidle2' both times out (5 minutes).

I don't quite understand why I am able to get all the data without using a proxy and only get partial data using a proxy.


问:
Google Chart, different color for each bar for Dynamic data
function drawMonthwiseChart(chart_data, chart_main_title)
{

```<code>var jsonData = chart_data;
var data = new google.visualization.DataTable();

data.addColumn('string', 'Month');
data.addColumn('number', 'Monthly_Opd');
//data.addColumn({ type: 'string', role: 'style' });

$.each(jsonData, function(i, jsonData){
    var Month = jsonData.Month;
    var Monthly_Opd =jsonData.Monthly_Opd;
    data.addRows([[Month, Monthly_Opd]]);
});

var options = {
    title:chart_main_title,
     //colors: colors,
    hAxis: {
        title: "Month",

    },
    vAxis: {
        title: 'Opd',
    },
    colors: ["#766499", "#0d2713", "#de8456", "#898cca", "#02a4cf",
"#d78e5d", "#87bd16", "#84b971", "#bacabe", "#766499", "#e51d85", "#287066"]

};

var chart = new google.visualization.ColumnChart(document.getElementById('chart_area'));

 chart.draw(data, google.charts.Bar.convertOptions(options));
</code>```

}

But bar color nt changed..displayed wih one same color for each bar..plase help me

Body:
function drawMonthwiseChart(chart_data, chart_main_title)
{

var jsonData = chart_data;
var data = new google.visualization.DataTable();

data.addColumn('string', 'Month');
data.addColumn('number', 'Monthly_Opd');
//data.addColumn({ type: 'string', role: 'style' });

$.each(jsonData, function(i, jsonData){
    var Month = jsonData.Month;
    var Monthly_Opd =jsonData.Monthly_Opd;
    data.addRows([[Month, Monthly_Opd]]);
});

var options = {
    title:chart_main_title,
     //colors: colors,
    hAxis: {
        title: "Month",

    },
    vAxis: {
        title: 'Opd',
    },
    colors: ["#766499", "#0d2713", "#de8456", "#898cca", "#02a4cf",
"#d78e5d", "#87bd16", "#84b971", "#bacabe", "#766499", "#e51d85", "#287066"]

};

var chart = new google.visualization.ColumnChart(document.getElementById('chart_area'));

 chart.draw(data, google.charts.Bar.convertOptions(options));

}

But bar color nt changed..displayed wih one same color for each bar..plase help me


问:
Building a custom Google SignIn button
I want o add google sign in odoo. I put the all related details and its working fine. But I want to show same button as google have the. But odoo showing simple. But I want to show multi color icon of G and after that blue background.

I go https://developers.google.com/identity/sign-in/web/build-button there and find the solution but not find how to implement that on my odoo login page.
enter image description here

Any one help me about what to do?

Title: Building a custom Google SignIn button


问:
Dynmaic X-Axis based on Selected Slicer Value in power BI
Can the X-Axis range be dynamic based on the selected week slicer?
We would like the range to automatically update to show the current week & the prior 7 weeks based on the selection

the range to automatically update to show the current week & the prior 7 weeks based on the selection


问:
what is BuildContext context parameter inside Widget buid method
Inside the widget build function, there is a parameter called CONTEXT BUILD CONTEXT. What is its importance?
Is there an example to explain its importance?</p>
```<code>import 'package:flutter/material.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override

  Widget build(BuildContext context) {    return MaterialApp(
title: 'Flutter Demo',
   theme: ThemeData(
      primarySwatch: Colors.blue,      ),      home: MyHomePage(title: 'Flutter Demo Home Page'),    );  }}
</code>```

Body:
Inside the widget build function, there is a parameter called CONTEXT BUILD CONTEXT. What is its importance?
Is there an example to explain its importance?

import 'package:flutter/material.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override

  Widget build(BuildContext context) {    return MaterialApp(
title: 'Flutter Demo',
   theme: ThemeData(
      primarySwatch: Colors.blue,      ),      home: MyHomePage(title: 'Flutter Demo Home Page'),    );  }}


问:
Is there any way to create data class instance in other data class in python?
I have some questions about using datacalss in python.

I am using data class structure to communicate json object which is created by data class and converted.

I'd like to make a indipendant log count data class for another data class and managing instant of log count at the same time.
Not only for this case, but also all of my communication protocols.

```<code>@dataclass
class Report:
    @dataclass
    class LogCount:
        critical: int = 0
        error: int = 0
        warning: int = 0
        info: int = 0
        debug: int = 0

    @dataclass
    class Store:
        @dataclass
        class Platform:
            name: str = ""
            sales: int = 0
            settlement: int = 0
            ratio: int = 0
            count: int = 0

        name: str = ""
        sales: int = 0
        settlement: int = 0
        count: int = 0
        platforms: List[Platform] = field(default_factory=list)

    log_count: LogCount = field(default_factory=LogCount)
    notice: str = ""
    stores: List[Store] = field(default_factory=list)

@staticmethod
def todict(dataclass):
    return asdict(dataclass)

@staticmethod
def tojson(dataclass):
    return json.dumps(asdict(dataclass))
</code>```

I'd like to define Log count out side of data class and create instance like this

```<code>@dataclass
class LogCount:
    critical: int = 0
    error: int = 0
    warning: int = 0
    info: int = 0
    debug: int = 0

@dataclass
class Report:
    @dataclass
    class Store:
        @dataclass
        class Platform:
            name: str = ""
            sales: int = 0
            settlement: int = 0
            ratio: int = 0
            count: int = 0

        name: str = ""
        sales: int = 0
        settlement: int = 0
        count: int = 0
        platforms: List[Platform] = field(default_factory=list)

    log_count: LogCount = field(default_factory=LogCount)
    notice: str = ""
    stores: List[Store] = field(default_factory=list)
</code>```

Can I add data class instance to another data class ?

Body:
I have some questions about using datacalss in python.

I am using data class structure to communicate json object which is created by data class and converted.

I'd like to make a indipendant log count data class for another data class and managing instant of log count at the same time.
Not only for this case, but also all of my communication protocols.

@dataclass
class Report:
    @dataclass
    class LogCount:
        critical: int = 0
        error: int = 0
        warning: int = 0
        info: int = 0
        debug: int = 0

    @dataclass
    class Store:
        @dataclass
        class Platform:
            name: str = ""
            sales: int = 0
            settlement: int = 0
            ratio: int = 0
            count: int = 0

        name: str = ""
        sales: int = 0
        settlement: int = 0
        count: int = 0
        platforms: List[Platform] = field(default_factory=list)

    log_count: LogCount = field(default_factory=LogCount)
    notice: str = ""
    stores: List[Store] = field(default_factory=list)

@staticmethod
def todict(dataclass):
    return asdict(dataclass)

@staticmethod
def tojson(dataclass):
    return json.dumps(asdict(dataclass))

I'd like to define Log count out side of data class and create instance like this

@dataclass
class LogCount:
    critical: int = 0
    error: int = 0
    warning: int = 0
    info: int = 0
    debug: int = 0

@dataclass
class Report:
    @dataclass
    class Store:
        @dataclass
        class Platform:
            name: str = ""
            sales: int = 0
            settlement: int = 0
            ratio: int = 0
            count: int = 0

        name: str = ""
        sales: int = 0
        settlement: int = 0
        count: int = 0
        platforms: List[Platform] = field(default_factory=list)

    log_count: LogCount = field(default_factory=LogCount)
    notice: str = ""
    stores: List[Store] = field(default_factory=list)

Can I add data class instance to another data class ?


问:
git lfs: upload over 8G files, it stuck at 8.1G
i build gerrit server using apache2.

i has 'git push' other lfs files successfully, now i want to upload over 8.1Gb lfs files，but it stuck at 8.1Gb, no return and no error.

android@gerrit-server:~/work/project$ git push http://username@gerrit-server:8888/vendor/qcom/boot_images HEAD:refs/heads/releases-branch**

Locking support detected on remote "http://username@gerrit-server:8888/vendor/qcom/boot_images". Consider enabling it with: $ git config lfs.http://gerrit-server:8888/vendor/qcom/boot_images.git/info/lfs.locksverify true Uploading LFS objects:  98% (9892/10045), 8.1 GB | 0 B/s

Just like that, it always stuck that


问:
select2 not loading in bootstrap5 remote modal the first time. second time works
I recently moved from bootstrap3 to bootstrap5. Select2 in modal stopped working. I know there has been known issue in this which was resolved using

```<code>$.fn.modal.Constructor.prototype.enforceFocus = function() {}
</code>```

Or using dropdownParent option for the select 2 to bind to the modal. But this didn't work for me.

So I am loading content (including modal) via ajax and populate Select2 inside it. When I click the link first time, select2 is invisible altogether. I close the modal and click the link again, it works fine the second time. I tried dame removing tabindex as well as tabindex='false'.

Clicking first time:

closed the modal and click the second time:

What am I missing here.

my Ajax code is :

HTML: Add

```<code>$(document).on('click', '.modal-remote', function (e) {
e.preventDefault();
var $modalRemote = $('#modal-remote'),
    url = $(this).attr('href');
$.ajax({
    url: url,
    beforeSend: function (data) {
        if (!$modalRemote.length) $modalRemote = $('<div class="modal fade"  id="modal-remote" aria-hidden="true"><div class="modal-dialog ' + modalClass + '"><div class="modal-content"></div></div></div>');
        $modalRemote.find('.modal-content').html('<div class="modal-header"><h5 id="remoteModalLabel">Loading...</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><div class="modal-remote-indicator"></div></div>');
        $modalRemote.modal('show');
    },
    success: function (data) {
        $.fn.modal.Constructor.prototype._enforceFocus = function() {};
        var $dom = $(document.createElement('html'));
        $dom[0].innerHTML = data;
        $dom.find('link').remove();
        $modalRemote.find('.modal-header > h5').html($dom.find('title').text());
        $modalRemote.find('.modal-body').html($dom.html());
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        $modalRemote.find('.modal-header > h5').html('Error');
        $modalRemote.find('.modal-body').html(XMLHttpRequest.responseText);
    }
});
</code>```

});

Body:
I recently moved from bootstrap3 to bootstrap5. Select2 in modal stopped working. I know there has been known issue in this which was resolved using

$.fn.modal.Constructor.prototype.enforceFocus = function() {}

Or using dropdownParent option for the select 2 to bind to the modal. But this didn't work for me.

So I am loading content (including modal) via ajax and populate Select2 inside it. When I click the link first time, select2 is invisible altogether. I close the modal and click the link again, it works fine the second time. I tried dame removing tabindex as well as tabindex='false'.

Clicking first time:

closed the modal and click the second time:

What am I missing here.

my Ajax code is :

HTML: Add

$(document).on('click', '.modal-remote', function (e) {
e.preventDefault();
var $modalRemote = $('#modal-remote'),
    url = $(this).attr('href');
$.ajax({
    url: url,
    beforeSend: function (data) {
        if (!$modalRemote.length) $modalRemote = $('

');
        $modalRemote.find('.modal-content').html('

Loading...
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>

');
        $modalRemote.modal('show');
    },
    success: function (data) {
        $.fn.modal.Constructor.prototype._enforceFocus = function() {};
        var $dom = $(document.createElement('html'));
        $dom[0].innerHTML = data;
        $dom.find('link').remove();
        $modalRemote.find('.modal-header > h5').html($dom.find('title').text());
        $modalRemote.find('.modal-body').html($dom.html());
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        $modalRemote.find('.modal-header > h5').html('Error');
        $modalRemote.find('.modal-body').html(XMLHttpRequest.responseText);
    }
});

});


问:
want to add custom layout in Tabs flutter
I am developing flutter web app and needs to add custom layout in TabView i want to achieve output like in the attached screen shot.

Here is the Image i want something like this : -

I have tried with DefaultTabController and added decoration in it but still not able to achieve same output like above can anyone have idea how to achieve this.

Thanks In Advance


问:
Compare mongodb and biqquery data
I have one requirement, I need to compare mongodb and bigquery data, basically I have 2 json objects and I need to compare them and display matched and unmatched results...I need to compare all the nested objects and arrays and return results

example data
const obj1 = {
foo: 1,
bar: 2,
h: 1
};

const obj2 = {
a:{
bar: 2,
h:1
}
};

compare(obj1,obj2) //this should return below result

matched
{
bar:2,
h:1
}

I tried comparing 2 objects but It will not check for netsted objects and does not retunr difference.

Title: Compare mongodb and biqquery data


问:
Path must include project and resource name: /.gitignore
i just use sts 4.9.0

The problem is this: whenever I do almost anything
(ex. save a file I'm working on)

I get an error:

An error has occurred. See error log for more details. Path must include project and resource name: /.gitignore

Stack Trace

```<code>java.lang.IllegalArgumentException: Path must include project and resource name: /.gitignore
    at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
    at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2128)
    at org.eclipse.core.internal.resources.Container.getFile(Container.java:196)
    at org.eclipse.egit.ui.internal.staging.StagingViewContentProvider.getFile(StagingViewContentProvider.java:139)
    at org.eclipse.egit.ui.internal.staging.StagingEntry.getFile(StagingEntry.java:213)
    at org.eclipse.egit.ui.internal.staging.StagingEntry.getProblemSeverity(StagingEntry.java:244)
    at org.eclipse.egit.ui.internal.decorators.ProblemLabelDecorator.decorateImage(ProblemLabelDecorator.java:84)
    at org.eclipse.jface.viewers.DecoratingLabelProvider.getImage(DecoratingLabelProvider.java:101)
    at org.eclipse.jface.viewers.DecoratingLabelProvider.updateLabel(DecoratingLabelProvider.java:237)
    at org.eclipse.egit.ui.internal.staging.StagingView$TreeDecoratingLabelProvider.updateLabel(StagingView.java:622)
    at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:169)
    at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:144)
    at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:959)
    at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:126)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1037)
    at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:427)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111)
    at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:853)
    at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:831)
    at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:604)
    at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:779)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalInitializeTree(AbstractTreeViewer.java:1599)
    at org.eclipse.jface.viewers.TreeViewer.internalInitializeTree(TreeViewer.java:780)
    at org.eclipse.jface.viewers.AbstractTreeViewer.lambda$1(AbstractTreeViewer.java:1584)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1400)
    at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:363)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1361)
    at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(AbstractTreeViewer.java:1578)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:282)
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1634)
    at org.eclipse.egit.ui.internal.staging.StagingView.setStagingViewerInput(StagingView.java:2353)
    at org.eclipse.egit.ui.internal.staging.StagingView.lambda$19(StagingView.java:3907)
    at org.eclipse.egit.ui.internal.staging.StagingView$56.runInUIThread(StagingView.java:4542)
    at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:95)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4001)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3629)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
</code>```

and Session Data

```<code>eclipse.buildId=4.9.0.202012132054
java.version=15.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ko_KR
Framework arguments:  -product org.springframework.boot.ide.branding.sts4
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.springframework.boot.ide.branding.sts4
</code>```

i did Maven > update Project to all my projects

but it's still the same situation

And I used it well before without this error

It happened when i formatted the computer and cloned the this repositoris again

and it already exist .gitignore file

https://i.stack.imgur.com/Mkk8d.png

i can't find out how to fix it

i hope it will fix it!

Thanks

Body:
i just use sts 4.9.0

The problem is this: whenever I do almost anything
(ex. save a file I'm working on)

I get an error:

An error has occurred. See error log for more details. Path must include project and resource name: /.gitignore

Stack Trace

java.lang.IllegalArgumentException: Path must include project and resource name: /.gitignore
    at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
    at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2128)
    at org.eclipse.core.internal.resources.Container.getFile(Container.java:196)
    at org.eclipse.egit.ui.internal.staging.StagingViewContentProvider.getFile(StagingViewContentProvider.java:139)
    at org.eclipse.egit.ui.internal.staging.StagingEntry.getFile(StagingEntry.java:213)
    at org.eclipse.egit.ui.internal.staging.StagingEntry.getProblemSeverity(StagingEntry.java:244)
    at org.eclipse.egit.ui.internal.decorators.ProblemLabelDecorator.decorateImage(ProblemLabelDecorator.java:84)
    at org.eclipse.jface.viewers.DecoratingLabelProvider.getImage(DecoratingLabelProvider.java:101)
    at org.eclipse.jface.viewers.DecoratingLabelProvider.updateLabel(DecoratingLabelProvider.java:237)
    at org.eclipse.egit.ui.internal.staging.StagingView$TreeDecoratingLabelProvider.updateLabel(StagingView.java:622)
    at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:169)
    at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:144)
    at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:959)
    at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:126)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1037)
    at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:427)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111)
    at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:853)
    at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:831)
    at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:604)
    at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:779)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalInitializeTree(AbstractTreeViewer.java:1599)
    at org.eclipse.jface.viewers.TreeViewer.internalInitializeTree(TreeViewer.java:780)
    at org.eclipse.jface.viewers.AbstractTreeViewer.lambda$1(AbstractTreeViewer.java:1584)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1400)
    at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:363)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1361)
    at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(AbstractTreeViewer.java:1578)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:282)
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1634)
    at org.eclipse.egit.ui.internal.staging.StagingView.setStagingViewerInput(StagingView.java:2353)
    at org.eclipse.egit.ui.internal.staging.StagingView.lambda$19(StagingView.java:3907)
    at org.eclipse.egit.ui.internal.staging.StagingView$56.runInUIThread(StagingView.java:4542)
    at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:95)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4001)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3629)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1461)

and Session Data

eclipse.buildId=4.9.0.202012132054
java.version=15.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ko_KR
Framework arguments:  -product org.springframework.boot.ide.branding.sts4
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.springframework.boot.ide.branding.sts4

i did Maven > update Project to all my projects

but it's still the same situation

And I used it well before without this error

It happened when i formatted the computer and cloned the this repositoris again

and it already exist .gitignore file

https://i.stack.imgur.com/Mkk8d.png

i can't find out how to fix it

i hope it will fix it!

Thanks


问:
Sticky Positioning Not Displaying whole section content
I am  using the "sticky" position property on some sections in Squarespace, but the content in these sections is cut off during the scroll. Is there a way to prevent this from happening while still using the sticky position property? I tried adding overflow: hidden; but this was unsuccessful

Would i need to change the properties for the objects within the section? Please see code snippet below:

```<code>section[data-section-id="63b6125e95b9de2f088d3517"].page-section {
  position: sticky!important;
  top: 0px;
  box-shadow: 1px 1px 5px rgba(0,0,0,0.2);
}

html {
scroll-behavior: smooth
}

</code>```

Originally, i started off with #page but pivoted to section only whilst i work through the content display issue. I switched from #page to section[.

This gave me the desired effect however i noticed the content was being cut off across multiple sections.

```<code>#page .page-section {
position: sticky!important;
top: 0px;
box-shadow: 5px 5px 15px rgba(0,0,0,0.8)!important
}
html {
scroll-behavior: smooth
}
</code>```

I decided to target the sections individually & toggled the section height within the squarespace fluid engine.

```<code>section[data-section-id="63b6125e95b9de2f088d3517"].page-section {
position: sticky!important;
top: 0px;
box-shadow: 0px 0px 0px rgba(0,0,0,0.8)!important
}
html {
scroll-behavior: smooth
}
</code>```

Body:
I am  using the "sticky" position property on some sections in Squarespace, but the content in these sections is cut off during the scroll. Is there a way to prevent this from happening while still using the sticky position property? I tried adding overflow: hidden; but this was unsuccessful

Would i need to change the properties for the objects within the section? Please see code snippet below:

section[data-section-id="63b6125e95b9de2f088d3517"].page-section {
  position: sticky!important;
  top: 0px;
  box-shadow: 1px 1px 5px rgba(0,0,0,0.2);
}

html {
scroll-behavior: smooth
}

Originally, i started off with #page but pivoted to section only whilst i work through the content display issue. I switched from #page to section[.

This gave me the desired effect however i noticed the content was being cut off across multiple sections.

#page .page-section {
position: sticky!important;
top: 0px;
box-shadow: 5px 5px 15px rgba(0,0,0,0.8)!important
}
html {
scroll-behavior: smooth
}

I decided to target the sections individually & toggled the section height within the squarespace fluid engine.

section[data-section-id="63b6125e95b9de2f088d3517"].page-section {
position: sticky!important;
top: 0px;
box-shadow: 0px 0px 0px rgba(0,0,0,0.8)!important
}
html {
scroll-behavior: smooth
}


问:
Animate a view based on multiple x,y co-ordinates in Android [pls refer description]
I'm trying to implement a snakes and ladders game where the image view has to moved on a given line.

7-8-9

6-5-4

1-2-3

lets say I have to move from pos 2 to pos 6, what would be the right approach ?
I tried translation animation, by giving x,y values one by one, but in vain. The view that I'm trying to animate is not updating its position after the animation is ended. Below is the code I used to achieve animation. Moving by one position is easy but I have to move with above pattern only.

val moveX = ObjectAnimator.ofFloat(starView, View.TRANSLATION_X,sourceX, targetX)


问:
Key code printed on onPreviewKeyEvent callback
I'm so confused when in add onPreviewKeyEvent in my OutlinedTextField.

I am add desired key like it. isAltPressed && it.key == Key.K so K appended in outlinedTextField value.

```<code>OutlinedTextField(
value = x.value,
onValueChange = {x.value = it},
modifier = Modifier.onPreviewKeyEvent {
if (it.isAltPressed && it.key == Key.K) {
  println("key is pressed")
  true
} else {
  false
  }
 }
)
</code>```

Body:
I'm so confused when in add onPreviewKeyEvent in my OutlinedTextField.

I am add desired key like it. isAltPressed && it.key == Key.K so K appended in outlinedTextField value.

OutlinedTextField(
value = x.value,
onValueChange = {x.value = it},
modifier = Modifier.onPreviewKeyEvent {
if (it.isAltPressed && it.key == Key.K) {
  println("key is pressed")
  true
} else {
  false
  }
 }
)


问:
nginx load balancing configuration for web sockets
I am configuring Nginx to redirect incoming web socket requests to two different servers, but every time I get 404.

My Nginx configuration in loadbalancer.conf file in /etc/nginx/conf.d/ folder look like this:

```<code>upstream websocket {
    server localhost:5050; //web socket server1 running here
    server localhost:8080; //web socket server2 running here
}
server {
    listen      4141;
    server_name localhost:4141;

    location / {
        proxy_pass http://websocket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header Connection "upgrade";
    }
}
</code>```

When I am hitting web socket servers directly (URL: ws://localhost:8080/app/socket/user1) then the request are working fine but when I am going through Nginx (URL: ws://localhost:4141/app/socket/user1) then the requests are not delivering to any of the web socket servers.

Update:

I have tried to change the proxy_pass setting to directly the server1 (localhost:5050) then also the request is not going through.

Nginx access log says the following error:

::1 - - [09/Jan/2023:10:57:07 +0530] "GET /app/socket/user1 HTTP/1.1" 404 197 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"

Can someone please answer

What is wrong with the configuration?

Does Nginx provide more detailed logs, where can I check them?

Body:
I am configuring Nginx to redirect incoming web socket requests to two different servers, but every time I get 404.

My Nginx configuration in loadbalancer.conf file in /etc/nginx/conf.d/ folder look like this:

upstream websocket {
    server localhost:5050; //web socket server1 running here
    server localhost:8080; //web socket server2 running here
}
server {
    listen      4141;
    server_name localhost:4141;

    location / {
        proxy_pass http://websocket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header Connection "upgrade";
    }
}

When I am hitting web socket servers directly (URL: ws://localhost:8080/app/socket/user1) then the request are working fine but when I am going through Nginx (URL: ws://localhost:4141/app/socket/user1) then the requests are not delivering to any of the web socket servers.

Update:

I have tried to change the proxy_pass setting to directly the server1 (localhost:5050) then also the request is not going through.

Nginx access log says the following error:

::1 - - [09/Jan/2023:10:57:07 +0530] "GET /app/socket/user1 HTTP/1.1" 404 197 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"

Can someone please answer

What is wrong with the configuration?

Does Nginx provide more detailed logs, where can I check them?


问:
Window Service Running in Docker container not processing NServiceBus messages
I am running a windows docker container which is running ASP.Net window service based on framework 4.7.2. It is running successfully and supposed to pick NServiceBus messages but it is not picking NServiceBus messages to process. NServiceBus is using SQL Transport in my case. Docker container is able to ping database as well.
Can anyone help me to fix this?</p>


问:
Form1.vb design form is blank after VB.NET crash
My VB.NET crash because of "system out of memory" and I restart my desktop, but when I open my VB.NET, the Home Page.Designer was now blank (white blank). No textbox, comboboxes, datagrids...everything I created is now gone. However all the Home Page.vb code I wrote is still there. If I run the compiler or start debugging there's no error, my program executes just fine, but only blank white space.
Home Page Design
Home Page Code

Anyone know of a way I can fix the form design view without redrawing
the form?
my project are all fine like form2, form 3 are okay, only the form 1 is the problem. I tried to insert textbox and button on Home Page but when I start debugging, it won't show


问:
" Runtime.ImportModuleError " in AWS cloudWatch Node.js
Someone please help me...I got a error like this in AWS Lambda. Not only the crypto-js

ERROR  Uncaught Exception  { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'crypto-js'\nRequire stack:\n- /var/task/api/actions/common.js\n- /var/task/api/actions/index.js\n- /var/task/index.js\n- /var/runtime/index.mjs", "stack": [ "Runtime.ImportModuleError: Error: Cannot find module 'crypto-js'", "Require stack:", "- /var/task/api/actions/common.js", "- /var/task/api/actions/index.js", "- /var/task/index.js", "- /var/runtime/index.mjs", "    at _loadUserApp (file:///var/runtime/index.mjs:1000:17)", "    at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:21)", "    at async start (file:///var/runtime/index.mjs:1200:23)", "    at async file:///var/runtime/index.mjs:1206:1" ] }

Whenever I deploy my code with NPM packages it shows error like this....! If anyone know the solution please help me
Node version : 16


问:
FIR low-pass filter is designed with Kaiser window, but the frequency response results all NaN
A problem, using Kaiser window to design FIR low-pass filter in Matlab without using filterDesigner.The requirements for boundary frequency, stopband starting frequency, passband tolerance and maximum stopband gain are as follows: ωp =0.4 π, ws=0.6 π, δ1= 0.01 and δ2= 0.001.The problem is the result vectors of the frequency response Hare all NaN.
I have checked the formula it seems ok.Most likely freqz but i don't know what went wrong.

```<code>% calculate N
delta1 = 0.01;
delta2 = 0.001;
A = -20 * log10(delta1);
delta_w = 0.2;
N = (A - 8) / (2.285 * delta_w);
N=floor(N);
% calculate beta
beta = 0.1102 * (A - 8.7);

% window
w = zeros(1, N);
for n = 1:N
    w(n) = besseli(0, beta * sqrt(1 - (2 * n / N - 1)^2)) / besseli(0, beta);
end

% calculate h(n)
h = zeros(1, N);
omega_p = 0.4;
for n = 1:N
    h(n) = (sin(omega_p * (n - N / 2)) / (pi * (n - N / 2))) * w(n);
end

% frequency response
[H, w] = freqz(h, 1, 512);

%  draw amplitude response
figure;
plot(w / pi, 20 * log10(abs(H)));
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Magnitude (dB)');

% draw phase response
figure;
plot(w / pi, angle(H));
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Phase (rad)');

% display N
disp(['Filter order: ' num2str(N)]);
</code>```

Any suggestion would be helpful

Body:
A problem, using Kaiser window to design FIR low-pass filter in Matlab without using filterDesigner.The requirements for boundary frequency, stopband starting frequency, passband tolerance and maximum stopband gain are as follows: ωp =0.4 π, ws=0.6 π, δ1= 0.01 and δ2= 0.001.The problem is the result vectors of the frequency response Hare all NaN.
I have checked the formula it seems ok.Most likely freqz but i don't know what went wrong.

% calculate N
delta1 = 0.01;
delta2 = 0.001;
A = -20 * log10(delta1);
delta_w = 0.2;
N = (A - 8) / (2.285 * delta_w);
N=floor(N);
% calculate beta
beta = 0.1102 * (A - 8.7);

% window
w = zeros(1, N);
for n = 1:N
    w(n) = besseli(0, beta * sqrt(1 - (2 * n / N - 1)^2)) / besseli(0, beta);
end

% calculate h(n)
h = zeros(1, N);
omega_p = 0.4;
for n = 1:N
    h(n) = (sin(omega_p * (n - N / 2)) / (pi * (n - N / 2))) * w(n);
end

% frequency response
[H, w] = freqz(h, 1, 512);

%  draw amplitude response
figure;
plot(w / pi, 20 * log10(abs(H)));
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Magnitude (dB)');

% draw phase response
figure;
plot(w / pi, angle(H));
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Phase (rad)');

% display N
disp(['Filter order: ' num2str(N)]);

Any suggestion would be helpful