问:
UnitTest run one test but insert two record
I make a very simple test, and right the method to click run test, but I have no idea why the table will insert two record

```<code>public class BookDbContext : DbContext
{
    public BookDbContext(DbContextOptions<BookDbContext> options)
     : base(options)
    { }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Books>().HasKey(x => x.ID)
            .HasName("PK_Books");
        modelBuilder.Entity<Books>().Property(x => x.ID)
           .ValueGeneratedOnAdd();
        base.OnModelCreating(modelBuilder);
    }
}
</code>```

Unit Test method :

```<code>[Fact]
    public void SimpleTest()
    {
        var contextOptions = new DbContextOptionsBuilder<BookDbContext>()
             .UseSqlServer("server=192.168.0.100;database=BookDB;User Id=sa;Password=password;Connection Timeout=120;TrustServerCertificate=True")
             .Options;
        BookDbContext db = new(contextOptions);
        var book = new Books()
        {
            BookName = "My Book"
        };
        db.Add(book);
        db.SaveChanges();
    }
</code>```

Table structure:

```<code> CREATE TABLE [dbo].[Books](
     [Id] [int] IDENTITY(1,1) NOT NULL,
    [BookName] [nvarchar](100) NULL,
    CONSTRAINT [PK_Books] PRIMARY KEY CLUSTERED  (  [Id] ASC )WITH (PAD_INDEX = OFF,
   STATISTICS_NORECOMPUTE  = OFF,
   IGNORE_DUP_KEY = OFF,
   ALLOW_ROW_LOCKS = ON,
   ALLOW_PAGE_LOCKS = ON,
   OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO
</code>```

I have make a breakpoint, it just just run one time, but after check with table, it appear as two record
can I know reason?

Body:
I make a very simple test, and right the method to click run test, but I have no idea why the table will insert two record

public class BookDbContext : DbContext
{
    public BookDbContext(DbContextOptions<BookDbContext> options)
     : base(options)
    { }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Books>().HasKey(x => x.ID)
            .HasName("PK_Books");
        modelBuilder.Entity<Books>().Property(x => x.ID)
           .ValueGeneratedOnAdd();
        base.OnModelCreating(modelBuilder);
    }
}

Unit Test method :

[Fact]
    public void SimpleTest()
    {
        var contextOptions = new DbContextOptionsBuilder<BookDbContext>()
             .UseSqlServer("server=192.168.0.100;database=BookDB;User Id=sa;Password=password;Connection Timeout=120;TrustServerCertificate=True")
             .Options;
        BookDbContext db = new(contextOptions);
        var book = new Books()
        {
            BookName = "My Book"
        };
        db.Add(book);
        db.SaveChanges();
    }

