问:
CSS styles do not apply correctly on deployed Sinatra app on fly.io
I have a Sinatra app that is minimally styled using Bootstrap and CSS.

Here is a snippet of the head section with the two CSS links

```<code><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Best Buy App | <%= @title %> </title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="/stylesheets/styles.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,500"
          rel="stylesheet">
  </head>
</code>```

When I run the server locally, here is how it appears

However the deployed version at the live link displays like the image below

When I deploy, it succeeds without any error. When I run the fly logs, I can't see any error. What could be causing that difference and causing the CSS not to load correctly?

Body:
I have a Sinatra app that is minimally styled using Bootstrap and CSS.

Here is a snippet of the head section with the two CSS links

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Best Buy App | <%= @title %> </title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="/stylesheets/styles.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,500"
          rel="stylesheet">

When I run the server locally, here is how it appears

However the deployed version at the live link displays like the image below

When I deploy, it succeeds without any error. When I run the fly logs, I can't see any error. What could be causing that difference and causing the CSS not to load correctly?


来源: stackexchange

问:
How to check copyright statement header in files by Doxygen(Jenkins)?
I want to get similar warnings as below from doxygen but with this different that this warning need to inform about lack of statement header in file:

"NfcStack_Cfg.h:42: warning: missing title after \defgroup NfcStack_AppConfig"

I don't know if that is possible, maybe there is the more simplest way how to list files which don't have header statement on the beginning of file? I use Jenkins for compilation and task scanner which search only given phrase but I need to list of files which header statement are missing. Any idea?

Examples of header statement:

```<code> *
 * @par Copyright
 * This code is the property of
 *
</code>```

or

```<code>
 *  COPYRIGHT
 *  -------------------------------------------------------------------------------------------------------------------
 *  \verbatim
 *  Copyright (c) 2022 by Company
 *
 *                This software is copyright protected and proprietary to Company.
 *
 *                All other rights remain with Company.
 *  \endverbatim
</code>```

Option which enable described functionality in doxygen or other solution which resolve my issue.

ContentLicense: CC BY-SA 4.0

Body:
I want to get similar warnings as below from doxygen but with this different that this warning need to inform about lack of statement header in file:

"NfcStack_Cfg.h:42: warning: missing title after \defgroup NfcStack_AppConfig"

I don't know if that is possible, maybe there is the more simplest way how to list files which don't have header statement on the beginning of file? I use Jenkins for compilation and task scanner which search only given phrase but I need to list of files which header statement are missing. Any idea?

Examples of header statement:

 *
 * @par Copyright
 * This code is the property of
 *

or

 *  COPYRIGHT
 *  -------------------------------------------------------------------------------------------------------------------
 *  \verbatim
 *  Copyright (c) 2022 by Company
 *
 *                This software is copyright protected and proprietary to Company.
 *
 *                All other rights remain with Company.
 *  \endverbatim

Option which enable described functionality in doxygen or other solution which resolve my issue.


问:
Trying to write a python application that creates an invoice but table is not working
I have created a table with the following code.

```<code>table = Invoice.add_table(rows=2, cols=4)

row = table.rows[0].cells
row[0].text = 'Dates\nWeek beginning'
row[1].text = 'No. of sessions'
row[2].text = 'Cost of sessions'
row[3].text = 'Paid with thanks'
next_row = table.rows[1].cells
next_row[0].text = 'null' #Haven't got a value for this yet
next_row[1].text = str(sessions)
next_row[2].text = str(charge_per_session)
next_row[3].text = 'null'

Invoice.save(r"~HIDDEN FOR PRIVACY~")
</code>```

When I run the code the file produced looks like this.
picture of file produced

The value of sessions is 12
The value of charge_per_session is 30

I have imported the following:

```<code>import docx
from docx.shared import Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
</code>```

I have tried a load of different ways to add the values but couldn't find much good documentation online.

Why is it not creating and filling in the next row?
Thanks in advance.

Body:
I have created a table with the following code.

table = Invoice.add_table(rows=2, cols=4)

row = table.rows[0].cells
row[0].text = 'Dates\nWeek beginning'
row[1].text = 'No. of sessions'
row[2].text = 'Cost of sessions'
row[3].text = 'Paid with thanks'
next_row = table.rows[1].cells
next_row[0].text = 'null' #Haven't got a value for this yet
next_row[1].text = str(sessions)
next_row[2].text = str(charge_per_session)
next_row[3].text = 'null'

Invoice.save(r"~HIDDEN FOR PRIVACY~")

When I run the code the file produced looks like this.
picture of file produced

The value of sessions is 12
The value of charge_per_session is 30

I have imported the following:

import docx
from docx.shared import Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH

I have tried a load of different ways to add the values but couldn't find much good documentation online.

Why is it not creating and filling in the next row?
Thanks in advance.


问:
Splinter error TypeError: NoneType not callable
I am trying to run the simplest splinter script:

```<code>from splinter import Browser

executable_path = {
    "executable_path": r"C:\Users\angel\chromedriver.exe"
}
print(executable_path)

browser = Browser('chrome',  **executable_path, headless=False)
</code>```

but keep getting this output:

```<code>{'executable_path': 'C:\\Users\\angel\\chromedriver.exe'}
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [2], line 8
      3 executable_path = {
      4     "executable_path": r"C:\Users\angel\chromedriver.exe"
      5 }
      6 print(executable_path)
----> 8 browser = Browser('chrome',  **executable_path, headless=False)

File C:\Python310\lib\site-packages\splinter\browser.py:121, in Browser(driver_name, retry_count, *args, **kwargs)
    118 except KeyError:
    119     raise DriverNotFoundError("No driver for %s" % driver_name)
--> 121 return get_driver(driver, retry_count=retry_count, *args, **kwargs)

File C:\Python310\lib\site-packages\splinter\browser.py:92, in get_driver(driver, retry_count, *args, **kwargs)
     90 for _ in range(retry_count):
     91     try:
---> 92         return driver(*args, **kwargs)
     93     except driver_exceptions as e:
     94         err = e

TypeError: 'NoneType' object is not callable
</code>```

I have research a lot and tried different things. I am sure that I have the correct driver for my chrome version. I am also sure that I have the .exe in that path I am providing.

What can be wrong?

Body:
I am trying to run the simplest splinter script:

from splinter import Browser

executable_path = {
    "executable_path": r"C:\Users\angel\chromedriver.exe"
}
print(executable_path)

browser = Browser('chrome',  **executable_path, headless=False)

but keep getting this output:

{'executable_path': 'C:\\Users\\angel\\chromedriver.exe'}
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [2], line 8
      3 executable_path = {
      4     "executable_path": r"C:\Users\angel\chromedriver.exe"
      5 }
      6 print(executable_path)
----> 8 browser = Browser('chrome',  **executable_path, headless=False)

File C:\Python310\lib\site-packages\splinter\browser.py:121, in Browser(driver_name, retry_count, *args, **kwargs)
    118 except KeyError:
    119     raise DriverNotFoundError("No driver for %s" % driver_name)
--> 121 return get_driver(driver, retry_count=retry_count, *args, **kwargs)

File C:\Python310\lib\site-packages\splinter\browser.py:92, in get_driver(driver, retry_count, *args, **kwargs)
     90 for _ in range(retry_count):
     91     try:
---> 92         return driver(*args, **kwargs)
     93     except driver_exceptions as e:
     94         err = e

TypeError: 'NoneType' object is not callable

I have research a lot and tried different things. I am sure that I have the correct driver for my chrome version. I am also sure that I have the .exe in that path I am providing.

What can be wrong?


问:
Get user photo greater than 96px from Google Workspace API
When querying the Google Workspace API for a user, it returns the profile photo URL downsized to 96px. The URL uses the sizing parameter =s96-c which according to the image sizing docs means size 96px, cropped. However modifying this seems to only change the scale and not the resolution.

Is there any way to get / endpoint that gives a higher resolution copy of the users profile photo?


问:
Padding for Text() within Column not working?
I have a Jetpack Compose composable in a column beginning with a icon, title, textbody and a pager row:

```<code>Box(modifier = Modifier
    .fillMaxSize()
    .background(color = TVTheme.colors.blue)
) {

val bigPadding = 334.dp
val smallPadding = 24.dp

    Column(
        verticalArrangement = Arrangement.Bottom,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {

        Image(
            modifier = Modifier
                .requiredSize(164.dp, 28.dp),
            icon = R.drawable.calendar_a_icon
        )

        // title
        val title = "Lorem Ipsum Dolor Sit"
        if (title.isNotEmpty()) {
            Text(
                text = title,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .padding(top = dimensionResource(id = R.dimen.vertical), start = bigPadding, end = bigPadding)
                    .fillMaxWidth(),
                overflow = TextOverflow.Visible
            )
        }

        // body
        val body = "Lorem ipsum dolor sit. Lorem ipsum dolor sit. Lorem ipsum dolor sit. Lorem ipsum dolor sit."
        if (body.isNotEmpty()) {
            Text(
                text = body,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .padding(top = dimensionResource(id = R.dimen.vertical), start = bigPadding, end = bigPadding)
                    .fillMaxWidth(),
                overflow = TextOverflow.Visible
            )
        }

        Row(
            modifier = Modifier
                .padding(top = 44.dp, bottom = smallPadding, start = smallPadding, end = smallPadding)
                .fillMaxWidth(),
            horizontalArrangement = Arrangement.SpaceBetween
        ) {

            val text = AnnotatedString.Builder(item.skipButtonText).toAnnotatedString()

            ClickableText(
                maxLines = 1,
                text = "Skip",
                onClick = {
                    skip()
                }
            )

            Pager(
                modifier = Modifier
                    .align(Alignment.CenterVertically),
                index = currentPageIndex,
                pageNumbers = totalPages)
        }
    }
}
</code>```

