问:
Unable to get the ARN for AWS SQS and its dead letter queue
I am creating a sqs with a dead letter queue. The creation of the queue is success but I need to store the ARN value of the queue in systems manager at parameter store. Is there any way to pass the value to parameter store? Please provide inputs.

I tried like this, but it is not deploying in the parameter store.. I am deploying through cdk using python.

```<code>    dead_letter_queue: sqs.Queue = sqs.Queue(
        self,
        id="DeadLetterQueue",
        queue_name="dlqueue",
        retention_period=Duration.days(14)
    )
    self.sqs_queue: sqs.Queue = sqs.Queue(
        self,
        id="SqsQueue",
        queue_name="queue",
        retention_period=Duration.days(4),
        visibility_timeout=Duration.hours(6),
        delivery_delay=Duration.seconds(0),
        receive_message_wait_time=Duration.seconds(0),
        max_message_size_bytes=262144,  # 256 KiB
        #encryption=sqs.QueueEncryption.SQS_MANAGED,
        dead_letter_queue=sqs.DeadLetterQueue(
            max_receive_count=1,
            queue=dead_letter_queue

        )

    )

    ssm.StringParameter(self, "arn value of queue",
                        parameter_name="test",
                        string_value=self.sqs_queue.queue_arn)
</code>```

Body:
I am creating a sqs with a dead letter queue. The creation of the queue is success but I need to store the ARN value of the queue in systems manager at parameter store. Is there any way to pass the value to parameter store? Please provide inputs.

I tried like this, but it is not deploying in the parameter store.. I am deploying through cdk using python.

    dead_letter_queue: sqs.Queue = sqs.Queue(
        self,
        id="DeadLetterQueue",
        queue_name="dlqueue",
        retention_period=Duration.days(14)
    )
    self.sqs_queue: sqs.Queue = sqs.Queue(
        self,
        id="SqsQueue",
        queue_name="queue",
        retention_period=Duration.days(4),
        visibility_timeout=Duration.hours(6),
        delivery_delay=Duration.seconds(0),
        receive_message_wait_time=Duration.seconds(0),
        max_message_size_bytes=262144,  # 256 KiB
        #encryption=sqs.QueueEncryption.SQS_MANAGED,
        dead_letter_queue=sqs.DeadLetterQueue(
            max_receive_count=1,
            queue=dead_letter_queue

        )

    )

    ssm.StringParameter(self, "arn value of queue",
                        parameter_name="test",
                        string_value=self.sqs_queue.queue_arn)


来源: stackexchange

问:
Is there any scope for MS Teams message extension to work in Team's channel (private + public)?
MS Teams message extension is working in bot personal chats and default team of tenant but not working in others team's channels.

I'm getting error:

Error

This is manifest file for my app:

```<code>{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
  "manifestVersion": "1.5",
  "version": "1.0",
  "id": "<<id>>",
  "packageName": "com.microsoft.teams.samples",
  "developer": {
    "name": "Microsoft",
    "websiteUrl": "https://dev.botframework.com",
    "privacyUrl": "https://privacy.microsoft.com",
    "termsOfUseUrl": "https://www.microsoft.com/en-us/legal/intellectualproperty/copyright/default.aspx"
  },
  "icons": {
    "color": "icon-color.png",
    "outline": "icon-outline.png"
  },
  "name": {
    "short": "Demo",
    "full": "Demo Demo"
  },
  "description": {
    "short": "Sample demonstrating an Action Based Messaging Extension with Preview",
    "full": "Sample Action Messaging Extension built with the Bot Builder SDK demonstrating Preview"
  },
  "accentColor": "#FFFFFF",
  "bots": [
    {
      "botId": "<<botId>>",
      "scopes": [
        "personal",
        "team",
        "groupchat"
      ]
    }
  ],
  "composeExtensions": [
    {
      "botId": "<<botId>>",
      "canUpdateConfiguration": false,
      "commands": [
        {
          "id": "create",
          "type": "action",
          "title": "Create",
          "description": "Create new card",
          "initialRun": false,
          "fetchTask": false,
          "context": [
            "compose"
          ],
          "parameters": [
            {
              "name": "description",
              "title": "Title",
              "description": "Enter Title...",
              "inputType": "textarea"
            }
          ]
        }
      ]
    }
  ],
  "validDomains": []
}

</code>```

I have seen others apps are able to send message from message extension without installing it to particular teams.

ContentLicense: CC BY-SA 4.0

Body:
MS Teams message extension is working in bot personal chats and default team of tenant but not working in others team's channels.

I'm getting error:

Error

This is manifest file for my app:

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
  "manifestVersion": "1.5",
  "version": "1.0",
  "id": "<<id>>",
  "packageName": "com.microsoft.teams.samples",
  "developer": {
    "name": "Microsoft",
    "websiteUrl": "https://dev.botframework.com",
    "privacyUrl": "https://privacy.microsoft.com",
    "termsOfUseUrl": "https://www.microsoft.com/en-us/legal/intellectualproperty/copyright/default.aspx"
  },
  "icons": {
    "color": "icon-color.png",
    "outline": "icon-outline.png"
  },
  "name": {
    "short": "Demo",
    "full": "Demo Demo"
  },
  "description": {
    "short": "Sample demonstrating an Action Based Messaging Extension with Preview",
    "full": "Sample Action Messaging Extension built with the Bot Builder SDK demonstrating Preview"
  },
  "accentColor": "#FFFFFF",
  "bots": [
    {
      "botId": "<<botId>>",
      "scopes": [
        "personal",
        "team",
        "groupchat"
      ]
    }
  ],
  "composeExtensions": [
    {
      "botId": "<<botId>>",
      "canUpdateConfiguration": false,
      "commands": [
        {
          "id": "create",
          "type": "action",
          "title": "Create",
          "description": "Create new card",
          "initialRun": false,
          "fetchTask": false,
          "context": [
            "compose"
          ],
          "parameters": [
            {
              "name": "description",
              "title": "Title",
              "description": "Enter Title...",
              "inputType": "textarea"
            }
          ]
        }
      ]
    }
  ],
  "validDomains": []
}

I have seen others apps are able to send message from message extension without installing it to particular teams.


问:
Why this mongoose unique index is not working?
I have this basic entity in mongoose

```<code>const mongoose = require("mongoose");

const ParticipantSchema = mongoose.Schema({
    createdBy: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "User",
        required: true
    },
    survey: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "Survey",
        required: true
    },
    email: {
        type: String,
        required: false
    },
    firstName: {
        type: String,
        required: false
    },
    lastName: {
        type: String,
        required: false
    }
});

ParticipantSchema.index({ email: 1, survey: 1 }, { unique: true });

module.exports.Participant = mongoose.models.Participant || mongoose.model("Participant", ParticipantSchema);
</code>```

as you can see it refers to 2 other entities. The problem I have is with the unique index: when I add 2 records with the same email and survey mongo does not complain and it creates 2 identical records. Am I doing anything wrong?

Body:
I have this basic entity in mongoose

const mongoose = require("mongoose");

const ParticipantSchema = mongoose.Schema({
    createdBy: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "User",
        required: true
    },
    survey: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "Survey",
        required: true
    },
    email: {
        type: String,
        required: false
    },
    firstName: {
        type: String,
        required: false
    },
    lastName: {
        type: String,
        required: false
    }
});

ParticipantSchema.index({ email: 1, survey: 1 }, { unique: true });

module.exports.Participant = mongoose.models.Participant || mongoose.model("Participant", ParticipantSchema);

as you can see it refers to 2 other entities. The problem I have is with the unique index: when I add 2 records with the same email and survey mongo does not complain and it creates 2 identical records. Am I doing anything wrong?


问:
Different behaviour of ipywidgets.interactive_output() on Windows and macOS
I wanted to learn how to use interactive plots in Jupyter Notebook and created a script that updates a figure based on the current values of two sliders. The idea is simply that when the value of one of the sliders changes the figure should be updated.

This worked fine when I first ran the code on my Windows PC (using Windows 10). However, when I then ran the same code on my MacBook (using macOS Monterey 12.6.1), the figure is not updated but a new figure is created every time I change the value of one of my sliders.

Please find a MWE below:

```<code>import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as widgets
%matplotlib widget

# Create two sliders
slider1 = widgets.IntSlider(value=4, min=0, max=10, step=1,
                            description='Slider1', continuous_update = False)

slider2 = widgets.IntSlider(value=8, min=0, max=10, step=1,
                            description='Slider2', continuous_update = False)

# Some function that plots the result based on the current values of the sliders
def plotResult(a, b):
    plt.close('all')
    plt.figure()
    plt.hlines(a+b, xmin=0, xmax=10)

# Create interactive plot
interactive_plot = widgets.interactive_output(plotResult, {"a":slider1, "b":slider2})
ui = widgets.HBox([slider1, slider2])
display(ui, interactive_plot)
</code>```