Table structure:

 CREATE TABLE [dbo].[Books](
     [Id] [int] IDENTITY(1,1) NOT NULL,
    [BookName] [nvarchar](100) NULL,
    CONSTRAINT [PK_Books] PRIMARY KEY CLUSTERED  (  [Id] ASC )WITH (PAD_INDEX = OFF,
   STATISTICS_NORECOMPUTE  = OFF,
   IGNORE_DUP_KEY = OFF,
   ALLOW_ROW_LOCKS = ON,
   ALLOW_PAGE_LOCKS = ON,
   OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO

I have make a breakpoint, it just just run one time, but after check with table, it appear as two record
can I know reason?


来源: stackexchange

问:
Bootstrap-select not working with HTMX partials
I am trying to use Bootstrap-select with HTMX partials in Django. When a specific element is changed, htmx will return a partial html containing only the dropdown, such as:

```<code><select id="myDropdown" class="selectpicker">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Barbecue</option>
</select>
</code>```

When loading the main page initially which contains the CDNs alongside myDropdown, selectpicker works fine. However, later when myDropdown gets returned by HTMX, selectpicker doesn't work, getting a display: None !important. This behaviour is exactly as if when rendering the partial html, the CDNs are not available for usage.

If instead of using class="selectpicker I use $(function(){ $('#myDropdown').selectpicker();}); it does work. The problem now is that there is a second where myDropdown isn't styled at all, before the JS function kicks in.

Does anyone know how to fix this problem or bypass it in a clever way?

ContentLicense: CC BY-SA 4.0

Body:
I am trying to use Bootstrap-select with HTMX partials in Django. When a specific element is changed, htmx will return a partial html containing only the dropdown, such as:

<select id="myDropdown" class="selectpicker">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Barbecue</option>
</select>

When loading the main page initially which contains the CDNs alongside myDropdown, selectpicker works fine. However, later when myDropdown gets returned by HTMX, selectpicker doesn't work, getting a display: None !important. This behaviour is exactly as if when rendering the partial html, the CDNs are not available for usage.

If instead of using class="selectpicker I use $(function(){ $('#myDropdown').selectpicker();}); it does work. The problem now is that there is a second where myDropdown isn't styled at all, before the JS function kicks in.

Does anyone know how to fix this problem or bypass it in a clever way?


问:
Trying to call recursive method with parameters, but parameters not holding
I am trying to create a Mondrian Generator in which a rectangle is recursively subdivided until its size meets a certain threshold. Within this program, I am trying to call a recursive method with defined values

```<code>public class Mondrian extends JPanel {
    private static final int CUTOFF = 40;
    private Random rng = new Random();
    static private Image mondrian;

    public Mondrian(int w, int h) {
        mondrian = new BufferedImage(w, h, TYPE_INT_RGB);
        Graphics2D g2 = (Graphics2D) mondrian.getGraphics();
        subdivide(0, 0, 800, 1000, g2);
    }
</code>```

which is subsequently calling on this method

```<code>private void subdivide(int tx, int ty, int w, int h, Graphics2D g2) {
    g2.setColor(Color.white);
    g2.fillRect(0,0, mondrian.getHeight(null), mondrian.getWidth(null));
    while (w > CUTOFF || h > CUTOFF) {
        System.out.println(w);
        Random randomSize = new Random();
        double size = randomSize.nextDouble();
        if (size < 0.6){
                int rndColour = rng.nextInt(COLORS.length);
                Color colour = COLORS[rndColour];
                g2.setColor(colour);
                subdivide(tx, ty, (w * (int) size), (h * (int) size), g2);
                g2.fillRect(tx, ty, tx-w, ty-h);
                g2.setColor(colour);
                subdivide(tx, ty, (w * (int) (1 - size)), (h * (int) (1 - size)), g2);
                g2.fillRect(tx, ty, tx-w, ty-h);
            g2.drawLine((w * (int) size), (h * (int) size), (w * (int) (1 - size)), (h * (int) (1 - size)));
        }
    }
}
</code>```

However, this function runs forever, as even though the values of w and h are set in the original method call, they are set to zero for some reason.

This is the main method, however I don't think there is anything wrong with it, I think its mostly to do with the class

```<code>public static void main(String[] args){
    JFrame frame = new JFrame();
    Mondrian mondrian = new Mondrian(800, 1000);
    frame.add(mondrian);
    frame.setSize(800, 1000);
    frame.setVisible(true);
}
</code>```

For what I have tried, I have tried to set the values of w and h within the recursive function itself, but it never shrinks. I have also tried setting explicit vlaues of w and h within the initial call, but the values are still set to 0. I don't know where else to go with this as something has to fundamentally be wrong with my code.

Body:
I am trying to create a Mondrian Generator in which a rectangle is recursively subdivided until its size meets a certain threshold. Within this program, I am trying to call a recursive method with defined values

public class Mondrian extends JPanel {
    private static final int CUTOFF = 40;
    private Random rng = new Random();
    static private Image mondrian;

    public Mondrian(int w, int h) {
        mondrian = new BufferedImage(w, h, TYPE_INT_RGB);
        Graphics2D g2 = (Graphics2D) mondrian.getGraphics();
        subdivide(0, 0, 800, 1000, g2);
    }

which is subsequently calling on this method

private void subdivide(int tx, int ty, int w, int h, Graphics2D g2) {
    g2.setColor(Color.white);
    g2.fillRect(0,0, mondrian.getHeight(null), mondrian.getWidth(null));
    while (w > CUTOFF || h > CUTOFF) {
        System.out.println(w);
        Random randomSize = new Random();
        double size = randomSize.nextDouble();
        if (size < 0.6){
                int rndColour = rng.nextInt(COLORS.length);
                Color colour = COLORS[rndColour];
                g2.setColor(colour);
                subdivide(tx, ty, (w * (int) size), (h * (int) size), g2);
                g2.fillRect(tx, ty, tx-w, ty-h);
                g2.setColor(colour);
                subdivide(tx, ty, (w * (int) (1 - size)), (h * (int) (1 - size)), g2);
                g2.fillRect(tx, ty, tx-w, ty-h);
            g2.drawLine((w * (int) size), (h * (int) size), (w * (int) (1 - size)), (h * (int) (1 - size)));
        }
    }
}

However, this function runs forever, as even though the values of w and h are set in the original method call, they are set to zero for some reason.

This is the main method, however I don't think there is anything wrong with it, I think its mostly to do with the class

public static void main(String[] args){
    JFrame frame = new JFrame();
    Mondrian mondrian = new Mondrian(800, 1000);
    frame.add(mondrian);
    frame.setSize(800, 1000);
    frame.setVisible(true);
}

For what I have tried, I have tried to set the values of w and h within the recursive function itself, but it never shrinks. I have also tried setting explicit vlaues of w and h within the initial call, but the values are still set to 0. I don't know where else to go with this as something has to fundamentally be wrong with my code.


问:
Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive
While Trying to install LWC local Server , getting this error then using this command
sfdx plugins:install @salesforce/lwc-dev-server

Tried applying all available community help but issue is still the same , tried restalling everything but no fix , please if someone can help then please help

This is the error Output :

Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@18.12.1 | win32 | x64
gyp info find Python using Python version 3.11.0 found at "C:\Users\nadee\AppData\Local\Programs\Python\Python311\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:420:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\Users\nadee\AppData\Local\sfdx\client\7.180.0-d902059\bin\node.exe" "C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\nadee\AppData\Local\sfdx\node_modules\fibers
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.3.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
RHEL users please run: yum install gcc-c++ and yum groupinstall 'Development Tools'
Alpine users please run: sudo apk add python make g++
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
Installing plugin @salesforce/lwc-dev-server... failed
Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive
--mutex=file:C:\Users\nadee\AppData\Local\sfdx\yarn.lock
--preferred-cache-folder=C:\Users\nadee\AppData\Local\sfdx\yarn --check-files exited with code 1

```<code>

LWC local server installation
</code>```

Body:
While Trying to install LWC local Server , getting this error then using this command
sfdx plugins:install @salesforce/lwc-dev-server

Tried applying all available community help but issue is still the same , tried restalling everything but no fix , please if someone can help then please help

This is the error Output :

Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@18.12.1 | win32 | x64
gyp info find Python using Python version 3.11.0 found at "C:\Users\nadee\AppData\Local\Programs\Python\Python311\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:420:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\Users\nadee\AppData\Local\sfdx\client\7.180.0-d902059\bin\node.exe" "C:\Users\nadee\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\nadee\AppData\Local\sfdx\node_modules\fibers
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.3.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
RHEL users please run: yum install gcc-c++ and yum groupinstall 'Development Tools'
Alpine users please run: sudo apk add python make g++
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
Installing plugin @salesforce/lwc-dev-server... failed
Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive
--mutex=file:C:\Users\nadee\AppData\Local\sfdx\yarn.lock
--preferred-cache-folder=C:\Users\nadee\AppData\Local\sfdx\yarn --check-files exited with code 1

LWC local server installation


问:
How to only pip install the latest tagged version when using setuptools_scm
I'm using setuptools_scm for version control for a python project.
I'm also using Python 3.10 and am on Windows 10.

My 2nd to last commit is tagged with "v0.1"
At this stage, I installed my package using the line below and got version 0.1 automatically installed:

python -m pip install git+url

My last commit was pushed after I installed my package, but I did not tag it.
However, when I tried to install my package in a different venv, version 0.2.dev1+[key] of my package got installed.

I'm aware that this versioning is the intended behavior of setuptools_scm, but I specifically want only the latest tagged version of my package to be installed when I run

python -m pip install git+url

In this case, I want v0.1 to be automatically installed, not version 0.2.dev1+[key], when installing it for the first time.

I would also like for my package to only be given the outdated status if a new tag is created and not when any commit is pushed. This would be applicable for

python -m pip list --outdated

python -m pip install --update

One obvious work around is

python -m pip install git+url@v0.1

However, this requires knowing what the latest tagged version is.

My question is this:
Is there a way to only be able to install tagged commits of my package instead of also the automatically generated ones from scm?


问:
MITMProxy and Charles Proxy not capturing Owlet camera livestream activity from iOS Owlet app
I am trying to reverse engineer the network API's for my baby monitor's app (Owlet) on my iPhone so I can access the live video stream from the Owlet cam.

My end goal is to create a plugin for Google Home and view the video stream there rather than having to use the Owlet app.

In order to isolate the network API's, I have used MITMPROXY and Charles Proxy to analyze the HTTP/S activity of my iPhone while using the app.

I downloaded the profiles from both proxies on my phone and trusted them (not simultaneously). I can use the Owlet app and view the cam livestream within the app while using the proxies, so in theory the proxies should be recording the activity.

The problem I am having is this: I cannot find the HTTP request for the video stream. All of the HTTP/S responses are "Content-Type: application/JSON". No chunked, no mpeg, or any other media file types or clues to indicate a request/response is a streamed video. I can see all of the authorization requests/responses and I can see metadata updates about the status of the Owlet hardware sensors, but nothing for the actual video stream.

I am able to replicate the authorization requests within the network. I can access metadata about the user account and the camera. But I cannot find out how to access the video stream from the camera.

Can HTTP/S proxies such as MITMPROXY and Charles essentially skip some network activity coming from the targeted device? Is it possible that the request for the stream URL is some other protocol besides HTTP/S that the proxies just ignore?

I am a novice regarding networking; please forgive any poorly phrased/understood concepts.


问:
ORA-12541: TNS: no listener
I have a VM in Oracle VM Virtual Box running Windows XP. In this VM, I have install Visual Studio .net 2003 with nhibertante ORM to connect to BBDD Oracle 12.2.

Oracle database is hosts in my physical machine with Windows 11 SO. The network configuration between VM and host that ok, or I suppose it, because the ping network servicio work ok.

In my VM I run a SQL*Plus command interface and I try to connect to Oracle database in the host machine.

I use the follow command: sqlplus user/pass@service
Well, the error I receive is:

```<code>ORA-12541: TNS: no listener
</code>```

Maybe some configuration in listener.ora or tnsname.ora not be ok, but I tried modify several parameter but it didn't work.

My tnsname.ora in VM is:

```<code>`LISTENER =
 (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 192.168.56.7)
    (PORT = 1521)
  )

orcl =
(DESCRIPTION =
    ADDRESS =
      our text`(PROTOCOL = TCP)
      (HOST = 192.168.56.7)
      (PORT = 1521)
    )
    (CONNECT_DATA =
      (SERVER = dedicated)
      (SERVICE_NAME = orcl)
    )
  )
`
</code>```

My listener.ora in my host machine is:

```<code>`SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = C:\app\orclDiego\product\12.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\orclDiego\product\12.2.0\dbhome_1\bin\oraclr12.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.7)(PORT = 1521))
    )
  )
`
</code>```

Title: ORA-12541: TNS: no listener

Body:
I have a VM in Oracle VM Virtual Box running Windows XP. In this VM, I have install Visual Studio .net 2003 with nhibertante ORM to connect to BBDD Oracle 12.2.

Oracle database is hosts in my physical machine with Windows 11 SO. The network configuration between VM and host that ok, or I suppose it, because the ping network servicio work ok.

In my VM I run a SQL*Plus command interface and I try to connect to Oracle database in the host machine.

I use the follow command: sqlplus user/pass@service
Well, the error I receive is:

ORA-12541: TNS: no listener

Maybe some configuration in listener.ora or tnsname.ora not be ok, but I tried modify several parameter but it didn't work.

My tnsname.ora in VM is:

`LISTENER =
 (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 192.168.56.7)
    (PORT = 1521)
  )

orcl =
(DESCRIPTION =
    ADDRESS =
      our text`(PROTOCOL = TCP)
      (HOST = 192.168.56.7)
      (PORT = 1521)
    )
    (CONNECT_DATA =
      (SERVER = dedicated)
      (SERVICE_NAME = orcl)
    )
  )
`

My listener.ora in my host machine is:

`SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = C:\app\orclDiego\product\12.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\orclDiego\product\12.2.0\dbhome_1\bin\oraclr12.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.7)(PORT = 1521))
    )
  )
`


问:
@react-three/fiber not rendering when using react-locomotive-scroll
Im using @react-three/fiber component and am having a issue where it does not show when I use react-locomotive-scroll.

If I remove locomotive-scroll from _app.tsx @react-three/fiber renders.

Also a side-issue of scroll-bar being duplicated when using fiber and locomotive-scroll.

```<code>import { useRouter } from 'next/router';
import type { AppProps } from 'next/app';
import { useRef } from 'react';
import { LocomotiveScrollProvider as RLSProvider } from 'react-locomotive-scroll';

import 'locomotive-scroll/dist/locomotive-scroll.css';
import '@styles/globals.scss';

function MyApp({ Component, pageProps }: AppProps) {
  const { asPath } = useRouter();
  const containerRef = useRef(null);
  return (
    <RLSProvider
      options={{
        smooth: true,
        // ... all available Locomotive Scroll instance options
      }}
      watch={
        [
          //..all the dependencies you want to watch to update the scroll.
          //  Basicaly, you would want to watch page/location changes
          //  For exemple, on Next.js you would want to watch properties like `router.asPath` (you may want to add more criterias if the instance should be update on locations with query parameters)
        ]
      }
      location={asPath}
      onLocationChange={(scroll: any) => scroll.scrollTo(0, { duration: 0, disableLerp: true })}
      containerRef={containerRef}
    >
      <div data-scroll-container ref={containerRef}>
        <Component {...pageProps} />
      </div>
    </RLSProvider>
  );
}

export default MyApp;
</code>```

and the @react-three/fiber component that I am rendering that works without @react-three/fiber
this seems to be an issue with different @react-three/fiber examples too.

```<code>import * as THREE from "three"
import { useRef, useState} from "react"
import { Canvas, extend, useFrame } from "@react-three/fiber"
import { useTexture, shaderMaterial } from "@react-three/drei"

interface ImageProps {
  scaleY: number;
  scaleX: number;

  cssY?: number | string;
  cssX?: number | string;

  image1: string;
  image2: string;

  right?: number | string;
  left?:  number | string;

}

export const ImageFadeMaterial = shaderMaterial(
  {
    effectFactor: 1.2,
    dispFactor: 0,
    tex: undefined,
    tex2: undefined,
    disp: undefined
  },
  ` varying vec2 vUv;
    void main() {
      vUv = uv;
      gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
    }`,
  ` varying vec2 vUv;
    uniform sampler2D tex;
    uniform sampler2D tex2;
    uniform sampler2D disp;
    uniform float _rot;
    uniform float dispFactor;
    uniform float effectFactor;
    void main() {
      vec2 uv = vUv;
      vec4 disp = texture2D(disp, uv);
      vec2 distortedPosition = vec2(uv.x + dispFactor * (disp.r*effectFactor), uv.y);
      vec2 distortedPosition2 = vec2(uv.x - (1.0 - dispFactor) * (disp.r*effectFactor), uv.y);
      vec4 _texture = texture2D(tex, distortedPosition);
      vec4 _texture2 = texture2D(tex2, distortedPosition2);
      vec4 finalTexture = mix(_texture, _texture2, dispFactor);
      gl_FragColor = finalTexture;
      #include <tonemapping_fragment>
      #include <encodings_fragment>
    }`
)

extend({ ImageFadeMaterial })

function FadingImage({ scaleY, scaleX, image1, image2 } : ImageProps) {
  const ref = useRef(null)
  const [texture1, texture2, dispTexture] = useTexture([image1, image2, "/displacement.jpg"])
  const [hovered, setHover] = useState(false)
  useFrame(() => {
    ref.current.dispFactor = THREE.MathUtils.lerp(ref.current.dispFactor, hovered ? 1 : 0, 0.075)
  })
  return (
    <mesh onPointerOver={() => setHover(true)} onPointerOut={() => setHover(false)} scale={[scaleX, scaleY, 1]}>
      <planeGeometry />
      <imageFadeMaterial ref={ref} tex={texture1} tex2={texture2} disp={dispTexture} toneMapped={false} />
    </mesh>
  )
}

const ImageShader = ({ scaleY, scaleX, cssY, cssX, image1, image2, right, left } : ImageProps) => {
  return (
    <div style={{
      height: cssY,
      width: cssX,

      marginRight: right,
      marginLeft: left,
    }}>
      <Canvas camera={{ position: [0, 0, 2], fov: 50 }}>
        <FadingImage scaleX={scaleX} scaleY={scaleY} image1={image1} image2={image2}/>
      </Canvas>
    </div>
  )
}

export default ImageShader

</code>```

Body:
Im using @react-three/fiber component and am having a issue where it does not show when I use react-locomotive-scroll.

If I remove locomotive-scroll from _app.tsx @react-three/fiber renders.

Also a side-issue of scroll-bar being duplicated when using fiber and locomotive-scroll.

import { useRouter } from 'next/router';
import type { AppProps } from 'next/app';
import { useRef } from 'react';
import { LocomotiveScrollProvider as RLSProvider } from 'react-locomotive-scroll';

import 'locomotive-scroll/dist/locomotive-scroll.css';
import '@styles/globals.scss';

function MyApp({ Component, pageProps }: AppProps) {
  const { asPath } = useRouter();
  const containerRef = useRef(null);
  return (
    <RLSProvider
      options={{
        smooth: true,
        // ... all available Locomotive Scroll instance options
      }}
      watch={
        [
          //..all the dependencies you want to watch to update the scroll.
          //  Basicaly, you would want to watch page/location changes
          //  For exemple, on Next.js you would want to watch properties like `router.asPath` (you may want to add more criterias if the instance should be update on locations with query parameters)
        ]
      }
      location={asPath}
      onLocationChange={(scroll: any) => scroll.scrollTo(0, { duration: 0, disableLerp: true })}
      containerRef={containerRef}
    >

        <Component {...pageProps} />

    </RLSProvider>
  );
}

export default MyApp;

and the @react-three/fiber component that I am rendering that works without @react-three/fiber
this seems to be an issue with different @react-three/fiber examples too.

import * as THREE from "three"
import { useRef, useState} from "react"
import { Canvas, extend, useFrame } from "@react-three/fiber"
import { useTexture, shaderMaterial } from "@react-three/drei"

interface ImageProps {
  scaleY: number;
  scaleX: number;

  cssY?: number | string;
  cssX?: number | string;

  image1: string;
  image2: string;

  right?: number | string;
  left?:  number | string;

}

export const ImageFadeMaterial = shaderMaterial(
  {
    effectFactor: 1.2,
    dispFactor: 0,
    tex: undefined,
    tex2: undefined,
    disp: undefined
  },
  ` varying vec2 vUv;
    void main() {
      vUv = uv;
      gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
    }`,
  ` varying vec2 vUv;
    uniform sampler2D tex;
    uniform sampler2D tex2;
    uniform sampler2D disp;
    uniform float _rot;
    uniform float dispFactor;
    uniform float effectFactor;
    void main() {
      vec2 uv = vUv;
      vec4 disp = texture2D(disp, uv);
      vec2 distortedPosition = vec2(uv.x + dispFactor * (disp.r*effectFactor), uv.y);
      vec2 distortedPosition2 = vec2(uv.x - (1.0 - dispFactor) * (disp.r*effectFactor), uv.y);
      vec4 _texture = texture2D(tex, distortedPosition);
      vec4 _texture2 = texture2D(tex2, distortedPosition2);
      vec4 finalTexture = mix(_texture, _texture2, dispFactor);
      gl_FragColor = finalTexture;
      #include <tonemapping_fragment>
      #include <encodings_fragment>
    }`
)

extend({ ImageFadeMaterial })

function FadingImage({ scaleY, scaleX, image1, image2 } : ImageProps) {
  const ref = useRef(null)
  const [texture1, texture2, dispTexture] = useTexture([image1, image2, "/displacement.jpg"])
  const [hovered, setHover] = useState(false)
  useFrame(() => {
    ref.current.dispFactor = THREE.MathUtils.lerp(ref.current.dispFactor, hovered ? 1 : 0, 0.075)
  })
  return (
    <mesh onPointerOver={() => setHover(true)} onPointerOut={() => setHover(false)} scale={[scaleX, scaleY, 1]}>
      <planeGeometry />
      <imageFadeMaterial ref={ref} tex={texture1} tex2={texture2} disp={dispTexture} toneMapped={false} />
    </mesh>
  )
}

const ImageShader = ({ scaleY, scaleX, cssY, cssX, image1, image2, right, left } : ImageProps) => {
  return (

      <Canvas camera={{ position: [0, 0, 2], fov: 50 }}>
        <FadingImage scaleX={scaleX} scaleY={scaleY} image1={image1} image2={image2}/>
      </Canvas>

  )
}

export default ImageShader


问:
SQLAlchemy and foreign keys doesn't work when deleting rows
I have API - python script (using Flask and SQLite) which works with database with 3 tables.

Table Comany has relationship 1:N with table User. And table Company has relationshipt 1:N with table Keyword.

Now, if I will delete some company, I expect it will also delete all users who belong to company, as well as all keywords.

I have found, I have to turn on FOREIGN Keys, using these lines

```<code>@event.listens_for(Engine, "connect")
def set_sqlite_pragma(dbapi_connection, connection_record):
    if type(dbapi_connection) is sqlite3.Connection:  # play well with other DB backends
       cursor = dbapi_connection.cursor()
       cursor.execute("PRAGMA foreign_keys=ON")
       cursor.close()
</code>```

However it will still only delete company, and foregin keys in rows of users as well as keywords of this company stay NULL.

E.g. Table User
ID, Name, Pass, FK_company_name

These are lines how I am deleting company

```<code>...
company_id = request.args.get('company_id')
company = Company.query.get(company_id)
db.session.delete(company)
db.session.commit()
...
</code>```

Do I have to set something else?

Body:
I have API - python script (using Flask and SQLite) which works with database with 3 tables.

Table Comany has relationship 1:N with table User. And table Company has relationshipt 1:N with table Keyword.

Now, if I will delete some company, I expect it will also delete all users who belong to company, as well as all keywords.

I have found, I have to turn on FOREIGN Keys, using these lines

@event.listens_for(Engine, "connect")
def set_sqlite_pragma(dbapi_connection, connection_record):
    if type(dbapi_connection) is sqlite3.Connection:  # play well with other DB backends
       cursor = dbapi_connection.cursor()
       cursor.execute("PRAGMA foreign_keys=ON")
       cursor.close()

However it will still only delete company, and foregin keys in rows of users as well as keywords of this company stay NULL.

E.g. Table User
ID, Name, Pass, FK_company_name

These are lines how I am deleting company

...
company_id = request.args.get('company_id')
company = Company.query.get(company_id)
db.session.delete(company)
db.session.commit()
...

Do I have to set something else?


问:
Access the action distribution network in Ray's RLlib library
I would like to train a Proximal Policy Optimization (PPO) type model using RLlib and then serve the action distribution model using Tensorflow Lite or the equivalent PyTorch technology.  I am interested in determining the ranking of actions and not just the policy.

Is there a way to extract this network from the trained policy? This tutorial shows how to train a PPO algorithm.  Is there a simple mechanism to extract the desired neural network from the algo object so that I can convert it to a form for efficient serving in an AWS lambda?


问:
How many dimens files are needed to support all the devices according to the screen width?
To answer this question I have tried to see all the possible dp values of all the different android devices widths, but I have seen that there are a huge amount of different dp values as there is a huge amount of different screen sizes with different screen densities.

I have seen that the typical dp values are the following: 320dp, 480dp, 600dp, 720dp

I have created a different dimens.xml for the above different dp values:

dimens.xml (w320dp) (will manage 320 to 479 dp)

dimens.xml (w480dp) (will manage 480 to 599 dp)

dimens.xml (w600dp) (will manage 600 to 699 dp)

dimens.xml (w700dp) (will manage up or equal to 700 dp)

Now my question is, how many more dimens files are needed to support like 95% of all devices?
I'm going off my head because I think I'll have to add more than 1000 dimens.xml(???dp) if I want to support all the different Android devices.


问:
SwiftUI NavigationSplitView - Show only List Column in iPad Portrait mode
I want a two column-view in a Swift UI app, where the left column displays a list and the right column displays a detail view.
This works fine like this:

```<code>struct ContentView: View {

  @State private var columnVisibility = NavigationSplitViewVisibility.doubleColumn

    var body: some View {
      NavigationSplitView( columnVisibility: $columnVisibility)  {
        List {
          ForEach(itemList, id: \.self ){item in
            NavigationLink(item.name){ ItemDetail(item: item)}
          }
        }      } detail: {
        Text("detail placeholder ")
      }

      .navigationSplitViewStyle(.automatic)
    }
}
</code>```

In iPad portrait mode I want to show only the list column first. This should then behave like a stack navigation.

In addition, on the Mac, if a certain window width is not reached, only the list column should be displayed. This should then also behave like a stack navigation.

How is this feasible?

Body:
I want a two column-view in a Swift UI app, where the left column displays a list and the right column displays a detail view.
This works fine like this:

struct ContentView: View {

  @State private var columnVisibility = NavigationSplitViewVisibility.doubleColumn

    var body: some View {
      NavigationSplitView( columnVisibility: $columnVisibility)  {
        List {
          ForEach(itemList, id: \.self ){item in
            NavigationLink(item.name){ ItemDetail(item: item)}
          }
        }      } detail: {
        Text("detail placeholder ")
      }

      .navigationSplitViewStyle(.automatic)
    }
}

In iPad portrait mode I want to show only the list column first. This should then behave like a stack navigation.

In addition, on the Mac, if a certain window width is not reached, only the list column should be displayed. This should then also behave like a stack navigation.

How is this feasible?


问:
Failed API test if run them in docker container
I have a problem if I run an api test in a container, it always crashes, if I don't use the container to run the test, then everything works.

I have an application that I'm testing through docker-compos. It is deployed locally and all api requests are sent to http://localhost:8080. If I understand correctly, then my container works with its internal localhost and therefore its requests are invalid.
There was an attempt to make a bridge but I did not understand how to do it at all.
I tried to add my image to the compose file, but it did not help

This is my docker file

```<code>FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /TAF.ReportPortal
COPY . ./
RUN dotnet restore

ENTRYPOINT ["dotnet", "te","--filter" ,"Category=DashboardApiTests", "--logger:trx", "--no-restore"]

</code>```

This commands I use for starting container

```<code>docker build -t taf.rp:latest .
docker run --name taf.rp -p 8085:89 -d taf.rp
</code>```

Logs from my container

Body:
I have a problem if I run an api test in a container, it always crashes, if I don't use the container to run the test, then everything works.

I have an application that I'm testing through docker-compos. It is deployed locally and all api requests are sent to http://localhost:8080. If I understand correctly, then my container works with its internal localhost and therefore its requests are invalid.
There was an attempt to make a bridge but I did not understand how to do it at all.
I tried to add my image to the compose file, but it did not help

This is my docker file

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /TAF.ReportPortal
COPY . ./
RUN dotnet restore

ENTRYPOINT ["dotnet", "te","--filter" ,"Category=DashboardApiTests", "--logger:trx", "--no-restore"]

This commands I use for starting container

docker build -t taf.rp:latest .
docker run --name taf.rp -p 8085:89 -d taf.rp

Logs from my container


问:
Layout gets ruined for short time then gets fixed after using gsap
I am trying to use gsap on the home page of a website.

```<code>.card {
    height: 10rem;
    min-width: 10rem;
    border-radius: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    grid-column: span 3;
    font-size: 1rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(18, 133, 189, 0.5), rgba(255, 255, 255, .1));
    backdrop-filter: blur(.75rem);
    -webkit-backdrop-filter: blur(.25rem);
    border: 0.15rem solid black;
    box-shadow: 0 0 .4rem 0  black;
    gap: 2rem;
    position: relative;
}
</code>```
```<code>.card:first-child {
    left: -25vw;
}

.card:last-child {
    left: 25vw;
}

.card:nth-child(2) {
    left: 25vw;
}

.card:nth-child(3) {
    left: -25vw;
}
</code>```
```<code>gsap.to('.card:first-child', {
    duration: 3, x: '25vw', ease: 'elastic'
});

gsap.to('.card:last-child', {
    duration: 3, x: '-25vw', ease: 'elastic'
});

gsap.to('.card:nth-child(2)', {
    duration: 3, x: '-25vw', ease: 'elastic'
});

gsap.to('.card:nth-child(3)', {
    duration: 3, x: '25vw', ease: 'elastic'
});
</code>```

After intro the layout behaves like it should but once I visit another page(page here doesnn't mean new page it's a single page website with display:none when not in that page) and come back to the home page, the layout is still in -25vw for .card:first-child and so on.. for a brief second before fixing itself(the animation doesn't happen again and this is how it should behave). How do I fix this?

Body:
I am trying to use gsap on the home page of a website.

.card {
    height: 10rem;
    min-width: 10rem;
    border-radius: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    grid-column: span 3;
    font-size: 1rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(18, 133, 189, 0.5), rgba(255, 255, 255, .1));
    backdrop-filter: blur(.75rem);
    -webkit-backdrop-filter: blur(.25rem);
    border: 0.15rem solid black;
    box-shadow: 0 0 .4rem 0  black;
    gap: 2rem;
    position: relative;
}

.card:first-child {
    left: -25vw;
}

.card:last-child {
    left: 25vw;
}

.card:nth-child(2) {
    left: 25vw;
}

.card:nth-child(3) {
    left: -25vw;
}

gsap.to('.card:first-child', {
    duration: 3, x: '25vw', ease: 'elastic'
});

gsap.to('.card:last-child', {
    duration: 3, x: '-25vw', ease: 'elastic'
});

gsap.to('.card:nth-child(2)', {
    duration: 3, x: '-25vw', ease: 'elastic'
});

gsap.to('.card:nth-child(3)', {
    duration: 3, x: '25vw', ease: 'elastic'
});

After intro the layout behaves like it should but once I visit another page(page here doesnn't mean new page it's a single page website with display:none when not in that page) and come back to the home page, the layout is still in -25vw for .card:first-child and so on.. for a brief second before fixing itself(the animation doesn't happen again and this is how it should behave). How do I fix this?


问:
Evict an entry based on fewer/different keys than that used for caching in Spring
Does Sprin-Cache support evicting selected entries based on fewer keys or different keys than those used while creating the entry?

User may be fetched by username and withTransactions=true

User may be fetched by username and withTransactions=false

User may be fetched by clientId and withTransactions=true

User may be fetched by clientId and withTransactions=false

Fetch

    @Cacheable(value = USER_CACHE, key = "{#userRequest.username, #userRequest.clientId, #userRequest.withTransactions}")
    public Optional<PlatformUser> getUser(userRequest userRequest) {
        return userUsecase.getUser(userRequest);
    }

```
<h6>Create</h6>
<pre class="lang-java prettyprint-override"><code>    @Caching(evict = {@CacheEvict(value = USER_CACHE,key = "{#subscriptionDto.username}")})
    public Optional<PlatformUser> createUser(userRequest userRequest) {
        return userUsecase.createUser(userRequest);
    }
</code>```

Let assume I have following cases:

Get with parameter as UserRequest[user1, null, false]: Returns null and the result is cached (user1 does not exist) -- cache miss

Create with parameter as UserRequest[user1, 1234567, false]: Evict previous entry only based on username. -- evict

Get with parameter as UserRequest[user1, null, false]: Returns PlatformUser Object and the result is cached (user1 now exists). -- cache miss, cached

Get with parameter as UserRequest[user1, null, false]: Returns PlatformUser Object and the result is cached (user1 now exists). -- cache miss, cached

Get with parameter as UserRequest[user1, null, true]: Returns PlatformUser Object and the result is cached (user1 now exists). -- cache miss, cached

Create a Transaction against user1:

a. Evict entry(only 1) having username=user1 and withTransactions=false

b. Evict entry(only 1) having clientId=1234567 and withTransactions=false

Is there any way to achieve such eviction? Any lead would be appreciated.

Body:
Does Sprin-Cache support evicting selected entries based on fewer keys or different keys than those used while creating the entry?

User may be fetched by username and withTransactions=true

User may be fetched by username and withTransactions=false

User may be fetched by clientId and withTransactions=true

User may be fetched by clientId and withTransactions=false

Fetch

    @Cacheable(value = USER_CACHE, key = "{#userRequest.username, #userRequest.clientId, #userRequest.withTransactions}")
    public Optional<PlatformUser> getUser(userRequest userRequest) {
        return userUsecase.getUser(userRequest);
    }

Create

    @Caching(evict = {@CacheEvict(value = USER_CACHE,key = "{#subscriptionDto.username}")})
    public Optional<PlatformUser> createUser(userRequest userRequest) {
        return userUsecase.createUser(userRequest);
    }

Let assume I have following cases:

Get with parameter as UserRequest[user1, null, false]: Returns null and the result is cached (user1 does not exist) -- cache miss

Create with parameter as UserRequest[user1, 1234567, false]: Evict previous entry only based on username. -- evict

Get with parameter as UserRequest[user1, null, false]: Returns PlatformUser Object and the result is cached (user1 now exists). -- cache miss, cached

Get with parameter as UserRequest[user1, null, false]: Returns PlatformUser Object and the result is cached (user1 now exists). -- cache miss, cached

Get with parameter as UserRequest[user1, null, true]: Returns PlatformUser Object and the result is cached (user1 now exists). -- cache miss, cached

Create a Transaction against user1:

a. Evict entry(only 1) having username=user1 and withTransactions=false

b. Evict entry(only 1) having clientId=1234567 and withTransactions=false

Is there any way to achieve such eviction? Any lead would be appreciated.


问:
How I can do something like "localhost/winter/2022" not "localhost/?season=winter&year=2022"
I used the GET method for season and year, but i want to make URL look better, how I can do that?

Something like: example.com/winter/2022


问:
C# WPF app auto generated g.i.cs not loading properly
I am working in WPF and all my projects on a pc have the same issue, while on the laptop they are working well.

The different between my laptop and pc is that my computer has Windows 10 and my laptop has Windows 11.

I tried literally everything I could find:

Deleted obj folder and reopend vs community

Deleted vs community and reinstalled

Deleted vs community with all packages and also from regedit and reinstalled

Copy paste to another project (not the files, only the code)

Chaged from .Net6 to .Net7 and back

Updated version forwards and backwords too

The g.i.cs won't load properly.

And an example of the xaml:

```<code><Window x:Class="VSC_Solution_Manager.Solution_Creator"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:VSC_Solution_Manager"
        mc:Ignorable="d"
        BorderThickness="1"
        Title="Solution Creator" Height="110" Width="430" Background="#FF232323" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" WindowStyle="None" BorderBrush="#FF323232" OpacityMask="Black">
    <Window.Resources>
        <Style TargetType="Border">
            <Setter Property="CornerRadius" Value="3"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Border x:Name="border" Margin="10,34,10,0" Height="25" BorderBrush="#FF323232" BorderThickness="1" CornerRadius="3" VerticalAlignment="Top">
            <TextBox x:Name="solution_name" Text="" Padding="5,1,5,5" TextChanged="solution_name_TextChanged" Background="#00272727" BorderBrush="#00323232"/>
        </Border>
        <Button x:Name="create" Content="Create" Margin="350,77,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="23" Width="70" Click="create_Click">
            <Button.Resources>
                <Style TargetType="{x:Type Border}">
                    <Setter Property="CornerRadius" Value="3"/>
                </Style>
            </Button.Resources>
        </Button>
        <Label x:Name="label" Content="Solution name:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,8,0,0"/>
        <Button x:Name="cancel" Content="Cancel" Margin="270,77,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="23" Width="70" Click="cancel_Click">
            <Button.Resources>
                <Style TargetType="{x:Type Border}">
                    <Setter Property="CornerRadius" Value="3"/>
                </Style>
            </Button.Resources>
        </Button>
        <TextBlock x:Name="taken" Text="Name taken!" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,64,0,0" Foreground="#FFF71C1C" Visibility="Hidden"/>

    </Grid>
</Window>

</code>```

All my g.i.cs like this:
g.i.cs of the above

And this pccurs with all of my xamls and projects.

Body:
I am working in WPF and all my projects on a pc have the same issue, while on the laptop they are working well.

The different between my laptop and pc is that my computer has Windows 10 and my laptop has Windows 11.

I tried literally everything I could find:

Deleted obj folder and reopend vs community

Deleted vs community and reinstalled

Deleted vs community with all packages and also from regedit and reinstalled

Copy paste to another project (not the files, only the code)

Chaged from .Net6 to .Net7 and back

Updated version forwards and backwords too

The g.i.cs won't load properly.

And an example of the xaml:

<Window x:Class="VSC_Solution_Manager.Solution_Creator"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:VSC_Solution_Manager"
        mc:Ignorable="d"
        BorderThickness="1"
        Title="Solution Creator" Height="110" Width="430" Background="#FF232323" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" WindowStyle="None" BorderBrush="#FF323232" OpacityMask="Black">
    <Window.Resources>

    </Window.Resources>
    <Grid>
        <Border x:Name="border" Margin="10,34,10,0" Height="25" BorderBrush="#FF323232" BorderThickness="1" CornerRadius="3" VerticalAlignment="Top">
            <TextBox x:Name="solution_name" Text="" Padding="5,1,5,5" TextChanged="solution_name_TextChanged" Background="#00272727" BorderBrush="#00323232"/>
        </Border>
        <Button x:Name="create" Content="Create" Margin="350,77,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="23" Width="70" Click="create_Click">
            <Button.Resources>

            </Button.Resources>
        </Button>

        <Button x:Name="cancel" Content="Cancel" Margin="270,77,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="23" Width="70" Click="cancel_Click">
            <Button.Resources>

            </Button.Resources>
        </Button>
        <TextBlock x:Name="taken" Text="Name taken!" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,64,0,0" Foreground="#FFF71C1C" Visibility="Hidden"/>

    </Grid>
</Window>

All my g.i.cs like this:
g.i.cs of the above

And this pccurs with all of my xamls and projects.


问:
Fail to bundle node ssh2 with webpack/browserify
I am currently trying to build a Chrome extension that uses ssh to connect to a server. I am currently using the ssh2 node module, but when I fail to bundle it using browserify.

I found this thread from 2014: ssh2 module with browserify

Is there a workaround at this point? Or has anyone another idea how I might access ssh inside the extension?

How come there is a browser extension that can provide an ssh-Terminal?


问:
SSAS Trace Logs TextData Parsing
I logged Analysis Services trace with Extended Events.

I want to summarize this data, which columns and measures are used in Tabular cube?

I have TextData column, Is there any way to parse and get this information?

Title: SSAS Trace Logs TextData Parsing


问:
Decorator with arguments inside class
I want to add a decorator (with arguments) that keeps the formatting of the input file. I've been trying for few days. Below is the closest that I get and I keep getting the error message:
TypeError: keep_formatting() missing 4 required positional arguments: 'func1', 'func2', 'path', and 'file'

```<code>def keep_formatting(func1, func2, path, file):
    def decorator(func):
        def wrapper(*args, **kwargs):
            df_first_row = func1(file)
            df_wrapper = func(*args, **kwargs)
            df_content = func2(df_wrapper)
            df_merge = pd.DataFrame(np.concatenate((df_first_row.values, df_content.values)))
            df_merge.to_csv(os.path.join(path, file), index=False)
        return wrapper
    return decorator

class InputFile:
    def __init__(self):
        pass

    @keep_formatting()
    def drop_row(self, file, col):
        df = pd.read_csv('xxx.csv')
        df = df.loc[~(df[col] == some_criteria), :]
        return df

    @keep_formatting()
    def some_other_functions(self, file):
        pass
</code>```

Here are some of the questions I'm wrapping my head around

Did I use the decorator correctly? E.g., put it outside the class and call it above the class methods

It seems that I have to define the parameters inside @keep_formatting(). However, how do I keep the last parameter (file) open to changes as the file being passed to the function may be different?

Thanks for your help.

Title: Decorator with arguments inside class

Body:
I want to add a decorator (with arguments) that keeps the formatting of the input file. I've been trying for few days. Below is the closest that I get and I keep getting the error message:
TypeError: keep_formatting() missing 4 required positional arguments: 'func1', 'func2', 'path', and 'file'

def keep_formatting(func1, func2, path, file):
    def decorator(func):
        def wrapper(*args, **kwargs):
            df_first_row = func1(file)
            df_wrapper = func(*args, **kwargs)
            df_content = func2(df_wrapper)
            df_merge = pd.DataFrame(np.concatenate((df_first_row.values, df_content.values)))
            df_merge.to_csv(os.path.join(path, file), index=False)
        return wrapper
    return decorator

class InputFile:
    def __init__(self):
        pass

    @keep_formatting()
    def drop_row(self, file, col):
        df = pd.read_csv('xxx.csv')
        df = df.loc[~(df[col] == some_criteria), :]
        return df

    @keep_formatting()
    def some_other_functions(self, file):
        pass

Here are some of the questions I'm wrapping my head around

Did I use the decorator correctly? E.g., put it outside the class and call it above the class methods

It seems that I have to define the parameters inside @keep_formatting(). However, how do I keep the last parameter (file) open to changes as the file being passed to the function may be different?

Thanks for your help.


问:
antd select using tags mode and autocompletion
With Antd when using a Select component with "tags" mode, is there a way to make it work like an autocomplete so that available options are based on characters wrote by the user ?

If not, is it possible to use the AutoComplete component with a tags mode ?


问:
How to combine TF-IDF weights with BERT embeddings?
I'm trying to implement the approach suggested by this paper. In their words
"We apply the TF-IDF score in the BERT mask layer, making the different attention score for the embedding crossing" and "through the attention mechanism of BERT model, we converted the distance between two words at any position to 1, which effectively solves the difficult long-term dependence problem in NLP. So we can directly use the feature representation of BERT as the word embedding feature of the following task."

I can't figure out where exactly TF-IDF comes into play. Should I use weights on the model output, or should I build the model from scratch and feed TF-IDF there?

The end goal is to cluster twitter users based on their sentence embeddings to detect their stances (as suggested by Rasheed et. al., article).


问:
Hide drawn rectangle after certain time
There is a basic openCv dlib face detection code below. It draw a rectangle around the face detected area and it works properly. What I want to achieve is, how can I hide the drawn rectangle after a certain period of time. Take a look at the comments on my code to understand the question better. Thanks in advance.

```<code>import cv2
import dlib
import time

while True:
        success, img = camera.read()
        if not success:
            break
        else
            imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

            faces = detector(imgGray)
            for face in faces:
                x1 = face.left()
                y1 = face.top()
                x2 = face.right()
                y2 = face.bottom()
                cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2)

                #what I want
                #rectangle is visible
                time.sleep(3)
                #hide rectangle after 3 seconds then loop again

            cv2.imshow("Webcam", img)
            cv2.waitKey(1)

</code>```

Title: Hide drawn rectangle after certain time

Body:
There is a basic openCv dlib face detection code below. It draw a rectangle around the face detected area and it works properly. What I want to achieve is, how can I hide the drawn rectangle after a certain period of time. Take a look at the comments on my code to understand the question better. Thanks in advance.

import cv2
import dlib
import time

while True:
        success, img = camera.read()
        if not success:
            break
        else
            imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

            faces = detector(imgGray)
            for face in faces:
                x1 = face.left()
                y1 = face.top()
                x2 = face.right()
                y2 = face.bottom()
                cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2)

                #what I want
                #rectangle is visible
                time.sleep(3)
                #hide rectangle after 3 seconds then loop again

            cv2.imshow("Webcam", img)
            cv2.waitKey(1)


问:
flutter sliverappbar with widget overlaping on top
I'm trying to create a screen like this one.
Has anyone ever succeeded in creating something like that?

I'm using a sliverappbar, and i tried with a transform widget with negative value (i'm new to flutter comming from the web :') ) it make the component under the appbar...


问:
Is OAuth 2.0 Authorization code flow (with PKCE) available for MSAL.js Only?
I am attempting to implement OAuth 2.0 Authorization code flow (with PKCE) using MSAL.  I want to use C#, not a scripting language.

I need to use a 3rd party application that only supports authorization code flow with Proof Key for Code Exchange (PKCE).


问:
VSCode build from sources problem since v1.74.0 (Windows)
Until Visual Studio Code version 1.74.0 (released 3 days ago), I always managed to build it from source.

However, when running the packaging task yarn gulp vscode-win32-x64, it keeps failing at the bundle-extensions-build stage...

Have anyone else being experiencing this, and how to troubleshoot it?

Thank you in advance. :)

Infos:

System - Windows 10 x64

Compiler - MSVC 2019

NoteJS - Version 16.18.1

NPM - Version 8.19.2

Yarn - Version 1.22.19

Python - Version 3.9.13

(please let me know if I forgot something :p)

Full log:

```<code>[12:24:00] Using gulpfile ~\Desktop\vscode\gulpfile.js
[12:24:00] Starting 'vscode-win32-x64'...
[12:24:00] Starting clean-out-build ...
[12:24:00] Finished clean-out-build after 46 ms
[12:24:00] Starting build-web-node-paths ...
[12:24:00] Finished build-web-node-paths after 43 ms
[12:24:00] Starting compile-api-proposal-names ...
[12:24:00] Starting compilation api-proposal-names...
[12:24:00] Finished compilation api-proposal-names with 0 errors after 113 ms
[12:24:00] Finished compile-api-proposal-names after 129 ms
[12:24:00] Starting <anonymous> ...
[12:26:00] Starting compilation...
[12:35:49] Finished compilation with 0 errors after 589828 ms
[12:35:50] Finished <anonymous> after 709712 ms
[12:35:50] Starting compile-build ...
[12:35:50] Finished compile-build after 126 ms
[12:35:50] Starting clean-extensions-build ...
[12:35:50] Finished clean-extensions-build after 9 ms
[12:35:50] Starting bundle-marketplace-extensions-build ...
[12:35:56] Downloading extension from GH: ms-vscode.js-debug-companion@1.0.18 ...
[12:35:56] Downloading extension from GH: ms-vscode.js-debug@1.74.0 ...
[12:35:56] Downloading extension from GH: ms-vscode.vscode-js-profile-table@1.0.3 ...
[12:36:01] Finished bundle-marketplace-extensions-build after 11583 ms
[12:36:01] Starting bundle-extensions-build ...
[12:36:37] 'vscode-win32-x64' errored after 13 min
[12:36:37] Error: Command failed: yarn list --prod --json

    at ChildProcess.exithandler (node:child_process:402:12)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:552:15)
    at maybeClose (node:internal/child_process:1100:16)
    at Socket.<anonymous> (node:internal/child_process:458:11)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:552:15)
    at Pipe.<anonymous> (node:net:301:12)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
</code>```

What I have tried so far:

Clean reinstallation of all the components.

Clearing the node, npm, yarn, node-gyp, etc cache.

Body:
Until Visual Studio Code version 1.74.0 (released 3 days ago), I always managed to build it from source.

However, when running the packaging task yarn gulp vscode-win32-x64, it keeps failing at the bundle-extensions-build stage...

Have anyone else being experiencing this, and how to troubleshoot it?

Thank you in advance. :)

Infos:

System - Windows 10 x64

Compiler - MSVC 2019

NoteJS - Version 16.18.1

NPM - Version 8.19.2

Yarn - Version 1.22.19

Python - Version 3.9.13

(please let me know if I forgot something :p)

Full log:

[12:24:00] Using gulpfile ~\Desktop\vscode\gulpfile.js
[12:24:00] Starting 'vscode-win32-x64'...
[12:24:00] Starting clean-out-build ...
[12:24:00] Finished clean-out-build after 46 ms
[12:24:00] Starting build-web-node-paths ...
[12:24:00] Finished build-web-node-paths after 43 ms
[12:24:00] Starting compile-api-proposal-names ...
[12:24:00] Starting compilation api-proposal-names...
[12:24:00] Finished compilation api-proposal-names with 0 errors after 113 ms
[12:24:00] Finished compile-api-proposal-names after 129 ms
[12:24:00] Starting <anonymous> ...
[12:26:00] Starting compilation...
[12:35:49] Finished compilation with 0 errors after 589828 ms
[12:35:50] Finished <anonymous> after 709712 ms
[12:35:50] Starting compile-build ...
[12:35:50] Finished compile-build after 126 ms
[12:35:50] Starting clean-extensions-build ...
[12:35:50] Finished clean-extensions-build after 9 ms
[12:35:50] Starting bundle-marketplace-extensions-build ...
[12:35:56] Downloading extension from GH: ms-vscode.js-debug-companion@1.0.18 ...
[12:35:56] Downloading extension from GH: ms-vscode.js-debug@1.74.0 ...
[12:35:56] Downloading extension from GH: ms-vscode.vscode-js-profile-table@1.0.3 ...
[12:36:01] Finished bundle-marketplace-extensions-build after 11583 ms
[12:36:01] Starting bundle-extensions-build ...
[12:36:37] 'vscode-win32-x64' errored after 13 min
[12:36:37] Error: Command failed: yarn list --prod --json

    at ChildProcess.exithandler (node:child_process:402:12)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:552:15)
    at maybeClose (node:internal/child_process:1100:16)
    at Socket.<anonymous> (node:internal/child_process:458:11)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:552:15)
    at Pipe.<anonymous> (node:net:301:12)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What I have tried so far:

Clean reinstallation of all the components.

Clearing the node, npm, yarn, node-gyp, etc cache.


问:
How do I use PageView.builder to do TikTok like scrolling while inside of a Chewie fullscreen video?
I want to create a tiktok like scrolling feature (edge to edge scrolling) for my landscape full screen videos. Using pageview.builder works perfect when I am not in fullscreen, but if I enter fullscreen then I can no longer scroll through my videos. Is there a way to make this feature work while in landscape full screen mode?

I added a pageview.builder to and when the index changes the page changes as well. It would perfect in portrait mode, but if I enter into fullscreen, it no longer allows me scroll.

Here is my code, 2 separate files:

`

```<code>import 'package:flutter/material.dart';
import 'package:waves_app/widgets/test_video.dart';

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView.builder(
        scrollDirection: Axis.vertical,
        itemCount: 8,
        itemBuilder: (context, index) {
          try {
            return TestVideo(index, true);
          } catch (e) {
            print(e);
            return Container();
          }
        },
      ),
    );
  }
}
</code>```

`

`

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

import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:video_player/video_player.dart';
import 'package:waves_app/screens/Profiles/profile_goth.dart';
import 'package:waves_app/screens/Profiles/profile_only.dart';
import 'package:waves_app/widgets/ui_controls_tv.dart';

class TestVideo extends StatefulWidget {
  final bool autoPlay;
  final int index;

  TestVideo(this.index, this.autoPlay);

  @override
  _TestVideoState createState() => _TestVideoState();
}

class _TestVideoState extends State<TestVideo> {
  late ChewieController chewieController;
  late VideoPlayerController videoPlayerController;
  final _controller = PageController();

  List assets = [
    'assets/ShortFilms/ShortFilm.mp4',
    'assets/ShortFilms/ShortFilm1.mp4',
    'assets/ShortFilms/ShortFilm2.mp4',
    'assets/ShortFilms/ShortFilm3.mp4',
    'assets/ShortFilms/ShortFilm4.mp4',
    'assets/ShortFilms/ShortFilm5.mp4',
    'assets/ShortFilms/ShortFilm6.mp4',
    'assets/ShortFilms/ShortFilm7.mp4',
    'assets/ShortFilms/ShortFilm8.mp4',
  ];

  @override
  void initState() {
    super.initState();

    videoPlayerController = VideoPlayerController.asset(assets[widget.index]);
    chewieController = ChewieController(
      videoPlayerController: videoPlayerController,
      autoPlay: widget.autoPlay,
      aspectRatio: 16 / 9,
      autoInitialize: true,
      fullScreenByDefault: true,
      errorBuilder: (context, errorMessage) {
        return Center(
          child: Text(
            errorMessage,
            style: const TextStyle(color: Colors.white),
          ),
        );
      },
      customControls: const UIControlsTV(),
      // overlay: Container(
      //   height: double.infinity,
      //   width: double.infinity,
      //   // color: Colors.red,
      // ),
      materialProgressColors: ChewieProgressColors(
        playedColor: Colors.lightBlue,
        handleColor: Colors.white,
        bufferedColor: Colors.white.withOpacity(0.5),
        backgroundColor: Colors.grey.withOpacity(.5),
      ),
    );
    chewieController.addListener(() {
      print("FULL SCREEN:${chewieController.isFullScreen}");
    });
    Future.delayed(Duration.zero, () {
      chewieController.deviceOrientationsOnEnterFullScreen = [
        // DeviceOrientation.landscapeLeft,
        DeviceOrientation.landscapeRight
      ];
      chewieController.deviceOrientationsAfterFullScreen = [
        DeviceOrientation.portraitUp
      ];
    });
  }

  @override
  void dispose() {
    chewieController.pause();
    videoPlayerController.dispose();
    chewieController.dispose();
    print('chewie disposed');
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return AspectRatio(
      aspectRatio: 16 / 9,
      child: Chewie(
        controller: chewieController,
      ),
    );
  }
}

</code>```

