问:
Why can't I run Main.java on Eclipse "Errors exist in required project(s)"
Here is error when I press run:

Down is Main.java and I don't know what this is. Yesterday I used this file and nothing happened.

```<code>package application;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {
        try {
            BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("LogIn.fxml"));
            Scene scene = new Scene(root, 700,512);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.initStyle(StageStyle.DECORATED);
            primaryStage.setScene(scene);
            primaryStage.show();
            primaryStage.setTitle("Log In");
            Image icon = new Image(getClass().getResourceAsStream("sherr.jpeg"));
            primaryStage.getIcons().add(icon);
            primaryStage.setResizable(false);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}
</code>```

Here is what displayed on Console

Body:
Here is error when I press run:

Down is Main.java and I don't know what this is. Yesterday I used this file and nothing happened.

package application;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {
        try {
            BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("LogIn.fxml"));
            Scene scene = new Scene(root, 700,512);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.initStyle(StageStyle.DECORATED);
            primaryStage.setScene(scene);
            primaryStage.show();
            primaryStage.setTitle("Log In");
            Image icon = new Image(getClass().getResourceAsStream("sherr.jpeg"));
            primaryStage.getIcons().add(icon);
            primaryStage.setResizable(false);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Here is what displayed on Console


来源: stackexchange

问:
Neural Network: For Binary Classification use 1 or 2 output neurons with VGG19
I have two groups of images (concrete cracks and uncracked concrete) so they are binary classification, I am making classification for them by using vgg19.
when I used  (1) neuron for the output layer and using softmax I got accuracy 0.5 and fixed during 250 epochs, while when I used 2 neuron with softmax the accuaracy increaced above 0.9.

So, shall I have to use 1 or 2 neurons for the output for VGG19 with binary classification?

ContentLicense: CC BY-SA 4.0


问:
SSL: Certificate verify failed using LeapHybridCQMSampler (DWave - Quantum Computing)
I'm having some trouble when trying to use the LeapHybridCQMSampler in the connection with cloud.dwavesys.com. This is the error log:

SSLError: HTTPSConnectionPool(host='cloud.dwavesys.com', port=443):
Max retries exceeded with url: /metadata/v1/regions/ (Caused by
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate
(_ssl.c:1108)')))

I tried using the permissive_ssl parameter, but it doesn't make any difference. I also tried running it in several devices and couldn't solve it either.

Here is the code I'm using, where I just build a simple CQM and send it to the sampler:

```<code>import dwave.system
from dimod import Integer, ConstrainedQuadraticModel

x = [Integer(f'x_{i}') for i in range(4)]

cqm = ConstrainedQuadraticModel()

H_Objective = -5*x[0] - x[1] + x[2] - x[3]

cqm.set_objective(H_Objective)

cqm.add_constraint(20 - 10*x[0] - x[1] - x[2] - x[3] >=0)

sampler = dwave.system.LeapHybridCQMSampler()
sampleset = sampler.sample_cqm(cqm, num_reads=5000)
</code>```

Body:
I'm having some trouble when trying to use the LeapHybridCQMSampler in the connection with cloud.dwavesys.com. This is the error log:

SSLError: HTTPSConnectionPool(host='cloud.dwavesys.com', port=443):
Max retries exceeded with url: /metadata/v1/regions/ (Caused by
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate
(_ssl.c:1108)')))

I tried using the permissive_ssl parameter, but it doesn't make any difference. I also tried running it in several devices and couldn't solve it either.

Here is the code I'm using, where I just build a simple CQM and send it to the sampler:

import dwave.system
from dimod import Integer, ConstrainedQuadraticModel

x = [Integer(f'x_{i}') for i in range(4)]

cqm = ConstrainedQuadraticModel()

H_Objective = -5*x[0] - x[1] + x[2] - x[3]

cqm.set_objective(H_Objective)

cqm.add_constraint(20 - 10*x[0] - x[1] - x[2] - x[3] >=0)

sampler = dwave.system.LeapHybridCQMSampler()
sampleset = sampler.sample_cqm(cqm, num_reads=5000)


问:
Why default vue swiper thumb gallery does not work?
I've created a code sample stackblitz sandbox. I want to create a vue swiper
Thumbs gallery, but default code from docs does not working. The bottom carousel does not switch the top carousel.. How to fix it ?</p>


问:
How to reuse a group and/or path in android vector drawable
I have the following vector drawable code

```<code>        <vector
            android:name="vector"
            android:width="9dp"
            android:height="16dp"
            android:viewportWidth="9"
            android:viewportHeight="16">

            <path
                android:fillColor="#11141C"
                android:pathData="M0,0 H9 V16 H0 Z" />

            <group
                android:name="group"
                android:pivotX="4.5"
                android:pivotY="9">
                <path
                    android:fillColor="#F57C00"
                    android:pathData="M4.5,6 c0.1,-1 0.2,-2 0.2,-3 c0,-1 -0.4,-1 -0.4,0 c0,1 0.1,2 0.2,3 z" />

                <path
                    android:fillType="evenOdd"
                    android:pathData="M4.5,6.5 c0.1,-1 0.2,-2 0.3,-3.5 c0,-1.2 -0.6,-1.2 -0.6,0 c0.1,1.5 0.2,2.5 0.3,3.5 z">
                    <aapt:attr name="android:fillColor">
                        <gradient
                            android:centerX="4.5"
                            android:centerY="2.5"
                            android:gradientRadius="5"
                            android:type="radial">
                            <item
                                android:color="#B9F57C00"
                                android:offset="0.0" />
                            <item
                                android:color="#00000000"
                                android:offset="1.0" />
                        </gradient>
                    </aapt:attr>
                </path>
            </group>
        </vector>
</code>```

I want to reuse the group "group" with different rotations and transitions without having to write all the inner code.

In SVG there is the tag <use> which can be used for this job but I can't find an equivalent in android syntax

Body:
I have the following vector drawable code

        <vector
            android:name="vector"
            android:width="9dp"
            android:height="16dp"
            android:viewportWidth="9"
            android:viewportHeight="16">

            <path
                android:fillColor="#11141C"
                android:pathData="M0,0 H9 V16 H0 Z" />

            <group
                android:name="group"
                android:pivotX="4.5"
                android:pivotY="9">
                <path
                    android:fillColor="#F57C00"
                    android:pathData="M4.5,6 c0.1,-1 0.2,-2 0.2,-3 c0,-1 -0.4,-1 -0.4,0 c0,1 0.1,2 0.2,3 z" />

                <path
                    android:fillType="evenOdd"
                    android:pathData="M4.5,6.5 c0.1,-1 0.2,-2 0.3,-3.5 c0,-1.2 -0.6,-1.2 -0.6,0 c0.1,1.5 0.2,2.5 0.3,3.5 z">
                    <aapt:attr name="android:fillColor">
                        <gradient
                            android:centerX="4.5"
                            android:centerY="2.5"
                            android:gradientRadius="5"
                            android:type="radial">
                            <item
                                android:color="#B9F57C00"
                                android:offset="0.0" />
                            <item
                                android:color="#00000000"
                                android:offset="1.0" />
                        </gradient>
                    </aapt:attr>
                </path>
            </group>
        </vector>

I want to reuse the group "group" with different rotations and transitions without having to write all the inner code.

In SVG there is the tag <use> which can be used for this job but I can't find an equivalent in android syntax


问:
How to get the average of n rasters
I have a list of n rasters and I would like to have a single raster that compute the average of all the rasters.

This the list of files from a python code

```<code>files
['../data_revision/LST/day/LST_Day_199_2018.tif',
 '../data_revision/LST/day/LST_Day_199_2012.tif',
 '../data_revision/LST/day/LST_Day_199_2013.tif',
 '../data_revision/LST/day/LST_Day_199_2011.tif',
 '../data_revision/LST/day/LST_Day_199_2017.tif',
 '../data_revision/LST/day/LST_Day_199_2015.tif',
 '../data_revision/LST/day/LST_Day_199_2016.tif',
 '../data_revision/LST/day/LST_Day_199_2021.tif',
 '../data_revision/LST/day/LST_Day_199_2020.tif',
 '../data_revision/LST/day/LST_Day_199_2014.tif',
 '../data_revision/LST/day/LST_Day_199_2019.tif',
 '../data_revision/LST/day/LST_Day_199_2010.tif']
</code>```

I could use GDAL to make the average of two images

```<code>import os
os.system('gdal_calc.py -A input.tif -B input2.tif --outfile=result.tif --calc="(A+B)/2"')
</code>```

Is there a way to compute the average of all the files using one command?

Title: How to get the average of n rasters

Body:
I have a list of n rasters and I would like to have a single raster that compute the average of all the rasters.

This the list of files from a python code

files
['../data_revision/LST/day/LST_Day_199_2018.tif',
 '../data_revision/LST/day/LST_Day_199_2012.tif',
 '../data_revision/LST/day/LST_Day_199_2013.tif',
 '../data_revision/LST/day/LST_Day_199_2011.tif',
 '../data_revision/LST/day/LST_Day_199_2017.tif',
 '../data_revision/LST/day/LST_Day_199_2015.tif',
 '../data_revision/LST/day/LST_Day_199_2016.tif',
 '../data_revision/LST/day/LST_Day_199_2021.tif',
 '../data_revision/LST/day/LST_Day_199_2020.tif',
 '../data_revision/LST/day/LST_Day_199_2014.tif',
 '../data_revision/LST/day/LST_Day_199_2019.tif',
 '../data_revision/LST/day/LST_Day_199_2010.tif']

I could use GDAL to make the average of two images

import os
os.system('gdal_calc.py -A input.tif -B input2.tif --outfile=result.tif --calc="(A+B)/2"')

Is there a way to compute the average of all the files using one command?


问:
NumberFormatter not working on danielgindi Charts
I just updated https://github.com/danielgindi/Charts to Charts 4.1 from 3.1

Before I formatted my values with this code

```<code>let pFormatter = NumberFormatter()
    pFormatter.numberStyle = .percent
    pFormatter.maximumFractionDigits = 0
    pFormatter.multiplier = 1
    pFormatter.percentSymbol = "%"
    chartData.setValueFormatter(DefaultValueFormatter(formatter: pFormatter))
</code>```

But it has no effect at all. Values are rare, unformatted and no percentSymbol at all.

I tried to google, but all solutions seem to be the same code as mine.
For some reason, the formatter has no effect at all, before it worked.

I checked the changelog but I can't find anything which had changed in terms of value formatting.

Body:
I just updated https://github.com/danielgindi/Charts to Charts 4.1 from 3.1

Before I formatted my values with this code

let pFormatter = NumberFormatter()
    pFormatter.numberStyle = .percent
    pFormatter.maximumFractionDigits = 0
    pFormatter.multiplier = 1
    pFormatter.percentSymbol = "%"
    chartData.setValueFormatter(DefaultValueFormatter(formatter: pFormatter))

But it has no effect at all. Values are rare, unformatted and no percentSymbol at all.

I tried to google, but all solutions seem to be the same code as mine.
For some reason, the formatter has no effect at all, before it worked.

I checked the changelog but I can't find anything which had changed in terms of value formatting.


问:
The _id in a subdocument in mongoose schema keeps changing
I have a model like this:

```<code>const productSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
  },
  description: {
    type: String,
  },
  package: [
    {
      name: {
        type: String,
        required: true,
      },
      description: {
        type: String,
        required: true,
      },
      price: {
        type: Number,
        required: true,
      },
    },
  ],
});
module.exports = product = mongoose.model('product', productSchema);
</code>```

and I have created some products in my db. Everytime I fetch a product by its _id I get the package array with varying _id objects in the array. I have to use the ids of the product and a package inside it for comparison and validation purposes but I can't due to the varying nature of the package ids. Is there any way to make it static so it doesn't change just like the product document id?

Body:
I have a model like this:

const productSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
  },
  description: {
    type: String,
  },
  package: [
    {
      name: {
        type: String,
        required: true,
      },
      description: {
        type: String,
        required: true,
      },
      price: {
        type: Number,
        required: true,
      },
    },
  ],
});
module.exports = product = mongoose.model('product', productSchema);