When I run the above code in a cell in my Jupyter Notebook, I get the following output:
(https://i.stack.imgur.com/NX02T.png).

When I now change any of the sliders, on Windows my figure is "updated in-place", while on macOS a new figure is created everytime (every figure newly created figure is labeled as 'Figure 1'). I don't understand why this is happening as I explicitly close all currently opening figures at the beginning of plotResults(a,b) by using the command plt.close('all').

I thought that since every newly created figure on macOS is labeled 'Figure 1' the problem could be that on macOS the cells are not refreshed. Thus, I additionally imported the module IPython using import IPython and then added the command IPython.display.clear_output(wait=True) after the first line of plotResults(a,b). However, this did not work and the problem persisted.

I also tried to use a different Matplotlib backend such as %matplotlib ipympl or %matplotlib nbagg instead of %matplotlib widget but this also did not help anything.

Body:
I wanted to learn how to use interactive plots in Jupyter Notebook and created a script that updates a figure based on the current values of two sliders. The idea is simply that when the value of one of the sliders changes the figure should be updated.

This worked fine when I first ran the code on my Windows PC (using Windows 10). However, when I then ran the same code on my MacBook (using macOS Monterey 12.6.1), the figure is not updated but a new figure is created every time I change the value of one of my sliders.

Please find a MWE below:

import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as widgets
%matplotlib widget

# Create two sliders
slider1 = widgets.IntSlider(value=4, min=0, max=10, step=1,
                            description='Slider1', continuous_update = False)

slider2 = widgets.IntSlider(value=8, min=0, max=10, step=1,
                            description='Slider2', continuous_update = False)

# Some function that plots the result based on the current values of the sliders
def plotResult(a, b):
    plt.close('all')
    plt.figure()
    plt.hlines(a+b, xmin=0, xmax=10)

# Create interactive plot
interactive_plot = widgets.interactive_output(plotResult, {"a":slider1, "b":slider2})
ui = widgets.HBox([slider1, slider2])
display(ui, interactive_plot)

When I run the above code in a cell in my Jupyter Notebook, I get the following output:
(https://i.stack.imgur.com/NX02T.png).

When I now change any of the sliders, on Windows my figure is "updated in-place", while on macOS a new figure is created everytime (every figure newly created figure is labeled as 'Figure 1'). I don't understand why this is happening as I explicitly close all currently opening figures at the beginning of plotResults(a,b) by using the command plt.close('all').

I thought that since every newly created figure on macOS is labeled 'Figure 1' the problem could be that on macOS the cells are not refreshed. Thus, I additionally imported the module IPython using import IPython and then added the command IPython.display.clear_output(wait=True) after the first line of plotResults(a,b). However, this did not work and the problem persisted.

I also tried to use a different Matplotlib backend such as %matplotlib ipympl or %matplotlib nbagg instead of %matplotlib widget but this also did not help anything.


问:
the error #7001: Error in creating the compiled module file when compiling fortran code with ifort
I was using the visual studio parallel version 2011 with intel compiler to compile my code by the command:
ifort mymain.f90 /heap-arrays /Qmkl:parallel solver*.obj preconds*.obj
It works well and generates executable files.

But now I changed my workstation, I have to try using visual studio 2022 community version with the Intel oneAPI HPC toolkit.

ifort mymain.f90 /heap-arrays  /module:"C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include\intel64\ilp64" /4I8  -I"C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include" solver*.obj preconds*.obj

Above is the command. I have the main code, mymain.f90, and two subfolders including some *.obj files.
In my main code, I have three modules to define the variables. When I compile it, I have errors with each of the modules: error #7001: Error in creating the compiled module file [module name]

I'm quite new with the compiler commands, I used Intel® oneAPI Math Kernel Library Link Line Advisor to generate the Compiler options. I was wondering if anyone knows what's wrong with my commands or some related settings?

a minimal example:

```<code>module vars
implicit none
integer :: i,j
real*8  :: numerator, denominator, myvalue
end module

program main
use vars
implicit none
numerator=2.
denominator=4.
myvalue = numerator/denominator
write(*,*)myvalue
end program
</code>```

compiler results of old version, it works well
the compiler error of new version

Body:
I was using the visual studio parallel version 2011 with intel compiler to compile my code by the command:
ifort mymain.f90 /heap-arrays /Qmkl:parallel solver*.obj preconds*.obj
It works well and generates executable files.

But now I changed my workstation, I have to try using visual studio 2022 community version with the Intel oneAPI HPC toolkit.

ifort mymain.f90 /heap-arrays  /module:"C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include\intel64\ilp64" /4I8  -I"C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include" solver*.obj preconds*.obj

Above is the command. I have the main code, mymain.f90, and two subfolders including some *.obj files.
In my main code, I have three modules to define the variables. When I compile it, I have errors with each of the modules: error #7001: Error in creating the compiled module file [module name]

I'm quite new with the compiler commands, I used Intel® oneAPI Math Kernel Library Link Line Advisor to generate the Compiler options. I was wondering if anyone knows what's wrong with my commands or some related settings?

a minimal example:

module vars
implicit none
integer :: i,j
real*8  :: numerator, denominator, myvalue
end module

program main
use vars
implicit none
numerator=2.
denominator=4.
myvalue = numerator/denominator
write(*,*)myvalue
end program

compiler results of old version, it works well
the compiler error of new version


问:
.Net Core REST API server giving CORS issue after deployment on remote IIS server
Added below code in the Startup file. It's working fine on the local but giving CORS issues after deployment on remote IIS server.

Framework: .Net Core 2.2

Using this API for Angular 8 web application.

Tried below things to resolve the issue but still no luck !

Added CORS attribute at controller level. Checked by giving static origin.

Adding IP alias on local hosts file and try.

Checked by adding secure certificate. Changes made in webconfig file.

Changes made in configuration by changing the URL. Adding static middelware files in server

```<code>         public void ConfigureServices(IServiceCollection services)
         {
                     services.AddCors(options =>
                     {
                         options.AddPolicy("AllowAll",
                             builder =>
                             {
                                 builder
                                 .AllowAnyOrigin()
                                 .SetIsOriginAllowed(origin => true)
                                 .AllowAnyMethod()
                                 .AllowAnyHeader()
                                 .AllowCredentials();
                             });
                     });
         }

         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
         {
             //app.UseHttpsRedirection();
             app.UseCors("AllowAll");
             app.UseStaticFiles();
             app.UseStaticFiles(new StaticFileOptions()
             {
                 FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),      @"Documents")),
                 RequestPath = new PathString("/Documents")
             });
             //  app.useRouting();
             app.UseAuthentication();
             app.UseMvc();
             app.UseSession();
         }
</code>```

Body:
Added below code in the Startup file. It's working fine on the local but giving CORS issues after deployment on remote IIS server.

Framework: .Net Core 2.2

Using this API for Angular 8 web application.

Tried below things to resolve the issue but still no luck !

Added CORS attribute at controller level. Checked by giving static origin.

Adding IP alias on local hosts file and try.

Checked by adding secure certificate. Changes made in webconfig file.

Changes made in configuration by changing the URL. Adding static middelware files in server

         public void ConfigureServices(IServiceCollection services)
         {
                     services.AddCors(options =>
                     {
                         options.AddPolicy("AllowAll",
                             builder =>
                             {
                                 builder
                                 .AllowAnyOrigin()
                                 .SetIsOriginAllowed(origin => true)
                                 .AllowAnyMethod()
                                 .AllowAnyHeader()
                                 .AllowCredentials();
                             });
                     });
         }

         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
         {
             //app.UseHttpsRedirection();
             app.UseCors("AllowAll");
             app.UseStaticFiles();
             app.UseStaticFiles(new StaticFileOptions()
             {
                 FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),      @"Documents")),
                 RequestPath = new PathString("/Documents")
             });
             //  app.useRouting();
             app.UseAuthentication();
             app.UseMvc();
             app.UseSession();
         }


问:
Django form doesn't work properly, error is always != 0
I am building a payment/checkout form in Django. If the user doesn't fill in the info during checkout, they will get stuck there until they fill in everything.

I suppose that the problem is that the error is constantly != 0. However, it cannot be.

Here is the code that I have problem with:

var form = document.getElementById('form')

form.addEventListener('submit', function(e) {
    e.preventDefault()
})

document.getElementById('make-payment').addEventListener('click', function(e){
    const form = document.getElementById('form')

    let error = formValidate(form);

    if (error != 0) {
        alert('smth typed in')
    }
    else {
        submitFormData()
    }
})

function formValidate(form) {
    var error = 0;
    let formReq = document.querySelectorAll('._req');

    for (let index = 0; index < formReq.length; index++) {
        const input = formReq[index]
        formRemoveError(input);

        if (input.classList.contains('_email')) {
            if (emailTest(input)) {
                formAddError(input);
                error++;
            }
        }
        else {
            if (input.value === '') {
                formAddError(input);
                error++;
            }
        }

    }
}
function formAddError(input) {
    input.parentElement.classList.add('_error')
    input.classList.add('_error');
}
function formRemoveError(input) {
    input.parentElement.classList.remove('_error')
    input.classList.remove('_error');
}
function emailTest(input) {
    return !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,8})+$/.test(input.value);
}