which produces this screen:

The left and right paddings for the title and body is set to 334.dp. The example screenshot has a width of 1800 dp and according to proportions the paddings are much more than given 334.dp. That would mean, the width of title and body is 1132.dp ?!:

I tried to make the proportions visible.
How can I apply correct paddings for title and body text composables?

Body:
I have a Jetpack Compose composable in a column beginning with a icon, title, textbody and a pager row:

Box(modifier = Modifier
    .fillMaxSize()
    .background(color = TVTheme.colors.blue)
) {

val bigPadding = 334.dp
val smallPadding = 24.dp

    Column(
        verticalArrangement = Arrangement.Bottom,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {

        Image(
            modifier = Modifier
                .requiredSize(164.dp, 28.dp),
            icon = R.drawable.calendar_a_icon
        )

        // title
        val title = "Lorem Ipsum Dolor Sit"
        if (title.isNotEmpty()) {
            Text(
                text = title,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .padding(top = dimensionResource(id = R.dimen.vertical), start = bigPadding, end = bigPadding)
                    .fillMaxWidth(),
                overflow = TextOverflow.Visible
            )
        }

        // body
        val body = "Lorem ipsum dolor sit. Lorem ipsum dolor sit. Lorem ipsum dolor sit. Lorem ipsum dolor sit."
        if (body.isNotEmpty()) {
            Text(
                text = body,
                textAlign = TextAlign.Center,
                modifier = Modifier
                    .padding(top = dimensionResource(id = R.dimen.vertical), start = bigPadding, end = bigPadding)
                    .fillMaxWidth(),
                overflow = TextOverflow.Visible
            )
        }

        Row(
            modifier = Modifier
                .padding(top = 44.dp, bottom = smallPadding, start = smallPadding, end = smallPadding)
                .fillMaxWidth(),
            horizontalArrangement = Arrangement.SpaceBetween
        ) {

            val text = AnnotatedString.Builder(item.skipButtonText).toAnnotatedString()

            ClickableText(
                maxLines = 1,
                text = "Skip",
                onClick = {
                    skip()
                }
            )

            Pager(
                modifier = Modifier
                    .align(Alignment.CenterVertically),
                index = currentPageIndex,
                pageNumbers = totalPages)
        }
    }
}

which produces this screen:

The left and right paddings for the title and body is set to 334.dp. The example screenshot has a width of 1800 dp and according to proportions the paddings are much more than given 334.dp. That would mean, the width of title and body is 1132.dp ?!:

I tried to make the proportions visible.
How can I apply correct paddings for title and body text composables?


问:
Can't open deploy.prototxt.txt
I've been agonizing over the problem for a long time. downloaded zip archive from github. I tried many times and it didn't work out.

import cv2
import numpy as np
import requests
import os

print(os.listdir(r"C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/"))
prototxt_path = r"C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/deploy.prototxt.txt"
caffemodel_path = r"C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/res10_300x300_ssd_iter_140000.caffemodel"
net = cv2.dnn.readNetFromCaffe(prototxt_path, caffemodel_path)

# Set up the DroidCam Source 3 camera
cap = cv2.VideoCapture("http://---.---.--.-:----/mjpegfeed")

net = cv2.dnn.readNetFromCaffe(prototxt_path, caffemodel_path)
```
<p>outputs this error.</p>
```File "C:\Users\Алекс\Desktop\camera.py", line 9, in <module>
    net = cv2.dnn.readNetFromCaffe(prototxt_path, caffemodel_path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1126: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/deploy.prototxt.txt" in function 'cv::dnn::ReadProtoFromTextFile'
```

help me please

many times, I deleted the extension .txt, tried to find using os.path.join() function and no result, path is completely correct.

Title: Can't open deploy.prototxt.txt

Body:
I've been agonizing over the problem for a long time. downloaded zip archive from github. I tried many times and it didn't work out.

import cv2
import numpy as np
import requests
import os

print(os.listdir(r"C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/"))
prototxt_path = r"C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/deploy.prototxt.txt"
caffemodel_path = r"C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/res10_300x300_ssd_iter_140000.caffemodel"
net = cv2.dnn.readNetFromCaffe(prototxt_path, caffemodel_path)

# Set up the DroidCam Source 3 camera
cap = cv2.VideoCapture("http://---.---.--.-:----/mjpegfeed")

net = cv2.dnn.readNetFromCaffe(prototxt_path, caffemodel_path)

outputs this error.

File "C:\Users\Алекс\Desktop\camera.py", line 9, in <module>
    net = cv2.dnn.readNetFromCaffe(prototxt_path, caffemodel_path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1126: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "C:/Users/Алекс/Desktop/face-detection-with-OpenCV-and-DNN-master/deploy.prototxt.txt" in function 'cv::dnn::ReadProtoFromTextFile'

help me please

many times, I deleted the extension .txt, tried to find using os.path.join() function and no result, path is completely correct.


问:
Can I use recently built image with Kaniko in next stage without pushing in Gitlab CI
I have a cluster of Gitlab CI Runners running our pipelines.

I have a stage where I build with Kaniko a Docker image, but without pushing it to any Docker registry. My question is, if I set the next stage to run inside that same image I just built, will Gitlab CI find it ?


问:
Altering  in thousands of posts with DomDocument
I used the PHP DomDocument class to extract all the a tags from over 3000 posts and collected them in a database as follows -

I used domDocument C14N() function to fill the existing_link table.

```<code>id | existing_link | replacement_link

1 | <a class="class1" href="domain1.com" rel="nofollow">Domain1.com</a> | <a href="domain2.com">Domain2.com</a>
</code>```

My initial thought was to simply use Laravel's Str::replace() to find and replace the links using above table. But, C14N() did something I did not think of. It put the link's attributes in alphabetical order. That is, while the link in my post exists as -

```<code><a href="domain1.com" class="class1" rel="nofollow">Domain1.com</a>
</code>```

The C14N() function saved it with attribute order changed (class -> href -> rel)! Look existing_link in above table.

As a result, I cannot use Laravel's Str::replace() to quickly replace links; even though they technically are the same links; they are not the same strings.

Each post in my DB can have multiple links to be replaced based on the table I've prepared. My best attempt so far is as follows -

```<code>$new_links = DB::table('links')->get();

        foreach ($new_links as $new_link)
        {

            $post = Post::where('id', $new_link->id)->first();
            $post_body = $post->body;

            $domDocument = new \DOMDocument();
            $domDocument->loadHTML($post_body, LIBXML_NOERROR);

            // Pull the links in the post body
            $old_links = $domDocument->getElementsByTagName('a');

            foreach ($old_links as $old_link)
            {
                if($old_link->C14N() == $new_link->existing_link)
                {
                    // Perform the replacement. I can't figure out how to do this using DOMDOcument.
                }
            }
        }
</code>```

How can I achieve the final replacement of links using DOMDocument? I am open to any other approach.

Title: Altering <a> in thousands of posts with DomDocument

Body:
I used the PHP DomDocument class to extract all the a tags from over 3000 posts and collected them in a database as follows -

I used domDocument C14N() function to fill the existing_link table.

id | existing_link | replacement_link

1 | Domain1.com | Domain2.com

My initial thought was to simply use Laravel's Str::replace() to find and replace the links using above table. But, C14N() did something I did not think of. It put the link's attributes in alphabetical order. That is, while the link in my post exists as -

Domain1.com

The C14N() function saved it with attribute order changed (class -> href -> rel)! Look existing_link in above table.

As a result, I cannot use Laravel's Str::replace() to quickly replace links; even though they technically are the same links; they are not the same strings.

Each post in my DB can have multiple links to be replaced based on the table I've prepared. My best attempt so far is as follows -

$new_links = DB::table('links')->get();

        foreach ($new_links as $new_link)
        {

            $post = Post::where('id', $new_link->id)->first();
            $post_body = $post->body;

            $domDocument = new \DOMDocument();
            $domDocument->loadHTML($post_body, LIBXML_NOERROR);

            // Pull the links in the post body
            $old_links = $domDocument->getElementsByTagName('a');

            foreach ($old_links as $old_link)
            {
                if($old_link->C14N() == $new_link->existing_link)
                {
                    // Perform the replacement. I can't figure out how to do this using DOMDOcument.
                }
            }
        }

How can I achieve the final replacement of links using DOMDocument? I am open to any other approach.


问:
how do I modify CSV column header names Using powershell on an SFTP Server?
I have the below code written up, I am just curious if I am on the right track or if there is a better way to do this sorta thing in a more programmatic way ?

I am wanting to automate the removal of backslashes in the CSV file header names. so technically only the first row needs modified or looked at. The header string will always be the same and I could also technically replace the first row string with the string without the backslashes but there is a lot of ways to tackle a problem, just trying to find the best way to do it!
Thanks all for your possible help!

```<code># Define Server Name
$ComputerName = "HOST ADDRESS"

# Define UserName
$UserName = "USERNAME"

#Define the Private Key file path
$KeyFile = "PATH TO KEYFILE\KEYFILE NAME (OPENSSH FORMAT)"

#Defines to not popup requesting for a password
$nopasswd = new-object System.Security.SecureString

#Set Credetials to connect to server
$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $nopasswd)

# Set local file path and SFTP path
$LocalPath = "E:\ftproot\LocalUser\USERNAME\In"
$SftpPath = 'In/'

# Establish the SFTP connection
$SFTPSession = New-SFTPSession -ComputerName $ComputerName -Credential $Credential -KeyFile $KeyFile

# lists directory files into variable
$FilePath = Get-SFTPChildItem -sessionID $SFTPSession.SessionID -path $SftpPath

#For each file listed in the directory below, modify the CSV header to remove the backslashes then reupload them to the correct folder path
ForEach ($LocalFile in $FilePath)
{

#Ignores '.' (current directory) and '..' (parent directory) to only look at files within the current directory
    if($LocalFile.name -eq "." -Or $LocalFile.name -eq ".." )
    {
          Write-Host "Files Ignored!"
    }
    else
    {
        Write-Host $LocalFile
        Get-SFTPFile -SessionId $SFTPSession.SessionID -LocalPath $LocalPath -RemoteFile $localfile.fullname -Overwrite

        $path ="the downloaded CSVS PATH"
        Get-ChildItem -path $path -Filter *.csv |
        Foreach-Object {
            $content = Get-Content -Path $path
            $content[0] = $content[0] -replace '/',""
            Set-Content $path -value $content -force
            }
            # Upload the file to the SFTP path
            Set-SFTPFile -SessionId $SFTPSession.SessionID -Path $SftpPath
        #Remove-SFTPItem -SessionId $SFTPSession.SessionID -Path $localfile.fullname -Force
    }

}

#Terminates the SFTP session on the server
Remove-SFTPSession -SessionId $SFTPSession.SessionID

</code>```

Body:
I have the below code written up, I am just curious if I am on the right track or if there is a better way to do this sorta thing in a more programmatic way ?

I am wanting to automate the removal of backslashes in the CSV file header names. so technically only the first row needs modified or looked at. The header string will always be the same and I could also technically replace the first row string with the string without the backslashes but there is a lot of ways to tackle a problem, just trying to find the best way to do it!
Thanks all for your possible help!

# Define Server Name
$ComputerName = "HOST ADDRESS"

# Define UserName
$UserName = "USERNAME"

#Define the Private Key file path
$KeyFile = "PATH TO KEYFILE\KEYFILE NAME (OPENSSH FORMAT)"

#Defines to not popup requesting for a password
$nopasswd = new-object System.Security.SecureString

#Set Credetials to connect to server
$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $nopasswd)

# Set local file path and SFTP path
$LocalPath = "E:\ftproot\LocalUser\USERNAME\In"
$SftpPath = 'In/'

# Establish the SFTP connection
$SFTPSession = New-SFTPSession -ComputerName $ComputerName -Credential $Credential -KeyFile $KeyFile

# lists directory files into variable
$FilePath = Get-SFTPChildItem -sessionID $SFTPSession.SessionID -path $SftpPath

#For each file listed in the directory below, modify the CSV header to remove the backslashes then reupload them to the correct folder path
ForEach ($LocalFile in $FilePath)
{

#Ignores '.' (current directory) and '..' (parent directory) to only look at files within the current directory
    if($LocalFile.name -eq "." -Or $LocalFile.name -eq ".." )
    {
          Write-Host "Files Ignored!"
    }
    else
    {
        Write-Host $LocalFile
        Get-SFTPFile -SessionId $SFTPSession.SessionID -LocalPath $LocalPath -RemoteFile $localfile.fullname -Overwrite

        $path ="the downloaded CSVS PATH"
        Get-ChildItem -path $path -Filter *.csv |
        Foreach-Object {
            $content = Get-Content -Path $path
            $content[0] = $content[0] -replace '/',""
            Set-Content $path -value $content -force
            }
            # Upload the file to the SFTP path
            Set-SFTPFile -SessionId $SFTPSession.SessionID -Path $SftpPath
        #Remove-SFTPItem -SessionId $SFTPSession.SessionID -Path $localfile.fullname -Force
    }

}

#Terminates the SFTP session on the server
Remove-SFTPSession -SessionId $SFTPSession.SessionID


问:
Highcharter and organization chart customisation
I am tring to make a WBS chart using highcharter R package.

I wish to be able to plot the differents tasks per actions in a straight way under the box whom they come from, rather than in wages. I struggle to find the appropriate option to control this. (even after checking this here https://api.highcharts.com/highcharts/plotOptions.organization)

See the code below and what does it returns. Which is almost what I expected, but not exactly. I found the way to control the column position, but this is not working for rows. Moreover the task order is mixed in a weird way for the tasks in column 8 which is not expected of course.

```<code>library(highcharter)

highchart() %>%
  hc_chart(type = 'organization', inverted = TRUE) %>%
  hc_title(text = 'WBS') %>%
  hc_add_series(
    name = 'WBS',
    data = list(
        #Liste action
        list(from = 'T', to = 'A1'),
        list(from = 'T', to = 'A2'),
        list(from = 'T', to = 'A3'),
        list(from = 'T', to = 'A4'),

            #A1
            list(from = 'A1', to = 'b1'),
            list(from = 'b1', to = 'P'),
            list(from = 'P', to = 'F1'),
            list(from = 'F1', to = 'AqDo'),
            list(from = 'AqDo', to = 'Ay1'),
            list(from = 'Ay1', to = 'R1'),
            list(from = 'R1', to = 'Ar1'),

            #A2
            list(from = 'A2', to = 'b2'),
            list(from = 'b2', to = 'Cx'),
            list(from = 'Cx', to = 'F2'),
            list(from = 'F2', to = 'Pr'),
            list(from = 'Pr', to = 'Ay2'),
            list(from = 'Ay2', to = 'R2'),
            list(from = 'R2', to = 'Ar2'),

            #A3
            list(from = 'A3', to = 'b3'),
            list(from = 'b3', to = 'Cx'),
            list(from = 'Cx', to = 'F3'),
            list(from = 'F3', to = 'Pr'),
            list(from = 'Pr', to = 'Ay4'),
            list(from = 'Ay4', to = 'R3'),
            list(from = 'R3', to = 'Ar3'),

            #A4
            list(from = 'A4', to = 'Ar4')
    ),
    nodes = list(
        #task list
        list(id = 'T', name = "name", title = "title", color = '#081358', dataLabels = list(color = 'white'), column = 0),
        list(id = 'A1', title = 'action1', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),
        list(id = 'A2', title = 'action2', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),
        list(id = 'A3', title = 'action3', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),
        list(id = 'A4', title = 'action4', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),

            #A1
            list(id = 'b1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 2),
            list(id = 'P',  title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 3),
            list(id = 'F1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 4),
            list(id = 'AqDo', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 5),
            list(id = 'Ay1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 6),
            list(id = 'R1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 7),
            list(id = 'Ar1', title = 'A1', color = '#B94331', dataLabels = list(color = 'white'), column = 8),

            #A2
            list(id = 'b2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 2),
            list(id = 'Cx', title = 'A2 + A3', color = '#2BA8C4', dataLabels = list(color = 'black'), column = 3),
            list(id = 'F2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 4),
            list(id = 'Pr', title = 'A2 + A3', color = '#2BA8C4', dataLabels = list(color = 'black'), column = 5),
            list(id = 'Ay2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 6),
            list(id = 'R2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 7),
            list(id = 'Ar2', title = 'A2', color = '#B94331', dataLabels = list(color = 'white'), column = 8),

            #A3
            list(id = 'b3', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 2),
            list(id = 'F3', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 4),
            list(id = 'Ay4', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 6),
            list(id = 'R3', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 7),
            list(id = 'Ar3', title = 'A3', color = '#B94331', dataLabels = list(color = 'white'), column = 8),

            #A4
            list(id = 'Ar4', title = 'A4', color = '#B94331', dataLabels = list(color = 'white'), column = 8)
    )
  )
</code>```

and see the plot below

Maybe the answer could be found by modifying the css, or html, or javaScript source code ? but this would not be logical as an R package has been created to use highchart from Rstudio.

Body:
I am tring to make a WBS chart using highcharter R package.

I wish to be able to plot the differents tasks per actions in a straight way under the box whom they come from, rather than in wages. I struggle to find the appropriate option to control this. (even after checking this here https://api.highcharts.com/highcharts/plotOptions.organization)

See the code below and what does it returns. Which is almost what I expected, but not exactly. I found the way to control the column position, but this is not working for rows. Moreover the task order is mixed in a weird way for the tasks in column 8 which is not expected of course.

library(highcharter)

highchart() %>%
  hc_chart(type = 'organization', inverted = TRUE) %>%
  hc_title(text = 'WBS') %>%
  hc_add_series(
    name = 'WBS',
    data = list(
        #Liste action
        list(from = 'T', to = 'A1'),
        list(from = 'T', to = 'A2'),
        list(from = 'T', to = 'A3'),
        list(from = 'T', to = 'A4'),

            #A1
            list(from = 'A1', to = 'b1'),
            list(from = 'b1', to = 'P'),
            list(from = 'P', to = 'F1'),
            list(from = 'F1', to = 'AqDo'),
            list(from = 'AqDo', to = 'Ay1'),
            list(from = 'Ay1', to = 'R1'),
            list(from = 'R1', to = 'Ar1'),

            #A2
            list(from = 'A2', to = 'b2'),
            list(from = 'b2', to = 'Cx'),
            list(from = 'Cx', to = 'F2'),
            list(from = 'F2', to = 'Pr'),
            list(from = 'Pr', to = 'Ay2'),
            list(from = 'Ay2', to = 'R2'),
            list(from = 'R2', to = 'Ar2'),

            #A3
            list(from = 'A3', to = 'b3'),
            list(from = 'b3', to = 'Cx'),
            list(from = 'Cx', to = 'F3'),
            list(from = 'F3', to = 'Pr'),
            list(from = 'Pr', to = 'Ay4'),
            list(from = 'Ay4', to = 'R3'),
            list(from = 'R3', to = 'Ar3'),

            #A4
            list(from = 'A4', to = 'Ar4')
    ),
    nodes = list(
        #task list
        list(id = 'T', name = "name", title = "title", color = '#081358', dataLabels = list(color = 'white'), column = 0),
        list(id = 'A1', title = 'action1', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),
        list(id = 'A2', title = 'action2', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),
        list(id = 'A3', title = 'action3', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),
        list(id = 'A4', title = 'action4', color = '#2D2F51', dataLabels = list(color = 'white'), column = 1),

            #A1
            list(id = 'b1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 2),
            list(id = 'P',  title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 3),
            list(id = 'F1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 4),
            list(id = 'AqDo', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 5),
            list(id = 'Ay1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 6),
            list(id = 'R1', title = 'A1', color = '#9EC3E7', dataLabels = list(color = 'black'), column = 7),
            list(id = 'Ar1', title = 'A1', color = '#B94331', dataLabels = list(color = 'white'), column = 8),

            #A2
            list(id = 'b2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 2),
            list(id = 'Cx', title = 'A2 + A3', color = '#2BA8C4', dataLabels = list(color = 'black'), column = 3),
            list(id = 'F2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 4),
            list(id = 'Pr', title = 'A2 + A3', color = '#2BA8C4', dataLabels = list(color = 'black'), column = 5),
            list(id = 'Ay2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 6),
            list(id = 'R2', title = 'A2', color = '#2491A9', dataLabels = list(color = 'black'), column = 7),
            list(id = 'Ar2', title = 'A2', color = '#B94331', dataLabels = list(color = 'white'), column = 8),

            #A3
            list(id = 'b3', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 2),
            list(id = 'F3', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 4),
            list(id = 'Ay4', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 6),
            list(id = 'R3', title = 'A3', color = '#34D1F4', dataLabels = list(color = 'black'), column = 7),
            list(id = 'Ar3', title = 'A3', color = '#B94331', dataLabels = list(color = 'white'), column = 8),

            #A4
            list(id = 'Ar4', title = 'A4', color = '#B94331', dataLabels = list(color = 'white'), column = 8)
    )
  )

and see the plot below

Maybe the answer could be found by modifying the css, or html, or javaScript source code ? but this would not be logical as an R package has been created to use highchart from Rstudio.


问:
How to export excel column data that contains existing HTML in each row
I've got a DB export that has information for a number of companies - There are 4 rows of information per company; LossExperience, CoverNotes, InsuredSummaryOperation and PricingRationale

Each of these rows has their "information" as HTML in another column.

I'm trying to figure out the best way to get these displayed. It would be great if I could export an HTML file for each company with the 4 rows of information on it but I'm not sure how to do that, and each row is a full HTML page starting with  so not sure how that would format.

Any help would be appreciated! (BTW if you know a better way for me to copy/paste this excel data in let me know)

id
company
information
comment

1
Company 1
LossExperience
there's html code in here

1
Company 1
CoverNotes
there's html code in here

1
Company 1
InsuredSummaryOperation
there's html code in here

1
Company 1
PricingRationale
there's html code in here

2
Company 2
LossExperience
there's html code in here

2
Company 2
CoverNotes
there's html code in here

2
Company 2
InsuredSummaryOperation
there's html code in here

2
Company 2
PricingRationale
there's html code in here

Edit: I've added the table to see it better


问:
Disable only one Woocommerce shipping method based on cart subtotal
I'm need hide only one woocommerce shipping method when subtotal cart is over R$ 130. i'm have been used this code below (found on web and modified by me), but what i need is not working, any effect was applied.

Here this code:

```<code>// Disable Woocommerce shipping methods based on cart subtot
add_filter( 'woocommerce_package_rates', 'wpsh_hide_shipping_based_on_subtotal', 10, 2 );
function wpsh_hide_shipping_based_on_subtotal( $rates, $package ) {
    // Retrieve cart subtotal
    $cart_subtotal = $package['contents_cost'];

    // Shipping rate to be excluded
    $shipping_id = 'correios-pac2';

   if ( $cart_subtotal >= 130 )
        unset( $rates[ $shipping_id ] );

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

Any help is apprecciate, tks.

Body:
I'm need hide only one woocommerce shipping method when subtotal cart is over R$ 130. i'm have been used this code below (found on web and modified by me), but what i need is not working, any effect was applied.

Here this code:

// Disable Woocommerce shipping methods based on cart subtot
add_filter( 'woocommerce_package_rates', 'wpsh_hide_shipping_based_on_subtotal', 10, 2 );
function wpsh_hide_shipping_based_on_subtotal( $rates, $package ) {
    // Retrieve cart subtotal
    $cart_subtotal = $package['contents_cost'];

    // Shipping rate to be excluded
    $shipping_id = 'correios-pac2';

   if ( $cart_subtotal >= 130 )
        unset( $rates[ $shipping_id ] );

    return $rates;
}

Any help is apprecciate, tks.


问:
How to change F5 key binding on Ubuntu 22.04 laptop
I have installed Visual Studio Code on Ubuntu 22.04 and found out that F5 Start Debugging key does not work because it is captured by operation system. It is bound to lower screen brightness function.

How can I disable this operation system key binding?

As a quick fix I have changed keyboard mapping inside VS Code, but I do not like it.
I would rather keep standard VS Code binding and bind Fn+F5 to lower screen brightness, as it is indicated on my laptop keyboard.


问:
Fetching hls source before <video /> element renders
I wish to load the playlist.m3u8 before the  element is rendered so that when it does render, there will be little to no loading time.

this can happen for instance if the video is in a popup element triggered by mouse hover. in that case, the video Element has not yet rendered, and only when it does, does it start streaming

is there a way to start fetching the playlist files from the CDN and pass it to the video element when it renders?


问:
Add additional fields in the payment form in Magento 2
I have tried to add additional fields in the payment form in Magento 2, but I have not succeeded. I have reviewed several manuals on this, but I can't find a definitive one.

What I want is to add 2 fields, in the first one that allows choosing the type of document as dropdown and the second field is displayed to complete the information with the chosen document number.

If anyone has managed to implement this type of requirement, I would greatly appreciate your help.

I have tried to add additional fields in the payment form in Magento 2, but I have not succeeded. I have reviewed several manuals on this, but I can't find a definitive one.


问:
Spring Shell integration with IntelliJ console
I'm using Spring-Shell v2.1.4 with IntelliJ Utlimate IDE. If I use a Flow component in a shell method I find that it does not work when launched within IntelliJ but works fine from a plain Bash terminal.
For example if I have a simple @ShellMethod using the example code from the above link:

```<code>@ShellMethod("Testing for flow component")
public void flowTest() {
    Map<String, String> single1SelectItems = new HashMap<>();
    single1SelectItems.put("key1", "value1");
    single1SelectItems.put("key2", "value2");
    List<SelectItem> multi1SelectItems = Arrays.asList(SelectItem.of("key1", "value1"),
        SelectItem.of("key2", "value2"), SelectItem.of("key3", "value3"));
        ComponentFlow flow = componentFlowBuilder.clone().reset()
                .terminal(this.terminal)
                .withStringInput("field1")
                .name("Field1")
                .defaultValue("defaultField1Value")
                .and()
                .withStringInput("field2")
                .name("Field2")
                .and()
                .withConfirmationInput("confirmation1")
                .name("Confirmation1")
                .and()
                .withPathInput("path1")
                .name("Path1")
                .and()
                .withSingleItemSelector("single1")
                .name("Single1")
                .selectItems(single1SelectItems)
                .and()
                .withMultiItemSelector("multi1")
                .name("Multi1")
                .selectItems(multi1SelectItems)
                .and()
                .build();

    flow.run();
}
</code>```

The method 'executes` but there is no interaction with the user:

Compare this to executing in genuine Bash terminal:

This older question is similar but it refers to an earlier version of Spring CLI and the recommended solution there is a VM argument for which the stated argument no longer appears to exist in the version of Spring Shell I am using.

Is there an updated version on the VM argument or an IntelliJ run-configuration setting to give better integration with the IDE?

Body:
I'm using Spring-Shell v2.1.4 with IntelliJ Utlimate IDE. If I use a Flow component in a shell method I find that it does not work when launched within IntelliJ but works fine from a plain Bash terminal.
For example if I have a simple @ShellMethod using the example code from the above link:

@ShellMethod("Testing for flow component")
public void flowTest() {
    Map<String, String> single1SelectItems = new HashMap<>();
    single1SelectItems.put("key1", "value1");
    single1SelectItems.put("key2", "value2");
    List<SelectItem> multi1SelectItems = Arrays.asList(SelectItem.of("key1", "value1"),
        SelectItem.of("key2", "value2"), SelectItem.of("key3", "value3"));
        ComponentFlow flow = componentFlowBuilder.clone().reset()
                .terminal(this.terminal)
                .withStringInput("field1")
                .name("Field1")
                .defaultValue("defaultField1Value")
                .and()
                .withStringInput("field2")
                .name("Field2")
                .and()
                .withConfirmationInput("confirmation1")
                .name("Confirmation1")
                .and()
                .withPathInput("path1")
                .name("Path1")
                .and()
                .withSingleItemSelector("single1")
                .name("Single1")
                .selectItems(single1SelectItems)
                .and()
                .withMultiItemSelector("multi1")
                .name("Multi1")
                .selectItems(multi1SelectItems)
                .and()
                .build();

    flow.run();
}

The method 'executes` but there is no interaction with the user:

Compare this to executing in genuine Bash terminal:

This older question is similar but it refers to an earlier version of Spring CLI and the recommended solution there is a VM argument for which the stated argument no longer appears to exist in the version of Spring Shell I am using.

Is there an updated version on the VM argument or an IntelliJ run-configuration setting to give better integration with the IDE?


问:
MySQL Server disappeared and it cannot be installed again
I wanted to reinstall MySQL Workbench 8.0, because I lost my password.
First, I stopped the server in services.msc, as it was written in the official guide for the password recovery.

Unfortunately, it just disappeared from the services list forever.
I tried to install it again using the mysqld --initialize and mysqld --install commands, but I get an "Access denied" message.
I can't start the server, I can't get my password back.

I would appreciate any help.
Thank you in advance,
Karolina


问:
DRF - Validation PrimaryRelatedField
I created a serializer:

```<code>def validate_users(users):
    # doing some validation
    return users

class MySerializer(serializer.Serializer):
    user_ids = serializers.PrimaryKeyRelatedField(
        many=True,
        source='users',
        queryset=User.objects.all(),
        validators=[validate_users]
    )
</code>```

The validation does not work when many=True because validators is not pass into ManyRelatedField https://github.com/encode/django-rest-framework/blob/c10f2266222c434485889b08cc1463acdb8fa169/rest_framework/relations.py#L146.

There is also a note:

How to run validation using validator property after to_internal_value when using PrimaryKeyRelatedField with many=True?

Title: DRF - Validation PrimaryRelatedField

Body:
I created a serializer:

def validate_users(users):
    # doing some validation
    return users

class MySerializer(serializer.Serializer):
    user_ids = serializers.PrimaryKeyRelatedField(
        many=True,
        source='users',
        queryset=User.objects.all(),
        validators=[validate_users]
    )

The validation does not work when many=True because validators is not pass into ManyRelatedField https://github.com/encode/django-rest-framework/blob/c10f2266222c434485889b08cc1463acdb8fa169/rest_framework/relations.py#L146.

There is also a note:

How to run validation using validator property after to_internal_value when using PrimaryKeyRelatedField with many=True?


问:
I have multiple chrome profile and i want to open one of them
It's launch chrome profile but not able to do any action after launch chrome profile and gives error bellow.
Note: i have successfully launched chrome browser...and i want to work on my profile not on every time create new instance.
My code is this---

```<code>from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys

options=Options()
options.add_argument('--profile-directory=Default')
options.add_argument("user-data-dir=C:\\Users\\amit9\\AppData\\Local\\Google\\Chrome\\User Data\\")
driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
driver.get("https://www.google.co.in")

</code>```

Error gives me after running code

```<code>PS C:\Users\amit9\OneDrive\Desktop\autogui> & C:/Users/amit9/AppData/Local/Programs/Python/Python311/python.exe c:/Users/amit9/OneDrive/Desktop/autogui/python/test.py
c:\Users\amit9\OneDrive\Desktop\autogui\python\test.py:10: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
Opening in existing browser session.
Traceback (most recent call last):
  File "c:\Users\amit9\OneDrive\Desktop\autogui\python\test.py", line 10, in <module>
    driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    super().__init__(
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
    super().__init__(
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome
has crashed.)
Stacktrace:
Backtrace:
        (No symbol) [0x006BF243]
        (No symbol) [0x00647FD1]
        (No symbol) [0x0053D04D]
        (No symbol) [0x0055C24E]
        (No symbol) [0x005582E9]
        (No symbol) [0x0058F056]
        (No symbol) [0x0058EB2A]
        (No symbol) [0x00588386]
        (No symbol) [0x0056163C]
        (No symbol) [0x0056269D]
        GetHandleVerifier [0x00959A22+2655074]
        GetHandleVerifier [0x0094CA24+2601828]
        GetHandleVerifier [0x00768C0A+619850]
        GetHandleVerifier [0x00767830+614768]
        (No symbol) [0x006505FC]
        (No symbol) [0x00655968]
        (No symbol) [0x00655A55]
        (No symbol) [0x0066051B]
        BaseThreadInitThunk [0x76B800F9+25]
        RtlGetAppContainerNamedObjectPath [0x778A7BBE+286]
        RtlGetAppContainerNamedObjectPath [0x778A7B8E+238]
</code>```

Body:
It's launch chrome profile but not able to do any action after launch chrome profile and gives error bellow.
Note: i have successfully launched chrome browser...and i want to work on my profile not on every time create new instance.
My code is this---

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys

options=Options()
options.add_argument('--profile-directory=Default')
options.add_argument("user-data-dir=C:\\Users\\amit9\\AppData\\Local\\Google\\Chrome\\User Data\\")
driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
driver.get("https://www.google.co.in")

Error gives me after running code

PS C:\Users\amit9\OneDrive\Desktop\autogui> & C:/Users/amit9/AppData/Local/Programs/Python/Python311/python.exe c:/Users/amit9/OneDrive/Desktop/autogui/python/test.py
c:\Users\amit9\OneDrive\Desktop\autogui\python\test.py:10: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
Opening in existing browser session.
Traceback (most recent call last):
  File "c:\Users\amit9\OneDrive\Desktop\autogui\python\test.py", line 10, in <module>
    driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    super().__init__(
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
    super().__init__(
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome
has crashed.)
Stacktrace:
Backtrace:
        (No symbol) [0x006BF243]
        (No symbol) [0x00647FD1]
        (No symbol) [0x0053D04D]
        (No symbol) [0x0055C24E]
        (No symbol) [0x005582E9]
        (No symbol) [0x0058F056]
        (No symbol) [0x0058EB2A]
        (No symbol) [0x00588386]
        (No symbol) [0x0056163C]
        (No symbol) [0x0056269D]
        GetHandleVerifier [0x00959A22+2655074]
        GetHandleVerifier [0x0094CA24+2601828]
        GetHandleVerifier [0x00768C0A+619850]
        GetHandleVerifier [0x00767830+614768]
        (No symbol) [0x006505FC]
        (No symbol) [0x00655968]
        (No symbol) [0x00655A55]
        (No symbol) [0x0066051B]
        BaseThreadInitThunk [0x76B800F9+25]
        RtlGetAppContainerNamedObjectPath [0x778A7BBE+286]
        RtlGetAppContainerNamedObjectPath [0x778A7B8E+238]


问:
Android Studio Login with SQLite database
Currently I am developing a personal software that is able to use the database to store the registered accounts and when logging in will retrieve the data from the database to compare with the characters been entered by the user.
But for some reason, even though I entered it correctly, I can't log in successfully

This is SQLite java file

```<code>    package anhtuan.example.sample.SQLite;

    import android.content.Context;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;

    import androidx.annotation.Nullable;

    public class SQLite extends SQLiteOpenHelper {
    public SQLite(@Nullable Context context) {
        super(context, "System", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        String account = "create table accounts " +
                "(" +
                "_id integer primary key autoincrement, " +
                "user text," +
                "password text" +
                ")";
        sqLiteDatabase.execSQL(account);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        sqLiteDatabase.execSQL("drop table if exists accounts");
        onCreate(sqLiteDatabase);
    }
    }
</code>```

Here are DAO java file

```<code>    package anhtuan.example.sample.DAO;

    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.widget.Toast;

    import java.util.ArrayList;

    import anhtuan.example.sample.Log.SignUp;
    import anhtuan.example.sample.Model.AccountModel;
    import anhtuan.example.sample.SQLite.SQLite;

    public class DAO {
    SQLite sqLite;
    ArrayList<AccountModel> ds = new ArrayList<>();
    public DAO(Context context) {
        sqLite = new SQLite(context);
    }

    public void addUser(String acc, String pass) {
        SQLiteDatabase sqLiteDatabase = sqLite.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("user",acc);
        values.put("password",pass);
        sqLiteDatabase.insert("accounts", null, values);
    }

    public ArrayList<AccountModel> getDSAccount(){
        SQLiteDatabase sqLiteDatabase = sqLite.getReadableDatabase();
        Cursor c = sqLiteDatabase.rawQuery("select * from accounts", null);
        if(c.getCount()>0){
            c.moveToFirst();
            do {
                ds.add(new AccountModel(c.getString(1),c.getString(2)));
            }while (c.moveToNext());
        }
        return ds;
    }

    public boolean checkLogin(Context context,String users,String passwords){
        ds = getDSAccount();
        for(int i = 0; i < ds.size();i++){
        if(ds.get(i).getUser().equals(users)){
            if(passwords.equals(ds.get(i).getPassword())){
                return true;
            }
        }
        };
        return false;
    }

    public boolean changePass(String user,String password){

        return true;
    }
    }
</code>```

And lastly the signin java file

```<code>    package anhtuan.example.sample.Log;

    import androidx.appcompat.app.AlertDialog;
    import androidx.appcompat.app.AppCompatActivity;

    import android.content.DialogInterface;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;
    import android.widget.Toast;

    import com.google.android.material.textfield.TextInputEditText;

    import java.util.ArrayList;

    import anhtuan.example.sample.DAO.DAO;
    import anhtuan.example.sample.Home;
    import anhtuan.example.sample.Model.AccountModel;
    import anhtuan.example.sample.R;

    public class SignIn extends AppCompatActivity {
    TextInputEditText user,pass;
    TextView signup;
    Button Login;

    DAO dao;
    ArrayList<AccountModel> ds;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_in);
        setTitle("Sign In");
        user = findViewById(R.id.SIuser);
        pass = findViewById(R.id.SIpass);
        Login = findViewById(R.id.SIbtn);
        signup = findViewById(R.id.SItv);

        dao = new DAO(this);

        signup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent(SignIn.this,ForgotPass.class);
                startActivity(i);
            }
        });

        String Loginuser = user.getText().toString();
        String Loginpasse = pass.getText().toString();

        Login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(user.getText().length() == 0 || pass.getText().length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(SignIn.this);
                    builder.setTitle("You haven't insert all the blank");
                    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                        }
                    });
                    builder.show();
                }else{
                    if(dao.checkLogin(SignIn.this,Loginuser,Loginpasse)){
                        Intent i = new Intent(SignIn.this,Home.class);
                        startActivity(i);
                    }else{
                        AlertDialog.Builder builder = new AlertDialog.Builder(SignIn.this);
                        builder.setTitle("Check again !");
                        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                            }
                        });
                        builder.show();
                    }
                }
            }
        });
    }
    }
</code>```

I had try to use contain and indexOf with arrayList to find the data without using for loop but it always come out false so i decide to use for loop again.

Body:
Currently I am developing a personal software that is able to use the database to store the registered accounts and when logging in will retrieve the data from the database to compare with the characters been entered by the user.
But for some reason, even though I entered it correctly, I can't log in successfully

This is SQLite java file

    package anhtuan.example.sample.SQLite;

    import android.content.Context;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;

    import androidx.annotation.Nullable;

    public class SQLite extends SQLiteOpenHelper {
    public SQLite(@Nullable Context context) {
        super(context, "System", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        String account = "create table accounts " +
                "(" +
                "_id integer primary key autoincrement, " +
                "user text," +
                "password text" +
                ")";
        sqLiteDatabase.execSQL(account);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        sqLiteDatabase.execSQL("drop table if exists accounts");
        onCreate(sqLiteDatabase);
    }
    }

Here are DAO java file

    package anhtuan.example.sample.DAO;

    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.widget.Toast;

    import java.util.ArrayList;

    import anhtuan.example.sample.Log.SignUp;
    import anhtuan.example.sample.Model.AccountModel;
    import anhtuan.example.sample.SQLite.SQLite;

    public class DAO {
    SQLite sqLite;
    ArrayList<AccountModel> ds = new ArrayList<>();
    public DAO(Context context) {
        sqLite = new SQLite(context);
    }

    public void addUser(String acc, String pass) {
        SQLiteDatabase sqLiteDatabase = sqLite.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("user",acc);
        values.put("password",pass);
        sqLiteDatabase.insert("accounts", null, values);
    }

    public ArrayList<AccountModel> getDSAccount(){
        SQLiteDatabase sqLiteDatabase = sqLite.getReadableDatabase();
        Cursor c = sqLiteDatabase.rawQuery("select * from accounts", null);
        if(c.getCount()>0){
            c.moveToFirst();
            do {
                ds.add(new AccountModel(c.getString(1),c.getString(2)));
            }while (c.moveToNext());
        }
        return ds;
    }

    public boolean checkLogin(Context context,String users,String passwords){
        ds = getDSAccount();
        for(int i = 0; i < ds.size();i++){
        if(ds.get(i).getUser().equals(users)){
            if(passwords.equals(ds.get(i).getPassword())){
                return true;
            }
        }
        };
        return false;
    }

    public boolean changePass(String user,String password){

        return true;
    }
    }

And lastly the signin java file

    package anhtuan.example.sample.Log;

    import androidx.appcompat.app.AlertDialog;
    import androidx.appcompat.app.AppCompatActivity;

    import android.content.DialogInterface;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;
    import android.widget.Toast;

    import com.google.android.material.textfield.TextInputEditText;

    import java.util.ArrayList;

    import anhtuan.example.sample.DAO.DAO;
    import anhtuan.example.sample.Home;
    import anhtuan.example.sample.Model.AccountModel;
    import anhtuan.example.sample.R;

    public class SignIn extends AppCompatActivity {
    TextInputEditText user,pass;
    TextView signup;
    Button Login;

    DAO dao;
    ArrayList<AccountModel> ds;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_in);
        setTitle("Sign In");
        user = findViewById(R.id.SIuser);
        pass = findViewById(R.id.SIpass);
        Login = findViewById(R.id.SIbtn);
        signup = findViewById(R.id.SItv);

        dao = new DAO(this);

        signup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent(SignIn.this,ForgotPass.class);
                startActivity(i);
            }
        });

        String Loginuser = user.getText().toString();
        String Loginpasse = pass.getText().toString();

        Login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(user.getText().length() == 0 || pass.getText().length() == 0){
                    AlertDialog.Builder builder = new AlertDialog.Builder(SignIn.this);
                    builder.setTitle("You haven't insert all the blank");
                    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                        }
                    });
                    builder.show();
                }else{
                    if(dao.checkLogin(SignIn.this,Loginuser,Loginpasse)){
                        Intent i = new Intent(SignIn.this,Home.class);
                        startActivity(i);
                    }else{
                        AlertDialog.Builder builder = new AlertDialog.Builder(SignIn.this);
                        builder.setTitle("Check again !");
                        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                            }
                        });
                        builder.show();
                    }
                }
            }
        });
    }
    }

