问:
Laravel hasManyThrough: get one of each unique id
I have the following tables:

projects
    id - integer
    name - string

environments
    id - integer
    project_id - integer
    name - string

deployments
    id - integer
    environment_id - integer
    name - string
```
<p>The following relationship get all deployments related to the project:</p>
<pre class="lang-php prettyprint-override"><code>class Project extends Model
{
    public function deployments()
    {
        return $this->hasManyThrough(
            Deployment::class,
            Environment::class,
            'project_id', // Foreign key on the environments table...
            'environment_id', // Foreign key on the deployments table...
            'id', // Local key on the projects table...
            'id' // Local key on the environments table...
        );
    }
}
</code>```

I'm trying to get only one (the latest) deployment of each environment.

Example data:

```<code>Projects
+------+-----------+
| id   | 1         |
| name | Project 1 |
+------+-----------+

Environments
+------------+------+
| id         | 1    |
| project_id | 1    |
| name       | Env1 |
+------------+------+
| id         | 2    |
| project_id | 1    |
| name       | Env2 |
+------------+------+

Deployments
+----------------+----------+
| id             | 1        |
| environment_id | 1        |
| name           | Dep1Env1 |
+----------------+----------+
| id             | 2        |
| environment_id | 1        |
| name           | Dep2Env1 |
+----------------+----------+
| id             | 3        |
| environment_id | 2        |
| name           | Dep3Env2 |
+----------------+----------+
| id             | 4        |
| environment_id | 2        |
| name           | Dep4Env2 |
+----------------+----------+
</code>```

Expected result:

{
  "id": 1,
  "name": "Project 1",
  "deployments": [
    {"id": 2, "environment_id": 1, "name": "Dep2Env1"},
    {"id": , "environment_id": 2, "name": "Dep4Env2"},
  ]
}
```
<p>I have tried to use <code>unique('id')</code>. But it does not work in the relationship. So I used it in a separate attribute:</p>
<pre class="lang-php prettyprint-override"><code>class Project extends Model
{
    protected $hidden = ['deployments'];

    public function deployments()
    {
        return $this->hasManyThrough(
            Deployment::class,
            Environment::class,
            'project_id', // Foreign key on the environments table...
            'environment_id', // Foreign key on the deployments table...
            'id', // Local key on the projects table...
            'id' // Local key on the environments table...
        );
    }

    public function getUniqueDeploymentsAttribute() {
        return $this->deployments()->unique('id');
    }
}
</code>```

Is there a way to get unique values in the relationship itself?

Body:
I have the following tables:

projects
    id - integer
    name - string

environments
    id - integer
    project_id - integer
    name - string

deployments
    id - integer
    environment_id - integer
    name - string

The following relationship get all deployments related to the project:

class Project extends Model
{
    public function deployments()
    {
        return $this->hasManyThrough(
            Deployment::class,
            Environment::class,
            'project_id', // Foreign key on the environments table...
            'environment_id', // Foreign key on the deployments table...
            'id', // Local key on the projects table...
            'id' // Local key on the environments table...
        );
    }
}

I'm trying to get only one (the latest) deployment of each environment.

Example data:

Projects
+------+-----------+
| id   | 1         |
| name | Project 1 |
+------+-----------+

Environments
+------------+------+
| id         | 1    |
| project_id | 1    |
| name       | Env1 |
+------------+------+
| id         | 2    |
| project_id | 1    |
| name       | Env2 |
+------------+------+

Deployments
+----------------+----------+
| id             | 1        |
| environment_id | 1        |
| name           | Dep1Env1 |
+----------------+----------+
| id             | 2        |
| environment_id | 1        |
| name           | Dep2Env1 |
+----------------+----------+
| id             | 3        |
| environment_id | 2        |
| name           | Dep3Env2 |
+----------------+----------+
| id             | 4        |
| environment_id | 2        |
| name           | Dep4Env2 |
+----------------+----------+

Expected result:

{
  "id": 1,
  "name": "Project 1",
  "deployments": [
    {"id": 2, "environment_id": 1, "name": "Dep2Env1"},
    {"id": , "environment_id": 2, "name": "Dep4Env2"},
  ]
}

I have tried to use unique('id'). But it does not work in the relationship. So I used it in a separate attribute:

class Project extends Model
{
    protected $hidden = ['deployments'];

    public function deployments()
    {
        return $this->hasManyThrough(
            Deployment::class,
            Environment::class,
            'project_id', // Foreign key on the environments table...
            'environment_id', // Foreign key on the deployments table...
            'id', // Local key on the projects table...
            'id' // Local key on the environments table...
        );
    }

    public function getUniqueDeploymentsAttribute() {
        return $this->deployments()->unique('id');
    }
}

Is there a way to get unique values in the relationship itself?


来源: stackexchange

问:
NextJS how to use the useEffect hook for detecting classes on page change
In my nextjs-app I have a Navbar-component, where I use the useEffect-hook to check, if the -tag contains a class:

Navbar.tsx:

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

   const router = useRouter()

   const [fullWidthBackground, setFullWidthBackground] = useState(false)

   useEffect(() => {
      const isFullWidth = document.body.classList.contains('full-width-hero')
      if (isFullWidth) {
        setFullWidthBackground(true)
      } else {
        setFullWidthBackground(false)
      }
   }, [fullWidthBackground])

}
</code>```

So far, this seems to be working, BUT when I'm on a route/page that has the full-width-hero-class and them navigate to the /-route (pages -> index.tsx),which does NOT have the full-width-hero-class, the isFullWidth still returns true - so what is going on here?

Can someone help me out

ContentLicense: CC BY-SA 4.0

Body:
In my nextjs-app I have a Navbar-component, where I use the useEffect-hook to check, if the -tag contains a class:

Navbar.tsx:

const Navbar = () => {

   const router = useRouter()

   const [fullWidthBackground, setFullWidthBackground] = useState(false)

   useEffect(() => {
      const isFullWidth = document.body.classList.contains('full-width-hero')
      if (isFullWidth) {
        setFullWidthBackground(true)
      } else {
        setFullWidthBackground(false)
      }
   }, [fullWidthBackground])

}

So far, this seems to be working, BUT when I'm on a route/page that has the full-width-hero-class and them navigate to the /-route (pages -> index.tsx),which does NOT have the full-width-hero-class, the isFullWidth still returns true - so what is going on here?

Can someone help me out


问:
Julia while loop slower than for loop?
I'm working with Julia 1.8.2 on the Advent of Code day 6 and noticed some strange performance difference between while and for loops.

I had written an implementation with a for loop, but realized that I did not need to go over each index, and I could skip indices in certain cases, but when I rewrote my code with a while loop it took ~10x as long to run. Both the for and the while loop code give the correct answer.
Then I added a small basic while vs for loop test to see if it was my code or the actual loops, and the results were even more dramatic. The while test took ~0.5s while the for test completed almost instantly.

My full code is given below, see AoC day6 for the data.

My question is why is the while loop so much slower? Does the Julia interpreter have a hard time optimizing while loops for some reason?

```<code>using BenchmarkTools

function parse_data()
    open(joinpath(dirname(@__FILE__), "data/day6.txt")) do f
        while !eof(f)
            line = readline(f)
            return line
        end
    end
end

function test_for(data)
    tot = 0
    for i = 1:length(data) * 100
        tot += 1
    end
    return tot
end

function test_while(data)
    tot = 0
    i = 1
    while i <= length(data) * 100
        tot += 1
        i += 1
    end
    return tot
end

function solve_problem_for(data)
    marker_length = 14
    for i = 1:length(data)
        repeat = false
        for (j, item) in enumerate(view(data, i:i+marker_length - 1))
            repeat = repeat || occursin(item, view(data, i + j:i + marker_length - 1))
            if repeat
                break
            end
        end
        if !repeat
            return i + marker_length - 1
        end
    end
end

function solve_problem_while(data)
    marker_length = 14
    i = 1
    while i <= length(data)
        repeat = false
        for (j, item) in enumerate(view(data, i:i+marker_length - 1))
            repeat = repeat || occursin(item, view(data, i + j:i + marker_length - 1))
            if repeat
                i += j - 1
                break
            end
        end
        if !repeat
            return i + marker_length - 1
        end
        i += 1
    end
end

function main()
    data = parse_data()
    @time sol = solve_problem_while(data)
    @time sol = solve_problem_while(data)
    println(sol)
    @time sol = test_while(data)
    @time sol = test_while(data)

    @time sol = solve_problem_for(data)
    @time sol = solve_problem_for(data)
    println(sol)
    @time sol = test_for(data)
    @time sol = test_for(data)
end

main()
</code>```

Title: Julia while loop slower than for loop?

Body:
I'm working with Julia 1.8.2 on the Advent of Code day 6 and noticed some strange performance difference between while and for loops.

I had written an implementation with a for loop, but realized that I did not need to go over each index, and I could skip indices in certain cases, but when I rewrote my code with a while loop it took ~10x as long to run. Both the for and the while loop code give the correct answer.
Then I added a small basic while vs for loop test to see if it was my code or the actual loops, and the results were even more dramatic. The while test took ~0.5s while the for test completed almost instantly.

My full code is given below, see AoC day6 for the data.

My question is why is the while loop so much slower? Does the Julia interpreter have a hard time optimizing while loops for some reason?

using BenchmarkTools

function parse_data()
    open(joinpath(dirname(@__FILE__), "data/day6.txt")) do f
        while !eof(f)
            line = readline(f)
            return line
        end
    end
end

function test_for(data)
    tot = 0
    for i = 1:length(data) * 100
        tot += 1
    end
    return tot
end

function test_while(data)
    tot = 0
    i = 1
    while i <= length(data) * 100
        tot += 1
        i += 1
    end
    return tot
end

function solve_problem_for(data)
    marker_length = 14
    for i = 1:length(data)
        repeat = false
        for (j, item) in enumerate(view(data, i:i+marker_length - 1))
            repeat = repeat || occursin(item, view(data, i + j:i + marker_length - 1))
            if repeat
                break
            end
        end
        if !repeat
            return i + marker_length - 1
        end
    end
end

function solve_problem_while(data)
    marker_length = 14
    i = 1
    while i <= length(data)
        repeat = false
        for (j, item) in enumerate(view(data, i:i+marker_length - 1))
            repeat = repeat || occursin(item, view(data, i + j:i + marker_length - 1))
            if repeat
                i += j - 1
                break
            end
        end
        if !repeat
            return i + marker_length - 1
        end
        i += 1
    end
end

function main()
    data = parse_data()
    @time sol = solve_problem_while(data)
    @time sol = solve_problem_while(data)
    println(sol)
    @time sol = test_while(data)
    @time sol = test_while(data)

    @time sol = solve_problem_for(data)
    @time sol = solve_problem_for(data)
    println(sol)
    @time sol = test_for(data)
    @time sol = test_for(data)
end

main()


问:
Iterating over a dictionary in Python starting from the middle
As we know we can get an iterator over a python dictionary using the following code:

```<code>(value for value in dict if <condition>)
</code>```

Let's say I want to find the first True value, and I know it is somewhere in the middle of the dictionary. (python dictionaries keep track of insertion order from 3.6 and above)

Can I somehow start iterating from the middle of the dictionary with the intent of finding the first True value, with O(1) time complexity to get to that middle point?

Or is my only option to somehow always keep track of the first True value in the dictionary?

Body:
As we know we can get an iterator over a python dictionary using the following code:

(value for value in dict if <condition>)

Let's say I want to find the first True value, and I know it is somewhere in the middle of the dictionary. (python dictionaries keep track of insertion order from 3.6 and above)

Can I somehow start iterating from the middle of the dictionary with the intent of finding the first True value, with O(1) time complexity to get to that middle point?

Or is my only option to somehow always keep track of the first True value in the dictionary?


问:
Linux command in terminal gives correct output whereas same command used in python script with subprocess not
On arch linux terminal the following command gives my active network adapter:ip route get 8.8.8.8 | sed -n 's/.* dev \([^\ ]*\) .*/\1/p' which outputs wlan0. Using this command in a python script: `#!/usr/bin/env python