```


问:
Python loading wrong Pillow (PIL) package
I have strange issue while loading matplotlib package. Never observed that before. The package is trying to load PIL from the wrong place. If I try to load PIL from the command line, it also loaded from the wrong place.

Here is matplotlib traceback:

```<code>>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/XXX/python_rep/miniconda3/envs/work/lib/python3.9/site-packages/matplotlib/__init__.py", line 113, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "/home/XXX/python_rep/miniconda3/envs/work/lib/python3.9/site-packages/matplotlib/rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/home/XXX/python_rep/miniconda3/envs/work/lib/python3.9/site-packages/matplotlib/colors.py", line 51, in <module>
    from PIL import Image
  File "/homeappl/common-software/sw/python3.6/lib/python3.6/site-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/homeappl/common-software/sw/python3.6/lib/python3.6/site-packages/PIL/__init__.py)
</code>```

Please note that I use my own conda environment with python 3.9
It is activated and contained Pillow version 9.0.0
Other packages are loaded from that instance, but bloody PIL tries to reach the common area.

```<code>/home/XXX/python_rep/miniconda3/envs/work/bin/python3.9 -m pip install pillow
Requirement already satisfied: pillow in /homeappl/common-software/sw/python3.6/lib/python3.6/site-packages (7.0.0)
</code>```

I have no idea why it tries to load package from old place. But I do not have access to that - due to admin rights.

How to force machine not to use wrong package?

Body:
I have strange issue while loading matplotlib package. Never observed that before. The package is trying to load PIL from the wrong place. If I try to load PIL from the command line, it also loaded from the wrong place.

Here is matplotlib traceback:

>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/XXX/python_rep/miniconda3/envs/work/lib/python3.9/site-packages/matplotlib/__init__.py", line 113, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "/home/XXX/python_rep/miniconda3/envs/work/lib/python3.9/site-packages/matplotlib/rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/home/XXX/python_rep/miniconda3/envs/work/lib/python3.9/site-packages/matplotlib/colors.py", line 51, in <module>
    from PIL import Image
  File "/homeappl/common-software/sw/python3.6/lib/python3.6/site-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/homeappl/common-software/sw/python3.6/lib/python3.6/site-packages/PIL/__init__.py)

Please note that I use my own conda environment with python 3.9
It is activated and contained Pillow version 9.0.0
Other packages are loaded from that instance, but bloody PIL tries to reach the common area.

/home/XXX/python_rep/miniconda3/envs/work/bin/python3.9 -m pip install pillow
Requirement already satisfied: pillow in /homeappl/common-software/sw/python3.6/lib/python3.6/site-packages (7.0.0)

I have no idea why it tries to load package from old place. But I do not have access to that - due to admin rights.

How to force machine not to use wrong package?


问:
How to access and edit local sqlite from Xamarin iOS app while debugging on device and not simulator
I want to access edit and update the local db sqlite of my mobile app while debugging. I was able to open using DB Browser for SQLite with the db path while running on simulator but not on actual iPhone. I can't debug on simulator anymore as I am using NFC library which fails to build on Simulators and builds only on devices.

Few of the solutions tried from existing answers:

Tried opening the containers from Xcode -> Windows -> Devices and Simulators -> clicked on installed Apps to download containers. But it fails to show the db file present.


问:
KonvaJS cropping an image using data saved in a Redux state
I'm building an image editor using NextJS, Konva and Redux. I've got a Redux state that saves data for each image, and then sends it down as 'data'. I want to let users crop images among other things.

this is a part of my image component. data, brightness, contrast and blur are sent from Redux

```<code>  <>
    <Image
    ref={imageRef}
    x={data.x}
    y={data.y}
    scaleX={data.scaleX}
    scaleY={data.scaleY}
    image={image}
    width={data.width}
    height={data.height}
    filters={[Konva.Filters.Brighten, Konva.Filters.Contrast, Konva.Filters.Blur,]}
    brightness={brightness ? brightness.value / 100 : 0}
    contrast={contrast ? contrast.value : 0}
    blurRadius={blur ? blur.value : 0}
</code>```

I am able to modify things like brightness, width etc. without any problems but when I want to crop the image things don't work.

.
This is the Konva stage on the right and the crop button (among the others) on the left (separate react components)

When I click on crop a transformer appears that can be moved around

After someone clicks 'Save Crop' the image should be cropped based on the X, Y, width and height of that transformer.

I've tried to call layer.draw() and image.draw() after the cropping is over but to no avail. I've also using the 4 separate properties for cropping (cropX, cropY, cropWidth, cropHeight) but that didn't work either.

So how would I be able to update my image crop values with the image changing?

Body:
I'm building an image editor using NextJS, Konva and Redux. I've got a Redux state that saves data for each image, and then sends it down as 'data'. I want to let users crop images among other things.

this is a part of my image component. data, brightness, contrast and blur are sent from Redux

  <>
    <Image
    ref={imageRef}
    x={data.x}
    y={data.y}
    scaleX={data.scaleX}
    scaleY={data.scaleY}
    image={image}
    width={data.width}
    height={data.height}
    filters={[Konva.Filters.Brighten, Konva.Filters.Contrast, Konva.Filters.Blur,]}
    brightness={brightness ? brightness.value / 100 : 0}
    contrast={contrast ? contrast.value : 0}
    blurRadius={blur ? blur.value : 0}

I am able to modify things like brightness, width etc. without any problems but when I want to crop the image things don't work.

.
This is the Konva stage on the right and the crop button (among the others) on the left (separate react components)

When I click on crop a transformer appears that can be moved around

After someone clicks 'Save Crop' the image should be cropped based on the X, Y, width and height of that transformer.

I've tried to call layer.draw() and image.draw() after the cropping is over but to no avail. I've also using the 4 separate properties for cropping (cropX, cropY, cropWidth, cropHeight) but that didn't work either.

So how would I be able to update my image crop values with the image changing?


问:
Stumped by Run Time error '1004': Unable to set the X property of the PageSetup class
I have created a sub for the page setup of a sheet. It used to work earlier on different computers.

But for a unknown reason now I get an error message pops up for Y.PageSetup.X = ... :
Run time error 1004 unable to set the X property of the pagesetup class, where X includes all used properties.
And Y is variable of type worksheet.

I looked into this error on Microsoft support, it says "This problem occurs when there are no printer drivers installed on your computer. Excel cannot set or get page setup properties if no printer drivers are installed."

Here is my code:

```<code>Dim oSheet As Worksheet
Dim oDescription As Worksheet

Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Name = "Calibri"
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Orientation = 45
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).HorizontalAlignment = xlHAlignLeft
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Size = 6
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Color = 0
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Bold = True
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents + 1)).VerticalAlignment = xlVAlignBottom

    Range(oSheet.Cells(1, 1), oSheet.Cells(2, zIdxMediaContents + 1)).Interior.Color = &HFFFFFF
    Range(oSheet.Cells(2, 1), oSheet.Cells(2, zIdxMediaContents + 1)).Borders(xlEdgeBottom).Weight = xlThick

    oSheet.PageSetup.CenterHeader = "&""Calibri"" &B&6 " & cHeaderColour & cHeaderText
    oSheet.PageSetup.LeftFooter = "&""Calibri"" &6 " & "J.nr.:" & tJournal
    oSheet.PageSetup.CenterFooter = "&""Calibri"" &6 " & Format(Now, "d. mmmm yyyy")
        oDescription.PageSetup.CenterHeader = "&""Calibri"" &B&6 " & cHeaderColour & cHeaderText
        oDescription.PageSetup.LeftFooter = "&""Calibri"" &6 " & "J.nr.:" & tJournal
        oDescription.PageSetup.CenterFooter = "&""Calibri"" &6 " & Format(Now, "d. mmmm yyyy")