I had try to use contain and indexOf with arrayList to find the data without using for loop but it always come out false so i decide to use for loop again.


问:
grafana visualization of average throughput amazon EBS
i am trying to create a grafana dashboard with a graph to visualize average throughput of my volume (my es nodes are having a tough time..) but i am unable to see data

i used this link:
https://aws.amazon.com/premiumsupport/knowledge-center/ebs-cloudwatch-metrics-throughput-iops/
and was able to calculate my average throughput in the amazon console using cloudwatch but i dont know how to calculator it in the my grafana panel
i tried importing AWS EBS dashboard but the metric they are using is probably deprecated


问:
SQL: Find discontinuities in temporal data
I have a dataset where I have to find gaps in the temporal columns and show what happened before and after each section for each person in the list.

If nothing was present in the day before valid_from, I want a 0, and if something was present, I want whatever was present.

If nothing was present the day after valid_to, I want a 0.

See the example below, where person XXX starts in G1 and moves to G2 with only 1 day between. Hence old_value = 0 and new_value is G1 followed by old_value = G1 and new_value = G2.

It should never happen that valid_to next valid_from for the same person_id

Input data:

id
person_id
current_value
valid_from
valid_to

1
XXX
G1
2022-01-01
2022-02-01

2
XXX
G2
2022-02-02
2022-03-01