import subprocess

iface = subprocess.check_output("ip route get 8.8.8.8 | sed -n 's/.* dev ([^\ ]) ./\1/p'", shell = True)
print(iface)
` outputs b'\x01\n'

I expect this has to to something with encoding or decoding but I have no idea how to solve this.


问:
How can I add absolute overlays over an img tag with object-contain behaviour?
I am working on a touch screen display for a museum. The screen will display old photos with touchable zones laid on top of it that reveal more information about people/objects show in the photos.

The screen size is fixed (it's a TV) but the photos could be in any aspect ratio; landscape or portrait.

There will be a header and footer at the top and bottom of the screen. In the middle I want to display the photo as large as possible. That is to say:

if the photo is portrait it should span the full height between the header and footer with empty space to the left and right.

if the photo is landscape (more landscape than the TV is) it should span the full width of the screen from left to right with empty space above and below.

This, I believe, is classic object-fit: contain; behaviour.

What I'm struggling with is adding the overlay on top. This consists of many rectangles that a user can touch. I know the top and left position and width and height of each box as a percent of the image it is overlaying.

I have made a tailwind playground here: https://play.tailwindcss.com/1c8QufeAFj

My understand is that I can't add the overlain boxes as children of the  tag, so they are placed in a
 that is the  tag's sibling.

Header

Footer

```

Since the boxes' positions and sizes are relative to the image, this sibling div must have the same size as the img at all times.

I can't get this to work with object-fit:contain; the sibling div that contains the boxes doesn't have the same size as the img so the boxes don't line up where they are supposed to.

If I try to find a solution without object-fit then I can either get it to work for portrait photos (using h-full) or landscape photos (using w-full) but I haven't managed to find code that works for both portrait and landscape.

Body:
I am working on a touch screen display for a museum. The screen will display old photos with touchable zones laid on top of it that reveal more information about people/objects show in the photos.