</code>```

Body:
I have created a sub for the page setup of a sheet. It used to work earlier on different computers.

But for a unknown reason now I get an error message pops up for Y.PageSetup.X = ... :
Run time error 1004 unable to set the X property of the pagesetup class, where X includes all used properties.
And Y is variable of type worksheet.

I looked into this error on Microsoft support, it says "This problem occurs when there are no printer drivers installed on your computer. Excel cannot set or get page setup properties if no printer drivers are installed."

Here is my code:

Dim oSheet As Worksheet
Dim oDescription As Worksheet

Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Name = "Calibri"
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Orientation = 45
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).HorizontalAlignment = xlHAlignLeft
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Size = 6
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Color = 0
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents)).Font.Bold = True
    Range(oSheet.Cells(1, 1), oSheet.Cells(1, zIdxMediaContents + 1)).VerticalAlignment = xlVAlignBottom

    Range(oSheet.Cells(1, 1), oSheet.Cells(2, zIdxMediaContents + 1)).Interior.Color = &HFFFFFF
    Range(oSheet.Cells(2, 1), oSheet.Cells(2, zIdxMediaContents + 1)).Borders(xlEdgeBottom).Weight = xlThick

    oSheet.PageSetup.CenterHeader = "&""Calibri"" &B&6 " & cHeaderColour & cHeaderText
    oSheet.PageSetup.LeftFooter = "&""Calibri"" &6 " & "J.nr.:" & tJournal
    oSheet.PageSetup.CenterFooter = "&""Calibri"" &6 " & Format(Now, "d. mmmm yyyy")
        oDescription.PageSetup.CenterHeader = "&""Calibri"" &B&6 " & cHeaderColour & cHeaderText
        oDescription.PageSetup.LeftFooter = "&""Calibri"" &6 " & "J.nr.:" & tJournal
        oDescription.PageSetup.CenterFooter = "&""Calibri"" &6 " & Format(Now, "d. mmmm yyyy")


问:
Login SSO: get claims from msal azure authentication response
We have to develop a integration to a external login provided by Azure AD (SAML 2.0).
Our system uses react for the front-end and python for the backend. The login workflow should works like this:

Front-end Login Page --> Azure - Success Login --> Azure requests to our backend success URL with user info

Everything is working fine and after a success login the Azure request arrives to our backend server. The problem is the way to read that requests and how to extract the basic information (user, email....).

We don't see any info in body or headers, only some encoded params in the url. The requests received is like this:

https://<MY_DOMAIN>#code=<RARE_CODE>&state=<BASE64_ENCODE_JSON>&session_state=<UUID_CODE>

The information of the logged user (claims) is supposed to be there, in any of those params, probably encoded in the "code" parameter. I think there must be a way to decode that information but I can't find answers in any documentation.

Any in-house solution to be able to recover those claims and access the user's login data?


问:
How do I map a tree by depth in a functional manner without recursion?
Given a tree, how can I get a depth -> nodes map?

I’ve come this far in JavaScript but I’m not sure how to make the outer loop functional. I could probably do it using recursive inject but I’d rather avoid recursion.

```<code>function treeToLayers(root) {
    var layers = [[root]];
    var nextLayer = root.children;
    while (nextLayer.length > 0) {
        layers.push(nextLayer);
        var lastLayer = nextLayer;
        nextLayer = _(lastLayer).chain().
            pluck('children').
            flatten().
            value();
    }
    return layers;
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Given a tree, how can I get a depth -> nodes map?

I’ve come this far in JavaScript but I’m not sure how to make the outer loop functional. I could probably do it using recursive inject but I’d rather avoid recursion.

function treeToLayers(root) {
    var layers = [[root]];
    var nextLayer = root.children;
    while (nextLayer.length > 0) {
        layers.push(nextLayer);
        var lastLayer = nextLayer;
        nextLayer = _(lastLayer).chain().
            pluck('children').
            flatten().
            value();
    }
    return layers;
}


问:
In angular material calendar when select todays date it is display yesterday date
Angular material calendar when i select todays date it is displayed yesterday date

.ts

```<code>filterDates=  (date:Date):boolean=>{
let today=new Date(new  Date().setDate(new Date().getDate()-1));
Console.log(today);
return date>today;
}
</code>```

. html

```<code><mat-calendar [dateFilter]="filterDates"></mat-calendar>
</code>```

Body:
Angular material calendar when i select todays date it is displayed yesterday date

.ts

filterDates=  (date:Date):boolean=>{
let today=new Date(new  Date().setDate(new Date().getDate()-1));
Console.log(today);
return date>today;
}

. html

<mat-calendar [dateFilter]="filterDates"></mat-calendar>


问:
Flutter cannot retrieve iPhone file (sometimes)
I have an app that lets the user pick local files and send them to the backend to add to their vault. To pick the file, I use FilePicker.platform.pickFiles. It seems to work fine, the file is picked and when it's an image we show a preview to the user (and it always works).

Once the user has picked all their files, we create a list of Future to try and send the files to the backend, then we await the list to resolve. If we deem a picture is too big, we reduce the size using FlutterImageCompress.compressAndGetFile.

This usually works, but on iPhone, there is a seemingly random behavior where the file isn't found and an error is thrown :  Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/3600F812-FD42-4441-A654-766991E45E04/tmp/com.feykro.myApp.int-Inbox/myFile.pdf' (OS Error: No such file or directory, errno = 2)

The file in the example works just fine in other instances, the problem seems random and not directly tied to the file I chose. The problem is not exclusive to pdf files either, as it also occurs on images even though they're picked correctly and displayed in the app.

Any idea what could be causing this ?

Thanks in advance !


问:
In sunmi_printer_plus, printRow not working properly on Thai language
I'm using this package sunmi_printer_plus.

Here my code

```<code>await SunmiPrinter.bindingPrinter();
await SunmiPrinter.initPrinter();
await SunmiPrinter.startTransactionPrint(true);
await SunmiPrinter.printText(
  restaurant.title,
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
  ),
);
await SunmiPrinter.lineWrap(1);
await SunmiPrinter.printText(
  'ใบเสร็จ',
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
  ),
);
await SunmiPrinter.line();
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'NO:', width: 10, align: SunmiPrintAlign.LEFT),
  ColumnMaker(text: order.id, width: 20, align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'Time:', width: 10, align: SunmiPrintAlign.LEFT),
  ColumnMaker(
      text: DateFormat('dd/MM/yyyy HH:mm')
          .format(order.paidTime ?? DateTime.now()),
      width: 20,
      align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.line();
await SunmiPrinter.bold();
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'Menu', width: 15, align: SunmiPrintAlign.LEFT),
  ColumnMaker(text: 'Price', width: 15, align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.resetBold();
for (var item in order.cart.items) {
  await SunmiPrinter.printRow(cols: [
    ColumnMaker(
        text: '${item.amount} x ${item.product.title}',
        width: 20,
        align: SunmiPrintAlign.LEFT),
    ColumnMaker(
        text: item.totalPrice.toString(),
        width: 10,
        align: SunmiPrintAlign.RIGHT),
  ]);
}
await SunmiPrinter.line();
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'Total', width: 10, align: SunmiPrintAlign.LEFT),
  ColumnMaker(
      text: '฿${order.cart.totalPrice}',
      width: 20,
      align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.lineWrap(1);
await SunmiPrinter.printText(
  'ขอบคุณที่มาอุดหนุนค่ะ',
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
    fontSize: SunmiFontSize.SM,
  ),
);
await SunmiPrinter.printText(
  'Powered by Dr.Dish',
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
    fontSize: SunmiFontSize.SM,
  ),
);
await SunmiPrinter.lineWrap(3);
await SunmiPrinter.exitTransactionPrint(true);
</code>```

Here result

as you can see, the character is stack on each other on lines that use printRow. (printText working fine)

and it working fine when I change to English.

What do I miss or this is a bug? I tried to change column size and word length, but still not working.

Body:
I'm using this package sunmi_printer_plus.

Here my code

await SunmiPrinter.bindingPrinter();
await SunmiPrinter.initPrinter();
await SunmiPrinter.startTransactionPrint(true);
await SunmiPrinter.printText(
  restaurant.title,
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
  ),
);
await SunmiPrinter.lineWrap(1);
await SunmiPrinter.printText(
  'ใบเสร็จ',
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
  ),
);
await SunmiPrinter.line();
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'NO:', width: 10, align: SunmiPrintAlign.LEFT),
  ColumnMaker(text: order.id, width: 20, align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'Time:', width: 10, align: SunmiPrintAlign.LEFT),
  ColumnMaker(
      text: DateFormat('dd/MM/yyyy HH:mm')
          .format(order.paidTime ?? DateTime.now()),
      width: 20,
      align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.line();
await SunmiPrinter.bold();
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'Menu', width: 15, align: SunmiPrintAlign.LEFT),
  ColumnMaker(text: 'Price', width: 15, align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.resetBold();
for (var item in order.cart.items) {
  await SunmiPrinter.printRow(cols: [
    ColumnMaker(
        text: '${item.amount} x ${item.product.title}',
        width: 20,
        align: SunmiPrintAlign.LEFT),
    ColumnMaker(
        text: item.totalPrice.toString(),
        width: 10,
        align: SunmiPrintAlign.RIGHT),
  ]);
}
await SunmiPrinter.line();
await SunmiPrinter.printRow(cols: [
  ColumnMaker(text: 'Total', width: 10, align: SunmiPrintAlign.LEFT),
  ColumnMaker(
      text: '฿${order.cart.totalPrice}',
      width: 20,
      align: SunmiPrintAlign.RIGHT),
]);
await SunmiPrinter.lineWrap(1);
await SunmiPrinter.printText(
  'ขอบคุณที่มาอุดหนุนค่ะ',
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
    fontSize: SunmiFontSize.SM,
  ),
);
await SunmiPrinter.printText(
  'Powered by Dr.Dish',
  style: SunmiStyle(
    align: SunmiPrintAlign.CENTER,
    fontSize: SunmiFontSize.SM,
  ),
);
await SunmiPrinter.lineWrap(3);
await SunmiPrinter.exitTransactionPrint(true);

Here result

as you can see, the character is stack on each other on lines that use printRow. (printText working fine)

and it working fine when I change to English.

What do I miss or this is a bug? I tried to change column size and word length, but still not working.


问:
Error received on token expiration despite of not being outdated in node js app
Good day developers, recently as been working in this node js app, and when implementing  jwt library i got an error related to tghe verify() method in this jwt repo.
Kind of :

```<code>      return secretCallback(null, secretOrPublicKey);
             ^
TokenExpiredError: jwt expired
</code>```

The repo  is structured in several folders:

```<code>controllers
middlewares
helpers
socket controllers
</code>```