3
YYY
G1
2022-01-01
2022-02-01

4
YYY
G3
2022-02-02
2022-03-01

5
YYY
G1
2022-04-01
2022-04-30

6
ZZZ
G2
2022-01-01
2022-01-31

Expected result:

person_id
old_value
new_value
valid_from

XXX
0
G1
2022-01-01

XXX
G1
G2
2022-02-02

XXX
G2
0
2022-03-02

YYY
0
G1
2022-01-01

YYY
G1
G3
2022-02-02

YYY
G3
0
2022-02-03

YYY
0
G1
2022-04-01

YYY
G1
0
2022-05-01

ZZZ
0
G2
2022-01-01

ZZZ
G2
0
2022-02-01

What have been tried so far: Self joins and various filters, but that does not catch the case with ZZZ.
Also tried some magic with LAG in an inner query, but no success.


问:
Powershell: How Can I get the random property of get-service cmdlet?
I have:

```<code>$services = get-service | get-random -count 5 | Select-Object -Property DisplayName, Status, *HERE I WANT 2 RANDOM PROPERTIES*
</code>```

I created a list of random properties:

```<code>$randomPropertyName = get-service | get-member | Where-Object memberType -eq property | get-random -count 2 | Select-Object name
</code>```

and i cannot convert it from object.array to string, I tried:

```<code>[string]$random1 = $randomPropertyName[0] | ft -hidetableheaders
</code>```

Body:
I have:

$services = get-service | get-random -count 5 | Select-Object -Property DisplayName, Status, *HERE I WANT 2 RANDOM PROPERTIES*

I created a list of random properties:

$randomPropertyName = get-service | get-member | Where-Object memberType -eq property | get-random -count 2 | Select-Object name

and i cannot convert it from object.array to string, I tried:

[string]$random1 = $randomPropertyName[0] | ft -hidetableheaders


问:
Qt : cannot connect signal and slot in 2 custom classes
I have problems with signal -> slot between custom classes

The definition of parameters class

```<code>class Parameters : public QObject
{
    Q_OBJECT

    public:
        //public stuff
    private slots:
       void NewValue(int Index, QVariant Value);

    private:
    //private stuff
}
</code>```

The definition of qNumedit class

```<code>class QNumEdit : public QLineEdit
{
    Q_OBJECT

    public:
        //public stuff
    signals:
        void ValueChanged(int ,QVariant);

    private:
        //private stuff
}
</code>```

In QnumEdit i emit a signal

```<code>emit ValueChanged(1,2);`
</code>```

this is my slot function

```<code>void Parameters::NewValue(int Index, QVariant Value)
{
    qDebug() << "NewValue " << Index << Value;
}
</code>```

this is a static test function

```<code>void test(int Index, QVariant Value)
{
    qDebug() << "test " << Index << Value;
}
</code>```

This is the way I connect both

```<code>QNumEdit* e = new QNumEdit(QMetaType::Double, i);
QObject::connect(e,&QNumEdit::ValueChanged,this,&Parameters::NewValue); //DOES NOT WORK
QObject::connect(e,&QNumEdit::ValueChanged,test);   //THIS WORKS OK!!!`
</code>```

The slot function  NewValue is never triggered
The static function Test is triggered

When I do the same thing, but the receiving class is my mainwindow, everything is OK.

Any idea ?

Body:
I have problems with signal -> slot between custom classes

The definition of parameters class

class Parameters : public QObject
{
    Q_OBJECT

    public:
        //public stuff
    private slots:
       void NewValue(int Index, QVariant Value);

    private:
    //private stuff
}

The definition of qNumedit class

class QNumEdit : public QLineEdit
{
    Q_OBJECT

    public:
        //public stuff
    signals:
        void ValueChanged(int ,QVariant);

    private:
        //private stuff
}

In QnumEdit i emit a signal

emit ValueChanged(1,2);`