`

Body:
I want to create a tiktok like scrolling feature (edge to edge scrolling) for my landscape full screen videos. Using pageview.builder works perfect when I am not in fullscreen, but if I enter fullscreen then I can no longer scroll through my videos. Is there a way to make this feature work while in landscape full screen mode?

I added a pageview.builder to and when the index changes the page changes as well. It would perfect in portrait mode, but if I enter into fullscreen, it no longer allows me scroll.

Here is my code, 2 separate files:

`

import 'package:flutter/material.dart';
import 'package:waves_app/widgets/test_video.dart';

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView.builder(
        scrollDirection: Axis.vertical,
        itemCount: 8,
        itemBuilder: (context, index) {
          try {
            return TestVideo(index, true);
          } catch (e) {
            print(e);
            return Container();
          }
        },
      ),
    );
  }
}

`

`

import 'dart:math';

import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:video_player/video_player.dart';
import 'package:waves_app/screens/Profiles/profile_goth.dart';
import 'package:waves_app/screens/Profiles/profile_only.dart';
import 'package:waves_app/widgets/ui_controls_tv.dart';

class TestVideo extends StatefulWidget {
  final bool autoPlay;
  final int index;

  TestVideo(this.index, this.autoPlay);

  @override
  _TestVideoState createState() => _TestVideoState();
}