On my middleware folder, sepecifically in a file related to jwt validation i settled this:

file middleware jwt-validation

```<code>
export {};
const { request, response } = require("express");
const User = require("../models/user-model");
const jwt = require("jsonwebtoken");

const jwtValidator = async (req = request, res = response, next) => {

  const token_response =  req.header("token-response");

  if (!token_response) {
    return res.status(401).json({
      message: "Not valid token .You don't have authorization",
    });
  }
  try {

    const payload = await jwt.verify(token_response, process.env.SECRETKEYJWT)

    const userAuth = await User.findById(payload.id);

    if (userAuth.userState != true) {
      return res.status(401).json({
        message: "User inhabilitated",
      });
    }

    if (!userAuth) {
      return res.status(404).json({
        message: "User not found",
      });
    }

    req.user = userAuth;

    next();

  } catch (error) {
    return res.status(500).json({
      message: "Not valid token.Error 500",
    });

  }
};
module.exports = { jwtValidator };
</code>```

file middleware jwt-validation-sockets

```<code>import { UserSchema } from "../interfaces";
const jwt = require("jsonwebtoken");
const User = require("../models/user-model");

const jwtValidatorRenew = async (
  token: string = ""
): Promise<UserSchema | null> => {

  if (token == "" || token.length < 10 || token == undefined) {
    return null;
  }

  const payloadToken = await jwt.verify(token, process.env.SECRETKEYJWT)

  const userTokenDecoded: UserSchema = User.findById(payloadToken.id);

  if (userTokenDecoded?.userState) {
    return userTokenDecoded;
  } else {
    return null;
  }

};

module.exports = { jwtValidatorRenew };

</code>```

file helper jwt-generator

```<code>

const { request, response } = require("express");
const jwt = require("jsonwebtoken");
const createJWT = async (id = "", nickname = "") =>
  return new Promise((resolve, reject) => {

    const payloadInJWT = { id, nickname };

    jwt.sign(
      payloadInJWT,
      process.env.SECRETKEYJWT,
      {
        expiresIn: 3600,
      },
      //calback
      (error:any, token:string) => {
        if (error) {
          alert(error)
          reject("Error creating token ");
        } else {
          resolve(token);
        }
      }
    );

  });
};

module.exports = { createJWT };

</code>```

file socket-controller

```<code>const { jwtValidatorRenew } = require("../middlewares/jwt-validation-socket");
const { userData } = require("../helpers/helper-user-schema-data");
const { Socket } = require("socket.io");
const User = require("../models/user-model");
const {
  ChatMessage,
  Message,
  MessagePrivate,
  GroupChat,
} = require("../models/chat-model");
const chatMessage = new ChatMessage()
const socketController = async (socket = new Socket(), io) => {
  const user = await jwtValidatorRenew(
    socket.handshake.headers["token-response"]
  );

  try {
   ...some sockets flags
  } catch (error) {
    socket.disconnect();
  }
};

module.exports = { socketController };

</code>```

Body:
Good day developers, recently as been working in this node js app, and when implementing  jwt library i got an error related to tghe verify() method in this jwt repo.
Kind of :

      return secretCallback(null, secretOrPublicKey);
             ^
TokenExpiredError: jwt expired

The repo  is structured in several folders:

controllers
middlewares
helpers
socket controllers

On my middleware folder, sepecifically in a file related to jwt validation i settled this:

file middleware jwt-validation

export {};
const { request, response } = require("express");
const User = require("../models/user-model");
const jwt = require("jsonwebtoken");

const jwtValidator = async (req = request, res = response, next) => {

  const token_response =  req.header("token-response");

  if (!token_response) {
    return res.status(401).json({
      message: "Not valid token .You don't have authorization",
    });
  }
  try {

    const payload = await jwt.verify(token_response, process.env.SECRETKEYJWT)

    const userAuth = await User.findById(payload.id);

    if (userAuth.userState != true) {
      return res.status(401).json({
        message: "User inhabilitated",
      });
    }

    if (!userAuth) {
      return res.status(404).json({
        message: "User not found",
      });
    }

    req.user = userAuth;

    next();

  } catch (error) {
    return res.status(500).json({
      message: "Not valid token.Error 500",
    });

  }
};
module.exports = { jwtValidator };

file middleware jwt-validation-sockets

import { UserSchema } from "../interfaces";
const jwt = require("jsonwebtoken");
const User = require("../models/user-model");

const jwtValidatorRenew = async (
  token: string = ""
): Promise<UserSchema | null> => {

  if (token == "" || token.length < 10 || token == undefined) {
    return null;
  }

  const payloadToken = await jwt.verify(token, process.env.SECRETKEYJWT)

  const userTokenDecoded: UserSchema = User.findById(payloadToken.id);

  if (userTokenDecoded?.userState) {
    return userTokenDecoded;
  } else {
    return null;
  }

};

module.exports = { jwtValidatorRenew };

file helper jwt-generator

const { request, response } = require("express");
const jwt = require("jsonwebtoken");
const createJWT = async (id = "", nickname = "") =>
  return new Promise((resolve, reject) => {

    const payloadInJWT = { id, nickname };

    jwt.sign(
      payloadInJWT,
      process.env.SECRETKEYJWT,
      {
        expiresIn: 3600,
      },
      //calback
      (error:any, token:string) => {
        if (error) {
          alert(error)
          reject("Error creating token ");
        } else {
          resolve(token);
        }
      }
    );

  });
};

module.exports = { createJWT };

file socket-controller

const { jwtValidatorRenew } = require("../middlewares/jwt-validation-socket");
const { userData } = require("../helpers/helper-user-schema-data");
const { Socket } = require("socket.io");
const User = require("../models/user-model");
const {
  ChatMessage,
  Message,
  MessagePrivate,
  GroupChat,
} = require("../models/chat-model");
const chatMessage = new ChatMessage()
const socketController = async (socket = new Socket(), io) => {
  const user = await jwtValidatorRenew(
    socket.handshake.headers["token-response"]
  );

  try {
   ...some sockets flags
  } catch (error) {
    socket.disconnect();
  }
};

module.exports = { socketController };


问:
After adding a filter which extends OncePerRequestFilter, getting exception "I/O error while reading input message; nested exception is Stream closed
I added one Request filter which extends OncePerRequestFilter.
 This filter I am using in my SpringBoot application which exposes end points for rest api.

After adding this filter it is working in localhost but when we are deploying it to any environment it is throwing this exception:

Request processing failed; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message; nested exception is java.io.IOException: Stream closed

```<code>@Component
public class RequestFilter extends OncePerRequestFilter {

    private static Logger LOGGER = LoggerFactory.getLogger(RequestFilter.class);
    private static final String X_JWT_PAYLOAD_HEADER = "x-jwt-payload";
    private static final String AUTHORIZATION_HEADER = "Authorization";
    private static final String DATA_KEY = "data";
    private static final String MESSAGE_KEY = "message";
    private static final String ERROR_KEY = "error";
    private static final String ERRORS_KEY = "errors";
    private static final String EMPTY_JWT_TOKEN_MSG = "Bad request, mandatory request header " + X_JWT_PAYLOAD_HEADER
            + ", is empty";

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {
            Map<String, String> errorDetails=new HashMap();
        try {
            LOGGER.debug("Auth Header: {}", request.getHeader(AUTHORIZATION_HEADER));
            LOGGER.info("JWT payload header: {}", request.getHeader(X_JWT_PAYLOAD_HEADER));

            if (request.getHeader(X_JWT_PAYLOAD_HEADER) == null) {
                errorDetails = getErrorMessage("data1", "dat2","data3");
                response.setStatus(HttpStatus.BAD_REQUEST.value());
                response.setContentType(MediaType.APPLICATION_JSON_VALUE);
                new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);

            } else {

                errorDetails = getErrorMessage("data1","data2","data3");
                response.setStatus(HttpStatus.BAD_REQUEST.value());//this can be any status HTTPStatus code
                response.setContentType(MediaType.APPLICATION_JSON_VALUE);
                new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);

            }

            if (!isValid) {
                errorDetails = getErrorMessage("data1","data2","data3");
                response.setStatus(HttpStatus.UNAUTHORIZED.value());
                response.setContentType(MediaType.APPLICATION_JSON_VALUE);
                new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);
            }

                LOGGER.debug("Processing Request Method {} URI {}", request.getMethod(), request.getRequestURI());
        } catch (Exception e) {
            LOGGER.error("Error validating token :", e);
            Map<String, String> errorDetails = getErrorMessage("data1","data2","data3");

            response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
            response.setContentType(MediaType.APPLICATION_JSON_VALUE);
            new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);
            filterChain.doFilter(request, response);
        }
        filterChain.doFilter(request, response);
    }

    private Map<String, String> getErrorMessage(String dataValue, String messageValue, String errorsValue) {
        Map<String, String> errorDetails = new HashMap<>();
        errorDetails.put(DATA_KEY, dataValue);
        errorDetails.put(MESSAGE_KEY, messageValue);
        errorDetails.put(ERROR_KEY, "true");
        errorDetails.put(ERRORS_KEY, errorsValue);
        return errorDetails;
    }
}
</code>```