and I have created some products in my db. Everytime I fetch a product by its _id I get the package array with varying _id objects in the array. I have to use the ids of the product and a package inside it for comparison and validation purposes but I can't due to the varying nature of the package ids. Is there any way to make it static so it doesn't change just like the product document id?


问:
PWA Android fullscreen display :  doesn't take 100% of the  wrapper
I created a PWA with a display "fullscreen" specified in the manifest. However, the body doesn't take 100% of the height of its HTML parent. The body is scrollable and doesn't take the whole height

Here the basic CSS

html,
body,
#root {
  background: green;
  padding: 0;
  margin: 0;
}

```
<p>The HTML opened by the PWA</p>
<pre class="lang-html prettyprint-override"><code><!DOCTYPE html>
<html translate="no" class="notranslate" lang="en">
  <head>
    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width; initial-scale=1; viewport-fit=cover" />
    <meta name="mobile-web-app-capable" content="yes" />
    <title>Test</title>
    <meta name="google" content="notranslate" />
    <meta name="description" content="Flink HubOne App" />
    <link rel="icon" href="/favicon.ico" />
    <link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180" />
    <link rel="mask-icon" href="/mask-icon.png" color="#FFFFFF" />
    <meta name="theme-color" content="#000000" />
  </head>
  <body>
    <div style="background-color: red; flex: 1; padding: 0; margin: 0;">
      <h1>TEST</h1>
      <h1>TEST</h1>
      <h1>TEST</h1>
      <h1>TEST</h1>
      <h1>TEST</h1>
      <h1>TEST</h1>
    </div>
  </body>
</html>

</code>```

Here the configuration used for my PWA

manifest: {
    id: "/",
    name: "Test App",
    short_name: "Test",
    description: "Test",
    theme_color: "#ffffff",
    display: "fullscreen",
    scope: "/",
    start_url: "/",
  },
```

Title: PWA Android fullscreen display : <body> doesn't take 100% of the <html> wrapper

Body:
I created a PWA with a display "fullscreen" specified in the manifest. However, the body doesn't take 100% of the height of its HTML parent. The body is scrollable and doesn't take the whole height

Here the basic CSS

html,
body,
#root {
  background: green;
  padding: 0;
  margin: 0;
}

The HTML opened by the PWA

<!DOCTYPE html>

    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width; initial-scale=1; viewport-fit=cover" />
    <meta name="mobile-web-app-capable" content="yes" />
    <title>Test</title>
    <meta name="google" content="notranslate" />
    <meta name="description" content="Flink HubOne App" />
    <link rel="icon" href="/favicon.ico" />
    <link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180" />
    <link rel="mask-icon" href="/mask-icon.png" color="#FFFFFF" />
    <meta name="theme-color" content="#000000" />

TEST

TEST

TEST

TEST

TEST

TEST

Here the configuration used for my PWA

manifest: {
    id: "/",
    name: "Test App",
    short_name: "Test",
    description: "Test",
    theme_color: "#ffffff",
    display: "fullscreen",
    scope: "/",
    start_url: "/",
  },


问:
Adding to database from another database using button in django
I am creating a web application in which there is a lot of data displayed in tables. I wanted to create a platform where there are various documents, and in order to see them, the user has to send a request for access. Meaning it browses what documents are available and asks for access to see their details. Now I've run into a problem that I can't solve.

I want to add data from one table to another without form. Only by clicking a button in a table row (this is the "request for access"). The data in that row would be added to another table.

Unfortunately, when I click the button, nothing happens. I know I'm probably going about this the wrong way, but when no problem is displayed, the page reloads normally, I don't have any ideas how to solve it.

I created models:

```<code>class CourtFile(models.Model):
    court = models.ForeignKey(Court, on_delete=models.CASCADE, null=True)
    signature = models.CharField(max_length=200, null=True)
    article = models.CharField(max_length=200, null=True)
    contents_list = models.FileField(upload_to = "filepath", null=True)

    def __str__(self):
        return f'{self.court} - {self.signature}'
</code>```
```<code>class AccessRequest(models.Model):
    user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
    status = models.BooleanField(null=True)
    signature = models.ForeignKey(CourtFile, on_delete=models.CASCADE, null=True)

    def __str__(self):
        return f'{self.signature}'
</code>```

I am displaying the table like this:

```<code><tbody>
{% for courtfile in courtfiles_list %}
<tr>
<td>{{courtfile.signature}}</td>
<td>{{courtfile.court}}</td>
<td>{{courtfile.article}}</td>
<td><a href="{% url 'podglad' courtfile.id %}" button class="btn btn-primary" type="button">Podgląd</a></td>
<form method="POST">
{% csrf_token %}
<td><a href="{% url 'access' courtfile.id %}" button class="btn btn-primary" type="submit">Uzyskaj dostęp</a></td>
</form>
</tr>
{% endfor %}
</tbody>
</code>```

The data is displayed on the "start_u" page, after pressing the button and adding data to another database, I would like to return to the "start_u" page
And it's my views.py:

```<code>@login_required(login_url='login')
def startPage(request):
    courtfiles_list = CourtFile.objects.all()
    access_list = AccessRequest.objects.all()
    context = {'courtfiles_list': courtfiles_list, 'access_list': access_list}

    return render(request, 'users/start_u.html', context)
</code>```
```<code>@login_required(login_url='login')
@allowed_users(allowed_roles=['user'])
def accessView(request, access_id):
    access_request = CourtFile.objects.get(pk=access_id)
    current_user = request.user
    if request.method == 'POST':
        entry = AccessRequest.objects.create(user=current_user, status=0, signature=access_request)
        entry.save(force_insert=True)
    return redirect('start_u')
</code>```

urls.py:

```<code>path('start_u/', views.startPage, name="start_u"),

</code>```

path('access/<access_id>', views.accessView, name="access"),

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

Body:
I am creating a web application in which there is a lot of data displayed in tables. I wanted to create a platform where there are various documents, and in order to see them, the user has to send a request for access. Meaning it browses what documents are available and asks for access to see their details. Now I've run into a problem that I can't solve.

I want to add data from one table to another without form. Only by clicking a button in a table row (this is the "request for access"). The data in that row would be added to another table.

Unfortunately, when I click the button, nothing happens. I know I'm probably going about this the wrong way, but when no problem is displayed, the page reloads normally, I don't have any ideas how to solve it.

I created models:

class CourtFile(models.Model):
    court = models.ForeignKey(Court, on_delete=models.CASCADE, null=True)
    signature = models.CharField(max_length=200, null=True)
    article = models.CharField(max_length=200, null=True)
    contents_list = models.FileField(upload_to = "filepath", null=True)

    def __str__(self):
        return f'{self.court} - {self.signature}'

class AccessRequest(models.Model):
    user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
    status = models.BooleanField(null=True)
    signature = models.ForeignKey(CourtFile, on_delete=models.CASCADE, null=True)

    def __str__(self):
        return f'{self.signature}'

I am displaying the table like this:

{% for courtfile in courtfiles_list %}

{{courtfile.signature}}
{{courtfile.court}}
{{courtfile.article}}
Podgląd
<form method="POST">
{% csrf_token %}
Uzyskaj dostęp
</form>

{% endfor %}

The data is displayed on the "start_u" page, after pressing the button and adding data to another database, I would like to return to the "start_u" page
And it's my views.py:

@login_required(login_url='login')
def startPage(request):
    courtfiles_list = CourtFile.objects.all()
    access_list = AccessRequest.objects.all()
    context = {'courtfiles_list': courtfiles_list, 'access_list': access_list}

    return render(request, 'users/start_u.html', context)

@login_required(login_url='login')
@allowed_users(allowed_roles=['user'])
def accessView(request, access_id):
    access_request = CourtFile.objects.get(pk=access_id)
    current_user = request.user
    if request.method == 'POST':
        entry = AccessRequest.objects.create(user=current_user, status=0, signature=access_request)
        entry.save(force_insert=True)
    return redirect('start_u')

urls.py:

path('start_u/', views.startPage, name="start_u"),

path('access/<access_id>', views.accessView, name="access"),


问:
While loop with += (Addition Assignment) shows just last resoult
I have a sql table for storing temp data

```<code>create table TempDataStore (ID int, HtmlCode NVARCHAR(max))
</code>```

I populate this table with while loop

```<code>while @cnt < 3
BEGIN
set @html = CONVERT(nvarchar(MAX),dilos.report.CreateHTMLTable(
(
select  * from  dilos.report.getHESExpress(cast(@site as varchar))
order by status,SendungsNr offset 0+@cnt*4 rows fetch next 4 rows only FOR XML PATH('row'),ELEMENTS XSINIL),null,'',''))
insert into TempDataStore values(@cnt+1, @html)
set @cnt = @cnt +1
end
</code>```

This is used to convert sql to html table and divide query results  to 4 rows.

Now I want to create a nvarchar(MAX) variable called @htmlSummary to display every row from TempDataStore  as one html code (string/nvachar).

```<code>while @cnt<3 --just some number
begin
set @htmlSummary = '<p><h3>Express Orders</h3>' +coalesce(replace((select HtmlCode from TempDataStore where id =@cnt+1),'<table border="1" style="font-size:40px;','<table class="table-sm table-striped"'),'') +'</p>'
set @htmlSummary +=@htmlSummary
set @cnt =@cnt+1
END