The screen size is fixed (it's a TV) but the photos could be in any aspect ratio; landscape or portrait.

There will be a header and footer at the top and bottom of the screen. In the middle I want to display the photo as large as possible. That is to say:

if the photo is portrait it should span the full height between the header and footer with empty space to the left and right.

if the photo is landscape (more landscape than the TV is) it should span the full width of the screen from left to right with empty space above and below.

This, I believe, is classic object-fit: contain; behaviour.

What I'm struggling with is adding the overlay on top. This consists of many rectangles that a user can touch. I know the top and left position and width and height of each box as a percent of the image it is overlaying.

I have made a tailwind playground here: https://play.tailwindcss.com/1c8QufeAFj

My understand is that I can't add the overlain boxes as children of the  tag, so they are placed in a
 that is the  tag's sibling.

Header

Footer

Since the boxes' positions and sizes are relative to the image, this sibling div must have the same size as the img at all times.

I can't get this to work with object-fit:contain; the sibling div that contains the boxes doesn't have the same size as the img so the boxes don't line up where they are supposed to.

If I try to find a solution without object-fit then I can either get it to work for portrait photos (using h-full) or landscape photos (using w-full) but I haven't managed to find code that works for both portrait and landscape.


问:
why css is not work corectly on vite lib mode?
I want to create a new npm package and I have a problem with vite lib mode.
I want my package to export some UI components that has some styles, project works fine on yarn dev but when I build it the style.css file inside dist directory is not used anywhere, so the styles not applied to the components

this is my vite.config.ts file

```<code>import { resolve } from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";

export default defineConfig({
  plugins: [
    react(),
    dts({
      insertTypesEntry: true,
    }),
  ],
  build: {
    lib: {
      entry: resolve(__dirname, "src/main.tsx"),
      name: "MyLib",
      fileName: "my-lib",
    },
    rollupOptions: {
      external: ["react", "react-dom"],
      output: {
        globals: {
          react: "React",
          "react-dom": "ReactDOM",
        },
      },
    },
  },
});
</code>```

and this is dist folder :

I know I can import my styles separately like :

```<code>import Skeleton from "skeleton-sh";
import "skeleton-sh/style";
</code>```

but I want is to just import package like  import Skeleton from "skeleton-sh"; and its import the styles for me

Body:
I want to create a new npm package and I have a problem with vite lib mode.
I want my package to export some UI components that has some styles, project works fine on yarn dev but when I build it the style.css file inside dist directory is not used anywhere, so the styles not applied to the components

this is my vite.config.ts file

import { resolve } from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";

export default defineConfig({
  plugins: [
    react(),
    dts({
      insertTypesEntry: true,
    }),
  ],
  build: {
    lib: {
      entry: resolve(__dirname, "src/main.tsx"),
      name: "MyLib",
      fileName: "my-lib",
    },
    rollupOptions: {
      external: ["react", "react-dom"],
      output: {
        globals: {
          react: "React",
          "react-dom": "ReactDOM",
        },
      },
    },
  },
});

and this is dist folder :

I know I can import my styles separately like :

import Skeleton from "skeleton-sh";
import "skeleton-sh/style";

but I want is to just import package like  import Skeleton from "skeleton-sh"; and its import the styles for me


问:
Two separate function calls influence each other
I have a recursive function that generates subwords of a word

```<code>
def subWords(word, arr=[]):
        if word=="":
            return arr
        currWord="#"
        if not arr:
            currWord = ""
        for i in word:
            currWord+=i
            arr.append(currWord)
        return subWords(word[1:], arr)
</code>```

When I call it one time with the word "nothuman" it prints out:

```<code>print(subWords("woman"))
</code>```

the output is :

```<code>['w', 'wo', 'wom', 'woma', 'woman', '#o', '#om', '#oma', '#oman', '#m', '#ma', '#man', '#a', '#an', '#n']

</code>```

But when I use anopther call befoire it:

```<code>print(subWords("man"))
print(subWords("woman"))
</code>```

the outputs are respectively:

```<code>['m', 'ma', 'man', '#a', '#an', '#n']
['m', 'ma', 'man', '#a', '#an', '#n', '#w', '#wo', '#wom', '#woma', '#woman', '#o', '#om', '#oma', '#oman', '#m', '#ma', '#man', '#a', '#an', '#n']
</code>```

Why does this happen?

Body:
I have a recursive function that generates subwords of a word

def subWords(word, arr=[]):
        if word=="":
            return arr
        currWord="#"
        if not arr:
            currWord = ""
        for i in word:
            currWord+=i
            arr.append(currWord)
        return subWords(word[1:], arr)

When I call it one time with the word "nothuman" it prints out:

print(subWords("woman"))

the output is :

['w', 'wo', 'wom', 'woma', 'woman', '#o', '#om', '#oma', '#oman', '#m', '#ma', '#man', '#a', '#an', '#n']

But when I use anopther call befoire it:

print(subWords("man"))
print(subWords("woman"))

the outputs are respectively:

['m', 'ma', 'man', '#a', '#an', '#n']
['m', 'ma', 'man', '#a', '#an', '#n', '#w', '#wo', '#wom', '#woma', '#woman', '#o', '#om', '#oma', '#oman', '#m', '#ma', '#man', '#a', '#an', '#n']

Why does this happen?


问:
Create a table inside excel with openpyxl, problem with headers
I need a table inside an Excel file,
like this. I can do it partially with this code using openpyxl:

```<code>import openpyxl
from openpyxl import Workbook
from openpyxl.worksheet.table import Table, TableStyleInfo

wb = Workbook()
ws = wb.active

data = [
    ['G0', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
    ['G17179136', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
    ['G17220207', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
    ['G17693868', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
]

ws.append(["Nº", "Grupo contable proveedor", "Cód. idioma",
            "Grupo contable negocio", "Grupo registro IVA neg.",
            "Tipo prov. fact.", "Cód IRPF", "IRPF %"])

for row in data:
    ws.append(row)

tab = Table(displayName="Table5", ref="A1:H4")

style = TableStyleInfo(name='TableStyleMedium2', showFirstColumn=False,
    showLastColumn=False, showRowStripes=True, showColumnStripes=False)

tab.tableStyleInfo = style

ws.add_table(tab)
wb.save("tablaprueba.xlsx")
</code>```

So i get a table with headers in the first row, but I need two rows above it, so I thought I could add them later, like this:

```<code>wb = openpyxl.load_workbook("tablaprueba.xlsx", data_only=True)
ws = wb.active

ws.insert_rows(1,2)
ws["A1"] = "PROVEEDORES"
ws["B1"] = "Proveedor"
ws["C1"] = 23

wb.save("tablaprueba2.xlsx")
</code>```

Sadly, that makes the file corrupted.
How can I make a table inside excel, with rows above the table headers?

Body:
I need a table inside an Excel file,
like this. I can do it partially with this code using openpyxl:

import openpyxl
from openpyxl import Workbook
from openpyxl.worksheet.table import Table, TableStyleInfo

wb = Workbook()
ws = wb.active

data = [
    ['G0', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
    ['G17179136', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
    ['G17220207', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
    ['G17693868', 'ASP', 'FRA', 'NAC', 'NAC', 'ASP','WHT2.5', 2.5],
]

ws.append(["Nº", "Grupo contable proveedor", "Cód. idioma",
            "Grupo contable negocio", "Grupo registro IVA neg.",
            "Tipo prov. fact.", "Cód IRPF", "IRPF %"])

for row in data:
    ws.append(row)

tab = Table(displayName="Table5", ref="A1:H4")

style = TableStyleInfo(name='TableStyleMedium2', showFirstColumn=False,
    showLastColumn=False, showRowStripes=True, showColumnStripes=False)

tab.tableStyleInfo = style

ws.add_table(tab)
wb.save("tablaprueba.xlsx")

So i get a table with headers in the first row, but I need two rows above it, so I thought I could add them later, like this:

wb = openpyxl.load_workbook("tablaprueba.xlsx", data_only=True)
ws = wb.active

ws.insert_rows(1,2)
ws["A1"] = "PROVEEDORES"
ws["B1"] = "Proveedor"
ws["C1"] = 23

wb.save("tablaprueba2.xlsx")

Sadly, that makes the file corrupted.
How can I make a table inside excel, with rows above the table headers?


问:
What is best practice regarding 'mouse' EventListeners and mobile users?
Let's say we have an event listener on a navigation that will get display:none on mobile screens. The event listener will still be applied, even though the elements are not displayed.

What is good practice here?

Ignore it, this is not a performance issue

Check the CSS property if element is displayed or check viewport size, and add conditional around addEventListner. e.g. getComputedStyle(nav.getPropertyValue('display') !== 'none'  or window.width < 1040

Check for matchMedia has hover window.matchMedia('(hover: hover)').matches // true | false (does this work for pencils with hover?)

Something else?


问:
How to set website-global hourCycle option
In many places in our project date formatting is being used. Dates is being formatted in 3-rd party libraries (such as SyncFusion EJ2 for example), and it's impossible unfortunately to define explicit format everywhere.

In Firefox hours is displayed in 0-23 format (which is fully correct). However, Chrome use 1-24 format for hour displaying.

Is there are any possibility to set hourCycle variable in Intl.DateTimeFormat globally which should affect all the page locale parameters?

Thank you very much


问:
Flutter Prevent a ScrollController from scrolling for a given number of pixels
Flutter's DraggableScrollableSheet Widget allows a sheet to be dragged into position and then continue scrolling the content without the user needing to start a new gesture (lift their finger from the screen).

This Widget however relies on a single scroll controller being declared which makes adding say a Navigator into that sheet with multiple scrolling pages difficult.

Instead I tried to mimic the behaviour with a Listener Widget that replaces the Draggable element and an attachable scroll listener that can modify the scroll position of any ScrollController it is attached to until the draggable sheet (Listener) updates the state to say that scrolling is now allowed.

It works perfectly but relies on overriding the ScrollController's position:

```<code>// state variable
bool allowScroll = false

if(! allowScroll){
    scrollController?.position.setPixels(0);
}
</code>```

However, that may not be the most efficient way to go about it. Essentially I am overriding the ScrollPosition as apposed to ignoring gestures on the scrollable widget.

Other options such as:

Changing scroll physics from Never to Always

IgnorePointer / Absorb Pointer

Changing HitTestBehaviour

do not allow the same gesture to be used and require the user to lift their finger after the state change and initiate a new gesture. That would not be the correct behaviour. The above works correctly, it just feels like a hack and I wondered if there was a better approach.

Body:
Flutter's DraggableScrollableSheet Widget allows a sheet to be dragged into position and then continue scrolling the content without the user needing to start a new gesture (lift their finger from the screen).

This Widget however relies on a single scroll controller being declared which makes adding say a Navigator into that sheet with multiple scrolling pages difficult.

Instead I tried to mimic the behaviour with a Listener Widget that replaces the Draggable element and an attachable scroll listener that can modify the scroll position of any ScrollController it is attached to until the draggable sheet (Listener) updates the state to say that scrolling is now allowed.

It works perfectly but relies on overriding the ScrollController's position:

// state variable
bool allowScroll = false

if(! allowScroll){
    scrollController?.position.setPixels(0);
}

However, that may not be the most efficient way to go about it. Essentially I am overriding the ScrollPosition as apposed to ignoring gestures on the scrollable widget.

Other options such as:

Changing scroll physics from Never to Always

IgnorePointer / Absorb Pointer

Changing HitTestBehaviour

do not allow the same gesture to be used and require the user to lift their finger after the state change and initiate a new gesture. That would not be the correct behaviour. The above works correctly, it just feels like a hack and I wondered if there was a better approach.


问:
Notification Pycharm in Windows
How to set a sound notification when a script is executed in window "run" (Process finished with exit code 0)? I would like to see a notification Pycharm  in Windows when the program window is minimized.</p>

Title: Notification Pycharm in Windows


问:
GitLab unable to pull docker image from registry container after changed password
Recently I built a Self-Hosted GitLab Server, and it was working fine. However, after I updated the GitLab account's password, I was unable to pull image from registry container. I getting following error:

unauthorized: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password.

Following is the command I run in my runner server after updated password

docker login gitlab.{name}.com:5050 -u {username} -p {password}

and the result returned from the command

Login Succeeded

After I change my GitLab account password to previous password, it working fine again. May I know why is this happening and how to resolve this?

Expected result will be able to pull image from registry container after updated password, previous password cache should be cleared.


问:
How to use Castor without default constructor?
In my project I use axis2 1.8.2 that generates java file from wsdl without default constructors. For getting instance classes use Factory.newInstance().
Also I use castor 1.4.1. Castor requires that each Java class must have default constructor.
So, I can't unmarshal xml file to generated by Java class object, due to these restrictions...
Maybe I can use this newInstance() instead of creating new object using default constructor or something else?
Thank you!

I tried to setObject to Unmarshaller object to use created instance but it didn't help me.


问:
Problems after installing MySql on Linux WSL
After a new installation of MySQL on WSL linux distribution a whole sequence of issues ocurred. Solutions are described on different posts, but I thought it would be good to have them on one place, since it concerns clean new installations of both mysql and WSL on a new Windows 11 PC, without any previous configuration changes, so 100% reproducible with the given versions. I followed the installation manuals for WSL and mysql expecting this would work out-of-the-box. My intention was to run MySQL instance on WSL and connect to it from MySQL Workbench running on the hosting Windows. Below is description of steps I've performed and how I solved the issues which occurred. Maybe it helps someone in the same scenario, or maybe someone can propose better solutions.

WSL installation

On a (new) Windows 11 PC, executed PowerShell command:

wsl --install -d Ubuntu

This installed Ubuntu 22.04.1 LTS

In the distribution set up username/password and performed necessary updates and upgrades according to https://learn.microsoft.com/en-us/windows/wsl/install.

MySQL installation

According to https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database

$ sudo apt install mysql-server

This installed:

mysql  Ver 8.0.31-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

Tried to start the instance:

$ sudo /etc/init.d/mysql start

Following warning was reported during the instance startup:

su: warning: cannot change directory to /nonexistent: No such file or directory

MySQL uses a user named 'mysql' who has '/nonexistent' set up as the home directory after installation. The home directory is registered in the file '/etc/passwd'. When you open the file in an editor, you will see the line for 'mysql' user with the '/nonexistent:' directory.

mysql:x:108:117:MySQL Server,,,:/nonexistent:/bin/false

This directory has to be changed to an existing one, e.g.: '/var/lib/mysql'. For this the instance must be stopped first:

$ sudo /etc/init.d/mysql stop

Then the home directory can be set with the command:

$ sudo usermod -d /var/lib/mysql/ mysql

After this the instance will start without the previous warining, but the following error appeared:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)

To solve this error, find where the mentioned mysqld.sock file is located. Do not stop the instance before running the command:

$ sudo find / -type s

Find the file in the output, in my case it was: '/run/mysqld/mysqld.sock'.

Find 'my.cnf' file under '/etc', in my case: '/etc/mysql/my.cnf'. Edit this file, do not use the Windows notepad.exe, but better notepad++, in order not to change the encoding, or add extra '.txt' extension.

Add following lines at the end of the file, using the exact file location:

```<code>[mysql]
socket=/run/mysqld/mysqld.sock
</code>```

I have searched for references to '/var/run' path in other .cnf files under '/etc/mysql' directory and changed them to '/run', because the '/var/run' does not exist on my distribution.

After this step, the instance can be started without any errors, or warnings.

Set up MySQL root user

While is was possible to start mysql with:

$ sudo mysql

There attempt to access the instance with the root user:

$ mysql -u root -p

Resulted in error:

Access denied for user 'root'@'localhost' (using password: NO)

The user was pre-created during installation without password, but yet cannot access the instance. To fix this issue, the 'root' user needs to be re-created:

```<code>$ sudo mysql
mysql> drop user 'root'@'localhost';
mysql> create user 'root'@'localhost' identified by '' ;
mysql> grant all privileges on *.* to 'root'@'localhost' WITH GRANT OPTION;
mysql> flush privileges;
</code>```

Connect from Workbench running on Windows

For connecting to Workbench, I've tried to use previously configured 'root' user without password.

First the IP address of WSL needs to be detected. One way is to install net-tools and use ifconfig command:

```<code>$ sudo apt install net-tools
$ ifconfig
</code>```

Then, the IP address can be seen under <BROADCAST, RUNNING, MULTICAST>  section in the output:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.114.54  netmask 255.255.240.0  broadcast 192.168.127.255

Here it was 192.168.114.54

Simpler way is to get this address from Windows PowerShell command:

wsl hostname -I

Using this address from Workbench resulted in error connecting to the server. I've solved this problem by changing the 'bind-address' setting found in the '/etc/mysql/mysql.conf.d/mysqld.cnf' file. This was previously set to 127.0.0.1. It had to be changed to:

bind-address=0.0.0.0

After this step, connection attempt from Workbench resulted in access error for the 'root' user, but it confirmed, that server was now accessible:

Failed to Connect to MySQL at 192.168.114.54:3306 with user root

Access denied for user 'root'@'192.168.112.1'

Problem with the 'root' user accessing the instance was, that each MySQL user is bound to a specific host. In my case the 'root' was bound to 'localhost'. I needed to create a new 'root' user bound to '192.168.112.1':

mysql> create user 'root'@'192.168.112.1' identified by '';

mysql> grant all privileges on . to 'root'@'192.168.112.1' WITH GRANT OPTION;

mysql> flush privileges;

After this step I could connect to MySQL instance from Workbench running on the hosting Windows without errors.

Body:
After a new installation of MySQL on WSL linux distribution a whole sequence of issues ocurred. Solutions are described on different posts, but I thought it would be good to have them on one place, since it concerns clean new installations of both mysql and WSL on a new Windows 11 PC, without any previous configuration changes, so 100% reproducible with the given versions. I followed the installation manuals for WSL and mysql expecting this would work out-of-the-box. My intention was to run MySQL instance on WSL and connect to it from MySQL Workbench running on the hosting Windows. Below is description of steps I've performed and how I solved the issues which occurred. Maybe it helps someone in the same scenario, or maybe someone can propose better solutions.

WSL installation

On a (new) Windows 11 PC, executed PowerShell command:

wsl --install -d Ubuntu

This installed Ubuntu 22.04.1 LTS

In the distribution set up username/password and performed necessary updates and upgrades according to https://learn.microsoft.com/en-us/windows/wsl/install.

MySQL installation

According to https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database

$ sudo apt install mysql-server

This installed:

mysql  Ver 8.0.31-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

Tried to start the instance:

$ sudo /etc/init.d/mysql start

Following warning was reported during the instance startup:

su: warning: cannot change directory to /nonexistent: No such file or directory

MySQL uses a user named 'mysql' who has '/nonexistent' set up as the home directory after installation. The home directory is registered in the file '/etc/passwd'. When you open the file in an editor, you will see the line for 'mysql' user with the '/nonexistent:' directory.

mysql:x:108:117:MySQL Server,,,:/nonexistent:/bin/false

This directory has to be changed to an existing one, e.g.: '/var/lib/mysql'. For this the instance must be stopped first:

$ sudo /etc/init.d/mysql stop

Then the home directory can be set with the command:

$ sudo usermod -d /var/lib/mysql/ mysql

After this the instance will start without the previous warining, but the following error appeared:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)

To solve this error, find where the mentioned mysqld.sock file is located. Do not stop the instance before running the command:

$ sudo find / -type s

Find the file in the output, in my case it was: '/run/mysqld/mysqld.sock'.

Find 'my.cnf' file under '/etc', in my case: '/etc/mysql/my.cnf'. Edit this file, do not use the Windows notepad.exe, but better notepad++, in order not to change the encoding, or add extra '.txt' extension.

Add following lines at the end of the file, using the exact file location:

[mysql]
socket=/run/mysqld/mysqld.sock

I have searched for references to '/var/run' path in other .cnf files under '/etc/mysql' directory and changed them to '/run', because the '/var/run' does not exist on my distribution.

After this step, the instance can be started without any errors, or warnings.

Set up MySQL root user

While is was possible to start mysql with:

$ sudo mysql

There attempt to access the instance with the root user:

$ mysql -u root -p

Resulted in error:

Access denied for user 'root'@'localhost' (using password: NO)

The user was pre-created during installation without password, but yet cannot access the instance. To fix this issue, the 'root' user needs to be re-created:

$ sudo mysql
mysql> drop user 'root'@'localhost';
mysql> create user 'root'@'localhost' identified by '' ;
mysql> grant all privileges on *.* to 'root'@'localhost' WITH GRANT OPTION;
mysql> flush privileges;

Connect from Workbench running on Windows

For connecting to Workbench, I've tried to use previously configured 'root' user without password.

First the IP address of WSL needs to be detected. One way is to install net-tools and use ifconfig command:

$ sudo apt install net-tools
$ ifconfig

Then, the IP address can be seen under <BROADCAST, RUNNING, MULTICAST>  section in the output:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.114.54  netmask 255.255.240.0  broadcast 192.168.127.255

Here it was 192.168.114.54

Simpler way is to get this address from Windows PowerShell command:

wsl hostname -I

Using this address from Workbench resulted in error connecting to the server. I've solved this problem by changing the 'bind-address' setting found in the '/etc/mysql/mysql.conf.d/mysqld.cnf' file. This was previously set to 127.0.0.1. It had to be changed to:

bind-address=0.0.0.0

After this step, connection attempt from Workbench resulted in access error for the 'root' user, but it confirmed, that server was now accessible:

Failed to Connect to MySQL at 192.168.114.54:3306 with user root

Access denied for user 'root'@'192.168.112.1'

Problem with the 'root' user accessing the instance was, that each MySQL user is bound to a specific host. In my case the 'root' was bound to 'localhost'. I needed to create a new 'root' user bound to '192.168.112.1':

mysql> create user 'root'@'192.168.112.1' identified by '';

mysql> grant all privileges on . to 'root'@'192.168.112.1' WITH GRANT OPTION;

mysql> flush privileges;

After this step I could connect to MySQL instance from Workbench running on the hosting Windows without errors.


问:
The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received function log
How to remove error

```<code>const fs = require('fs');
function MathTable(n) {
    for (let i = 1; i <= 12; ++i) {
        console.log(n + " * " + i + " = " + n * i)
        result = (console.log);
     }
     return result;
}

let a = MathTable(10);
console.log(a);

NodeJSWriteFile('filename',a);
</code>```

Error : The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received function log

Body:
How to remove error

const fs = require('fs');
function MathTable(n) {
    for (let i = 1; i <= 12; ++i) {
        console.log(n + " * " + i + " = " + n * i)
        result = (console.log);
     }
     return result;
}

let a = MathTable(10);
console.log(a);

NodeJSWriteFile('filename',a);

Error : The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received function log


问:
Ant Design - Form Item Custom rule triggering only when the input is different than the original value
I have a Ant Design Form Item with a custom rule to check for name uniqueness.  I only want this to be triggered in the edit scenario if the name was changed.

For example, the user edits an existing object named "Bob", he changes the name to "Fred".

In this scenario I want the validation to be triggered.

If the user edits the existing object called "Fred", and doesnt edit this field, but edits another field on the form I don't want the name uniqueness to be triggered.

```<code> <Form.Item
        name="name"
        label="name"

        rules={[
          {
            required: true,
            message: "Please input the name",
            }),
          },
          () => {
            return {
              validator: uniqueNameValidator,
            };
          },
        ]}
      >
        <Input autoFocus data-cy="dir-create-name" />
      </Form.Item>

      <Form.Item
        name="desc"
        label="Description",
        })}
      >
        <Input.TextArea data-cy="dir-create-desc" />
      </Form.Item>
</code>```

I am not sure if there is a way to compare values, and only do the validation if the previous value doesn't match the new value

Body:
I have a Ant Design Form Item with a custom rule to check for name uniqueness.  I only want this to be triggered in the edit scenario if the name was changed.

For example, the user edits an existing object named "Bob", he changes the name to "Fred".

In this scenario I want the validation to be triggered.

If the user edits the existing object called "Fred", and doesnt edit this field, but edits another field on the form I don't want the name uniqueness to be triggered.

 <Form.Item
        name="name"
        label="name"

        rules={[
          {
            required: true,
            message: "Please input the name",
            }),
          },
          () => {
            return {
              validator: uniqueNameValidator,
            };
          },
        ]}
      >
        <Input autoFocus data-cy="dir-create-name" />
      </Form.Item>

      <Form.Item
        name="desc"
        label="Description",
        })}
      >
        <Input.TextArea data-cy="dir-create-desc" />
      </Form.Item>