Body:
I added one Request filter which extends OncePerRequestFilter.
 This filter I am using in my SpringBoot application which exposes end points for rest api.

After adding this filter it is working in localhost but when we are deploying it to any environment it is throwing this exception:

Request processing failed; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message; nested exception is java.io.IOException: Stream closed

@Component
public class RequestFilter extends OncePerRequestFilter {

    private static Logger LOGGER = LoggerFactory.getLogger(RequestFilter.class);
    private static final String X_JWT_PAYLOAD_HEADER = "x-jwt-payload";
    private static final String AUTHORIZATION_HEADER = "Authorization";
    private static final String DATA_KEY = "data";
    private static final String MESSAGE_KEY = "message";
    private static final String ERROR_KEY = "error";
    private static final String ERRORS_KEY = "errors";
    private static final String EMPTY_JWT_TOKEN_MSG = "Bad request, mandatory request header " + X_JWT_PAYLOAD_HEADER
            + ", is empty";

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {
            Map<String, String> errorDetails=new HashMap();
        try {
            LOGGER.debug("Auth Header: {}", request.getHeader(AUTHORIZATION_HEADER));
            LOGGER.info("JWT payload header: {}", request.getHeader(X_JWT_PAYLOAD_HEADER));

            if (request.getHeader(X_JWT_PAYLOAD_HEADER) == null) {
                errorDetails = getErrorMessage("data1", "dat2","data3");
                response.setStatus(HttpStatus.BAD_REQUEST.value());
                response.setContentType(MediaType.APPLICATION_JSON_VALUE);
                new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);

            } else {

                errorDetails = getErrorMessage("data1","data2","data3");
                response.setStatus(HttpStatus.BAD_REQUEST.value());//this can be any status HTTPStatus code
                response.setContentType(MediaType.APPLICATION_JSON_VALUE);
                new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);

            }

            if (!isValid) {
                errorDetails = getErrorMessage("data1","data2","data3");
                response.setStatus(HttpStatus.UNAUTHORIZED.value());
                response.setContentType(MediaType.APPLICATION_JSON_VALUE);
                new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);
            }

                LOGGER.debug("Processing Request Method {} URI {}", request.getMethod(), request.getRequestURI());
        } catch (Exception e) {
            LOGGER.error("Error validating token :", e);
            Map<String, String> errorDetails = getErrorMessage("data1","data2","data3");

            response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
            response.setContentType(MediaType.APPLICATION_JSON_VALUE);
            new ObjectMapper().writeValue(response.getOutputStream(), errorDetails);
            filterChain.doFilter(request, response);
        }
        filterChain.doFilter(request, response);
    }

    private Map<String, String> getErrorMessage(String dataValue, String messageValue, String errorsValue) {
        Map<String, String> errorDetails = new HashMap<>();
        errorDetails.put(DATA_KEY, dataValue);
        errorDetails.put(MESSAGE_KEY, messageValue);
        errorDetails.put(ERROR_KEY, "true");
        errorDetails.put(ERRORS_KEY, errorsValue);
        return errorDetails;
    }
}


问:
Use result previous row as start value for next line
I'm working on an MRP simulation in which I have to subtract demand or add supply qty to available stock and I hope you can be of support. Find below the result I want to achieve.

I have 1 value for stock = 22 and a lot of values for future demand/supply on specific dates.

Part
Stock
Demand/Supply qty
Demand/Supply Date
Result

1000680
22
-1
2023-01-01
21

1000680
21* what I want to achieve
-15
2023-01-02
6* expected outcome

1000680
6* what I want to achieve
+10
2023-01-03
16* expected outcome

I'm still on the SQL learning curve. I started to add rownumbers to the lines to make sure that the sequence is correct:

select

 part,

 rownum = ROW_NUMBER() OVER (ORDER BY part, mrp_due_date),

 current_stock_qty,

 demand_supply_qty,

 current_stock - qty as new_stock_qty,  -- if demand

 current_stock + qty as new_stock_qty,  -- if supply

 mrp_due_date

from #base

Then I tried the lag function to derive previous row 'new_stock_qty' at date but this only worked for the first line (see image:
)

So I probably need the loop function to first calculate stock-demand and use the result as new stock.

I have looked through similar questions asked on this site, but I find it difficult to define my solution based on that information.


问:
Can AWS Device Farm be used to test Android console applications?
My team is responsible for maintaining a C++ library built, amongst other targets, for Android using NDK. We have unit tests that are based on googletest/gtest and are built as simple executables. Our automated build system currently runs these tests on a physical device by running adb commands.

It has been suggested that we investigate using Android Device Farm, at least as an option - we occasionally get trouble with specific versions of Android, and it would allow us to test more widely. However the examples I am seeing reflect running proper Android apps via a generated apk - they would need an App entry point.

I am thinking this would need a dummy app to call the unit test code via an JNI entry point and then exit, or is that over complicating something that is better supported and I've not noticed.

Has anybody tried doing this?


问:
Log4j2 Configuration compress the last 5 files only when rolling
How should I specify that only compress the last 5 files when rolling and the first ones to keep uncompres? Is that possible to do on log4j2 configuration file?</p>


问:
SafetyNet Attestation API deprecation
I'm getting this email from Google developers who remembers me to migrate to Play Integrity API.

My app is built using react-native and it uses rnfirebase library for Authentication, storage, and a few other services. We are not using AppCheck directly.

I could see the SafetyNet library inside my app which is being internally used by Firebase Auth.

There is an issue already open in the rn-firebase repo. The discussion there concludes to wait a bit more till the migration is done at the library side.

So my question is should I wait till it is done or can I do something from my side and will my app stop working after January 30th?

You can read the complete email from here

Title: SafetyNet Attestation API deprecation


问:
Show color in gutter for commented CSS code in WebStorm
I'm expecting below code to show color in gutter for commented CSS code.

```<code>/*
Light green: #7ed56f
*/
body {
    color: #7ed56f;
}
</code>```

Body:
I'm expecting below code to show color in gutter for commented CSS code.

/*
Light green: #7ed56f
*/
body {
    color: #7ed56f;
}


问:
RH file conversion
I need to extract the design from a Right Hemisphere 3D file (contains design and sop) to .STEP/ .STL / .fbx.

We could open the RH file in Deep View but could not convert it to the .STEP/.STL/.fbx format.

Title: RH file conversion


问:
Constructor value is not accessible in function
Here I have a very simple class and I have a constructor inside of it and in constructor I am declaring a value donut_count but when I try to access that value in another function it says undefined why it is undefined:

```<code>class DonutMaker {
  constructor() {
    var donut_count = 1;
    this.target = document.getElementById("donut_creater");
    this.target.addEventListener("click", this.donutCreate);
  }
  donutCreate() {
    console.log(this.donut_count);
  }
}

let obj1 = new DonutMaker();
</code>```

Body:
Here I have a very simple class and I have a constructor inside of it and in constructor I am declaring a value donut_count but when I try to access that value in another function it says undefined why it is undefined:

class DonutMaker {
  constructor() {
    var donut_count = 1;
    this.target = document.getElementById("donut_creater");
    this.target.addEventListener("click", this.donutCreate);
  }
  donutCreate() {
    console.log(this.donut_count);
  }
}

let obj1 = new DonutMaker();


问:
Maximum call stack size exceed when using computed in vue component
In the following code i want to load component dynamically based on value stored in the vuex store. But when I run this code then in developer console I am getting Maximum call stack size exceed when using computed in vue component. Computed function is running multiple time.

```<code><template>
     <div>
        <component :is="layout"></component>
     </div>
</template>

<script setup>
    import { computed } from 'vue';
    import app from './layouts/app-layout.vue';
    import auth from './layouts/auth-layout.vue';

    import { useMeta } from '@/composables/use-meta';
    import { useStore } from 'vuex';
    useMeta({ title: 'My Title' });
    const store = useStore();

    const layout = computed(() => {
       return store.getters.layout;
    });
</script>
</code>```

Body:
In the following code i want to load component dynamically based on value stored in the vuex store. But when I run this code then in developer console I am getting Maximum call stack size exceed when using computed in vue component. Computed function is running multiple time.

<template>

        <component :is="layout"></component>

</template>


Title: Filter column values matching other column values

Body:
I know it is an easy question but I don't know why is getting complicated somehow.
I provide a small dataset with just 5 categories in the column named gen. In my dataset there is more than 3 categories. My intention is to get NA values in dCt according to gen category matching several strings == gapd, b2m and s18

#applying filter with "&"
genes %>% dplyr::filter(dCt == "NA" & gen == c("gapd", "b2m", "s18"))

#rowAny

genes %>% dplyr::filter(rowAny(across(.cols = dCt[gen = c("gapd", "b2m", "s18")],
.fns = ~ is.na(.x)
)))

# try with str_detect and filter
genes %>% dplyr::filter(gen == c("gapd", "b2m", "s18")) %>% str_detect(.x, "NA")

The df