select @htmlSummary
</code>```

The problem is that at the end @htmlSummary stores just the last row of TempDataStore  table.

Body:
I have a sql table for storing temp data

create table TempDataStore (ID int, HtmlCode NVARCHAR(max))

I populate this table with while loop

while @cnt < 3
BEGIN
set @html = CONVERT(nvarchar(MAX),dilos.report.CreateHTMLTable(
(
select  * from  dilos.report.getHESExpress(cast(@site as varchar))
order by status,SendungsNr offset 0+@cnt*4 rows fetch next 4 rows only FOR XML PATH('row'),ELEMENTS XSINIL),null,'',''))
insert into TempDataStore values(@cnt+1, @html)
set @cnt = @cnt +1
end

This is used to convert sql to html table and divide query results  to 4 rows.

Now I want to create a nvarchar(MAX) variable called @htmlSummary to display every row from TempDataStore  as one html code (string/nvachar).

while @cnt<3 --just some number
begin
set @htmlSummary = '

Express Orders
' +coalesce(replace((select HtmlCode from TempDataStore where id =@cnt+1),'<table border="1" style="font-size:40px;','<table class="table-sm table-striped"'),'') +'
'
set @htmlSummary +=@htmlSummary
set @cnt =@cnt+1
END

select @htmlSummary

The problem is that at the end @htmlSummary stores just the last row of TempDataStore  table.


问:
A PostreSQL "interval "does not complie
I have the following condition in a Postgres query:

```<code>…where (o.estimate_close_date + m.MonthNumber) < (o.estimate_close_date + **interval** '1 month' * o.duration_months)…
</code>```

This test is compiled OK while it is just an SQL text.
But when a put this on a VIEW I get the following compilation error:

SQL Error [42601]: ERROR: syntax error at or near "months"
Position: 171

What it is ? I fin the root case is the "interval"
; but whet exactly to do with it?

Title: A PostreSQL "interval "does not complie

Body:
I have the following condition in a Postgres query:

…where (o.estimate_close_date + m.MonthNumber) < (o.estimate_close_date + **interval** '1 month' * o.duration_months)…

This test is compiled OK while it is just an SQL text.
But when a put this on a VIEW I get the following compilation error:

SQL Error [42601]: ERROR: syntax error at or near "months"
Position: 171

What it is ? I fin the root case is the "interval"
; but whet exactly to do with it?


问:
Asgardeo Auth Angular SDK - Interceptor not working
I'm using Asgardeo Auth Angular SDK.
(https://github.com/asgardeo/asgardeo-auth-angular-sdk#asgardeoauthinterceptor)

I want to use their interceptor to send the access token to every http request.

This is my app.module.ts (WSO2 Identity server is my identity provider):

```<code>@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    AppRoutingModule,
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    CoreModule,
    HttpClientXsrfModule.withOptions({
      cookieName: 'XSRF-TOKEN',
      headerName: 'X-XSRF-TOKEN',
    }),
    AsgardeoAuthModule.forRoot({
       clientID: {{clientId}},
       baseUrl: "https://localhost:9443",
       signInRedirectURL: "http://localhost:4200/login",
       signOutRedirectURL: "http://localhost:4200/login",
       enablePKCE: true,
       storage: Storage.LocalStorage,
       resourceServerURLs: [
          "https://localhost:8080/*",
       ],
       scope: ["openid", "internal_user_mgt_list", "internal_user_mgt_view", "internal_user_mgt_create", "internal_user_mgt_update", "internal_user_mgt_delete"]
    })
   ],
   providers: [
    {
       provide: HTTP_INTERCEPTORS,
       useClass: AsgardeoAuthInterceptor,
       multi: true
    }
  ],
  bootstrap: [AppComponent]
 })
 export class AppModule {}
</code>```

but it doesn't work.

Body:
I'm using Asgardeo Auth Angular SDK.
(https://github.com/asgardeo/asgardeo-auth-angular-sdk#asgardeoauthinterceptor)

I want to use their interceptor to send the access token to every http request.

This is my app.module.ts (WSO2 Identity server is my identity provider):

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    AppRoutingModule,
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    CoreModule,
    HttpClientXsrfModule.withOptions({
      cookieName: 'XSRF-TOKEN',
      headerName: 'X-XSRF-TOKEN',
    }),
    AsgardeoAuthModule.forRoot({
       clientID: {{clientId}},
       baseUrl: "https://localhost:9443",
       signInRedirectURL: "http://localhost:4200/login",
       signOutRedirectURL: "http://localhost:4200/login",
       enablePKCE: true,
       storage: Storage.LocalStorage,
       resourceServerURLs: [
          "https://localhost:8080/*",
       ],
       scope: ["openid", "internal_user_mgt_list", "internal_user_mgt_view", "internal_user_mgt_create", "internal_user_mgt_update", "internal_user_mgt_delete"]
    })
   ],
   providers: [
    {
       provide: HTTP_INTERCEPTORS,
       useClass: AsgardeoAuthInterceptor,
       multi: true
    }
  ],
  bootstrap: [AppComponent]
 })
 export class AppModule {}

but it doesn't work.


问:
I am struggling to figure out what's wrong with this image upload component using React and Firebase
When I upload the image, the file is detected, but it does not load to firebase. I have noticed that while an upload is running and I navigate to another page within the app, the code starts running again.

In my console, I see:
Image upload started
Upload is 0% done
Upload is running

Nothing happens after this. For context, I have used the similar upload logic in other places within my app and it works.

Here is what my code currently looks like:

I have tried leaving out uuidv4 and the image upload still does not start.

```<code>import React, { useEffect, useState, useRef } from "react";
import { ref, getDownloadURL, getStorage, listAll,
uploadBytesResumable, deleteObject }
from 'firebase/storage'
import { auth, db, storage } from '../../firebase'
import { collection, doc, updateDoc, setDoc, getDoc, onSnapshot, deleteDoc } from '@firebase/firestore'
import { onAuthStateChanged } from "firebase/auth";
import { v4 as uuidv4} from "uuid";

import './ImagePopup.css'

const ImagePopup = (props) => {
  const [imageFile, setImageFile] = useState("")
  const [percentage, setPercentage] = useState(null)
  const [data, setData] = useState({})
  // const [imageID, setImageID] = useState(getImageID())
  const [progress, setProgress] = useState(0)

  useEffect(() => {
    console.log(imageFile)
    const name = imageFile.name + uuidv4()
    const storageRef = ref(storage, `website images/${name}`)
    console.log(storageRef)
    const uploadTask = uploadBytesResumable(storageRef, imageFile)

    console.log(uploadTask)
    const uploadImageFile = () => {
      console.log("image upload started");
      uploadTask.on(
        'state_changed',
        (snapshot) => {
          console.log(snapshot)
          const progress = Math.round(snapshot.bytesTransferred / snapshot.totalBytes) * 100;
          console.log('Upload is ' + progress + '% done')
          setProgress(progress) //not setPercentage has been changed to setProgress
          switch (snapshot.state) {
            case 'paused':
              console.log('Upload is paused');
              break;
            case 'running':
              console.log('Upload is running');
              break;
            default:
              break;
          }
          console.log(data.img)
        },
        (error) => {console.log(error)},
        () => {
          getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {
            setData((prev) => ({...prev, img:downloadURL}))
          });
        }
      );
    }
    imageFile && uploadImageFile()
  }, [imageFile])

  return (
    <div className="ImagePopupDiv">
      <form >
        <label htmlFor="websiteImageUpload" className="websiteImageUploadButton">upload image</label>
        <input type="file" id="websiteImageUpload"
        onChange={(e) => {
          setImageFile(e.target.files[0])
        }}
        style={{ display: "none"}} required>
        </input>
        <img src={imageFile ? URL.createObjectURL(imageFile) : "https://icon-library.com/images/no-image-icon/no-image-icon-0.jpg"}
        id="uploadedImage1"
        alt="uploaded"
        />
        <progress className="progressBar" value={percentage} max="100"/>
      </form>
      <button disabled={percentage !== null && percentage < 100} className='imagePopupSubmitButton' type='submit'>submit</button>
    </div>
  )
}