I am not sure if there is a way to compare values, and only do the validation if the previous value doesn't match the new value


问:
my flutter default splash screen is taking time to load
My flutter app's default splash screen takes too much time when the app opens time,

And also added the flutter flavor's

screen record is

My folder is

my main_dev.dart code is

```<code>void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await MobileAds.instance.initialize();
  FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
  _initConfig();
  final fcmToken = await FirebaseMessaging.instance.getToken();

  FirebaseMessaging.onMessageOpenedApp.listen(
      (RemoteMessage message) => {print('onMessageOpenedApp $message')});
  var configuredApp = AppConfig(
    appDisplayName: "dev Config",
    fcmToken: fcmToken!,
    baseUrl: 'https://dev-services.ducoinsure.com/',
    appInternalId: 1,
    child: const MyHomepage(),
  );
  // HttpOverrides.global = MyHttpOverrides();
  mainCommon();

  runApp(configuredApp);
}

Future<void> _initConfig() async {
  await _remoteConfig.setConfigSettings(RemoteConfigSettings(
    fetchTimeout: const Duration(seconds: 1),
    minimumFetchInterval: const Duration(seconds: 10),
  ));

  _fetchConfig();
}

void _fetchConfig() async {
  await _remoteConfig.fetchAndActivate();
}

</code>```

my InheritedWidget is

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

class AppConfig extends InheritedWidget {
  const AppConfig(
      {super.key,
      required this.appDisplayName,
      required this.appInternalId,
      required Widget child,
      required this.baseUrl,
      required this.fcmToken})
      : super(child: child);

  final String appDisplayName, baseUrl, fcmToken;
  final int appInternalId;

  static AppConfig? of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<AppConfig>();
  }

  @override
  bool updateShouldNotify(InheritedWidget oldWidget) => false;
}
</code>```

Body:
My flutter app's default splash screen takes too much time when the app opens time,

And also added the flutter flavor's

screen record is

My folder is

my main_dev.dart code is

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await MobileAds.instance.initialize();
  FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
  _initConfig();
  final fcmToken = await FirebaseMessaging.instance.getToken();

  FirebaseMessaging.onMessageOpenedApp.listen(
      (RemoteMessage message) => {print('onMessageOpenedApp $message')});
  var configuredApp = AppConfig(
    appDisplayName: "dev Config",
    fcmToken: fcmToken!,
    baseUrl: 'https://dev-services.ducoinsure.com/',
    appInternalId: 1,
    child: const MyHomepage(),
  );
  // HttpOverrides.global = MyHttpOverrides();
  mainCommon();

  runApp(configuredApp);
}

Future<void> _initConfig() async {
  await _remoteConfig.setConfigSettings(RemoteConfigSettings(
    fetchTimeout: const Duration(seconds: 1),
    minimumFetchInterval: const Duration(seconds: 10),
  ));

  _fetchConfig();
}

void _fetchConfig() async {
  await _remoteConfig.fetchAndActivate();
}

my InheritedWidget is

import 'package:flutter/material.dart';

class AppConfig extends InheritedWidget {
  const AppConfig(
      {super.key,
      required this.appDisplayName,
      required this.appInternalId,
      required Widget child,
      required this.baseUrl,
      required this.fcmToken})
      : super(child: child);

  final String appDisplayName, baseUrl, fcmToken;
  final int appInternalId;

  static AppConfig? of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<AppConfig>();
  }

  @override
  bool updateShouldNotify(InheritedWidget oldWidget) => false;
}


问:
How to install Yarn on Windows?
Why is storybook not running?
I have installed Node and Yarn, but storybook command fails.

I have copied repo from GitHub and tried to run storybook, but it doesn't work and I have no idea why. I have tried to re-install Node, install other versions, nothing helps. Any advice or working instructions on how to use Yarn on VS Code?

Title: How to install Yarn on Windows?


问:
How to detect if composable is overlapping other composable
Lets say I have a constraint layout with a column and a button inside of it. Button is constrained to the bottom of the screen.

How can I detect in compose if button covers text column? In other words - how can I check if the text column is fully visible?

Text column can become partially visible when keyboard is opened and windowSoftInputMode is set to adjustResize.

```<code>ConstraintLayout(
        modifier = Modifier.fillMaxHeight()
    ) {
        val (text, button) = createRefs()
        Column(
            modifier = Modifier
                .verticalScroll(rememberScrollState())
                .constrainAs(text) {
                    top.linkTo(parent.top)
                    bottom.linkTo(button.top)
                    height = Dimension.fillToConstraints
                }
        ) {
            Text(
                modifier = Modifier
                    .padding(horizontal = 40.dp)
                    .fillMaxWidth(),
                text = "Hello, this is text"
            )
        }
        Button(
            modifier = Modifier
                .padding(
                    top = 20.dp,
                    bottom = 20.dp,
                    start = 40.dp,
                    end = 40.dp
                )
                .fillMaxWidth()
                .constrainAs(button) {
                    bottom.linkTo(parent.bottom)
                },
            onClick = {}
        ) {
            Text(
                modifier = Modifier
                    .padding(horizontal = 20.dp)
                    .fillMaxWidth(),
                text = "And this is button"
            )
        }
    }