df <-
structure(list(id = c(70802011, 110104023, 130106038, 130106038,
110104023, 50705001, 50430001, 110113006, 50203004, 50118001,
50109025, 140103024, 110104028, 50521002, 120715026, 140101088,
130102014, 50109026, 50203012, 70802011, 111202007, 50203022,
50109027, 50203012, 140101096, 140103023, 60901029, 130105045,
120715020, 120715025, 50203029, 140102089, 140103020, 60901029,
140103026, 50109027, 110606056, 130102014, 111202015, 120715027,
71801001, 60901038, 110104027, 60901036, 50521001, 111201017,
120715033, 60901027, 50203027, 60901033, 110104029, 130108009,
140102095, 130106037, 60901021, 71801002, 50203020, 110113001,
140101097, 130108008, 110104028, 70802015, 140103029, 140102090,
50203026, 50521002, 120715025, 140102092, 140101091, 110113005,
130104004, 50203013, 70802015, 50203010, 110104019, 130105044,
70107034, 120715021, 111201006, 111201007, 111201014, 70713001,
140102089, 130108008, 60901037, 140101099, 60901026, 130102009,
50203016, 110113008, 50203032, 111201006, 130102014, 50203010,
70802012, 140103038, 70802012, 60901030, 60901029, 70710002,
120715033, 50203012, 110113007, 130104004, 140103036, 110113003,
70211014, 120715033, 60901026, 140103029, 120715037, 60901033,
50203019, 140102087, 130102008, 140103029, 50203017, 140103030,
50203020, 130102012, 110113006, 70111021, 111202009, 120715037,
111202007, 140101097, 50430001, 140102095, 110113008, 130102010,
50203027, 50203019, 71801003, 140102092, 60901034, 120715035,
120715029, 50430001, 70201047, 130106038, 70111023, 120715026,
50203031, 120715021, 120715037, 120715011, 50508026, 130102010,
110104024, 140103033), gen = c("abca1", "abca1", "rxrb", "s18",
"rxrb", "chuk", "abca1", "b2m", "rxrb", "chuk", "b2m", "gapd",
"s18", "chuk", "chuk", "rxrb", "rxrb", "gapd", "rxrb", "s18",
"rxrb", "gapd", "abca1", "abca1", "gapd", "b2m", "abca1", "s18",
"rxrb", "rxrb", "gapd", "chuk", "rxrb", "s18", "abca1", "s18",
"chuk", "abca1", "gapd", "gapd", "b2m", "gapd", "gapd", "abca1",
"abca1", "abca1", "abca1", "b2m", "chuk", "rxrb", "b2m", "gapd",
"chuk", "gapd", "s18", "gapd", "b2m", "chuk", "abca1", "chuk",
"abca1", "abca1", "s18", "gapd", "rxrb", "b2m", "s18", "s18",
"chuk", "s18", "b2m", "chuk", "s18", "chuk", "gapd", "gapd",
"s18", "chuk", "abca1", "b2m", "gapd", "chuk", "b2m", "b2m",
"chuk", "b2m", "abca1", "gapd", "chuk", "abca1", "gapd", "rxrb",
"s18", "b2m", "chuk", "gapd", "b2m", "chuk", "rxrb", "rxrb",
"rxrb", "s18", "gapd", "chuk", "b2m", "gapd", "gapd", "s18",
"rxrb", "rxrb", "s18", "s18", "s18", "gapd", "chuk", "abca1",
"gapd", "chuk", "chuk", "b2m", "chuk", "b2m", "b2m", "rxrb",
"abca1", "rxrb", "rxrb", "b2m", "s18", "s18", "b2m", "abca1",
"abca1", "rxrb", "chuk", "gapd", "s18", "s18", "gapd", "abca1",
"s18", "b2m", "b2m", "b2m", "abca1", "rxrb", "b2m", "abca1",
"b2m", "gapd"), dCt = c(8.348, 7.316, 5.148, -1.316, 5.304, 4.961,
6.475, -0.982, 4.995, 4.972, -2.819, 4.231, -1.062, 4.985, 5.382,
4.615, 5.095, 4.422, 5.448, -1.212, 4.683, 4.207, 4.19, 6.014,
4.024, -3.487, 5.179, -0.584, 4.842, 5.004, 4.192, 5.402, 4.963,
-1.022, 5.771, -1.845, 5.55, 5.751, 3.925, 3.654, -2.438, 4.594,
5.88, 5.651, 6.794, 5.77, 6.256, -2.607, 5.207, 6.018, -3.132,
4.215, 5.325, 4.799, -1.161, 4.235, -3.432, 5.846, 6.193, 6.125,
7.36, 5.853, -1.162, 7.406, 5.051, -2.891, -1.083, -1.565, 6.538,
-1.52, -2.979, 5.569, -1.313, 5.77, 3.998, 4.074, -1.081, 5.705,
6.678, -2.969, 4.358, 5.203, -3.159, -3.052, 5.55, -2.679, 4.936,
3.953, 5.964, 6.691, 4.29, 4.781, -1.419, -2.17, 4.853, 4.604,
-2.654, 5.374, 4.74, 4.899, 4.379, -0.464, 3.634, 5.786, -3.019,
4.037, 4.601, -1.544, 5.543, 5.19, -0.961, -0.982, -1.232, 3.96,
5.868, 6.332, 4.54, 6.743, 5.944, -2.981, 7.02, -3.826, -3.429,
5.648, NA, 4.158, 5.494, -3.097, -1.143, -1.079, -2.924, 5.503,
5.263, 5.905, 5.275, 3.374, -0.893, -1.799, 4.366, 6.434, -0.968,
-2.98, -3.123, -2.436, NA, 4.306, -3.239, 5.394, -2.828, 4.248
)), row.names = c(NA, -150L), class = "data.frame")


问:
Avoid recompositions of other elements when changing TextField value
I have basic Login screen in my app, which looks like this:

LoginScreen.kt:

```<code>@Composable
fun LoginScreen(navController: NavController, viewModel: LoginViewModel) {
    val userEmail = viewModel.userEmail.collectAsState()
    val userPassword = viewModel.userPassword.collectAsState()
    val isLoginPending = viewModel.isLoginPending.collectAsState()
    val isLoginButtonEnabled = viewModel.isLoginButtonEnabled.collectAsState()

    val scaffoldState = rememberScaffoldState()

    if (viewModel.getOnboardingStatus() == OnboardingStatus.NOT_COMPLETED) {
        navController.navigate(Screen.Onboarding.route)
    }

    LaunchedEffect(key1 = true) {
        viewModel.loginError.collectLatest {
            it?.let {
                scaffoldState.snackbarHostState.showSnackbar(message = it)
            }
        }
    }

    Scaffold(
        modifier = Modifier
            .fillMaxSize()
            .recomposeHighlighter(),
        scaffoldState = scaffoldState
    ) {
        Box(modifier = Modifier
            .fillMaxSize()
            .recomposeHighlighter()) {
            if (isLoginPending.value) {
                ProgressBar(
                    modifier = Modifier
                        .align(Alignment.Center)
                        .recomposeHighlighter(),
                )
            }
            Column(
                modifier = Modifier
                    .fillMaxWidth()
                    .align(Alignment.Center)
                    .recomposeHighlighter(),
                horizontalAlignment = Alignment.CenterHorizontally,
                verticalArrangement = Arrangement.Center
            ) {
                Text(
                    text = "Login",
                    fontWeight = FontWeight.Bold,
                    fontSize = 36.sp
                )
                Spacer(modifier = Modifier
                    .height(64.dp)
                    .recomposeHighlighter())
                UserInputTextField(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(start = 16.dp, end = 16.dp)
                        .recomposeHighlighter(),
                    label = "Email",
                    inputState = userEmail.value,
                    onValueChange = { viewModel.onEvent(LoginEvent.EnteredEmail(it)) },
                    isLoginPending = isLoginPending.value
                )
                Spacer(modifier = Modifier
                    .height(8.dp)
                    .recomposeHighlighter())
                UserInputTextField(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(start = 16.dp, end = 16.dp)
                        .recomposeHighlighter(),
                    label = "Password",
                    inputState = userPassword.value,
                    onValueChange = { viewModel.onEvent(LoginEvent.EnteredPassword(it)) },
                    isLoginPending = isLoginPending.value,
                    keyboard = KeyboardOptions(keyboardType = KeyboardType.Password),
                    visualTransformation = PasswordVisualTransformation()
                )
                Spacer(modifier = Modifier
                    .height(32.dp)
                    .recomposeHighlighter())
                Button(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(
                            start = 16.dp,
                            end = 16.dp
                        )
                        .recomposeHighlighter(),
                    enabled = isLoginButtonEnabled.value,
                    onClick = {
                        viewModel.onEvent(LoginEvent.Login)
                    }
                ) {
                    Text(text = "Login")
                }
            }
            ClickableButton(
                modifier = Modifier
                    .align(Alignment.BottomCenter)
                    .padding(bottom = 32.dp)
                    .recomposeHighlighter(),
                text = "No account? Click to register",
                onTextClicked = { navController.navigate(Screen.Register.route) }
            )
        }
    }
}

@Composable
private fun UserInputTextField(
    modifier: Modifier,
    label: String,
    inputState: String,
    onValueChange: (String) -> Unit,
    isLoginPending: Boolean,
    keyboard: KeyboardOptions? = null,
    visualTransformation: VisualTransformation? = null
) {
    OutlinedTextField(
        value = inputState,
        onValueChange = { onValueChange(it) },
        label = { Text(text = label) },
        placeholder = { Text(text = label) },
        singleLine = true,
        enabled = !isLoginPending,
        modifier = modifier,
        keyboardOptions = keyboard?.let { keyboard } ?: KeyboardOptions.Default,
        visualTransformation = visualTransformation?.let { visualTransformation } ?: VisualTransformation.None
    )
}
</code>```