export default ImagePopup
</code>```

Body:
When I upload the image, the file is detected, but it does not load to firebase. I have noticed that while an upload is running and I navigate to another page within the app, the code starts running again.

In my console, I see:
Image upload started
Upload is 0% done
Upload is running

Nothing happens after this. For context, I have used the similar upload logic in other places within my app and it works.

Here is what my code currently looks like:

I have tried leaving out uuidv4 and the image upload still does not start.

import React, { useEffect, useState, useRef } from "react";
import { ref, getDownloadURL, getStorage, listAll,
uploadBytesResumable, deleteObject }
from 'firebase/storage'
import { auth, db, storage } from '../../firebase'
import { collection, doc, updateDoc, setDoc, getDoc, onSnapshot, deleteDoc } from '@firebase/firestore'
import { onAuthStateChanged } from "firebase/auth";
import { v4 as uuidv4} from "uuid";

import './ImagePopup.css'

const ImagePopup = (props) => {
  const [imageFile, setImageFile] = useState("")
  const [percentage, setPercentage] = useState(null)
  const [data, setData] = useState({})
  // const [imageID, setImageID] = useState(getImageID())
  const [progress, setProgress] = useState(0)

  useEffect(() => {
    console.log(imageFile)
    const name = imageFile.name + uuidv4()
    const storageRef = ref(storage, `website images/${name}`)
    console.log(storageRef)
    const uploadTask = uploadBytesResumable(storageRef, imageFile)

    console.log(uploadTask)
    const uploadImageFile = () => {
      console.log("image upload started");
      uploadTask.on(
        'state_changed',
        (snapshot) => {
          console.log(snapshot)
          const progress = Math.round(snapshot.bytesTransferred / snapshot.totalBytes) * 100;
          console.log('Upload is ' + progress + '% done')
          setProgress(progress) //not setPercentage has been changed to setProgress
          switch (snapshot.state) {
            case 'paused':
              console.log('Upload is paused');
              break;
            case 'running':
              console.log('Upload is running');
              break;
            default:
              break;
          }
          console.log(data.img)
        },
        (error) => {console.log(error)},
        () => {
          getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {
            setData((prev) => ({...prev, img:downloadURL}))
          });
        }
      );
    }
    imageFile && uploadImageFile()
  }, [imageFile])

  return (

      <form >
        upload image
        <input type="file" id="websiteImageUpload"
        onChange={(e) => {
          setImageFile(e.target.files[0])
        }}
        style={{ display: "none"}} required>
        </input>

        <progress className="progressBar" value={percentage} max="100"/>
      </form>
      <button disabled={percentage !== null && percentage < 100} className='imagePopupSubmitButton' type='submit'>submit</button>

  )
}

export default ImagePopup


问:
Jetpack Compose LazyColumn Performance Issue
I'm writing example-screen with using lazyColumn. I encountered some performance issues on release build. Frame skipping happens when I fast-scroll the list.
All models and composables are stable. My code is below;

 Screen record link -> https://imgur.com/a/cvlA8g0

viewModel:

```<code>@HiltViewModel
class ExampleViewModel @Inject constructor(
    private val repo: ExampleRepository,
) : ViewModel() {

    private val _viewState = MutableStateFlow(ItemsViewState())
    val viewState = _viewState.asStateFlow()

    init {
        fetch()
    }

    private fun fetch() = viewModelScope.launch {
        repo.getItems()
            .onStart { _viewState.value = _viewState.value.copy(state = PageState.Loading) }
            .onCompletion { _viewState.value = _viewState.value.copy(state = PageState.Content) }
            .collect { _viewState.value = _viewState.value.copy(items = it.toImmutableList()) }
    }
}
</code>```

viewState and models:

```<code>data class ItemsViewState(
    val items: ImmutableList<Item> = persistentListOf(),
    val state: PageState = PageState.Loading,
)

data class Item(
    val id: Int,
    val imageUrl: String,
    val name: String,
    val rating: Double,
    val campaignText: String,
    val isChecked: Boolean = false,
)

data class ItemViewState(val item: Item) {

    fun isRatingVisible(): Boolean = item.rating > 7.0
}

sealed class PageState {

    object Content : PageState()

    object Loading : PageState()

    object Error : PageState()
}
</code>```

and my composable functions:

```<code>@Composable
fun ExampleScreen(
    viewModel: ExampleViewModel = hiltViewModel(),
) {
    val viewState by viewModel.viewState.collectAsState()

    when (viewState.state) {
        PageState.Content -> {
            ExampleList(viewState = viewState)
        }
        PageState.Loading -> LoadingScreen()
        PageState.Error -> {}
    }
}

@Composable
private fun ExampleList(
    viewState: ItemsViewState,
) {
    LazyColumn(
        state = rememberLazyListState(),
        contentPadding = PaddingValues(16.dp),
        verticalArrangement = Arrangement.spacedBy(8.dp),
        modifier = Modifier.fillMaxSize()
    ) {
        items(viewState.items, key = { it.id }) { item ->
            ExampleListItem(item = item)
        }
    }
}

@Composable
private fun ExampleListItem(item: Item) {
    val viewState = ItemViewState(item)

    Card(
        shape = RoundedCornerShape(8.dp),
        backgroundColor = MaterialTheme.colors.background
    ) {
        Row(
            modifier = Modifier
                .padding(8.dp)
                .fillMaxWidth()
                .wrapContentHeight()
        ) {
            AsyncImage(
                model = item.imageUrl,
                contentDescription = viewState.item.name,
                contentScale = ContentScale.FillHeight,
                modifier = Modifier
                    .clip(RoundedCornerShape(10.dp))
                    .width(120.dp)
                    .height(120.dp),
            )
            Spacer(modifier = Modifier.width(8.dp))
            Column(verticalArrangement = Arrangement.SpaceBetween) {
                Row(horizontalArrangement = Arrangement.SpaceEvenly) {
                    Text(
                        text = viewState.item.name,
                        overflow = TextOverflow.Ellipsis,
                        maxLines = 1,
                        modifier = Modifier.weight(1f),
                    )
                    Icon(imageVector = Icons.Default.List, contentDescription = null)
                }
                Spacer(modifier = Modifier.height(2.dp))
                Row {
                    if (viewState.isRatingVisible()) {
                        Spacer(modifier = Modifier.width(4.dp))
                        Text(
                            text = viewState.item.rating.toString(),
                            overflow = TextOverflow.Ellipsis,
                            maxLines = 1,
                        )
                    }
                }
                Spacer(modifier = Modifier.height(2.dp))
                CampaignRow(campaignText = viewState.item.campaignText)
            }
        }
    }
}

@Composable
private fun CampaignRow(
    modifier: Modifier = Modifier,
    campaignText: String,
) = Row(modifier = modifier) {
    Image(
        painter = painterResource(androidx.ui.livedata.R.drawable.abc_ic_star_black_16dp),
        contentDescription = "",
        modifier = Modifier
            .wrapContentSize()
            .align(Alignment.CenterVertically)
            .padding(end = 4.dp)
    )
    Text(
        text = campaignText,
        overflow = TextOverflow.Ellipsis,
        maxLines = 1,
    )
}
</code>```

I followed google guideline to fix performance issues.

I created Baseline profile

I tested on release build

I used key parameter on lazyColumn

but still happening performance issues. How can I prevent this?

Body:
I'm writing example-screen with using lazyColumn. I encountered some performance issues on release build. Frame skipping happens when I fast-scroll the list.
All models and composables are stable. My code is below;

 Screen record link -> https://imgur.com/a/cvlA8g0

viewModel:

@HiltViewModel
class ExampleViewModel @Inject constructor(
    private val repo: ExampleRepository,
) : ViewModel() {

    private val _viewState = MutableStateFlow(ItemsViewState())
    val viewState = _viewState.asStateFlow()

    init {
        fetch()
    }

    private fun fetch() = viewModelScope.launch {
        repo.getItems()
            .onStart { _viewState.value = _viewState.value.copy(state = PageState.Loading) }
            .onCompletion { _viewState.value = _viewState.value.copy(state = PageState.Content) }
            .collect { _viewState.value = _viewState.value.copy(items = it.toImmutableList()) }
    }
}

viewState and models:

data class ItemsViewState(
    val items: ImmutableList<Item> = persistentListOf(),
    val state: PageState = PageState.Loading,
)

data class Item(
    val id: Int,
    val imageUrl: String,
    val name: String,
    val rating: Double,
    val campaignText: String,
    val isChecked: Boolean = false,
)

data class ItemViewState(val item: Item) {

    fun isRatingVisible(): Boolean = item.rating > 7.0
}

sealed class PageState {

    object Content : PageState()

    object Loading : PageState()

    object Error : PageState()
}

and my composable functions:

@Composable
fun ExampleScreen(
    viewModel: ExampleViewModel = hiltViewModel(),
) {
    val viewState by viewModel.viewState.collectAsState()

    when (viewState.state) {
        PageState.Content -> {
            ExampleList(viewState = viewState)
        }
        PageState.Loading -> LoadingScreen()
        PageState.Error -> {}
    }
}

@Composable
private fun ExampleList(
    viewState: ItemsViewState,
) {
    LazyColumn(
        state = rememberLazyListState(),
        contentPadding = PaddingValues(16.dp),
        verticalArrangement = Arrangement.spacedBy(8.dp),
        modifier = Modifier.fillMaxSize()
    ) {
        items(viewState.items, key = { it.id }) { item ->
            ExampleListItem(item = item)
        }
    }
}

@Composable
private fun ExampleListItem(item: Item) {
    val viewState = ItemViewState(item)

    Card(
        shape = RoundedCornerShape(8.dp),
        backgroundColor = MaterialTheme.colors.background
    ) {
        Row(
            modifier = Modifier
                .padding(8.dp)
                .fillMaxWidth()
                .wrapContentHeight()
        ) {
            AsyncImage(
                model = item.imageUrl,
                contentDescription = viewState.item.name,
                contentScale = ContentScale.FillHeight,
                modifier = Modifier
                    .clip(RoundedCornerShape(10.dp))
                    .width(120.dp)
                    .height(120.dp),
            )
            Spacer(modifier = Modifier.width(8.dp))
            Column(verticalArrangement = Arrangement.SpaceBetween) {
                Row(horizontalArrangement = Arrangement.SpaceEvenly) {
                    Text(
                        text = viewState.item.name,
                        overflow = TextOverflow.Ellipsis,
                        maxLines = 1,
                        modifier = Modifier.weight(1f),
                    )
                    Icon(imageVector = Icons.Default.List, contentDescription = null)
                }
                Spacer(modifier = Modifier.height(2.dp))
                Row {
                    if (viewState.isRatingVisible()) {
                        Spacer(modifier = Modifier.width(4.dp))
                        Text(
                            text = viewState.item.rating.toString(),
                            overflow = TextOverflow.Ellipsis,
                            maxLines = 1,
                        )
                    }
                }
                Spacer(modifier = Modifier.height(2.dp))
                CampaignRow(campaignText = viewState.item.campaignText)
            }
        }
    }
}

@Composable
private fun CampaignRow(
    modifier: Modifier = Modifier,
    campaignText: String,
) = Row(modifier = modifier) {
    Image(
        painter = painterResource(androidx.ui.livedata.R.drawable.abc_ic_star_black_16dp),
        contentDescription = "",
        modifier = Modifier
            .wrapContentSize()
            .align(Alignment.CenterVertically)
            .padding(end = 4.dp)
    )
    Text(
        text = campaignText,
        overflow = TextOverflow.Ellipsis,
        maxLines = 1,
    )
}

I followed google guideline to fix performance issues.

I created Baseline profile

I tested on release build

I used key parameter on lazyColumn

but still happening performance issues. How can I prevent this?


问:
Best way to connect AWS Transfer Family (SFTP) with Windows EC2 VM?
I have a requirement where some clients will be sending files using SFTP Client. these files need to be processed by an application that is hosted in a EC2 Windows VM.

This application code can not be changed to pick files from a S3 location. It can only pick files from a windows folder path (this path can be changed from a Config file).

For this requirement we have hosted a AWS transfer family SFTP endpoint with S3 Storage bucket.

Now the customers are pushing files via SFTP Client and those files are arriving in the S3 Bucket properly.

Now the question is, how can we make those files accessible from the Windows EC2 VM ?

Currently AWS Transfer Family SFTP server can be configured only with S3 and EFS.

EFS can not be mounted in a Windows EC2 VM (At least there are no straightforward way to do this).

So what could be my option? Is there a way to connect S3 with a Windows VM so that the S3 content can be directly accessible from the Windows EC2 VM as a Mapped drive ? Or is there a  way to make a local windows folder that always remains in sync with the S3 location ?


问:
Download files to local storage in ionic react native
I have a requirement where I have doc/pdf/xls/jpeg/png files saved in the backend.
I have a backend path where the files are retrieved as a blob.

Now, as a requirement I want to download the file to the local storage of the device. As a usecase I want that the downloaded file can be viewed using native apps like adobe, ms office etc.
The same usecase as downloading an attachment and viewing from gmail.

I cannot find a good alternative for this in native mode. The capacitor Filesystem seem to only save in application specific storage and not accessible outside it, eg: from gallery

I did find a few posts which suggest using '@awesome-cordova-plugins/http/ngx'. This looks to be an Angular specific package. I am using Ionic React.

I have this code working for web mode

```<code>    let url = window.URL.createObjectURL(res.data);
    let a = document.createElement("a");
    document.body.appendChild(a);
    a.href = url;
    a.download = res.filename;
    a.click();
    window.URL.revokeObjectURL(url);