class _TestVideoState extends State<TestVideo> {
  late ChewieController chewieController;
  late VideoPlayerController videoPlayerController;
  final _controller = PageController();

  List assets = [
    'assets/ShortFilms/ShortFilm.mp4',
    'assets/ShortFilms/ShortFilm1.mp4',
    'assets/ShortFilms/ShortFilm2.mp4',
    'assets/ShortFilms/ShortFilm3.mp4',
    'assets/ShortFilms/ShortFilm4.mp4',
    'assets/ShortFilms/ShortFilm5.mp4',
    'assets/ShortFilms/ShortFilm6.mp4',
    'assets/ShortFilms/ShortFilm7.mp4',
    'assets/ShortFilms/ShortFilm8.mp4',
  ];

  @override
  void initState() {
    super.initState();

    videoPlayerController = VideoPlayerController.asset(assets[widget.index]);
    chewieController = ChewieController(
      videoPlayerController: videoPlayerController,
      autoPlay: widget.autoPlay,
      aspectRatio: 16 / 9,
      autoInitialize: true,
      fullScreenByDefault: true,
      errorBuilder: (context, errorMessage) {
        return Center(
          child: Text(
            errorMessage,
            style: const TextStyle(color: Colors.white),
          ),
        );
      },
      customControls: const UIControlsTV(),
      // overlay: Container(
      //   height: double.infinity,
      //   width: double.infinity,
      //   // color: Colors.red,
      // ),
      materialProgressColors: ChewieProgressColors(
        playedColor: Colors.lightBlue,
        handleColor: Colors.white,
        bufferedColor: Colors.white.withOpacity(0.5),
        backgroundColor: Colors.grey.withOpacity(.5),
      ),
    );
    chewieController.addListener(() {
      print("FULL SCREEN:${chewieController.isFullScreen}");
    });
    Future.delayed(Duration.zero, () {
      chewieController.deviceOrientationsOnEnterFullScreen = [
        // DeviceOrientation.landscapeLeft,
        DeviceOrientation.landscapeRight
      ];
      chewieController.deviceOrientationsAfterFullScreen = [
        DeviceOrientation.portraitUp
      ];
    });
  }