And I am using it with view model to decide if login button should be enabled, to login user etc.
LoginViewModel:

```<code>@HiltViewModel
class LoginViewModel @Inject constructor(private val repository: LoginRepository): ViewModel() {

    private val _userEmail = MutableStateFlow<String>(value = String())
    val userEmail: StateFlow<String> = _userEmail.asStateFlow()

    private val _userPassword = MutableStateFlow<String>(value = String())
    val userPassword: StateFlow<String> = _userPassword.asStateFlow()

    private val _isLoginPending = MutableStateFlow<Boolean>(value = false)
    val isLoginPending: StateFlow<Boolean> = _isLoginPending.asStateFlow()

    private val _loginError = MutableSharedFlow<String?>()
    val loginError: SharedFlow<String?> = _loginError.asSharedFlow()

    private val _isLoginButtonEnabled = MutableStateFlow<Boolean>(value = false)
    val isLoginButtonEnabled: StateFlow<Boolean> = _isLoginButtonEnabled.asStateFlow()

    fun getOnboardingStatus(): OnboardingStatus {
        return repository.isOnboardingCompleted()
    }

    fun onEvent(event: LoginEvent) {
        when (event) {
            is LoginEvent.EnteredEmail -> {
                _userEmail.value = event.email
                _isLoginButtonEnabled.value = _userEmail.value.isNotEmpty() && _userPassword.value.isNotEmpty()
            }
            is LoginEvent.EnteredPassword -> {
                _userPassword.value = event.password
                _isLoginButtonEnabled.value = _userEmail.value.isNotEmpty() && _userPassword.value.isNotEmpty()
            }
            is LoginEvent.Login -> {
                viewModelScope.launch {
                    _isLoginPending.value = true
                    _isLoginButtonEnabled.value = false

                    val result = repository.loginUser(_userEmail.value, _userPassword.value)
                    when (result) {
                        is AuthRequestState.Success -> { /* nothing to do */ }
                        is AuthRequestState.Fail -> {
                            _loginError.emit(result.msg)
                        }
                    }

                    _isLoginPending.value = false
                    _isLoginButtonEnabled.value = true
                }
            }
        }
    }

}
</code>```

However the problem is that when I am typing something in TextFields in layout inspector I see that other elements of UI (like Button and ClickableButton) are recomposed:

How to avoid such behavior?

Body:
I have basic Login screen in my app, which looks like this:

LoginScreen.kt:

@Composable
fun LoginScreen(navController: NavController, viewModel: LoginViewModel) {
    val userEmail = viewModel.userEmail.collectAsState()
    val userPassword = viewModel.userPassword.collectAsState()
    val isLoginPending = viewModel.isLoginPending.collectAsState()
    val isLoginButtonEnabled = viewModel.isLoginButtonEnabled.collectAsState()

    val scaffoldState = rememberScaffoldState()

    if (viewModel.getOnboardingStatus() == OnboardingStatus.NOT_COMPLETED) {
        navController.navigate(Screen.Onboarding.route)
    }

    LaunchedEffect(key1 = true) {
        viewModel.loginError.collectLatest {
            it?.let {
                scaffoldState.snackbarHostState.showSnackbar(message = it)
            }
        }
    }

    Scaffold(
        modifier = Modifier
            .fillMaxSize()
            .recomposeHighlighter(),
        scaffoldState = scaffoldState
    ) {
        Box(modifier = Modifier
            .fillMaxSize()
            .recomposeHighlighter()) {
            if (isLoginPending.value) {
                ProgressBar(
                    modifier = Modifier
                        .align(Alignment.Center)
                        .recomposeHighlighter(),
                )
            }
            Column(
                modifier = Modifier
                    .fillMaxWidth()
                    .align(Alignment.Center)
                    .recomposeHighlighter(),
                horizontalAlignment = Alignment.CenterHorizontally,
                verticalArrangement = Arrangement.Center
            ) {
                Text(
                    text = "Login",
                    fontWeight = FontWeight.Bold,
                    fontSize = 36.sp
                )
                Spacer(modifier = Modifier
                    .height(64.dp)
                    .recomposeHighlighter())
                UserInputTextField(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(start = 16.dp, end = 16.dp)
                        .recomposeHighlighter(),
                    label = "Email",
                    inputState = userEmail.value,
                    onValueChange = { viewModel.onEvent(LoginEvent.EnteredEmail(it)) },
                    isLoginPending = isLoginPending.value
                )
                Spacer(modifier = Modifier
                    .height(8.dp)
                    .recomposeHighlighter())
                UserInputTextField(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(start = 16.dp, end = 16.dp)
                        .recomposeHighlighter(),
                    label = "Password",
                    inputState = userPassword.value,
                    onValueChange = { viewModel.onEvent(LoginEvent.EnteredPassword(it)) },
                    isLoginPending = isLoginPending.value,
                    keyboard = KeyboardOptions(keyboardType = KeyboardType.Password),
                    visualTransformation = PasswordVisualTransformation()
                )
                Spacer(modifier = Modifier
                    .height(32.dp)
                    .recomposeHighlighter())
                Button(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(
                            start = 16.dp,
                            end = 16.dp
                        )
                        .recomposeHighlighter(),
                    enabled = isLoginButtonEnabled.value,
                    onClick = {
                        viewModel.onEvent(LoginEvent.Login)
                    }
                ) {
                    Text(text = "Login")
                }
            }
            ClickableButton(
                modifier = Modifier
                    .align(Alignment.BottomCenter)
                    .padding(bottom = 32.dp)
                    .recomposeHighlighter(),
                text = "No account? Click to register",
                onTextClicked = { navController.navigate(Screen.Register.route) }
            )
        }
    }
}

@Composable
private fun UserInputTextField(
    modifier: Modifier,
    label: String,
    inputState: String,
    onValueChange: (String) -> Unit,
    isLoginPending: Boolean,
    keyboard: KeyboardOptions? = null,
    visualTransformation: VisualTransformation? = null
) {
    OutlinedTextField(
        value = inputState,
        onValueChange = { onValueChange(it) },
        label = { Text(text = label) },
        placeholder = { Text(text = label) },
        singleLine = true,
        enabled = !isLoginPending,
        modifier = modifier,
        keyboardOptions = keyboard?.let { keyboard } ?: KeyboardOptions.Default,
        visualTransformation = visualTransformation?.let { visualTransformation } ?: VisualTransformation.None
    )
}

And I am using it with view model to decide if login button should be enabled, to login user etc.
LoginViewModel:

@HiltViewModel
class LoginViewModel @Inject constructor(private val repository: LoginRepository): ViewModel() {

    private val _userEmail = MutableStateFlow<String>(value = String())
    val userEmail: StateFlow<String> = _userEmail.asStateFlow()

    private val _userPassword = MutableStateFlow<String>(value = String())
    val userPassword: StateFlow<String> = _userPassword.asStateFlow()

    private val _isLoginPending = MutableStateFlow<Boolean>(value = false)
    val isLoginPending: StateFlow<Boolean> = _isLoginPending.asStateFlow()

    private val _loginError = MutableSharedFlow<String?>()
    val loginError: SharedFlow<String?> = _loginError.asSharedFlow()

    private val _isLoginButtonEnabled = MutableStateFlow<Boolean>(value = false)
    val isLoginButtonEnabled: StateFlow<Boolean> = _isLoginButtonEnabled.asStateFlow()

    fun getOnboardingStatus(): OnboardingStatus {
        return repository.isOnboardingCompleted()
    }

    fun onEvent(event: LoginEvent) {
        when (event) {
            is LoginEvent.EnteredEmail -> {
                _userEmail.value = event.email
                _isLoginButtonEnabled.value = _userEmail.value.isNotEmpty() && _userPassword.value.isNotEmpty()
            }
            is LoginEvent.EnteredPassword -> {
                _userPassword.value = event.password
                _isLoginButtonEnabled.value = _userEmail.value.isNotEmpty() && _userPassword.value.isNotEmpty()
            }
            is LoginEvent.Login -> {
                viewModelScope.launch {
                    _isLoginPending.value = true
                    _isLoginButtonEnabled.value = false

                    val result = repository.loginUser(_userEmail.value, _userPassword.value)
                    when (result) {
                        is AuthRequestState.Success -> { /* nothing to do */ }
                        is AuthRequestState.Fail -> {
                            _loginError.emit(result.msg)
                        }
                    }

                    _isLoginPending.value = false
                    _isLoginButtonEnabled.value = true
                }
            }
        }
    }

}

However the problem is that when I am typing something in TextFields in layout inspector I see that other elements of UI (like Button and ClickableButton) are recomposed:

How to avoid such behavior?