</code>```

Any help is greatly appreciated.

Regards

Body:
I have a requirement where I have doc/pdf/xls/jpeg/png files saved in the backend.
I have a backend path where the files are retrieved as a blob.

Now, as a requirement I want to download the file to the local storage of the device. As a usecase I want that the downloaded file can be viewed using native apps like adobe, ms office etc.
The same usecase as downloading an attachment and viewing from gmail.

I cannot find a good alternative for this in native mode. The capacitor Filesystem seem to only save in application specific storage and not accessible outside it, eg: from gallery

I did find a few posts which suggest using '@awesome-cordova-plugins/http/ngx'. This looks to be an Angular specific package. I am using Ionic React.

I have this code working for web mode

    let url = window.URL.createObjectURL(res.data);
    let a = document.createElement("a");
    document.body.appendChild(a);
    a.href = url;
    a.download = res.filename;
    a.click();
    window.URL.revokeObjectURL(url);

Any help is greatly appreciated.

Regards


问:
How to create a custom anomaly in SchemaSpy
I was learning about SchemaSpy lately. Was amazed with the UI representation by graphviz.

But had a doubt whether we can create custom anomaly, if so how do we create custom anomalies(Step by step approach).

Tried to create custom anomaly but didn't know how to do. Need some help with this.


问:
Extension Autodesk forge: the elements of my model can not be defined
I was trying to deploy an extension that was developed using three.js in the IoT-demo-app-extension, but as soon as my extension was loaded, the "add sensor" functionality failed and when I select elements, the sensor figures don't change. What could be the possible causes of this issue?

These Errors are in console whenever I select any elements of my model.


问:
How can i center element (typography) in React MUI Appbar component?
I am building an appbar in React. I am using material components to make it.
Is there a way to center the "TITLE" element and make the menu items align to the right at the same time?
enter image description here

The problem is that centering the "TITLE" element and placing the menu items on the right does not seem possible inside a container such as a Box or a Grid. i use "<Box sx={{ flexGrow: 1 }} />" to avoid that components of menu align next to title but I can't therefore align the "TITLE" element in the center of the appbar

```<code> <Box sx={{ flexGrow: 1 }}>
      <AppBar position="static">
        <Toolbar>

          <Typography
            variant="h6"
            noWrap
            component="div"
            sx={{ display: 'block'}}
          >
            TITLE
          </Typography>

          <Box sx={{ flexGrow: 1 }} />

          <Box sx={{ display: 'flex' }}>
            <IconButton size="large" aria-label="show 4 new mails" color="inherit">
              <Badge badgeContent={4} color="error">
                <MailIcon />
              </Badge>
            </IconButton>
            <IconButton
              size="large"
              aria-label="show 17 new notifications"
              color="inherit"
            >
              <Badge badgeContent={17} color="error">
                <NotificationsIcon />
              </Badge>
            </IconButton>
            <IconButton
              size="large"
              edge="end"
              aria-label="account of current user"
              aria-controls={menuId}
              aria-haspopup="true"
              onClick={handleProfileMenuOpen}
              color="inherit"
            >
              <AccountCircle />
            </IconButton>
          </Box>

        </Toolbar>
      </AppBar>
      {renderMobileMenu}
      {renderMenu}
    </Box>
</code>```

Body:
I am building an appbar in React. I am using material components to make it.
Is there a way to center the "TITLE" element and make the menu items align to the right at the same time?
enter image description here

The problem is that centering the "TITLE" element and placing the menu items on the right does not seem possible inside a container such as a Box or a Grid. i use "<Box sx={{ flexGrow: 1 }} />" to avoid that components of menu align next to title but I can't therefore align the "TITLE" element in the center of the appbar

 <Box sx={{ flexGrow: 1 }}>
      <AppBar position="static">
        <Toolbar>

          <Typography
            variant="h6"
            noWrap
            component="div"
            sx={{ display: 'block'}}
          >
            TITLE
          </Typography>

          <Box sx={{ flexGrow: 1 }} />

          <Box sx={{ display: 'flex' }}>
            <IconButton size="large" aria-label="show 4 new mails" color="inherit">
              <Badge badgeContent={4} color="error">
                <MailIcon />
              </Badge>
            </IconButton>
            <IconButton
              size="large"
              aria-label="show 17 new notifications"
              color="inherit"
            >
              <Badge badgeContent={17} color="error">
                <NotificationsIcon />
              </Badge>
            </IconButton>
            <IconButton
              size="large"
              edge="end"
              aria-label="account of current user"
              aria-controls={menuId}
              aria-haspopup="true"
              onClick={handleProfileMenuOpen}
              color="inherit"
            >
              <AccountCircle />
            </IconButton>
          </Box>

        </Toolbar>
      </AppBar>
      {renderMobileMenu}
      {renderMenu}
    </Box>


问:
Pyspark not reading data from kafka stream
I'm using PySpark to read streaming data from kafka. Both kafka and PySpark are running in a local kubernetes cluster setup using minikube. I am using the bitnami/spark-cluster helm chart. It seems that the PySpark app is unable to read streaming data from Kafka.

Here are some logs from the pyspark app -

```<code>22/12/18 20:40:57 INFO StandaloneSchedulerBackend: Granted executor ID app-20221218203946-0013/5 on hostPort 172.17.0.4:40893 with 1 core(s), 1024.0 MiB RAM
22/12/18 20:40:57 INFO AppInfoParser: Kafka version: 2.6.0
22/12/18 20:40:57 INFO AppInfoParser: Kafka commitId: 62abe01bee039651
22/12/18 20:40:57 INFO AppInfoParser: Kafka startTimeMs: 1671396057484
22/12/18 20:40:57 INFO KafkaConsumer: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Subscribed to topic(s): meetup-rsvps-topic
22/12/18 20:40:57 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/5 is now RUNNING
22/12/18 20:41:04 INFO Metadata: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Cluster ID: tIhn8pqNQbWmb6C_WDce3A
22/12/18 20:41:04 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Discovered group coordinator kafka-local-0.kafka-local-headless.meetupstream.svc.cluster.local:9092 (id: 2147483647 rack: null)
22/12/18 20:41:04 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] (Re-)joining group
22/12/18 20:41:05 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group.
22/12/18 20:41:05 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] (Re-)joining group
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Finished assignment for group at generation 1: {consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1-8ff6df17-88f3-48dd-86f1-caa731cfbfab=Assignment(partitions=[meetup-rsvps-topic-0])}
22/12/18 20:41:05 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Successfully joined group with generation 1
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Notifying assignor about the new Assignment(partitions=[meetup-rsvps-topic-0])
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Adding newly assigned partitions: meetup-rsvps-topic-0
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Found no committed offset for partition meetup-rsvps-topic-0
22/12/18 20:41:06 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Seeking to EARLIEST offset of partition meetup-rsvps-topic-0
22/12/18 20:41:06 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Resetting offset for partition meetup-rsvps-topic-0 to offset 0.
22/12/18 20:41:06 INFO CheckpointFileManager: Writing atomically to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/0 using temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/.0.e93bfa5b-6db8-4892-8447-a500739de876.tmp
22/12/18 20:41:07 INFO CheckpointFileManager: Renamed temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/.0.e93bfa5b-6db8-4892-8447-a500739de876.tmp to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/0
22/12/18 20:41:07 INFO KafkaMicroBatchStream: Initial offsets: {"meetup-rsvps-topic":{"0":0}}
22/12/18 20:41:07 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Seeking to LATEST offset of partition meetup-rsvps-topic-0
22/12/18 20:41:07 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Resetting offset for partition meetup-rsvps-topic-0 to offset 1898.
22/12/18 20:41:07 INFO CheckpointFileManager: Writing atomically to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/0 using temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/.0.a9f679ba-5f6a-4ca5-9e3d-4e7ac92d3afa.tmp
22/12/18 20:41:09 INFO CheckpointFileManager: Renamed temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/.0.a9f679ba-5f6a-4ca5-9e3d-4e7ac92d3afa.tmp to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/0
22/12/18 20:41:09 INFO MicroBatchExecution: Committed offsets for batch 0. Metadata OffsetSeqMetadata(0,1671396067279,Map(spark.sql.streaming.stateStore.providerClass -> org.apache.spark.sql.execution.streaming.state.HDFSBackedStateStoreProvider, spark.sql.streaming.join.stateFormatVersion -> 2, spark.sql.streaming.stateStore.compression.codec -> lz4, spark.sql.streaming.flatMapGroupsWithState.stateFormatVersion -> 2, spark.sql.streaming.multipleWatermarkPolicy -> min, spark.sql.streaming.aggregation.stateFormatVersion -> 2, spark.sql.shuffle.partitions -> 200))
22/12/18 20:41:15 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:16 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:16 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:16 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:17 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:17 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:31 INFO CodeGenerator: Code generated in 4801.506531 ms
22/12/18 20:41:33 INFO WriteToDataSourceV2Exec: Start processing data source write support: org.apache.spark.sql.execution.streaming.sources.MicroBatchWrite@53fa8f13. The input RDD has 1 partitions.
22/12/18 20:41:33 INFO SparkContext: Starting job: start at NativeMethodAccessorImpl.java:0
22/12/18 20:41:33 INFO DAGScheduler: Got job 0 (start at NativeMethodAccessorImpl.java:0) with 1 output partitions
22/12/18 20:41:33 INFO DAGScheduler: Final stage: ResultStage 0 (start at NativeMethodAccessorImpl.java:0)
22/12/18 20:41:33 INFO DAGScheduler: Parents of final stage: List()
22/12/18 20:41:33 INFO DAGScheduler: Missing parents: List()
22/12/18 20:41:33 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/5 is now EXITED (Command exited with code 1)
22/12/18 20:41:33 INFO StandaloneSchedulerBackend: Executor app-20221218203946-0013/5 removed: Command exited with code 1
22/12/18 20:41:33 INFO BlockManagerMaster: Removal of executor 5 requested
22/12/18 20:41:33 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Asked to remove non-existent executor 5
22/12/18 20:41:33 INFO StandaloneAppClient$ClientEndpoint: Executor added: app-20221218203946-0013/6 on worker-20221217144830-172.17.0.4-40893 (172.17.0.4:40893) with 1 core(s)
22/12/18 20:41:33 INFO BlockManagerMasterEndpoint: Trying to remove executor 5 from BlockManagerMaster.
22/12/18 20:41:33 INFO StandaloneSchedulerBackend: Granted executor ID app-20221218203946-0013/6 on hostPort 172.17.0.4:40893 with 1 core(s), 1024.0 MiB RAM
22/12/18 20:41:33 INFO DAGScheduler: Submitting ResultStage 0 (MapPartitionsRDD[2] at start at NativeMethodAccessorImpl.java:0), which has no missing parents
22/12/18 20:41:33 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/6 is now RUNNING
22/12/18 20:41:34 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/4 is now EXITED (Command exited with code 1)
22/12/18 20:41:34 INFO StandaloneSchedulerBackend: Executor app-20221218203946-0013/4 removed: Command exited with code 1
22/12/18 20:41:34 INFO StandaloneAppClient$ClientEndpoint: Executor added: app-20221218203946-0013/7 on worker-20221217144749-172.17.0.3-46817 (172.17.0.3:46817) with 1 core(s)
22/12/19 10:35:09 INFO StandaloneSchedulerBackend: Granted executor ID app-20221219103231-0000/9 on hostPort 172.17.0.4:35303 with 1 core(s), 1024.0 MiB RAM
22/12/19 10:35:09 INFO StandaloneSchedulerBackend: Granted executor ID app-20221219103231-0000/9 on hostPort 172.17.0.4:35303 with 1 core(s), 1024.0 MiB RAM
22/12/19 10:35:09 INFO BlockManagerMasterEndpoint: Trying to remove executor 7 from BlockManagerMaster.
22/12/19 10:35:09 INFO BlockManagerMaster: Removal of executor 7 requested
22/12/19 10:35:09 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Asked to remove non-existent executor 7
22/12/19 10:35:09 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221219103231-0000/9 is now RUNNING
22/12/19 10:35:18 WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
22/12/19 10:35:25 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221219103231-0000/8 is now EXITED (Command exited with code 1)
22/12/19 10:35:25 INFO StandaloneSchedulerBackend: Executor app-20221219103231-0000/8 removed: Command exited with code 1
22/12/19 10:35:25 INFO StandaloneAppClient$ClientEndpoint: Executor added: app-20221219103231-0000/10 on worker-20221219102048-172.17.0.3-33275 (172.17.0.3:33275) with 1 core(s)
22/12/19 10:35:25 INFO StandaloneSchedulerBackend: Granted executor ID app-20221219103231-0000/10 on hostPort 172.17.0.3:33275 with 1 core(s), 1024.0 MiB RAM
22/12/19 10:35:25 INFO BlockManagerMasterEndpoint: Trying to remove executor 8 from BlockManagerMaster.
22/12/19 10:35:25 INFO BlockManagerMaster: Removal of executor 8 requested
</code>```

Here is the code for my pyspark app.

```<code>from pyspark.sql import SparkSession
from pyspark.sql.functions import *