  @override
  void dispose() {
    chewieController.pause();
    videoPlayerController.dispose();
    chewieController.dispose();
    print('chewie disposed');
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return AspectRatio(
      aspectRatio: 16 / 9,
      child: Chewie(
        controller: chewieController,
      ),
    );
  }
}

`


问:
How to make ARIMA model predict many times one by one?
```<code>model = pm.auto_arima(df.outtemp, start_p=1, start_q=1,
                      test='adf',       # use adftest to find optimal 'd'
                      max_p=3, max_q=3, # maximum p and q
                      m=1,              # frequency of series
                      d=None,           # let model determine 'd'
                      seasonal=False,   # No Seasonality
                      start_P=0,
                      D=0,
                      trace=True,
                      error_action='ignore',
                      suppress_warnings=True,
                      stepwise=True)

print(model.summary())
</code>```

I want to use this arima to draw a graph based on the df.outtemp, so instead of only predict after this series, I want to make it predict inside the outtemp index, for example the outtemp start with 1, 2, 3... I want to predict start 1, 2, 3 and draw two lines in one graph to compare them.

But model.predict(n_periods=n_periods, return_conf_int=True) seems can only predict after the last outtemp index.

something like this:

Body:
model = pm.auto_arima(df.outtemp, start_p=1, start_q=1,
                      test='adf',       # use adftest to find optimal 'd'
                      max_p=3, max_q=3, # maximum p and q
                      m=1,              # frequency of series
                      d=None,           # let model determine 'd'
                      seasonal=False,   # No Seasonality
                      start_P=0,
                      D=0,
                      trace=True,
                      error_action='ignore',
                      suppress_warnings=True,
                      stepwise=True)

print(model.summary())

I want to use this arima to draw a graph based on the df.outtemp, so instead of only predict after this series, I want to make it predict inside the outtemp index, for example the outtemp start with 1, 2, 3... I want to predict start 1, 2, 3 and draw two lines in one graph to compare them.

But model.predict(n_periods=n_periods, return_conf_int=True) seems can only predict after the last outtemp index.

something like this:


问:
How to create GridLayout Dynamically and clear its widgets in Kivy?
I have a problem on clearing widgets in Gridlayout which was created in KY File.

I added self.ids.gridsonuc.clear_widgets() command on a button so when i click on that button, it successfully removes widgets but after removing widgets since i am not dynamically creating the gridlayout through python code that's why when i click the button for the second time i get an error because there exists no gridlayout with that ID. So, instead of declaring child gridlayout directly in .kv file, i should use main.py to create the child gridlayout and then i should use the object of the child gridlayout for removing it from screen instead of its id. But i don't know how to do this?

My usage is in below form!

```<code>from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.metrics import dp
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavior
from kivy.clock import Clock
from kivy.uix.popup import Popup
from kivy.factory import Factory
from kivy.properties import ObjectProperty
import requests