this is my slot function

void Parameters::NewValue(int Index, QVariant Value)
{
    qDebug() << "NewValue " << Index << Value;
}

this is a static test function

void test(int Index, QVariant Value)
{
    qDebug() << "test " << Index << Value;
}

This is the way I connect both

QNumEdit* e = new QNumEdit(QMetaType::Double, i);
QObject::connect(e,&QNumEdit::ValueChanged,this,&Parameters::NewValue); //DOES NOT WORK
QObject::connect(e,&QNumEdit::ValueChanged,test);   //THIS WORKS OK!!!`

The slot function  NewValue is never triggered
The static function Test is triggered

When I do the same thing, but the receiving class is my mainwindow, everything is OK.

Any idea ?


问:
Javascript - how to give an id name with querySelector followed by a incremented number?
I add a row to an array using the javascript clone function and I want an element of my new row, namely an input, to take an id name followed by a number corresponding to its rank.

For example, if I add a row, the input thus created will have the id "HiddenBox1". If I add another one, it will have the id "HiddenBox2", and so on.

The following script allows to increment the first input "id=boxHidden" to 0 (id="0") after submitting (button 'Add') but can't replace the next "id=boxHidden" by id="1" and the following one by id="2", and so on. Solution ? Thanks for help !

```<code><script>
function addRow() {
    const table = document.querySelector('#tbl_usr_task'); //id of the table
    const tfoot = table.querySelector('tfoot'); //tfoot of the table
    const emptyRow = tfoot.querySelector('tr:nth-child(2)'); // the line (tr) I want to clone
    const clone = emptyRow.cloneNode(true);
    clone.querySelector('th').innerHTML = '';
    tfoot.appendChild(clone); // the clone
    [].forEach.call(document.querySelectorAll('tr:nth-child(2)'), function() {
        var div_array = [...document.querySelector('td:nth-child(8)').querySelectorAll('#boxHidden')]; // converts NodeList to Array
        div_array.forEach((v,i)=>v.id=i+0);
    });
}
</script>
<button type="button" class="btn btn-light add-more" onclick="addRow();">Add</button>
</code>```
```<code><tr>
  <th style="display: none">

  </th>

  <td>
    <input id="boxHidden" type='hidden' name='ovr_ms[]' value='0' />
    <input id="boxVisible" type="checkbox" name="ovr_ms[]" value='1' onclick="disableHiddenBox()"/>
  </td>
</tr>
</code>```