def main():

    spark = SparkSession \
        .builder \
        .appName("SparkProcess") \
        .getOrCreate()

    df = spark.readStream.format("kafka")
        .option("kafka.bootstrap.servers", "kafka-local.meetupstream.svc.cluster.local:9092")
        .option("subscribe", "meetup-rsvps-topic")
        .option("startingOffsets", "earliest")
        .load()

    df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")

    df.writeStream \
        .trigger(processingTime="60 seconds") \
        .format("console") \
        .outputMode("append") \
        .start()
</code>```

I have also tried setting .config("spark.dynamicAllocation.enabled", "false") in PySpark but I still get the same error.

My spark UI -

I am using the following command for executing my spark app -
kubectl run spark-base -it --rm --labels="app=spark-client"  --image-pull-policy Never --restart Never   --image spark-layer:latest -- bash ./spark/bin/spark-submit --master spark://spark-cluster-master-svc:7077     --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.1    ./spark-process.py

Body:
I'm using PySpark to read streaming data from kafka. Both kafka and PySpark are running in a local kubernetes cluster setup using minikube. I am using the bitnami/spark-cluster helm chart. It seems that the PySpark app is unable to read streaming data from Kafka.

Here are some logs from the pyspark app -

22/12/18 20:40:57 INFO StandaloneSchedulerBackend: Granted executor ID app-20221218203946-0013/5 on hostPort 172.17.0.4:40893 with 1 core(s), 1024.0 MiB RAM
22/12/18 20:40:57 INFO AppInfoParser: Kafka version: 2.6.0
22/12/18 20:40:57 INFO AppInfoParser: Kafka commitId: 62abe01bee039651
22/12/18 20:40:57 INFO AppInfoParser: Kafka startTimeMs: 1671396057484
22/12/18 20:40:57 INFO KafkaConsumer: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Subscribed to topic(s): meetup-rsvps-topic
22/12/18 20:40:57 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/5 is now RUNNING
22/12/18 20:41:04 INFO Metadata: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Cluster ID: tIhn8pqNQbWmb6C_WDce3A
22/12/18 20:41:04 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Discovered group coordinator kafka-local-0.kafka-local-headless.meetupstream.svc.cluster.local:9092 (id: 2147483647 rack: null)
22/12/18 20:41:04 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] (Re-)joining group
22/12/18 20:41:05 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group.
22/12/18 20:41:05 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] (Re-)joining group
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Finished assignment for group at generation 1: {consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1-8ff6df17-88f3-48dd-86f1-caa731cfbfab=Assignment(partitions=[meetup-rsvps-topic-0])}
22/12/18 20:41:05 INFO AbstractCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Successfully joined group with generation 1
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Notifying assignor about the new Assignment(partitions=[meetup-rsvps-topic-0])
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Adding newly assigned partitions: meetup-rsvps-topic-0
22/12/18 20:41:05 INFO ConsumerCoordinator: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Found no committed offset for partition meetup-rsvps-topic-0
22/12/18 20:41:06 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Seeking to EARLIEST offset of partition meetup-rsvps-topic-0
22/12/18 20:41:06 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Resetting offset for partition meetup-rsvps-topic-0 to offset 0.
22/12/18 20:41:06 INFO CheckpointFileManager: Writing atomically to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/0 using temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/.0.e93bfa5b-6db8-4892-8447-a500739de876.tmp
22/12/18 20:41:07 INFO CheckpointFileManager: Renamed temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/.0.e93bfa5b-6db8-4892-8447-a500739de876.tmp to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/sources/0/0
22/12/18 20:41:07 INFO KafkaMicroBatchStream: Initial offsets: {"meetup-rsvps-topic":{"0":0}}
22/12/18 20:41:07 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Seeking to LATEST offset of partition meetup-rsvps-topic-0
22/12/18 20:41:07 INFO SubscriptionState: [Consumer clientId=consumer-spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0-1, groupId=spark-kafka-source-bfcc8f10-c42a-4320-a4bf-735d75f3893b--1704904730-driver-0] Resetting offset for partition meetup-rsvps-topic-0 to offset 1898.
22/12/18 20:41:07 INFO CheckpointFileManager: Writing atomically to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/0 using temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/.0.a9f679ba-5f6a-4ca5-9e3d-4e7ac92d3afa.tmp
22/12/18 20:41:09 INFO CheckpointFileManager: Renamed temp file file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/.0.a9f679ba-5f6a-4ca5-9e3d-4e7ac92d3afa.tmp to file:/tmp/temporary-a95fafb4-6113-49ab-93d8-b0c495bac40a/offsets/0
22/12/18 20:41:09 INFO MicroBatchExecution: Committed offsets for batch 0. Metadata OffsetSeqMetadata(0,1671396067279,Map(spark.sql.streaming.stateStore.providerClass -> org.apache.spark.sql.execution.streaming.state.HDFSBackedStateStoreProvider, spark.sql.streaming.join.stateFormatVersion -> 2, spark.sql.streaming.stateStore.compression.codec -> lz4, spark.sql.streaming.flatMapGroupsWithState.stateFormatVersion -> 2, spark.sql.streaming.multipleWatermarkPolicy -> min, spark.sql.streaming.aggregation.stateFormatVersion -> 2, spark.sql.shuffle.partitions -> 200))
22/12/18 20:41:15 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:16 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:16 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:16 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:17 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:17 INFO KafkaOffsetReaderConsumer: Partitions added: Map()
22/12/18 20:41:31 INFO CodeGenerator: Code generated in 4801.506531 ms
22/12/18 20:41:33 INFO WriteToDataSourceV2Exec: Start processing data source write support: org.apache.spark.sql.execution.streaming.sources.MicroBatchWrite@53fa8f13. The input RDD has 1 partitions.
22/12/18 20:41:33 INFO SparkContext: Starting job: start at NativeMethodAccessorImpl.java:0
22/12/18 20:41:33 INFO DAGScheduler: Got job 0 (start at NativeMethodAccessorImpl.java:0) with 1 output partitions
22/12/18 20:41:33 INFO DAGScheduler: Final stage: ResultStage 0 (start at NativeMethodAccessorImpl.java:0)
22/12/18 20:41:33 INFO DAGScheduler: Parents of final stage: List()
22/12/18 20:41:33 INFO DAGScheduler: Missing parents: List()
22/12/18 20:41:33 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/5 is now EXITED (Command exited with code 1)
22/12/18 20:41:33 INFO StandaloneSchedulerBackend: Executor app-20221218203946-0013/5 removed: Command exited with code 1
22/12/18 20:41:33 INFO BlockManagerMaster: Removal of executor 5 requested
22/12/18 20:41:33 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Asked to remove non-existent executor 5
22/12/18 20:41:33 INFO StandaloneAppClient$ClientEndpoint: Executor added: app-20221218203946-0013/6 on worker-20221217144830-172.17.0.4-40893 (172.17.0.4:40893) with 1 core(s)
22/12/18 20:41:33 INFO BlockManagerMasterEndpoint: Trying to remove executor 5 from BlockManagerMaster.
22/12/18 20:41:33 INFO StandaloneSchedulerBackend: Granted executor ID app-20221218203946-0013/6 on hostPort 172.17.0.4:40893 with 1 core(s), 1024.0 MiB RAM
22/12/18 20:41:33 INFO DAGScheduler: Submitting ResultStage 0 (MapPartitionsRDD[2] at start at NativeMethodAccessorImpl.java:0), which has no missing parents
22/12/18 20:41:33 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/6 is now RUNNING
22/12/18 20:41:34 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221218203946-0013/4 is now EXITED (Command exited with code 1)
22/12/18 20:41:34 INFO StandaloneSchedulerBackend: Executor app-20221218203946-0013/4 removed: Command exited with code 1
22/12/18 20:41:34 INFO StandaloneAppClient$ClientEndpoint: Executor added: app-20221218203946-0013/7 on worker-20221217144749-172.17.0.3-46817 (172.17.0.3:46817) with 1 core(s)
22/12/19 10:35:09 INFO StandaloneSchedulerBackend: Granted executor ID app-20221219103231-0000/9 on hostPort 172.17.0.4:35303 with 1 core(s), 1024.0 MiB RAM
22/12/19 10:35:09 INFO StandaloneSchedulerBackend: Granted executor ID app-20221219103231-0000/9 on hostPort 172.17.0.4:35303 with 1 core(s), 1024.0 MiB RAM
22/12/19 10:35:09 INFO BlockManagerMasterEndpoint: Trying to remove executor 7 from BlockManagerMaster.
22/12/19 10:35:09 INFO BlockManagerMaster: Removal of executor 7 requested
22/12/19 10:35:09 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Asked to remove non-existent executor 7
22/12/19 10:35:09 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221219103231-0000/9 is now RUNNING
22/12/19 10:35:18 WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
22/12/19 10:35:25 INFO StandaloneAppClient$ClientEndpoint: Executor updated: app-20221219103231-0000/8 is now EXITED (Command exited with code 1)
22/12/19 10:35:25 INFO StandaloneSchedulerBackend: Executor app-20221219103231-0000/8 removed: Command exited with code 1
22/12/19 10:35:25 INFO StandaloneAppClient$ClientEndpoint: Executor added: app-20221219103231-0000/10 on worker-20221219102048-172.17.0.3-33275 (172.17.0.3:33275) with 1 core(s)
22/12/19 10:35:25 INFO StandaloneSchedulerBackend: Granted executor ID app-20221219103231-0000/10 on hostPort 172.17.0.3:33275 with 1 core(s), 1024.0 MiB RAM
22/12/19 10:35:25 INFO BlockManagerMasterEndpoint: Trying to remove executor 8 from BlockManagerMaster.
22/12/19 10:35:25 INFO BlockManagerMaster: Removal of executor 8 requested

Here is the code for my pyspark app.

from pyspark.sql import SparkSession
from pyspark.sql.functions import *

def main():

    spark = SparkSession \
        .builder \
        .appName("SparkProcess") \
        .getOrCreate()

    df = spark.readStream.format("kafka")
        .option("kafka.bootstrap.servers", "kafka-local.meetupstream.svc.cluster.local:9092")
        .option("subscribe", "meetup-rsvps-topic")
        .option("startingOffsets", "earliest")
        .load()

    df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")

    df.writeStream \
        .trigger(processingTime="60 seconds") \
        .format("console") \
        .outputMode("append") \
        .start()

I have also tried setting .config("spark.dynamicAllocation.enabled", "false") in PySpark but I still get the same error.

My spark UI -

I am using the following command for executing my spark app -
kubectl run spark-base -it --rm --labels="app=spark-client"  --image-pull-policy Never --restart Never   --image spark-layer:latest -- bash ./spark/bin/spark-submit --master spark://spark-cluster-master-svc:7077     --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.1    ./spark-process.py


问:
tabIndex not working at all in ChakraUI project
I'm trying to add tabIndex into my project made with ChakraUI. However, it is not working at ALL. I tried moving tabIndex into different elements, but it's giving tab index to whatever items it thinks are 'tabbable'. I also tried to pass it a string into tabIndex like so: tabIndex='1' - but it's throwing an error ( string cannot be used in type number ). So I am stuck, and unable to figure out the proper way of assigning tabIndex. On top of it, I have a child component within this component that I will have to give tabIndex to. And I am already stuck. :/ How should I go about this problem too - pass tabIndex as props (into the child component)?

```<code><Box>
      <SimpleGrid>
        <GridItem >
          <Text>{t('get-a-quote.from')}</Text>
        </GridItem>
        <GridInputWrapper
          tabIndex={1}
        >
          <Select/>
        </GridInputWrapper>
        <GridInputWrapper
          tabIndex={2}
        >
          <Select/>
        </GridInputWrapper>
        <GridItem>
          <Text>To:</Text>
        </GridItem>
        <GridInputWrapper
          tabIndex={3}
        >
          <Select/>
        </GridInputWrapper>
      </SimpleGrid>
    </Box>