</code>```

Body:
Lets say I have a constraint layout with a column and a button inside of it. Button is constrained to the bottom of the screen.

How can I detect in compose if button covers text column? In other words - how can I check if the text column is fully visible?

Text column can become partially visible when keyboard is opened and windowSoftInputMode is set to adjustResize.

ConstraintLayout(
        modifier = Modifier.fillMaxHeight()
    ) {
        val (text, button) = createRefs()
        Column(
            modifier = Modifier
                .verticalScroll(rememberScrollState())
                .constrainAs(text) {
                    top.linkTo(parent.top)
                    bottom.linkTo(button.top)
                    height = Dimension.fillToConstraints
                }
        ) {
            Text(
                modifier = Modifier
                    .padding(horizontal = 40.dp)
                    .fillMaxWidth(),
                text = "Hello, this is text"
            )
        }
        Button(
            modifier = Modifier
                .padding(
                    top = 20.dp,
                    bottom = 20.dp,
                    start = 40.dp,
                    end = 40.dp
                )
                .fillMaxWidth()
                .constrainAs(button) {
                    bottom.linkTo(parent.bottom)
                },
            onClick = {}
        ) {
            Text(
                modifier = Modifier
                    .padding(horizontal = 20.dp)
                    .fillMaxWidth(),
                text = "And this is button"
            )
        }
    }


问:
How do I fix scroll-snap-align: start not working because I am scroll in another div?
Scroll-snap-align: start; is not working because I am scrolling inside a div wrapper. I need this div wrapper so that on mobile, there is no overflow-x (I referred to this post ---https://stackoverflow.com/questions/14270084/overflow-xhidden-doesnt-prevent-content-from-overflowing-in-mobile-browsers). How can I make it so that scroll snap align still works even when I scroll within the div?

I haven't tried anything yet because I have no idea :(


问:
Glue adapter: Error in GlueCursor execute An error occurred (ThrottlingException) when calling the GetStatement operation
Describe the bug
We are runnning dbtvault jobs on glue and have scheduled the same via airflow to run daily. We are running all the models through cmd commands "dbt run -m models/path/model.sql" and this model is run in a pod, so for each dbtvault models a pod is created and each dbtvault models runs on different pod. the whole process is being done using a for loop which is being implemented in the airflow dag, now all the dbtvault modelss are running simultaeneously. Since all the dbtvault models are running seprately so they are creating a different glue interactive session each in different pods each.
Now what is happening is we are experiencing a throttling exception, which on debugging we got to know that its happening becase we have reached the maximum limit of api calls for interactive session at a time, we increased the limit but still there always seems to be a random model which fails because of the throttling exception. Now the weird thing is though it fails with this throttling exception, it still shows the dbt status to be "ok completed". The problem is not in particular with a specific model, everytime the dag is run a different model fails with this issue

Steps To Reproduce

Connect dbtvault with glue
Run dbtvault models simultaeneously in a way that all of them create different glue interactive sessions
Glue version - 3.0
DBT version - 1.1.2
Spark - 1.1.0

Screenshots and log output

`

```<code>[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:587} INFO - Creating pod run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0 with labels: {'dag_id': 'care_data_model_airflow_dag', 'task_id': 'run_dbt_cmd_ref_clm_cs', 'run_id': 'manual__2022-12-02T135414.2097260000-21e70563e', 'kubernetes_pod_operator': 'True', 'try_number': '1'}
[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:380} INFO - Found matching pod run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0 with labels {'airflow_kpo_in_cluster': 'True', 'airflow_version': '2.4.2', 'dag_id': 'care_data_model_airflow_dag', 'foo': 'bar', 'kubernetes_pod_operator': 'True', 'run_id': 'manual__2022-12-02T135414.2097260000-21e70563e', 'task_id': 'run_dbt_cmd_ref_clm_cs', 'try_number': '1'}
[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:381} INFO - `try_number` of task_instance: 1
[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:382} INFO - `try_number` of pod: 1
[2022-12-02, 19:30:13 IST] {pod_manager.py:180} WARNING - Pod not yet started: run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0
[2022-12-02, 19:30:14 IST] {pod_manager.py:180} WARNING - Pod not yet started: run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0
[2022-12-02, 19:30:15 IST] {pod_manager.py:228} INFO - + cd /apps/dbt_vault
[2022-12-02, 19:30:15 IST] {pod_manager.py:228} INFO - + dbt run -m models/dbtvault_models/reference/ref_clm_cs/dbtv/ref_clm_cs.sql --vars '{"start_date":"1640995200000","end_date":"1669989282999"}'
[2022-12-02, 19:30:16 IST] {pod_manager.py:228} INFO - 14:00:16  Running with dbt=1.1.2
[2022-12-02, 19:30:16 IST] {pod_manager.py:228} INFO - 14:00:16  Unable to do partial parsing because config vars, config profile, or config target have changed
[2022-12-02, 19:30:16 IST] {pod_manager.py:228} INFO - 14:00:16  Unable to do partial parsing because profile has changed
[2022-12-02, 19:30:26 IST] {pod_manager.py:228} INFO - 14:00:26  Found 158 models, 4 tests, 0 snapshots, 0 analyses, 716 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics
[2022-12-02, 19:30:26 IST] {pod_manager.py:228} INFO - 14:00:26
[2022-12-02, 19:30:59 IST] {pod_manager.py:228} INFO - 14:00:59  Concurrency: 1 threads (target='prod')
[2022-12-02, 19:30:59 IST] {pod_manager.py:228} INFO - 14:00:59
[2022-12-02, 19:30:59 IST] {pod_manager.py:228} INFO - 14:00:59  1 of 1 START incremental model empower_uat_raw.ref_clm_cs ...................... [RUN]
[2022-12-02, 19:31:13 IST] {pod_manager.py:228} INFO - 14:01:13  Glue adapter: Error in GlueCursor execute An error occurred (ThrottlingException) when calling the GetStatement operation (reached max retries: 4): Rate exceeded
[2022-12-02, 19:31:13 IST] {pod_manager.py:228} INFO - 14:01:13  Glue adapter: __init__() missing 3 required positional arguments: 'cwd', 'cmd', and 'message'
[2022-12-02, 19:31:14 IST] {pod_manager.py:228} INFO - 14:01:14  1 of 1 OK created incremental model empower_uat_raw.ref_clm_cs ................. [�[32mOK�[0m in 15.86s]
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15  Finished running 1 incremental model in 48.33s.
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15  �[32mCompleted successfully�[0m
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15  Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1
[2022-12-02, 19:31:25 IST] {pod_manager.py:228} INFO - 14:01:25  Error sending message, disabling tracking
[2022-12-02, 19:31:26 IST] {pod_manager.py:275} INFO - Pod run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0 has phase Running
[2022-12-02, 19:31:28 IST] {kubernetes_pod.py:475} INFO - Deleting pod: run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0
[2022-12-02, 19:31:28 IST] {taskinstance.py:1406} INFO - Marking task as SUCCESS. dag_id=care_data_model_airflow_dag, task_id=run_dbt_cmd_ref_clm_cs, execution_date=20221202T135414, start_date=20221202T140011, end_date=20221202T140128
[2022-12-02, 19:31:28 IST] {local_task_job.py:164} INFO - Task exited with return code 0
[2022-12-02, 19:31:28 IST] {local_task_job.py:273} INFO - 1 downstream tasks scheduled from follow-on schedule check
</code>```

`

I have tried increasing DPU for the models.

Body:
Describe the bug
We are runnning dbtvault jobs on glue and have scheduled the same via airflow to run daily. We are running all the models through cmd commands "dbt run -m models/path/model.sql" and this model is run in a pod, so for each dbtvault models a pod is created and each dbtvault models runs on different pod. the whole process is being done using a for loop which is being implemented in the airflow dag, now all the dbtvault modelss are running simultaeneously. Since all the dbtvault models are running seprately so they are creating a different glue interactive session each in different pods each.
Now what is happening is we are experiencing a throttling exception, which on debugging we got to know that its happening becase we have reached the maximum limit of api calls for interactive session at a time, we increased the limit but still there always seems to be a random model which fails because of the throttling exception. Now the weird thing is though it fails with this throttling exception, it still shows the dbt status to be "ok completed". The problem is not in particular with a specific model, everytime the dag is run a different model fails with this issue

Steps To Reproduce

Connect dbtvault with glue
Run dbtvault models simultaeneously in a way that all of them create different glue interactive sessions
Glue version - 3.0
DBT version - 1.1.2
Spark - 1.1.0

Screenshots and log output

`