Body:
I add a row to an array using the javascript clone function and I want an element of my new row, namely an input, to take an id name followed by a number corresponding to its rank.

For example, if I add a row, the input thus created will have the id "HiddenBox1". If I add another one, it will have the id "HiddenBox2", and so on.

The following script allows to increment the first input "id=boxHidden" to 0 (id="0") after submitting (button 'Add') but can't replace the next "id=boxHidden" by id="1" and the following one by id="2", and so on. Solution ? Thanks for help !

<button type="button" class="btn btn-light add-more" onclick="addRow();">Add</button>

    <input id="boxHidden" type='hidden' name='ovr_ms[]' value='0' />
    <input id="boxVisible" type="checkbox" name="ovr_ms[]" value='1' onclick="disableHiddenBox()"/>


问:
WASI: wasm-ld symbol not found
The following short c example uses the standard c library and therefore requires the wasi sdk:

#include <stdio.h>

int main(void)
{
    puts("Hello");
    return 0;
}
```
<p>When compiling the code directly with clang to wasm it works without problem:</p>
<pre class="lang-bash prettyprint-override"><code>clang --target=wasm32-unknown-wasi -s -o example.wasm example.c
</code>```

My understanding of the LLVM tool chain is that I could achieve the same result with either

clang -> LLVM IR (.ll) -> LLVM native object files (.o) -> convert to wasm

clang -> LLVM native object files (.o) -> convert to wasm

I am able to use the second approach with a simple C program which does not use standard lib calls, when trying with the example above I receive a undefined symbol error:

clang --target=wasm32-unknown-wasi -c  example.c
wasm-ld example.o -o example.wasm  --no-entry --export-all
   wasm-ld: error: example.o: undefined symbol: puts
```

I do not know if my problem is that I use the wrong clang parameters and therefore not export enough information or that the error is in the wasm-ld command.

Would be happy if someone could give me more insight into tool chain, thanks

Title: WASI: wasm-ld symbol not found

Body:
The following short c example uses the standard c library and therefore requires the wasi sdk:

#include <stdio.h>

int main(void)
{
    puts("Hello");
    return 0;
}

When compiling the code directly with clang to wasm it works without problem:

clang --target=wasm32-unknown-wasi -s -o example.wasm example.c

My understanding of the LLVM tool chain is that I could achieve the same result with either

clang -> LLVM IR (.ll) -> LLVM native object files (.o) -> convert to wasm

clang -> LLVM native object files (.o) -> convert to wasm

I am able to use the second approach with a simple C program which does not use standard lib calls, when trying with the example above I receive a undefined symbol error:

clang --target=wasm32-unknown-wasi -c  example.c
wasm-ld example.o -o example.wasm  --no-entry --export-all
   wasm-ld: error: example.o: undefined symbol: puts

I do not know if my problem is that I use the wrong clang parameters and therefore not export enough information or that the error is in the wasm-ld command.

Would be happy if someone could give me more insight into tool chain, thanks


问:
Is it right to create a custom authentication form.Forms instead of extending the Django AuthenticationForm?
I've been working on my first authentication system using Django and I wanted to make it complete, with field validations, login with email and even send a confirmation email to activate the account (which I haven't done yet).
So far, I have made: A small custom user model with email field, an extension of the UserCreationForm to register users using their emails (which works), and finally the main problem, I tried to make an extension of the AuthenticationForm to login users using their emails instead of their usernames, but it doesn't seem to work. First, I tried to overwrite the clean method of the form but it didn't work, then I tried to make a backend.py to overwrite how the authentication system works but it failed and I couldn't understand why, so I created my own form using form.Forms with all the necessary fields and validations and it worked fine. I've heard that it's not a good idea to use form.Forms if I interact with models, but it was the only solution I could think of. Should I try to extend the AuthenticationForm instead of creating a form from scratch? Or is my form fine for the system I want to build?

Thanks for taking your time!

```<code>forms.py
</code>```
```<code>class IngresarUsuarioForm(forms.Form):
    email = forms.EmailField(
        widget=forms.EmailInput(attrs={"placeholder": "Ingrese su email"}),
        required=True,
        label="Email",
    )
    password = forms.CharField(
        widget=forms.PasswordInput(attrs={"placeholder": "Ingrese su contraseña"}),
        required=True,
        label="Contraseña",
    )

    def clean(self):
        email = self.cleaned_data.get("email")
        password = self.cleaned_data.get("password")
        user = authenticate(email=email, password=password)
        if user is None:
            raise forms.ValidationError(
                "El email o contraseña no son válidos.",
                code="invalid_login",
                params={"email": email},
            )
        else:
            if not user.is_active:
                raise forms.ValidationError(
                    "La cuenta no ha sido activada.", code="inactive"
                )
        return self.cleaned_data

class CrearUsuarioForm(UserCreationForm):
    error_messages = {
        "password_mismatch": "Las contraseñas no coinciden.",
    }

    password1 = forms.CharField(
        widget=forms.PasswordInput(attrs={"placeholder": "Ingrese una contraseña"}),
        required=True,
        label="Contraseña",
    )
    password2 = forms.CharField(
        widget=forms.PasswordInput(attrs={"placeholder": "Confirme la contraseña"}),
        required=True,
        label="Confirmación de contraseña",
    )

    class Meta:
        model = Usuario
        fields = ["username", "email", "password1", "password2"]
        widgets = {
            "username": forms.TextInput(attrs={"placeholder": "Ingrese un nombre"}),
            "email": forms.EmailInput(attrs={"placeholder": "Ingrese su email"}),
        }

        error_messages = {
            "username": {"unique": "Ese nombre de usuario ya ha sido utilizado."},
            "email": {"unique": "Ese email ya ha sido utilizado."},
        }