</code>```

Body:
I'm trying to add tabIndex into my project made with ChakraUI. However, it is not working at ALL. I tried moving tabIndex into different elements, but it's giving tab index to whatever items it thinks are 'tabbable'. I also tried to pass it a string into tabIndex like so: tabIndex='1' - but it's throwing an error ( string cannot be used in type number ). So I am stuck, and unable to figure out the proper way of assigning tabIndex. On top of it, I have a child component within this component that I will have to give tabIndex to. And I am already stuck. :/ How should I go about this problem too - pass tabIndex as props (into the child component)?

<Box>
      <SimpleGrid>
        <GridItem >
          <Text>{t('get-a-quote.from')}</Text>
        </GridItem>
        <GridInputWrapper
          tabIndex={1}
        >
          <Select/>
        </GridInputWrapper>
        <GridInputWrapper
          tabIndex={2}
        >
          <Select/>
        </GridInputWrapper>
        <GridItem>
          <Text>To:</Text>
        </GridItem>
        <GridInputWrapper
          tabIndex={3}
        >
          <Select/>
        </GridInputWrapper>
      </SimpleGrid>
    </Box>


问:
Vue custom element as web component and vue component
I have a vue 3 app which builds some web components as custom elements. That works fine, I can define an html tag and use it in other apps and in my own vue app. I export the styles with the .ce.vue file ending.

Now I want to use the web components as normal vue components inside my app, but then the styles are not applied anymore. When I remove the custom element tag (the ce.vue. file ending), the vue component looks fine, but the web component loses it's styling.

Is there a way to be able to use a component in both ways, as a vue component and a web component?


问:
How can I connect medical devices like omron with flutter application
I want my flutter app to have the ability to be connected with the medical devices like omron and accu-chek and take the data from it via Bluetooth..
is there a Sdk or API that enables me to do that>>

I have searched but I didn't find a solution yet.


问:
Require form-urlencoded request body with swagger-core
Using Dropwizard with swagger-core and swagger-jaxrs2 2.2.6, how can you mark the requestBody of a x-www-form-urlencoded request as required?

    @POST
    @Path("/do-something")
    @Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
    @Operation(summary = "Does something")
    public void doSomething(@NotNull @FormParam("what") String what) {
      // ...
    }
```
<p>This generates the following:</p>
<pre class="lang-js prettyprint-override"><code>    "/do-something" : {
      "post" : {
        "summary" : "Does something",
        "operationId" : "doSomething",
        "requestBody" : {

          /* missing here: "required": true */

          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "required" : [ "what" ],
                "type" : "object",
                "properties" : {
                  "what" : {
                    "type" : "string"
                  }
                }
              }
            }
          }
        },
        "responses" : { /* ... */ }
      }
    },