class PopupBox(Popup):

    pop_up_text = ObjectProperty()
    def update_pop_up_text(self, p_message):
        self.pop_up_text.text = p_message

class Updown(ButtonBehavior, Image):

    def __init__(self, **kwargs):
        super(Updown, self).__init__(**kwargs)

class WrappedLabel(Label):

    def __init__(self, **kwargs):
        super(WrappedLabel, self).__init__(**kwargs)

        self.bind(
            width=lambda *x: self.setter('text_size')(self, (self.width, None)),
            texture_size = lambda *x: self.setter('height')(self, self.texture_size[1]))

class Predictor(BoxLayout):

    def __init__(self, **kwargs):
        super(Predictor, self).__init__(**kwargs)

        self.status = True
        self.data = self.datas()
        self.Today = self.todayMatches()

    def homepage(self, s_image, screenmanager):

        screenmanager.current = 'homepage_screen'

    def show_popup(self):

        self.pop_up = Factory.PopupBox()
        self.pop_up.update_pop_up_text('Loading...')
        self.pop_up.open()

    def underOver(self, s_image, screenmanager):

        screenmanager.current = 'underover_screen'

        self.show_popup()
        #mythread = threading.Thread(target=self.underOver_hesaplama)
        #mythread.start()
        #self.ids.gridsonuc.clear_widgets()
        Clock.schedule_once(self.datas)
        Clock.schedule_once(self.underOver_hesaplama)

    #@mainthread
    def underOver_hesaplama(self, *args):

        print("""
        Welcome to Under Over Goal Statics
        """)

        #self.ids.gridsonuc.remove_widget(box)

        for i in range(len(self.Today[0])):
            try:
                sonuc = some calculations
            except:
                sonuc = int(0)

            box = BoxLayout(size_hint_y = None, height = dp(50))
            sira = WrappedLabel(text = f'{i+1}', font_name = 'fonts/Lcd.ttf', font_size = dp(15), size_hint = (0.10, 1), halign='center' )
            evsahibi = WrappedLabel(text = f'{self.Today[0][i]}', font_name = 'Roboto', font_size = dp(15), size_hint = (0.225, 1), halign='center', bold = True )
            deplasman = WrappedLabel(text = f'{self.Today[1][i]}', font_name = 'Roboto', font_size = dp(15), size_hint = (0.225, 1), halign='center', bold = True )
            macbasigol = WrappedLabel(text = f'{sonuc}', font_name = 'fonts/Lcd.ttf', font_size = dp(20), size_hint = (0.15, 1), halign='center', color= (1, 0.4, 0.769, 1) )
            if sonuc == int(0):
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/error.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/error.png')
            elif sonuc < 2.50:
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/down.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/down.png')
            elif sonuc >= 2.50 and sonuc < 3.50:
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/up.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/down.png')
            else:
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/up.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/up.png')
            box.add_widget(sira)
            box.add_widget(evsahibi)
            box.add_widget(deplasman)
            box.add_widget(macbasigol)
            box.add_widget(ust_2_5)
            box.add_widget(ust_3_5)
            self.ids.gridsonuc.add_widget(box)

        self.pop_up.dismiss()
</code>```

My KV file:

```<code>#:import NoTransition kivy.uix.screenmanager.NoTransition
<Predictor>:
    ScreenManager:
        transition: NoTransition()
        id: sm
        size: root.width, root.height
        Screen:
            name: 'homepage_screen'
            Image:
                source: 'images/homepage_background.png'
                allow_stretch: True
                keep_ratio: False
            BoxLayout:
                size_hint: 1, 0.10
                Button:
                    id: underOver_button_homepage
                    on_press: root.underOver(img_underOver, sm)
                    background_color: 0, 0, 0, 0
                    Image:
                        id: img_underOver
                        source: 'images/underover_button.png'
                        allow_stretch: True
                        keep_ratio: False
                        size: self.parent.size
                        pos: underOver_button_homepage.pos
                Button:
                    id: side_button_homepage
                    on_press: root.side(img_side, sm)
                    background_color: 0, 0, 0, 0
                    Image:
                        id: img_side
                        source: 'images/side_button.png'
                        allow_stretch: True
                        keep_ratio: False
                        size: self.parent.size
                        pos: side_button_homepage.pos
        Screen:
            name: 'underover_screen'
            Image:
                source: 'images/screen_background.png'
                allow_stretch: True
                keep_ratio: False
            BoxLayout:
                spacing: '20dp'
                orientation: 'vertical'
                BoxLayout:
                    size_hint: 1, 0.10
                    Label:
                        size_hint: 0.10, 1
                        text: '#'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.225, 1
                        text: 'T1'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.225, 1
                        text: 'T2'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.15, 1
                        text: 'G.A'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.15, 1
                        text: '2.5'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.15, 1
                        text: '3.5'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                BoxLayout:
                    size_hint: 1, 0.80
                    ScrollView:
                        bar_margin: '5dp'
                        bar_color: 1, 0.4, 0.769, 1
                        bar_width: '5dp'
                        bar_inactive_color: 1, 0.4, 0.769, 1
                        GridLayout:
                            id: gridsonuc
                            cols: 1
                            spacing: '50dp'
                            size_hint_y: None
                            height: self.minimum_height
                BoxLayout:
                    size_hint: 1, 0.10
                    Button:
                        id: home_button_underOver
                        on_press: root.homepage(img_home, sm)
                        background_color: 0, 0, 0, 0
                        Image:
                            id: img_home
                            source: 'images/home_button.png'
                            allow_stretch: True
                            keep_ratio: False
                            size: self.parent.size
                            pos: home_button_underOver.pos
                    Button:
                        id: side_button_underOver
                        on_press: root.side(img_side, sm)
                        background_color: 0, 0, 0, 0
                        Image:
                            id: img_side
                            source: 'images/side_button.png'
                            allow_stretch: True
                            keep_ratio: False
                            size: self.parent.size
                            pos: side_button_underOver.pos