'''
views.py
'''

def indexView(request):
        context = {}
        return render(request, "logueo/index.html", context)

def registroView(request):
    if request.method == "POST":
        form = CrearUsuarioForm(request.POST)
        if form.is_valid():
            user = form.save(commit=False)
            user.username = user.username.lower()
            user.email = user.email.lower()
            user.is_active = False
            # Acá finalmente sí guardo el form en la base de datos.
            user.save()
            return redirect("aviso")
    else:
        form = CrearUsuarioForm()
    context = {"form": form}
    return render(request, "logueo/ingresar.html", context)

def avisoView(request):
    context = {}
    return render(request, "logueo/aviso.html", context)

def logueoView(request):
    context = {}
    if request.user.is_authenticated:
        redirect("index")

    if request.method == "POST":
        form = IngresarUsuarioForm(request.POST)
        if form.is_valid():
            email = form.cleaned_data.get("email")
            password = form.cleaned_data.get("password")
            user = authenticate(email=email, password=password)
            if user is not None:
                login(request, user)
                return redirect("index")
    else:
        form = IngresarUsuarioForm()
    context = {"form": form}
    return render(request, "logueo/ingresar.html", context)

def deslogueoView(request):
    logout(request)
    return redirect("index")

@login_required(login_url="logueo")
def seccionView(request):
    context = {}
    return render(request, "logueo/private.html", context)

'''
models.py
'''

class Usuario(AbstractUser):
    nombre = models.CharField(max_length=100, null=True)
    email = models.EmailField(unique=True, null=True)

    USERNAME_FIELD = "email"
    REQUIRED_FIELDS = []
</code>```

Body:
I've been working on my first authentication system using Django and I wanted to make it complete, with field validations, login with email and even send a confirmation email to activate the account (which I haven't done yet).
So far, I have made: A small custom user model with email field, an extension of the UserCreationForm to register users using their emails (which works), and finally the main problem, I tried to make an extension of the AuthenticationForm to login users using their emails instead of their usernames, but it doesn't seem to work. First, I tried to overwrite the clean method of the form but it didn't work, then I tried to make a backend.py to overwrite how the authentication system works but it failed and I couldn't understand why, so I created my own form using form.Forms with all the necessary fields and validations and it worked fine. I've heard that it's not a good idea to use form.Forms if I interact with models, but it was the only solution I could think of. Should I try to extend the AuthenticationForm instead of creating a form from scratch? Or is my form fine for the system I want to build?

Thanks for taking your time!

forms.py

class IngresarUsuarioForm(forms.Form):
    email = forms.EmailField(
        widget=forms.EmailInput(attrs={"placeholder": "Ingrese su email"}),
        required=True,
        label="Email",
    )
    password = forms.CharField(
        widget=forms.PasswordInput(attrs={"placeholder": "Ingrese su contraseña"}),
        required=True,
        label="Contraseña",
    )

    def clean(self):
        email = self.cleaned_data.get("email")
        password = self.cleaned_data.get("password")
        user = authenticate(email=email, password=password)
        if user is None:
            raise forms.ValidationError(
                "El email o contraseña no son válidos.",
                code="invalid_login",
                params={"email": email},
            )
        else:
            if not user.is_active:
                raise forms.ValidationError(
                    "La cuenta no ha sido activada.", code="inactive"
                )
        return self.cleaned_data

class CrearUsuarioForm(UserCreationForm):
    error_messages = {
        "password_mismatch": "Las contraseñas no coinciden.",
    }

    password1 = forms.CharField(
        widget=forms.PasswordInput(attrs={"placeholder": "Ingrese una contraseña"}),
        required=True,
        label="Contraseña",
    )
    password2 = forms.CharField(
        widget=forms.PasswordInput(attrs={"placeholder": "Confirme la contraseña"}),
        required=True,
        label="Confirmación de contraseña",
    )

    class Meta:
        model = Usuario
        fields = ["username", "email", "password1", "password2"]
        widgets = {
            "username": forms.TextInput(attrs={"placeholder": "Ingrese un nombre"}),
            "email": forms.EmailInput(attrs={"placeholder": "Ingrese su email"}),
        }

        error_messages = {
            "username": {"unique": "Ese nombre de usuario ya ha sido utilizado."},
            "email": {"unique": "Ese email ya ha sido utilizado."},
        }

'''
views.py
'''

def indexView(request):
        context = {}
        return render(request, "logueo/index.html", context)

def registroView(request):
    if request.method == "POST":
        form = CrearUsuarioForm(request.POST)
        if form.is_valid():
            user = form.save(commit=False)
            user.username = user.username.lower()
            user.email = user.email.lower()
            user.is_active = False
            # Acá finalmente sí guardo el form en la base de datos.
            user.save()
            return redirect("aviso")
    else:
        form = CrearUsuarioForm()
    context = {"form": form}
    return render(request, "logueo/ingresar.html", context)

def avisoView(request):
    context = {}
    return render(request, "logueo/aviso.html", context)

def logueoView(request):
    context = {}
    if request.user.is_authenticated:
        redirect("index")

    if request.method == "POST":
        form = IngresarUsuarioForm(request.POST)
        if form.is_valid():
            email = form.cleaned_data.get("email")
            password = form.cleaned_data.get("password")
            user = authenticate(email=email, password=password)
            if user is not None:
                login(request, user)
                return redirect("index")
    else:
        form = IngresarUsuarioForm()
    context = {"form": form}
    return render(request, "logueo/ingresar.html", context)

def deslogueoView(request):
    logout(request)
    return redirect("index")

@login_required(login_url="logueo")
def seccionView(request):
    context = {}
    return render(request, "logueo/private.html", context)

'''
models.py
'''

class Usuario(AbstractUser):
    nombre = models.CharField(max_length=100, null=True)
    email = models.EmailField(unique=True, null=True)

    USERNAME_FIELD = "email"
    REQUIRED_FIELDS = []


问:
Creation of a timeline for all months per year
I have a problem. I have a timeline.
In this timeline I would like to indicate the whole events for each year. More precisely, I want to indicate all the months in the year that exist.

What is the best way to loop through all the months and years so that I don't have to repeat everything?

So I want to show all unique years on the one hand and then all unique months.
During the months I would then like to display the individual dates.

import React, { useState, useEffect } from "react";
import { useHistory } from "react-router-dom";

function Event() {
  events = [
    {
      eventid: 6,
      name: "Event 1",
      description: "This is the first event.",
      date: "10.10.2023",
      status: "XO",
    },
    {
      eventid: 8,
      name: "Event 2",
      description: "This is a another event",
      date: "14.01.2023",
      status: "XO",
    },
    {
      eventid: 8,
      name: "Event 3",
      description: "This is the last event",
      date: "14.03.2024",
      status: "OS",
    },
  ];

  const result = {};
  for (let e of res.data) {
    const [_, m, y] = e.datum.split(".");
    const yn = parseInt(y);
    const mn = parseInt(m);

    if (!result[yn]) result[yn] = [];
    if (!result[yn].includes(mn)) result[yn].push(mn);
  }

  for (let y in result) {
    result[y] = result[y]
      .sort()
      .map((m) =>
        new Date(2020, m - 1, 1).toLocaleString("en-US", { month: "long" })
      );
  }

  return (

          2023

          January

14. January

Event 2

This is a another event.

          October

10. Januar

Event 1

This is the first event.

          2024

          March

14. Januar

Event 3

This is the last event

  );
}

export default Event;

```

What I want

Body:
I have a problem. I have a timeline.
In this timeline I would like to indicate the whole events for each year. More precisely, I want to indicate all the months in the year that exist.

What is the best way to loop through all the months and years so that I don't have to repeat everything?

So I want to show all unique years on the one hand and then all unique months.
During the months I would then like to display the individual dates.

import React, { useState, useEffect } from "react";
import { useHistory } from "react-router-dom";

function Event() {
  events = [
    {
      eventid: 6,
      name: "Event 1",
      description: "This is the first event.",
      date: "10.10.2023",
      status: "XO",
    },
    {
      eventid: 8,
      name: "Event 2",
      description: "This is a another event",
      date: "14.01.2023",
      status: "XO",
    },
    {
      eventid: 8,
      name: "Event 3",
      description: "This is the last event",
      date: "14.03.2024",
      status: "OS",
    },
  ];

  const result = {};
  for (let e of res.data) {
    const [_, m, y] = e.datum.split(".");
    const yn = parseInt(y);
    const mn = parseInt(m);

    if (!result[yn]) result[yn] = [];
    if (!result[yn].includes(mn)) result[yn].push(mn);
  }

  for (let y in result) {
    result[y] = result[y]
      .sort()
      .map((m) =>
        new Date(2020, m - 1, 1).toLocaleString("en-US", { month: "long" })
      );
  }

  return (

          2023

          January

14. January

Event 2

This is a another event.

          October

10. Januar

Event 1

This is the first event.

          2024

          March

14. Januar

Event 3

This is the last event

  );
}

export default Event;

What I want


问:
How to put CheckBoxPreference on pop out dialog like ListPreference
I have several preferences items that a user can choose from and wanted to have them on a CheckBoxPreference widget. Since its a list of over 7 Items; on a preference activity with other options, it may lead to an unsightly scrolling IMHO. So I wanted to have it like the ListPreference pop out which is built into it, how could I have that pop out for CheckBoxPreference? Thanks guys</p>

ContentLicense: CC BY-SA 3.0