</code>```

Parameter what is required, however the requestBody as a whole is not marked as required. Generated TypeScript clients therefore allow to omit it.

I could annotate the operation with something like @RequestBody(required = true), but this disables the auto detection of the parameters.

Do you have any idea how to solve this without rewriting half the documentation manually?

Body:
Using Dropwizard with swagger-core and swagger-jaxrs2 2.2.6, how can you mark the requestBody of a x-www-form-urlencoded request as required?

    @POST
    @Path("/do-something")
    @Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
    @Operation(summary = "Does something")
    public void doSomething(@NotNull @FormParam("what") String what) {
      // ...
    }

This generates the following:

    "/do-something" : {
      "post" : {
        "summary" : "Does something",
        "operationId" : "doSomething",
        "requestBody" : {

          /* missing here: "required": true */

          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "required" : [ "what" ],
                "type" : "object",
                "properties" : {
                  "what" : {
                    "type" : "string"
                  }
                }
              }
            }
          }
        },
        "responses" : { /* ... */ }
      }
    },

Parameter what is required, however the requestBody as a whole is not marked as required. Generated TypeScript clients therefore allow to omit it.

I could annotate the operation with something like @RequestBody(required = true), but this disables the auto detection of the parameters.

Do you have any idea how to solve this without rewriting half the documentation manually?


问:
AHK Timing from 60 to 0
When I press (example) f:: my time starts counting down from 60seconds to 0s. In the last two seconds I have to press f:: and the countdown must start again from 60 to 0.

Is it possible through AHK to make me press with f:: anytime within 60 sec and AHK to click within the last two seconds. I don't need it for a computer game and any help would be greatly appreciated.

So far I haven't tried anything because either it doesn't exist, or I been looking in the wrong place.

Title: AHK Timing from 60 to 0


问:
com.sun.mail.util.MailConnectException after a few days of use with Amazon SES
I have a strange problem with Java 8, Javamail 1.6.2 and Amazon SES.

I have a plain Java application with a main loop that performs some actions, sends a mail to Amazon SES SMTP service using Javamail, then pauses and then repeat the actions etc.

The Javamail code is very simple and it's almost identical to the Amazon SES example:

https://docs.aws.amazon.com/ses/latest/dg/send-using-smtp-programmatically.html

My problem is that after a few days of work every email sending attempt starts to raise a com.sun.mail.util.MailConnectException:

```<code>com.sun.mail.util.MailConnectException : Couldn't connect to host, port: email-smtp.eu-central-1.amazonaws.com, 587; timeout 60000
</code>```

The strange things are two:

in the meanwhile, if I separately try to telnet email-smtp.eu-central-1.amazonaws.com 587 from the same host the connection is accepted

if I restart the application the error disappears and the application starts to work again

It seems to me that Amazon SES somehow recognize the application and denies access to it after some days of work. I don't understand how can it recognize that the connection comes from the same JVM instance.
How can I completely reset the Javamail enviroment after every email sending?
What I'm doing now is just:

```<code>// Create a transport.
Transport transport = session.getTransport();
transport.connect(host, user, password);

// send the message
transport.sendMessage (msg, msg.getAllRecipients()) ;

// close transport
transport.close() ;
</code>```

Since there is no session.close() method in Javamail

Body:
I have a strange problem with Java 8, Javamail 1.6.2 and Amazon SES.

I have a plain Java application with a main loop that performs some actions, sends a mail to Amazon SES SMTP service using Javamail, then pauses and then repeat the actions etc.

The Javamail code is very simple and it's almost identical to the Amazon SES example:

https://docs.aws.amazon.com/ses/latest/dg/send-using-smtp-programmatically.html

My problem is that after a few days of work every email sending attempt starts to raise a com.sun.mail.util.MailConnectException:

com.sun.mail.util.MailConnectException : Couldn't connect to host, port: email-smtp.eu-central-1.amazonaws.com, 587; timeout 60000

The strange things are two:

in the meanwhile, if I separately try to telnet email-smtp.eu-central-1.amazonaws.com 587 from the same host the connection is accepted

if I restart the application the error disappears and the application starts to work again

It seems to me that Amazon SES somehow recognize the application and denies access to it after some days of work. I don't understand how can it recognize that the connection comes from the same JVM instance.
How can I completely reset the Javamail enviroment after every email sending?
What I'm doing now is just:

// Create a transport.
Transport transport = session.getTransport();
transport.connect(host, user, password);

// send the message
transport.sendMessage (msg, msg.getAllRecipients()) ;

// close transport
transport.close() ;

Since there is no session.close() method in Javamail


问:
Flutter folding cell with menu
It is not folding multiple times

I tried tween animation and I need this https://lh4.googleusercontent.com/YV78CKkRCA1Hg8FLGTgROfQ9SdD_1RwHZQw82ddyPb1xmxwgr0RH_BvsTlOsMNdRKV6bTUysr6In59R83tMDa0PCqRcXKed9q9ltxE_tAgjt-pVQ2aAjRx_DDeZAFpaiD2lH4No5=s0

Title: Flutter folding cell with menu


Title: gtsummary - providing mean of means

Body:
library(gtsummary)

table1_test <- test %>%
  select(period,   hr_avg_relative, hr_max_relative )%>%
  tbl_summary(by = period, statistic = list(
    all_continuous() ~ "{mean} ± {sd} ",
    all_categorical() ~ "{n} / {N} ({p}%)"))%>%
  bold_labels()  %>%
  modify_header(label = "**Variable**" )

The previous working code provides a summary of ALL observations.

However, each id provides multiple observations. Instead of provinding a mean of all observations, can gtsummary provide the mean of each id's means?

df below

test <- structure(list(period = c("pre", "pre", "pre", "post", "post",
"post", "post", "post", "post", "pre", "pre", "pre", "pre", "pre",
"pre", "post", "post", "post", "pre", "pre", "pre", "post", "post",
"post"), id = c(1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 2,
2, 2, 2, 4, 4, 4, 4, 4, 4), hr_max_relative = c(0.866279069767442,
0.877906976744186, 0.802325581395349, 0.866279069767442, 0.918604651162791,
0.872093023255814, 0.879120879120879, 0.857142857142857, 0.857142857142857,
0.857142857142857, 0.89010989010989, 0.89010989010989, 0.941798941798942,
0.873015873015873, 0.899470899470899, 0.899470899470899, 0.915343915343915,
0.878306878306878, 0.844919786096257, 0.844919786096257, 0.855614973262032,
0.903743315508021, 0.914438502673797, 0.866310160427808), hr_avg_relative = c(0.796511627906977,
0.808139534883721, 0.761627906976744, 0.808139534883721, 0.837209302325581,
0.813953488372093, 0.763736263736264, 0.796703296703297, 0.785714285714286,
0.763736263736264, 0.802197802197802, 0.785714285714286, 0.878306878306878,
0.793650793650794, 0.835978835978836, 0.835978835978836, 0.804232804232804,
0.80952380952381, 0.689839572192513, 0.72192513368984, 0.754010695187166,
0.754010695187166, 0.796791443850267, 0.786096256684492)), row.names = c(NA,
-24L), class = c("tbl_df", "tbl", "data.frame"))


问:
Pass args parameters at the start of a Jax-Rs Server
I want to start a Jax-Rs server and the user has to give in the args some paramters.
Thoses parameters I need them to initialise the variable metaDatalist that will be after used in the Get service.

```<code>@Path("namenode")
public class MWNameNode {

private List<MWFileMetaData> metaDatalist;

@GET
@Path("test")
public Response getSize() {
//do Something with metaDatalist;
    System.out.println("Calling test :)");
    return Response.ok(//object to return).build();
  }
}
public static void main(String[] args) {
//read args and init the variable metaDatalist
URI uri = UriBuilder.fromUri("http://localhost/").port(12354).build();
    ResourceConfig config = new ResourceConfig(MWNameNode.class);
    GrizzlyHttpServerFactory.createHttpServer(uri, config);
}
</code>```

Is there any clean way to do this ?

Body:
I want to start a Jax-Rs server and the user has to give in the args some paramters.
Thoses parameters I need them to initialise the variable metaDatalist that will be after used in the Get service.

@Path("namenode")
public class MWNameNode {

private List<MWFileMetaData> metaDatalist;

@GET
@Path("test")
public Response getSize() {
//do Something with metaDatalist;
    System.out.println("Calling test :)");
    return Response.ok(//object to return).build();
  }
}
public static void main(String[] args) {
//read args and init the variable metaDatalist
URI uri = UriBuilder.fromUri("http://localhost/").port(12354).build();
    ResourceConfig config = new ResourceConfig(MWNameNode.class);
    GrizzlyHttpServerFactory.createHttpServer(uri, config);
}

Is there any clean way to do this ?


问:
"A named range you specified cannot be found." Warning Microsoft Excel
I named a range in Name Manager and when I select it the name is displayed, but when I want to create a Data Validation for that range I get that warning and I don't understand why.

Name Manager

Data Validation

I want to check if there are whitespaces using regex and I want to use more regex formulas and that's why I tried this way.


问:
gRPC IPC between Go and C++ on Windows
I am failing to allow ipc between Go and C++ over sockets on Windows.

I have a C++ app and a Go app on Windows (10/11) where I need IPC between the apps. I have been trying out gRPC and it worked over a localhost channel perfectly but the firewall popup is not ideal. It looks like grpc++ doesn't support named pipes but finding out if I can switch to sockets on the C++ side is a little less clear.

Trying TestClient client(grpc::CreateChannel("unix:grpctest", grpc::InsecureChannelCredentials()));
just results in:

DNS resolution failed for unix:grpctest: C-ares status is not ARES_SUCCESS qtype=A name=unix is_balancer=0: Domain name not found

Does anybody know if this is possible?

Title: gRPC IPC between Go and C++ on Windows


问:
surface plot does not show all x-axis value
I am trying to plot a surface in my dash app.

My x-axis has the 17 values below.

50, 60, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 140, 150

My y-axis has the 5 values below.

1, 3, 6, 12, 24.

Each x-y value is populate, there are no nan's.

The issue I have is that my plot does not show all my x-axis values. It starts at 50 & ends at 80, I have no idea why. Also the plot is quiet small, the figure is bigger. How can I see all my x-axis values?


问:
For Each loop to delete all tables deletes one of two tables
I am trying to delete all the tables on a slide.

There are two tables on page 5, but the code deletes the first table only.

Sub deleteTable()
    Dim p5 As Slide, shp As Shape
    Set p5 = ActivePresentation.Slides(5)
    p5.Select
    For Each shp In p5.Shapes
        If shp.Type = 19 Then
            shp.Delete
        End If
    Next shp
End Sub
```


问:
Which codes i need to return in RESTFul API for username/password mismatch, unauthorized access, not found & inactive user
I am building a RESTFul api using asp.net mvc core. and we have 2 scenarios/endpoints:-

EndPoint-1 that accepts a username and password >> validate them against a database>> return true or false.

EndPoint-2 that accepts a manager username + employee username >> return the employee salary incase the manager manages the employee.

So i am unsure which status codes i need to return in those cases:-

EndPoint-1. If the passed username and password do not match? which represent unauthenticated request?

EndPoint-2. If a manager request the salary for an employee he/she does not manage? which represents unauthorized request?

EndPoint-3. If the passed manager username has been just deleted from the database,, but the employee username is valid/active ? which represent not found?

EndPoint-3. If the passed manager username is valid, but the employee username is valid but has been deactivated (the employee left the company)?

Can anyone advice on the above please? which status codes i need to return and why?
Thanks


问:
How to disable LPT port programmatically?
I want to write a program to enable/disable the LPT port so that I can make sure everyone who uses the printer should gain permission. At the same time, I can use some functions to record who is using the printer and what he wants to print. However, I haven't found any solution to enable/disable the LPT port programmatically on windows.</p>