</code>```

How can i create GridLayout Dynamically and clear its widgets in this project?

What i tried:
I added a Gridlayout class to main.py

```<code>from kivy.uix.gridlayout import GridLayout
class Kafes(GridLayout):

    def __init__(self, **kwargs):
        super(Kafes, self).__init__(**kwargs)
</code>```

What are the problems?

How can i add these to Gridlayout class in Pure Python?
cols: 1
size_hint_y: None
height: self.minimum_height

In class Predictor(BoxLayout):
def underOver_hesaplama(self, *args): function
adds all (box) boxlayout to Gridlayout with an ID
self.ids.gridsonuc.add_widget(box) in a for loop!
If i create a new Gridlayout class this time; there will be two different classes!
One class Predictor(BoxLayout):
Other class Kafes(GridLayout):

How can i add the widgets to another (class Kafes(GridLayout):) which are already created in  class Predictor(BoxLayout): > def underOver_hesaplama(self, *args): function?

lastly how can i clear this widgets in Gridlayout Class?

Thanks very much

Body:
I have a problem on clearing widgets in Gridlayout which was created in KY File.

I added self.ids.gridsonuc.clear_widgets() command on a button so when i click on that button, it successfully removes widgets but after removing widgets since i am not dynamically creating the gridlayout through python code that's why when i click the button for the second time i get an error because there exists no gridlayout with that ID. So, instead of declaring child gridlayout directly in .kv file, i should use main.py to create the child gridlayout and then i should use the object of the child gridlayout for removing it from screen instead of its id. But i don't know how to do this?

My usage is in below form!

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.metrics import dp
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavior
from kivy.clock import Clock
from kivy.uix.popup import Popup
from kivy.factory import Factory
from kivy.properties import ObjectProperty
import requests

class PopupBox(Popup):

    pop_up_text = ObjectProperty()
    def update_pop_up_text(self, p_message):
        self.pop_up_text.text = p_message

class Updown(ButtonBehavior, Image):

    def __init__(self, **kwargs):
        super(Updown, self).__init__(**kwargs)

class WrappedLabel(Label):

    def __init__(self, **kwargs):
        super(WrappedLabel, self).__init__(**kwargs)

        self.bind(
            width=lambda *x: self.setter('text_size')(self, (self.width, None)),
            texture_size = lambda *x: self.setter('height')(self, self.texture_size[1]))

class Predictor(BoxLayout):

    def __init__(self, **kwargs):
        super(Predictor, self).__init__(**kwargs)

        self.status = True
        self.data = self.datas()
        self.Today = self.todayMatches()

    def homepage(self, s_image, screenmanager):

        screenmanager.current = 'homepage_screen'

    def show_popup(self):

        self.pop_up = Factory.PopupBox()
        self.pop_up.update_pop_up_text('Loading...')
        self.pop_up.open()

    def underOver(self, s_image, screenmanager):

        screenmanager.current = 'underover_screen'

        self.show_popup()
        #mythread = threading.Thread(target=self.underOver_hesaplama)
        #mythread.start()
        #self.ids.gridsonuc.clear_widgets()
        Clock.schedule_once(self.datas)
        Clock.schedule_once(self.underOver_hesaplama)

    #@mainthread
    def underOver_hesaplama(self, *args):

        print("""
        Welcome to Under Over Goal Statics
        """)

        #self.ids.gridsonuc.remove_widget(box)

        for i in range(len(self.Today[0])):
            try:
                sonuc = some calculations
            except:
                sonuc = int(0)

            box = BoxLayout(size_hint_y = None, height = dp(50))
            sira = WrappedLabel(text = f'{i+1}', font_name = 'fonts/Lcd.ttf', font_size = dp(15), size_hint = (0.10, 1), halign='center' )
            evsahibi = WrappedLabel(text = f'{self.Today[0][i]}', font_name = 'Roboto', font_size = dp(15), size_hint = (0.225, 1), halign='center', bold = True )
            deplasman = WrappedLabel(text = f'{self.Today[1][i]}', font_name = 'Roboto', font_size = dp(15), size_hint = (0.225, 1), halign='center', bold = True )
            macbasigol = WrappedLabel(text = f'{sonuc}', font_name = 'fonts/Lcd.ttf', font_size = dp(20), size_hint = (0.15, 1), halign='center', color= (1, 0.4, 0.769, 1) )
            if sonuc == int(0):
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/error.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/error.png')
            elif sonuc < 2.50:
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/down.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/down.png')
            elif sonuc >= 2.50 and sonuc < 3.50:
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/up.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/down.png')
            else:
                ust_2_5 = Updown(size_hint = (0.15, 1), source = 'images/up.png')
                ust_3_5 = Updown(size_hint = (0.15, 1), source = 'images/up.png')
            box.add_widget(sira)
            box.add_widget(evsahibi)
            box.add_widget(deplasman)
            box.add_widget(macbasigol)
            box.add_widget(ust_2_5)
            box.add_widget(ust_3_5)
            self.ids.gridsonuc.add_widget(box)

        self.pop_up.dismiss()

My KV file:

#:import NoTransition kivy.uix.screenmanager.NoTransition
<Predictor>:
    ScreenManager:
        transition: NoTransition()
        id: sm
        size: root.width, root.height
        Screen:
            name: 'homepage_screen'
            Image:
                source: 'images/homepage_background.png'
                allow_stretch: True
                keep_ratio: False
            BoxLayout:
                size_hint: 1, 0.10
                Button:
                    id: underOver_button_homepage
                    on_press: root.underOver(img_underOver, sm)
                    background_color: 0, 0, 0, 0
                    Image:
                        id: img_underOver
                        source: 'images/underover_button.png'
                        allow_stretch: True
                        keep_ratio: False
                        size: self.parent.size
                        pos: underOver_button_homepage.pos
                Button:
                    id: side_button_homepage
                    on_press: root.side(img_side, sm)
                    background_color: 0, 0, 0, 0
                    Image:
                        id: img_side
                        source: 'images/side_button.png'
                        allow_stretch: True
                        keep_ratio: False
                        size: self.parent.size
                        pos: side_button_homepage.pos
        Screen:
            name: 'underover_screen'
            Image:
                source: 'images/screen_background.png'
                allow_stretch: True
                keep_ratio: False
            BoxLayout:
                spacing: '20dp'
                orientation: 'vertical'
                BoxLayout:
                    size_hint: 1, 0.10
                    Label:
                        size_hint: 0.10, 1
                        text: '#'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.225, 1
                        text: 'T1'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.225, 1
                        text: 'T2'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.15, 1
                        text: 'G.A'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.15, 1
                        text: '2.5'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                    Label:
                        size_hint: 0.15, 1
                        text: '3.5'
                        font_name: 'fonts/Lcd.ttf'
                        font_size: '30dp'
                        color: 1, 0.4, 0.769, 1
                BoxLayout:
                    size_hint: 1, 0.80
                    ScrollView:
                        bar_margin: '5dp'
                        bar_color: 1, 0.4, 0.769, 1
                        bar_width: '5dp'
                        bar_inactive_color: 1, 0.4, 0.769, 1
                        GridLayout:
                            id: gridsonuc
                            cols: 1
                            spacing: '50dp'
                            size_hint_y: None
                            height: self.minimum_height
                BoxLayout:
                    size_hint: 1, 0.10
                    Button:
                        id: home_button_underOver
                        on_press: root.homepage(img_home, sm)
                        background_color: 0, 0, 0, 0
                        Image:
                            id: img_home
                            source: 'images/home_button.png'
                            allow_stretch: True
                            keep_ratio: False
                            size: self.parent.size
                            pos: home_button_underOver.pos
                    Button:
                        id: side_button_underOver
                        on_press: root.side(img_side, sm)
                        background_color: 0, 0, 0, 0
                        Image:
                            id: img_side
                            source: 'images/side_button.png'
                            allow_stretch: True
                            keep_ratio: False
                            size: self.parent.size
                            pos: side_button_underOver.pos

How can i create GridLayout Dynamically and clear its widgets in this project?

What i tried:
I added a Gridlayout class to main.py

from kivy.uix.gridlayout import GridLayout
class Kafes(GridLayout):

    def __init__(self, **kwargs):
        super(Kafes, self).__init__(**kwargs)

What are the problems?

How can i add these to Gridlayout class in Pure Python?
cols: 1
size_hint_y: None
height: self.minimum_height

In class Predictor(BoxLayout):
def underOver_hesaplama(self, *args): function
adds all (box) boxlayout to Gridlayout with an ID
self.ids.gridsonuc.add_widget(box) in a for loop!
If i create a new Gridlayout class this time; there will be two different classes!
One class Predictor(BoxLayout):
Other class Kafes(GridLayout):

How can i add the widgets to another (class Kafes(GridLayout):) which are already created in  class Predictor(BoxLayout): > def underOver_hesaplama(self, *args): function?

lastly how can i clear this widgets in Gridlayout Class?

Thanks very much