[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:587} INFO - Creating pod run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0 with labels: {'dag_id': 'care_data_model_airflow_dag', 'task_id': 'run_dbt_cmd_ref_clm_cs', 'run_id': 'manual__2022-12-02T135414.2097260000-21e70563e', 'kubernetes_pod_operator': 'True', 'try_number': '1'}
[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:380} INFO - Found matching pod run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0 with labels {'airflow_kpo_in_cluster': 'True', 'airflow_version': '2.4.2', 'dag_id': 'care_data_model_airflow_dag', 'foo': 'bar', 'kubernetes_pod_operator': 'True', 'run_id': 'manual__2022-12-02T135414.2097260000-21e70563e', 'task_id': 'run_dbt_cmd_ref_clm_cs', 'try_number': '1'}
[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:381} INFO - `try_number` of task_instance: 1
[2022-12-02, 19:30:13 IST] {kubernetes_pod.py:382} INFO - `try_number` of pod: 1
[2022-12-02, 19:30:13 IST] {pod_manager.py:180} WARNING - Pod not yet started: run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0
[2022-12-02, 19:30:14 IST] {pod_manager.py:180} WARNING - Pod not yet started: run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0
[2022-12-02, 19:30:15 IST] {pod_manager.py:228} INFO - + cd /apps/dbt_vault
[2022-12-02, 19:30:15 IST] {pod_manager.py:228} INFO - + dbt run -m models/dbtvault_models/reference/ref_clm_cs/dbtv/ref_clm_cs.sql --vars '{"start_date":"1640995200000","end_date":"1669989282999"}'
[2022-12-02, 19:30:16 IST] {pod_manager.py:228} INFO - 14:00:16  Running with dbt=1.1.2
[2022-12-02, 19:30:16 IST] {pod_manager.py:228} INFO - 14:00:16  Unable to do partial parsing because config vars, config profile, or config target have changed
[2022-12-02, 19:30:16 IST] {pod_manager.py:228} INFO - 14:00:16  Unable to do partial parsing because profile has changed
[2022-12-02, 19:30:26 IST] {pod_manager.py:228} INFO - 14:00:26  Found 158 models, 4 tests, 0 snapshots, 0 analyses, 716 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics
[2022-12-02, 19:30:26 IST] {pod_manager.py:228} INFO - 14:00:26
[2022-12-02, 19:30:59 IST] {pod_manager.py:228} INFO - 14:00:59  Concurrency: 1 threads (target='prod')
[2022-12-02, 19:30:59 IST] {pod_manager.py:228} INFO - 14:00:59
[2022-12-02, 19:30:59 IST] {pod_manager.py:228} INFO - 14:00:59  1 of 1 START incremental model empower_uat_raw.ref_clm_cs ...................... [RUN]
[2022-12-02, 19:31:13 IST] {pod_manager.py:228} INFO - 14:01:13  Glue adapter: Error in GlueCursor execute An error occurred (ThrottlingException) when calling the GetStatement operation (reached max retries: 4): Rate exceeded
[2022-12-02, 19:31:13 IST] {pod_manager.py:228} INFO - 14:01:13  Glue adapter: __init__() missing 3 required positional arguments: 'cwd', 'cmd', and 'message'
[2022-12-02, 19:31:14 IST] {pod_manager.py:228} INFO - 14:01:14  1 of 1 OK created incremental model empower_uat_raw.ref_clm_cs ................. [�[32mOK�[0m in 15.86s]
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15  Finished running 1 incremental model in 48.33s.
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15  �[32mCompleted successfully�[0m
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15
[2022-12-02, 19:31:15 IST] {pod_manager.py:228} INFO - 14:01:15  Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1
[2022-12-02, 19:31:25 IST] {pod_manager.py:228} INFO - 14:01:25  Error sending message, disabling tracking
[2022-12-02, 19:31:26 IST] {pod_manager.py:275} INFO - Pod run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0 has phase Running
[2022-12-02, 19:31:28 IST] {kubernetes_pod.py:475} INFO - Deleting pod: run-dbt-cmd-ref-clm-cs-a4ec0e9599314d35ade1019a995bbcf0
[2022-12-02, 19:31:28 IST] {taskinstance.py:1406} INFO - Marking task as SUCCESS. dag_id=care_data_model_airflow_dag, task_id=run_dbt_cmd_ref_clm_cs, execution_date=20221202T135414, start_date=20221202T140011, end_date=20221202T140128
[2022-12-02, 19:31:28 IST] {local_task_job.py:164} INFO - Task exited with return code 0
[2022-12-02, 19:31:28 IST] {local_task_job.py:273} INFO - 1 downstream tasks scheduled from follow-on schedule check

`

I have tried increasing DPU for the models.


问:
Filtering tf.dataset results in an endless process
I'm filtering the dataset according to certain labels. Once I call the filtering method, everything is fine. But once I call next(iter(dataset))for certain values it gets processing for more the 12 hours - for other value it just give the result.

My filtering line code is:

```<code> def balanced_dataset(dataset, labels_list, sample_size=1000):
    datasets_list = []
       for label in labels_list:
          print(f'Preparando o dataset {label}')
          locals()[label] = dataset.filter(lambda x, y: tf.greater(tf.reduce_sum(tf.cast(tf.equal(tf.constant(label, dtype=tf.int64), y), tf.float32)), tf.constant(0.)))
          datasets_list.append(locals()[label].take(sample_size))
      ds = tf.data.Dataset.from_tensor_slices(datasets_list)
      # 2. extract all elements from datasets and concat them into one dataset
      concat_ds = ds.interleave(lambda x: x, cycle_length=len(labels_list), num_parallel_calls=tf.data.AUTOTUNE, deterministic=False)

    return concat_ds
</code>```

Body:
I'm filtering the dataset according to certain labels. Once I call the filtering method, everything is fine. But once I call next(iter(dataset))for certain values it gets processing for more the 12 hours - for other value it just give the result.

My filtering line code is:

 def balanced_dataset(dataset, labels_list, sample_size=1000):
    datasets_list = []
       for label in labels_list:
          print(f'Preparando o dataset {label}')
          locals()[label] = dataset.filter(lambda x, y: tf.greater(tf.reduce_sum(tf.cast(tf.equal(tf.constant(label, dtype=tf.int64), y), tf.float32)), tf.constant(0.)))
          datasets_list.append(locals()[label].take(sample_size))
      ds = tf.data.Dataset.from_tensor_slices(datasets_list)
      # 2. extract all elements from datasets and concat them into one dataset
      concat_ds = ds.interleave(lambda x: x, cycle_length=len(labels_list), num_parallel_calls=tf.data.AUTOTUNE, deterministic=False)

    return concat_ds


问:
How can i delete the Bookmark in word using js api or is this the way to delete the bookmark as i tried?
the error is showed in image please check
Here is the code for deleting the bookmark from word addin using js api

```<code>  Word.run(async (context) => {

            console.log("result", result);
            const range :any = context.document.getSelection();

            return context.sync().then(async function ()
            {
              context.load(range);
              await context.sync();
              let text = range.text
              console.log("item", item.ImageId, text);

              if (item.ImageId == text) {
                console.log("item bookmark",item.bookmark)
                range.hyperlink = "#" + item.bookmark;

                //delete the bookmark after 5 sec
                setTimeout(()=>{
                  console.log("setTimeout called")
                  range.deleteBookmark(item.bookmark)
                },5000)

              } else {
                console.log("range not matched");
              }

              await context.sync();
            });
</code>```

Body:
the error is showed in image please check
Here is the code for deleting the bookmark from word addin using js api

  Word.run(async (context) => {

            console.log("result", result);
            const range :any = context.document.getSelection();

            return context.sync().then(async function ()
            {
              context.load(range);
              await context.sync();
              let text = range.text
              console.log("item", item.ImageId, text);

              if (item.ImageId == text) {
                console.log("item bookmark",item.bookmark)
                range.hyperlink = "#" + item.bookmark;

                //delete the bookmark after 5 sec
                setTimeout(()=>{
                  console.log("setTimeout called")
                  range.deleteBookmark(item.bookmark)
                },5000)

              } else {
                console.log("range not matched");
              }

              await context.sync();
            });


问:
Vue js how to emit event on chart js on click
I use chart js with vue js, and show some data on dashboard. But what i am trying to do now is to make a function when i click on chart to go on the responsibile table on another view, maybe with filter also.
I mean if i have a chart where i show how many user are and how many user is_suspended are on user table, when i click on side where i see how many is_suspended are to go on users table, maybe to add also filter to show  is_suspended only

this is my chart js

```<code><template>
    <div class="container card mx-0 my-2 p-2">
        <Doughnut v-if="loaded"
            :chart-options="chartOptions"
            :chart-data="chartData"
            :width="width"
            :height="height"
        />
    </div>
</template>

<script>
    import { Doughnut } from 'vue-chartjs/legacy'
    import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale } from 'chart.js'

    ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)

    export default {
        name: 'PieChart',
        components: { Doughnut },

        props: {
            width: {
                type: Number,
                default: 200
            },
            height: {
                type: Number,
                default: 100
            },
        },

        data: () => ({
            chartOptions: {
                responsive: true
            },
            loaded: false,
            chartData: {}
        }),
        async mounted () {
            this.loaded = false

            try {
                let response = await fetch('/home/user-statistics-doughnutchart')
                let userdata = await response.json()
                // console.log(userdata)
                this.chartData = userdata

                this.loaded = true
            } catch (e) {
                console.error(e)
            }
        }
    }
</script>
</code>```

and my controller

```<code>$users = User::count();
        $active = User::where('is_suspended', 0)->count();
        $suspendedUsers = User::where('is_suspended', 1)->count();

        $post_data = array(
            'labels' => [
                'Accounts '.'('.$users.')',
                'Active '.'('.$active.')',
                'Suspended '.'('.$suspendedUsers.')',
            ],
            'datasets' => [
                [
                    'backgroundColor' => ['#695CFE', '#191641', '#F2C335'],
                    'data' => [$users, $active, $suspendedUsers]
                ],
            ]
        );
</code>```

Body:
I use chart js with vue js, and show some data on dashboard. But what i am trying to do now is to make a function when i click on chart to go on the responsibile table on another view, maybe with filter also.
I mean if i have a chart where i show how many user are and how many user is_suspended are on user table, when i click on side where i see how many is_suspended are to go on users table, maybe to add also filter to show  is_suspended only

this is my chart js

<template>

        <Doughnut v-if="loaded"
            :chart-options="chartOptions"
            :chart-data="chartData"
            :width="width"
            :height="height"
        />

</template>

and my controller

$users = User::count();
        $active = User::where('is_suspended', 0)->count();
        $suspendedUsers = User::where('is_suspended', 1)->count();

        $post_data = array(
            'labels' => [
                'Accounts '.'('.$users.')',
                'Active '.'('.$active.')',
                'Suspended '.'('.$suspendedUsers.')',
            ],
            'datasets' => [
                [
                    'backgroundColor' => ['#695CFE', '#191641', '#F2C335'],
                    'data' => [$users, $active, $suspendedUsers]
                ],
            ]
        );


问:
C++ sin() function sometimes returns different values for the same argument
Sometimes sin function in C++ returns slightly different values (in 8th decimal position).
What can be the reason?

```<code>#include <fstream>
#include <iostream>
#include <thread>
#include <vector>
#include <cmath>
#include <immintrin.h>

std::ofstream toFile("file.txt");
double xValue = 1.3808129283228576;

void func(int nValues) {
    std::vector<double> results(nValues);
    for (int i=0; i<nValues; i++) {
        results[i] = sin(xValue);
        uint64_t *ptrX     = (uint64_t *)&xValue;
        uint64_t *ptrValue = (uint64_t *)&results[i];
        toFile << xValue << " " << results[i] << "   " << std::hex << *ptrX << " " << *ptrValue << " " <<
                  _mm_getcsr() << "\n";
        std::this_thread::sleep_for(std::chrono::milliseconds(30));
    }
    for (int i=0; i+1<nValues; i++)
        if (fabs(results[i] - results[i+1]) > 1e-10) {
            toFile << "ERROR:\n" << results[i] << "\n" << results[i+1] << "\n";
            std::cout <<  "ERROR:\n" << results[i] << "\n" << results[i+1] << "\n";
            return;
        }
    toFile << "OK\n";
    std::cout << "OK\n";
}

int main() {
    toFile.   precision(16);
    std::cout.precision(16);
    func(1000);
    return 0;
}

</code>```

The values in file.txt are, e.g.:

```<code>1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.982007359072273    3ff617cf4c10a691 3fef6c9ab274b21b 1fa0
1.380812928322858 0.982007359072273    3ff617cf4c10a691 3fef6c9ab274b21b 1fa0
1.380812928322858 0.982007359072273    3ff617cf4c10a691 3fef6c9ab274b21b 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
</code>```

Compiler: g++ 9.2 as well as 11.2 from Mingw (Windows), flags: -O3

Update: added output of the hex-representation of xValue and sin(xValue).

Update: added result of the _mm_getcsr() function.

Body:
Sometimes sin function in C++ returns slightly different values (in 8th decimal position).
What can be the reason?

#include <fstream>
#include <iostream>
#include <thread>
#include <vector>
#include <cmath>
#include <immintrin.h>

std::ofstream toFile("file.txt");
double xValue = 1.3808129283228576;

void func(int nValues) {
    std::vector<double> results(nValues);
    for (int i=0; i<nValues; i++) {
        results[i] = sin(xValue);
        uint64_t *ptrX     = (uint64_t *)&xValue;
        uint64_t *ptrValue = (uint64_t *)&results[i];
        toFile << xValue << " " << results[i] << "   " << std::hex << *ptrX << " " << *ptrValue << " " <<
                  _mm_getcsr() << "\n";
        std::this_thread::sleep_for(std::chrono::milliseconds(30));
    }
    for (int i=0; i+1<nValues; i++)
        if (fabs(results[i] - results[i+1]) > 1e-10) {
            toFile << "ERROR:\n" << results[i] << "\n" << results[i+1] << "\n";
            std::cout <<  "ERROR:\n" << results[i] << "\n" << results[i+1] << "\n";
            return;
        }
    toFile << "OK\n";
    std::cout << "OK\n";
}

int main() {
    toFile.   precision(16);
    std::cout.precision(16);
    func(1000);
    return 0;
}

The values in file.txt are, e.g.:

1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.982007359072273    3ff617cf4c10a691 3fef6c9ab274b21b 1fa0
1.380812928322858 0.982007359072273    3ff617cf4c10a691 3fef6c9ab274b21b 1fa0
1.380812928322858 0.982007359072273    3ff617cf4c10a691 3fef6c9ab274b21b 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0
1.380812928322858 0.9820073703281703   3ff617cf4c10a691 3fef6c9ab87fb1c9 1fa0

Compiler: g++ 9.2 as well as 11.2 from Mingw (Windows), flags: -O3

Update: added output of the hex-representation of xValue and sin(xValue).

Update: added result of the _mm_getcsr() function.


问:
Segmentation fault while training a ml model using yolov5
I'm doing a project on object detection using yolov5. After I run train.py file for yolov5, it stops causing segmentation error. How do I solve this?</p>
```<code>zsh: segmentation fault  python3 train.py --img 640 --cfg yolov5m.yaml --hyp  --batch 5 --epochs 1
</code>```

Body:
I'm doing a project on object detection using yolov5. After I run train.py file for yolov5, it stops causing segmentation error. How do I solve this?

zsh: segmentation fault  python3 train.py --img 640 --cfg yolov5m.yaml --hyp  --batch 5 --epochs 1


问:
Accepting DB details from command line in spiring boot
I found these 2 lines in a project and wondering from where the values for DB_URL and DB_USER. These two variables are not declared in the application.propeties file.

If the value is coming from the command line how can I pass the value? Can someone show a sample command for how to pass the data for these 2 variables from command line?

```<code>spring.datasource.url=$(DB_URL}
spring.datasource.username=$(DB_USER)
</code>```

Body:
I found these 2 lines in a project and wondering from where the values for DB_URL and DB_USER. These two variables are not declared in the application.propeties file.

If the value is coming from the command line how can I pass the value? Can someone show a sample command for how to pass the data for these 2 variables from command line?

spring.datasource.url=$(DB_URL}
spring.datasource.username=$(DB_USER)


问:
Dynamically add meta Tags based on route in Angular which should render in chat-bots
I'm using Angular 13 for my application which is hosted in S3 Bucket. Thus far, I have my routes set up, and the page title and meta tags changes dynamically based on the activated route using @angular/platform-browser in browser but when i try to share the link in any social media platform there chat-bot is basically fetching the default meta tags and URL link preview is been generated based on those meta tags

I am not able to get dynamic meta tags to show the preview of the link, when shared in chat-bots

I have tried researching on the web and found some library's which didn't work out and i have even tried out SSR(server side rendering) where i am facing an unknow build error.

I have even tried Hosting in EC2 and running server using docker and port mapping it to the domain.

I assume, Any library we use should be able to assign dynamic meta tags content as they run script in backend process where as chat-bot doesn't run java script so thats the reason then are unable to fetch dynamic meta tags

Can anyone please let me know , if there's a way to achieve the dynamic meta tags , without changing the stack from Angular


问:
MATLAB nested parfor indexing
I converted a nested for loo into a unique parfor loop. The nested for loop looked like this:

```<code>for RIPETIZIONE = 1:N_RIPETIZIONI
   for k=1:size(lambda_tol_vector)
       %do things
   end
end
</code>```

Now, the parfor loop takes on the following values:

```<code>parfor n=1:N_RIPETIZIONI*K
   [~,k]=ind2sub([N_RIPETIZIONI,K],n);
...
</code>```

hence merging into a single loop the nested loops of before.
Now, inside the "outer" nested loop (for RIPETIZIONE = 1:N_RIPETIZIONI), but outside the inner loop (for k=1:size(lambda_tol_vector)), there was this part:

```<code>scv=size(columns_validation_test,2);

for counter_columns = 1:scv
   COLONNA_SELEZIONATA=columns_validation_test(counter_columns);
   Ctest=zeros(size(A.Value));
   Ctest(:,COLONNA_SELEZIONATA)=C(:,COLONNA_SELEZIONATA);
   Cvalidation=C-Ctest;
   for j=1:size(lambdavector)
       RMSE_initial_test{counter_columns}(j)=sqrt(sum2(Diff_sq_initial{j}.*Ctest)/sum(Ctest(:)));
       RMSE_final_corrected_validation{counter_columns}(j)=sqrt(sum2(Diff_sq_corrected{j}.*Cvalidation)/sum(Cvalidation(:)));
       RMSE_final_test{counter_columns}(j)=sqrt(sum2(Diff_sq{j}.*Ctest)/sum(Ctest(:)));
       RMSE_final_corrected_test{counter_columns}(j)=sqrt(sum2(Diff_sq_corrected{j}.*Ctest)/sum(Ctest(:)));

   end
       [~,arg_min_temp_1]=min(RMSE_final_corrected_validation{counter_columns});
end

</code>```

which I need now to include in the unique parfor loop with a pope indexing. Fo instance, Diff_sq_initial, Diff_sq_corrected and Diff_sq are all defined within the parfor loop with an index of n in the new loop (whereas previously they were indexed with k inside the for k=1:size(lambda_tol_vector) loop).
Is there a way to properly indexing those variables so that they fit the new parfor loop?

Title: MATLAB nested parfor indexing

Body:
I converted a nested for loo into a unique parfor loop. The nested for loop looked like this:

for RIPETIZIONE = 1:N_RIPETIZIONI
   for k=1:size(lambda_tol_vector)
       %do things
   end
end

Now, the parfor loop takes on the following values:

parfor n=1:N_RIPETIZIONI*K
   [~,k]=ind2sub([N_RIPETIZIONI,K],n);
...

hence merging into a single loop the nested loops of before.
Now, inside the "outer" nested loop (for RIPETIZIONE = 1:N_RIPETIZIONI), but outside the inner loop (for k=1:size(lambda_tol_vector)), there was this part:

scv=size(columns_validation_test,2);

for counter_columns = 1:scv
   COLONNA_SELEZIONATA=columns_validation_test(counter_columns);
   Ctest=zeros(size(A.Value));
   Ctest(:,COLONNA_SELEZIONATA)=C(:,COLONNA_SELEZIONATA);
   Cvalidation=C-Ctest;
   for j=1:size(lambdavector)
       RMSE_initial_test{counter_columns}(j)=sqrt(sum2(Diff_sq_initial{j}.*Ctest)/sum(Ctest(:)));
       RMSE_final_corrected_validation{counter_columns}(j)=sqrt(sum2(Diff_sq_corrected{j}.*Cvalidation)/sum(Cvalidation(:)));
       RMSE_final_test{counter_columns}(j)=sqrt(sum2(Diff_sq{j}.*Ctest)/sum(Ctest(:)));
       RMSE_final_corrected_test{counter_columns}(j)=sqrt(sum2(Diff_sq_corrected{j}.*Ctest)/sum(Ctest(:)));

   end
       [~,arg_min_temp_1]=min(RMSE_final_corrected_validation{counter_columns});
end

which I need now to include in the unique parfor loop with a pope indexing. Fo instance, Diff_sq_initial, Diff_sq_corrected and Diff_sq are all defined within the parfor loop with an index of n in the new loop (whereas previously they were indexed with k inside the for k=1:size(lambda_tol_vector) loop).
Is there a way to properly indexing those variables so that they fit the new parfor loop?


问:
How do I override every banner title tag from H2 to H1 of my wordpress theme?
I'm using Real Homes theme, and I have this weird problem. After finishing up my website, I've noticed that some titles are not H1 tag, but H2. As I said, not everyone. I thought it might be the template, but some of the ones with H1 title use a template. So I checked them manually and I can't figure out where to edit this. So my question became: how do I override the banner title tag so that every banner title is H1 tag? Here is an example of a code in H1 and H2 tags. Thanks!

```<code></div>
        <section id="rh-banner-attachment-parallax" class="rh_banner rh_banner__image" style="background-image: url('');">
        <div class="rh_banner__cover"></div>
        <div class="rh_banner__wrap">
            <h2 class="rh_banner__title">Real Estate</h2>
                            <div class="rh_banner__controls">
</code>```
```<code> </div>
    <section id="rh-banner-attachment-parallax" class="rh_banner rh_banner__image" style="background-image: url('');">
    <div class="rh_banner__cover"></div>
    <div class="rh_banner__wrap">
                <h1 class="rh_banner__title">News</h1>
                    </div>
</section>  <section class="rh_section rh_section--flex rh_wrap--padding rh_wrap--topPadding">
                <div class="rh_page rh_page__listing_page rh_page__news rh_page__main">
</code>```

I tried editing some files in editor theme, the one inside wordpress, but nothing worked. In the end, I couldn't even find the exact line I was looking for. I guess I was hoping to find a line do edit, but I'm not skilled enough I'm afraid. That's why I want to override the info. I also tried searching for a solution here, but nothing seems to work for this theme. Thanks in advance.

Edit: you can see the problem in the demo of this theme as well: https://modern.realhomes.io
The Contact page and News page have the banner title in H1 tag, while the other pages are in H2 tag.

Body:
I'm using Real Homes theme, and I have this weird problem. After finishing up my website, I've noticed that some titles are not H1 tag, but H2. As I said, not everyone. I thought it might be the template, but some of the ones with H1 title use a template. So I checked them manually and I can't figure out where to edit this. So my question became: how do I override the banner title tag so that every banner title is H1 tag? Here is an example of a code in H1 and H2 tags. Thanks!

Real Estate

News

I tried editing some files in editor theme, the one inside wordpress, but nothing worked. In the end, I couldn't even find the exact line I was looking for. I guess I was hoping to find a line do edit, but I'm not skilled enough I'm afraid. That's why I want to override the info. I also tried searching for a solution here, but nothing seems to work for this theme. Thanks in advance.

Edit: you can see the problem in the demo of this theme as well: https://modern.realhomes.io
The Contact page and News page have the banner title in H1 tag, while the other pages are in H2 tag.


问:
Lots of issues what can I say?
So having downloaded the tag assistant extension for chrome and running it to debug for the preview of the tags I made previously to track music stream conversions (spotify), tag assistant clued me in to several issues. I also checked through google analytics and my tags are indeed, not firing.

I have a lot more than just 2 screenshots but if I can somehow send them your way, I am happy to includ all of them as well as the explanations they offer to fix the problems (which I did try as well as other potential solutions that I googled) I will include it all. It's kind of hard to explain but basically I literally spent the entire night trying to figure this out on my own so I wouldn't need to bother anyone with my problems, and I tried everything they suggested for all of the error messages, and still could not figure out what the problem is or how to fix it. I've included screenshots of the error messages themselves as well as where the links take you. It is now 4:30am so I really need to sleep, but I wanted to get this out there because I am super worried about it. I really need to be able to track my conversions for this ad campaign with reddit as soon as possible because this song is one that I just released and I need to get word out quickly, or else it will become yesterday's news. That may sound dramatic, but if you've ever made and distributed music, it really is the truth that every second counts the moment you release it!

Literally, I just need to know that my ads are working properly, and that's it. I just really need help, and from the bottom of my heart I would appreciate you so much if you have anything you could possibly help with.

Also, if there is a customer service line for google tag manager, please let me know, I know this is a huge question and favor to ask, so yeah if you know of it let me know, I couldn't find a number or email or any form of communication with a real person when I looked around for it.
Thank you so much.

Stay golden

I tried everything each of the solutions suggested by google tag manager's tag assistant extension for chrome as well as various things online that I found. I was hoping to figure out if the people who are clicking the button on the ad I'm running are actually being taken to the right song, the right website, it's not crashing or anything.

Thank you

Title: Lots of issues what can I say?


问:
VBA to PCOM connection
I am trying to get specific numbers from IBM Pcomm to Excel. I want to use the search.text function to do a column offset to retrieve a string of numbers to excel (Say to cell A1) on the same row as the searched text.

Thank you in advance!

I have tried searching through the web without any success.

Title: VBA to PCOM connection


问:
problem with anova refit argument: objects must inherit from classes "gls"
I am testing whether I should include certain variance structure in my model, for which I'm using the LRT test from the anova function. The problem is that when I set the argument refit to FALSE (in fact, it doesn't work with TRUE neither), anova returns an error that I don't know how to handle.

```<code>> m1 <- lme(Compscore ~ Cond * Time, random = ~1|Participant, data = lyster.long4)
> m4 <- update(m1, weights = varIdent(form = ~ Time | Cond))
> an.res <- anova.lme(m1, m4, refit=FALSE)
Error in anova.lme(m1, m4, refit = FALSE) :
objects must inherit from classes "gls", "gnls", "lm", "lmList", "lme", "nlme", "nlsList", or
"nls"
</code>```

Without that argument, the function works fine. I'm using lme package.

Body:
I am testing whether I should include certain variance structure in my model, for which I'm using the LRT test from the anova function. The problem is that when I set the argument refit to FALSE (in fact, it doesn't work with TRUE neither), anova returns an error that I don't know how to handle.

> m1 <- lme(Compscore ~ Cond * Time, random = ~1|Participant, data = lyster.long4)
> m4 <- update(m1, weights = varIdent(form = ~ Time | Cond))
> an.res <- anova.lme(m1, m4, refit=FALSE)
Error in anova.lme(m1, m4, refit = FALSE) :
objects must inherit from classes "gls", "gnls", "lm", "lmList", "lme", "nlme", "nlsList", or
"nls"

Without that argument, the function works fine. I'm using lme package.


问:
How to configure elasticsearch 6 java
I'm using Spring version 2.1.18.RELEASE (I can't change this version)
I need to implement a crud repository for elasticsearch, for this I connect spring-data-elasticsearch (version 3.1.21.RELEASE is automatically pulled up) with elasticsearch 6.4.3
I tried a bunch of manuals, but elastic is so different from version to version that I can't find a solution. I need to connect to remote server via https with username and password.

pom:

```<code>        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
        </dependency>
</code>```

Config:

```<code>@Configuration
@EnableElasticsearchRepositories(basePackages = "path.to.elastic")
@ComponentScan(basePackages = {"path.to.elastic"})
public class ElasticConfiguration {

    private final int port = 1234;

    @Bean
    public Client client() throws Exception {

        Settings settings = Settings.builder().put("cluster.name", "test")
                .put("xpack.security.user", "login:pass")
                .put("xpack.security.transport.ssl.enabled", "true")
                .put("xpack.security.transport.ssl.enabled", "true")
                .build();

        return new PreBuiltTransportClient(settings)
                .addTransportAddress(new TransportAddress(InetAddress.getByName("bah.elk1.com"), port))
                .addTransportAddress(new TransportAddress(InetAddress.getByName("bah.elk2.com"), port))
                .addTransportAddress(new TransportAddress(InetAddress.getByName("bah.elk3.com"), port));
    }

    @Bean
    public ElasticsearchOperations elasticsearchTemplate() throws Exception {
        return new ElasticsearchTemplate(client());
    }
}
</code>```

Repository:

```<code>@Repository
public interface ElkThingRepository extends ElasticsearchRepository<Things, Long> {

    List<Things> findByEarNameAndName(String earName, String thingName);
}
</code>```

Service interface:

```<code>public interface ElkThingsService {

    List<Things> simpleGet(String thingName);
}
</code>```

Service impl:

```<code>@Service
public class ElkThingsServiceImpl implements ElkThingsService {

        private final ElkThingsRepository elkThingsRepository;

        @Autowired
        public ElkThingsServiceImpl(ElkThingsRepository elkThingsRepository) {
            this.elkThingsRepository = elkThingsRepository;
        }

        public List<Things> simpleGet(String thingsName) {
            return elkThingsRepository.findByEarNameAndName(AppInfo.SUBSYSTEM_CODE, thingName);
        }
    }
</code>```

Things:

```<code>@Data
@Document(indexName = "things-*", type = "things")
public class Things {

    @Id
    private Long id;
    private String earName;
    private String name;
}
</code>```

Now im get exceprion:

```<code>java.lang.IllegalArgumentException: unknown setting [xpack.security.user] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
</code>```

When i add spring-data-elasticsearch 4.0.0 and try to use RestHighLevelClient i get NoClassDefFoundError error creating RestHighLevelClient bean

Title: How to configure elasticsearch 6 java

Body:
I'm using Spring version 2.1.18.RELEASE (I can't change this version)
I need to implement a crud repository for elasticsearch, for this I connect spring-data-elasticsearch (version 3.1.21.RELEASE is automatically pulled up) with elasticsearch 6.4.3
I tried a bunch of manuals, but elastic is so different from version to version that I can't find a solution. I need to connect to remote server via https with username and password.

pom:

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
        </dependency>

Config:

@Configuration
@EnableElasticsearchRepositories(basePackages = "path.to.elastic")
@ComponentScan(basePackages = {"path.to.elastic"})
public class ElasticConfiguration {

    private final int port = 1234;

    @Bean
    public Client client() throws Exception {

        Settings settings = Settings.builder().put("cluster.name", "test")
                .put("xpack.security.user", "login:pass")
                .put("xpack.security.transport.ssl.enabled", "true")
                .put("xpack.security.transport.ssl.enabled", "true")
                .build();

        return new PreBuiltTransportClient(settings)
                .addTransportAddress(new TransportAddress(InetAddress.getByName("bah.elk1.com"), port))
                .addTransportAddress(new TransportAddress(InetAddress.getByName("bah.elk2.com"), port))
                .addTransportAddress(new TransportAddress(InetAddress.getByName("bah.elk3.com"), port));
    }

    @Bean
    public ElasticsearchOperations elasticsearchTemplate() throws Exception {
        return new ElasticsearchTemplate(client());
    }
}

Repository:

@Repository
public interface ElkThingRepository extends ElasticsearchRepository<Things, Long> {

    List<Things> findByEarNameAndName(String earName, String thingName);
}

Service interface:

public interface ElkThingsService {

    List<Things> simpleGet(String thingName);
}

Service impl:

@Service
public class ElkThingsServiceImpl implements ElkThingsService {

        private final ElkThingsRepository elkThingsRepository;

        @Autowired
        public ElkThingsServiceImpl(ElkThingsRepository elkThingsRepository) {
            this.elkThingsRepository = elkThingsRepository;
        }

        public List<Things> simpleGet(String thingsName) {
            return elkThingsRepository.findByEarNameAndName(AppInfo.SUBSYSTEM_CODE, thingName);
        }
    }

Things:

@Data
@Document(indexName = "things-*", type = "things")
public class Things {

    @Id
    private Long id;
    private String earName;
    private String name;
}

Now im get exceprion:

java.lang.IllegalArgumentException: unknown setting [xpack.security.user] please check that any required plugins are installed, or check the breaking changes documentation for removed settings

When i add spring-data-elasticsearch 4.0.0 and try to use RestHighLevelClient i get NoClassDefFoundError error creating RestHighLevelClient bean


问:
RaisedButton in flutter not working how to solve?
```<code>body:Column(children: const [
            Text('The Questions!'),
          RaisedButton  ** //raisedbutton come in red underline no suggestions of button **
        ],
</code>```

not working RaisedButton in Flutter

Body:
body:Column(children: const [
            Text('The Questions!'),
          RaisedButton  ** //raisedbutton come in red underline no suggestions of button **
        ],

not working RaisedButton in Flutter