问:
How can I click on the 'Toggle device toolbar' for automation testing using visual studio code with selenium using JS
I have to click 'Toggle device toolbar' and 'Refresh' the page after that in visual studio code, for my mobile web automation, can someone help me out, how can o click these two while automating

I try finding it online but didn't get it


来源: stackexchange

问:
Azure Synapse Analytics - Can a Spark Job Activity return values?
EDIT: I have raised the same question on Microsoft Learn Q&A, and there they told me there is no solution as far as December 2022. They opened an internal ticket to solve this directly. My present solution is to write the outputs in the Lake database, and then query it afterwards in the pipeline.

I am working on Azure Synapse Analytics and I have a pipeline in which there is a Spark Job Activity for a Python script. I managed to get input parameters inside the Spark Job by using the sys package (sys.argv) inside the Python script.

I wonder if there is a similar method to return output values from the Spark Job Activity inside the pipeline.

Thank you, Dario

I tried sys.exit(), but if  is not the integer 0, then the Spark Job Activity terminates with an error, and it is not what I want.

ContentLicense: CC BY-SA 4.0


问:
Adding custom 'Attribute Type' to Layer
I would like to add a custom 'attribute-type' to a column, when i am creating a new layer (by SQL view).

Document says:

Change the type of the attribute using the Type column. The most common types are available in a drop-down on editing, but it’s possible to indicate any valid Java class, as long as GeoServer has a converter that goes from the value produced by the Source expression to the target type (new converters can be plugged in with some Java programming).

So I can not add custom datatype without write a Java converter? Somebody has a kind of converter?

Example:

Title: Adding custom 'Attribute Type' to Layer


问:
Is it possible to ALT+LMB, but opening it in n-th tab?
VSCode allows for opening the source file of a reference (class, method etc) on mouse hover (ALT + left click):

But when working with multiple sections (split screen), the file always opens in the same "section" (in the picture below, ALT+click in section 1 will always open the file in section 1):

Instead, I would be very happy to quickly open the file in my selected section 1, 2, or 3 (or quickly move it there - not with a mouse - immediately after opening). I tried combinations like ALT+num+click, or SHIFT+arrL / SHIFT+arrR (for moving) but haven't found anything that helps. Is there some magic trick I'm missing? Any other suggestions much appreciated.


问:
Affirm learn more link affects SEO lighthouse metric
I'm using affrim service and have a when affirm script loads an additional HTML markup for opening a modal window. And thise "additional code" affects SEO metric in my lighthouse analytic, "Links are not crawlable" and I don't have a direct control of the markup.

```<code>   <p
    className="affirm-as-low-as"
    data-page-type="category"
    data-amount={summary.totalDue.toString().replace(/[^0-9]/g, '')}
   ></p>
</code>```

and affirm then adds additional markup:

```<code><p
 class="affirm-as-low-as"
 data-page-type="category"
 data-amount="64799">
  Starting at
  <span class="affirm-ala-price">
   $59
  </span>/mo with
  <span
   class="__affirm-logo __affirm-logo-blue __ligature__affirm_full_logo__ __processed">
     Affirm
  </span>.
  <a
   class="affirm-modal-trigger"
   aria-label="Learn more about Affirm Financing (opens in modal)"
   href="javascript:void(0)"
  >
   Learn more
  </a>
</p>
</code>```

Is there a posibility to turn off a link from crawling by lighthouse from the parent element ? Or smth like that.

Body:
I'm using affrim service and have a when affirm script loads an additional HTML markup for opening a modal window. And thise "additional code" affects SEO metric in my lighthouse analytic, "Links are not crawlable" and I don't have a direct control of the markup.

and affirm then adds additional markup:

  Starting at

   $59
  /mo with

     Affirm
  .

   Learn more

Is there a posibility to turn off a link from crawling by lighthouse from the parent element ? Or smth like that.


问:
Why is my Big Query Dataset connected to a G Sheet throwing an error when I'm trying to auto refresh it through an AppScript code?
I am trying to trigger another function after 2 of Big Query tables are refreshed hence I trying to refresh all my connected datasets in a google sheet by using an app script code. Both of my tables come from different datasets but the permission of both the datasets is the same on Big Query. When I'm running the code, only one set is being refreshed while the other is throwing an "You do not have access to the connected BigQuery table" error where I'm the owner of the table itself. While I try to refresh all the sheets manually using refresh all button all sheets are refreshing rightly.
I'm new to BigQuery so please help me out how I can fix the same.

The following code is what I'm using but it seems to be working fine only for one table not for the another.
`

```<code>function BigQueryRefresh() {
  var sheet = SpreadsheetApp.getActive();
  SpreadsheetApp.enableAllDataSourcesExecution();
  sheet.refreshAllDataSources();

    ScriptApp.newTrigger("myFunction")
                .timeBased()
                .after(60*1000)  // Time is sec * conversion
                .create();
}
</code>```

`
This is the error which I'm getting even though I'm the owner of the table:

You do not have access to the connected BigQuery table. The required permission is: "bigquery.tables.getData". Learn how to fix permission issues

Contact the table's owner or your admin to request access.

To view this query, visit BigQuery. If you do not have access, then relay the following Job ID to someone who has access: {Job ID}

Body:
I am trying to trigger another function after 2 of Big Query tables are refreshed hence I trying to refresh all my connected datasets in a google sheet by using an app script code. Both of my tables come from different datasets but the permission of both the datasets is the same on Big Query. When I'm running the code, only one set is being refreshed while the other is throwing an "You do not have access to the connected BigQuery table" error where I'm the owner of the table itself. While I try to refresh all the sheets manually using refresh all button all sheets are refreshing rightly.
I'm new to BigQuery so please help me out how I can fix the same.

The following code is what I'm using but it seems to be working fine only for one table not for the another.
`

function BigQueryRefresh() {
  var sheet = SpreadsheetApp.getActive();
  SpreadsheetApp.enableAllDataSourcesExecution();
  sheet.refreshAllDataSources();

    ScriptApp.newTrigger("myFunction")
                .timeBased()
                .after(60*1000)  // Time is sec * conversion
                .create();
}

`
This is the error which I'm getting even though I'm the owner of the table:

You do not have access to the connected BigQuery table. The required permission is: "bigquery.tables.getData". Learn how to fix permission issues

Contact the table's owner or your admin to request access.

To view this query, visit BigQuery. If you do not have access, then relay the following Job ID to someone who has access: {Job ID}


问:
How to use the fs module in Electron?
I am trying to use the fs module in my Electron app to copy and edit files, however it does not work in any way.

I have a schedule.js file where I want to have methods to copy files.

I tried adding const fs = require('fs'); and using fs.copyFile() in my code, ended up telling me Uncaught ReferenceError: require is not defined at schedule.js:2:12.

I found the solution of doing import { copyFile } from "fs"; (or "original-fs"), it told me Uncaught TypeError: Failed to resolve module specifier "fs". Relative references must start with either "/", "./", or "../"..

I tried importing it to Electron's index.js (where imports seem to go fine) and then exporting it to schedule.js, it did not work.
I tried changing package.json to "type" : "module", it did not work.
I tried changing package.json to "type" : "commonjs", it did not work.

schedule.js

```<code>// const fs = require("fs");
import { copyFile } from "fs";

function fsCopyFile(source, destination) {
    copyFile(source, destination, (err) => {
      if (err) throw err;
      console.log(source+' was copied to '+destination);
  });
  }
</code>```

index.js

```<code>const createWindow = () => {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      // devTools: false
      nodeIntegration: true
    },
    frame: false,
    titleBarStyle: 'hiddenInset'
  });
  // and load the index.html of the app.
  mainWindow.loadFile(path.join(__dirname, 'index.html'));
};
</code>```

Thanks in advance for those of you who can help me, I have been working on it for 2 days.

Title: How to use the fs module in Electron?

Body:
I am trying to use the fs module in my Electron app to copy and edit files, however it does not work in any way.

I have a schedule.js file where I want to have methods to copy files.

I tried adding const fs = require('fs'); and using fs.copyFile() in my code, ended up telling me Uncaught ReferenceError: require is not defined at schedule.js:2:12.

I found the solution of doing import { copyFile } from "fs"; (or "original-fs"), it told me Uncaught TypeError: Failed to resolve module specifier "fs". Relative references must start with either "/", "./", or "../"..

I tried importing it to Electron's index.js (where imports seem to go fine) and then exporting it to schedule.js, it did not work.
I tried changing package.json to "type" : "module", it did not work.
I tried changing package.json to "type" : "commonjs", it did not work.

schedule.js

// const fs = require("fs");
import { copyFile } from "fs";

function fsCopyFile(source, destination) {
    copyFile(source, destination, (err) => {
      if (err) throw err;
      console.log(source+' was copied to '+destination);
  });
  }

index.js

const createWindow = () => {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      // devTools: false
      nodeIntegration: true
    },
    frame: false,
    titleBarStyle: 'hiddenInset'
  });
  // and load the index.html of the app.
  mainWindow.loadFile(path.join(__dirname, 'index.html'));
};

Thanks in advance for those of you who can help me, I have been working on it for 2 days.


问:
MvvmCross Button methodbinding inside an itemscontrol (with parameter) not working
I am new to WPF and using Mvvm frameworks. I am currently using MvvmCross.
What I am trying to do is the following:
I have a list of objects which have properties. I want to show these objects in an itemscontrol with some properties showing in the UI. (this works)
However I also want to add a button to each object showing in the itemscontrol to delete that entry of the list showing in the itemscontrol with a parameter of object.Id

I am loading the methodbinding plug as well.

As you can see in the view I have a button outside of the Itemscontrol component and this command binding works. When I click that button the first element in my list gets deleted.

However I would like the buttons added for each Invoice in Itemscontrol to fire RemoveInvoice method with the Invoice.Id as parameter to delete that exact Invoice from the list.

My Model

```<code>namespace MvvmCrossTutorial.Core.Models;

public class Invoice
{
    public int Id { get; set; }
    public string? Number { get; set; }
    public double Amount { get; set; }
    public string? Description { get; set; }

    public Invoice(int id, string? number, double amount, string? description)
    {
        Id = id;
        Number = number;
        Amount = amount;
        Description = description;
    }
}
</code>```

My ViewModel

```<code>using MvvmCross.Commands;
using MvvmCross.ViewModels;
using MvvmCrossTutorial.Core.Models;
using System.Collections.ObjectModel;

namespace MvvmCrossTutorial.Core.ViewModels;

public class InvoiceViewModel : MvxViewModel
{
    private ObservableCollection<Invoice> _invoices = new ObservableCollection<Invoice>();

    public InvoiceViewModel()
    {
        _invoices.Add(new Invoice(1, "INV123", 122.3, "Invoice 123 description"));
        _invoices.Add(new Invoice(2, "INV456", 50.62, "Invoice 456 description"));
        _invoices.Add(new Invoice(3, "INV789", 78.83, "Invoice 789 description"));

        RemoveInvoiceCommand = new MvxCommand(RemoveInvoice);
    }

    public MvxCommand RemoveInvoiceCommand { get; set; }

    public ObservableCollection<Invoice> Invoices
    {
        get { return _invoices; }
        set
        {
            SetProperty(ref _invoices, value);
        }
    }

    //public void RemoveFactuur(int id)
    //{
    //    Facturen.Remove(_facturen.Where(f => f.Id == id).First());
    //}

    public void RemoveInvoice()
    {
        if(Invoices.Count > 0)
            Invoices.Remove(Invoices[0]);
    }
}
</code>```

My View

```<code><views:MvxWpfView x:Class="MvvmCrossTutorial.WPF.Views.InvoiceView"
             xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
             xmlns:mvx="clr-namespace:MvvmCross.Platforms.Wpf.Binding;assembly=MvvmCross.Platforms.Wpf"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:MvvmCrossTutorial.WPF.Views"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="20" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="20" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" Text="Facturen" FontSize="42" />

        <Button Grid.Column="1" Grid.Row="2" mvx:Bi.nd="Command RemoveInvoiceCommand" Margin="0,0,20,0">Delete</Button>

        <ItemsControl ItemsSource="{Binding Invoices}" Grid.Column="2" Grid.Row="2">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Black" BorderThickness="1" Margin="10" Padding="10" CornerRadius="5">
                        <StackPanel Orientation="Horizontal" >
                            <Button mvx:Bi.nd="Command RemoveInvoiceCommand"
                                    Margin="0,0,20,0">Delete</Button>
                            <TextBlock Margin="0,0,20,0" Text="{Binding Number}" />
                            <TextBlock Margin="0,0,20,0" Text="{Binding Amount}" />
                            <TextBlock Text="{Binding Description}" />
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</views:MvxWpfView>

</code>```

My Setup class

```<code>using Microsoft.Extensions.Logging;
using MvvmCross.Platforms.Wpf.Core;
using MvvmCross.Plugin;
using Serilog;
using Serilog.Extensions.Logging;

namespace MvvmCrossTutorial.WPF;

class Setup : MvxWpfSetup<Core.App>
{
    protected override ILoggerFactory? CreateLogFactory()
    {
        Log.Logger = new LoggerConfiguration()
            .MinimumLevel.Debug()
            .WriteTo.Trace()
            .CreateLogger();

        return new SerilogLoggerFactory();
    }

    protected override ILoggerProvider? CreateLogProvider()
    {
        return new SerilogLoggerProvider();
    }

    public override void LoadPlugins(IMvxPluginManager pluginManager)
    {
        pluginManager.EnsurePluginLoaded<MvvmCross.Plugin.MethodBinding.Plugin>(true);
    }
}

</code>```

I have tried numerous things with DataContext and RelativeSource as well as mvx:Bi.nd as well as standard Button Command property none seem to work

Body:
I am new to WPF and using Mvvm frameworks. I am currently using MvvmCross.
What I am trying to do is the following:
I have a list of objects which have properties. I want to show these objects in an itemscontrol with some properties showing in the UI. (this works)
However I also want to add a button to each object showing in the itemscontrol to delete that entry of the list showing in the itemscontrol with a parameter of object.Id

I am loading the methodbinding plug as well.

As you can see in the view I have a button outside of the Itemscontrol component and this command binding works. When I click that button the first element in my list gets deleted.

However I would like the buttons added for each Invoice in Itemscontrol to fire RemoveInvoice method with the Invoice.Id as parameter to delete that exact Invoice from the list.

My Model

namespace MvvmCrossTutorial.Core.Models;

public class Invoice
{
    public int Id { get; set; }
    public string? Number { get; set; }
    public double Amount { get; set; }
    public string? Description { get; set; }

    public Invoice(int id, string? number, double amount, string? description)
    {
        Id = id;
        Number = number;
        Amount = amount;
        Description = description;
    }
}

My ViewModel

using MvvmCross.Commands;
using MvvmCross.ViewModels;
using MvvmCrossTutorial.Core.Models;
using System.Collections.ObjectModel;

namespace MvvmCrossTutorial.Core.ViewModels;

public class InvoiceViewModel : MvxViewModel
{
    private ObservableCollection<Invoice> _invoices = new ObservableCollection<Invoice>();

    public InvoiceViewModel()
    {
        _invoices.Add(new Invoice(1, "INV123", 122.3, "Invoice 123 description"));
        _invoices.Add(new Invoice(2, "INV456", 50.62, "Invoice 456 description"));
        _invoices.Add(new Invoice(3, "INV789", 78.83, "Invoice 789 description"));

        RemoveInvoiceCommand = new MvxCommand(RemoveInvoice);
    }

    public MvxCommand RemoveInvoiceCommand { get; set; }

    public ObservableCollection<Invoice> Invoices
    {
        get { return _invoices; }
        set
        {
            SetProperty(ref _invoices, value);
        }
    }

    //public void RemoveFactuur(int id)
    //{
    //    Facturen.Remove(_facturen.Where(f => f.Id == id).First());
    //}

    public void RemoveInvoice()
    {
        if(Invoices.Count > 0)
            Invoices.Remove(Invoices[0]);
    }
}

My View

<views:MvxWpfView x:Class="MvvmCrossTutorial.WPF.Views.InvoiceView"
             xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
             xmlns:mvx="clr-namespace:MvvmCross.Platforms.Wpf.Binding;assembly=MvvmCross.Platforms.Wpf"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:MvvmCrossTutorial.WPF.Views"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="20" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="20" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" Text="Facturen" FontSize="42" />

        <Button Grid.Column="1" Grid.Row="2" mvx:Bi.nd="Command RemoveInvoiceCommand" Margin="0,0,20,0">Delete</Button>

        <ItemsControl ItemsSource="{Binding Invoices}" Grid.Column="2" Grid.Row="2">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Black" BorderThickness="1" Margin="10" Padding="10" CornerRadius="5">
                        <StackPanel Orientation="Horizontal" >
                            <Button mvx:Bi.nd="Command RemoveInvoiceCommand"
                                    Margin="0,0,20,0">Delete</Button>
                            <TextBlock Margin="0,0,20,0" Text="{Binding Number}" />
                            <TextBlock Margin="0,0,20,0" Text="{Binding Amount}" />
                            <TextBlock Text="{Binding Description}" />
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</views:MvxWpfView>

My Setup class

using Microsoft.Extensions.Logging;
using MvvmCross.Platforms.Wpf.Core;
using MvvmCross.Plugin;
using Serilog;
using Serilog.Extensions.Logging;

namespace MvvmCrossTutorial.WPF;

class Setup : MvxWpfSetup<Core.App>
{
    protected override ILoggerFactory? CreateLogFactory()
    {
        Log.Logger = new LoggerConfiguration()
            .MinimumLevel.Debug()
            .WriteTo.Trace()
            .CreateLogger();

        return new SerilogLoggerFactory();
    }

    protected override ILoggerProvider? CreateLogProvider()
    {
        return new SerilogLoggerProvider();
    }

    public override void LoadPlugins(IMvxPluginManager pluginManager)
    {
        pluginManager.EnsurePluginLoaded<MvvmCross.Plugin.MethodBinding.Plugin>(true);
    }
}

I have tried numerous things with DataContext and RelativeSource as well as mvx:Bi.nd as well as standard Button Command property none seem to work


问:
How to prerender CSS and images on nextjs?
By using nextjs am getting the content as prerender, but I am not getting the images and CSS applied on the response. My images are in the public folder.
But other sites have responses with images and CSS. How to achieve that?


问:
How to handle custom Role Base Permissions with AWS Cognito
In AWS Cognito, We can manage Role Base Permissions for AWS services(S3 Bucket,EC2) with creating GROUPS. But How to mange my own permission and Roles related to application for users using Cognito User pool.

e.g.;

Role =  MANAGER

permissions = create-new-employee, update-employee

Is there is a solution for that in AWS Cognito User Pool?

Note: I want to mange my Front-End components which developed using ReactJs and Backend which developed using GraphQL + Spring boot according to permissions

I try to find any solution. But not found yet.


问:
How can I have a dataframe as output with Subprocess?
I am using subprocess in order to run an R script within my Python code. The R script produces a dataframe, however the output shown after subprocess is terminal text plus the dataframe result in a string format. I need to transform the R output into a pandas df.

R code:

```<code>Name <- c("Jon", "Bill", "Maria", "Ben", "Tina")
Age <- c(23, 41, 32, 58, 26)
df <- data.frame(Name, Age)
df
</code>```

Python code:

```<code>process = subprocess.Popen(["Rscript", "R_sample.R"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
result = process.communicate()
</code>```

But this outputs the following:

('   Name Age\n1   Jon  23\n2  Bill  41\n3 Maria  32\n4   Ben  58\n5
Tina  26\n',  'During startup - Warning messages:\n1: Setting
LC_COLLATE failed, using "C" \n2: Setting LC_TIME failed, using "C"
\n3: Setting LC_MESSAGES failed, using "C" \n4: Setting LC_MONETARY
failed, using "C" \n')

How can I convert this output into a pandas df?

Body:
I am using subprocess in order to run an R script within my Python code. The R script produces a dataframe, however the output shown after subprocess is terminal text plus the dataframe result in a string format. I need to transform the R output into a pandas df.

R code:

Name <- c("Jon", "Bill", "Maria", "Ben", "Tina")
Age <- c(23, 41, 32, 58, 26)
df <- data.frame(Name, Age)
df

Python code:

process = subprocess.Popen(["Rscript", "R_sample.R"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
result = process.communicate()

But this outputs the following:

('   Name Age\n1   Jon  23\n2  Bill  41\n3 Maria  32\n4   Ben  58\n5
Tina  26\n',  'During startup - Warning messages:\n1: Setting
LC_COLLATE failed, using "C" \n2: Setting LC_TIME failed, using "C"
\n3: Setting LC_MESSAGES failed, using "C" \n4: Setting LC_MONETARY
failed, using "C" \n')

How can I convert this output into a pandas df?


问:
How to handle HTTP STATUS CODE 429 (Rate limiting) for a particular domain in Scrapy?
I am using Scrapy to build a broad crawler which will crawl a few thousand pages from 50-60 different domains.

I have encountered 429 status code sometimes. I am thinking of ways of dealing with it. I am trying to set polite policies regarding Concurrent requests per domain and autothrottle settings. This is a worst-case situation.

By default, Scrapy drops the request.

If we add 429 to RETRY_HTTP_CODES, Scrapy will use the default retry middleware which will schedule the request at the end of the queue. This will still allow other requests to the same domain to ping the server - Does this prolong the temporary block in place due to rate limiting? If not, why not use this approach only instead of trying other complex solutions as described below?

Another approach is to block the spider when it encounters a 429. However, one of the comments mentions that this will lead to a timeout in other active requests. Also, this would block requests to all the domains (which is an inefficient way as requests to other domains should continue normally). Does it make sense to temporarily reschedule requests to a particular domain instead of pinging the server continuously with other requests to the same domain? If yes, how to implement it in Scapy?

Does this solve the issue?

When Rate Limiting is already triggered - does sending more requests (which will receive a 429 response) prolong the time period for which rate limiting is applied? Or will it have no effect on rate limiting's time period?

How to pause scrapy to send requests to a particular domain, while continuing its other tasks (including requests to other domains)?

EDIT:
The default Retry Middleware cannot be used as it has a max retry counter - RETRY_TIMES. After this has expired for a particular request, that request is dropped - something that we don't want in the case of a 429.


问:
How can i tell work apt changelog for my deb package?
When I added changelog file to my deb package, built it and installed. I tryed to use apt changelog, but error has occured E: Failed to fetch changelog:/simple-application.changelog  Changelog unavailable for simple-application=1.0.0-1. Then i used apt changelog git for example and saw that apt downloaded changelog from repository. My deb package installed from my local repository via dpkg-scanpackages and my link file in /etc/apt/sources.list.d.
changelog file i added in DEBIAN/ folder and changelog.Debian.gz in usr/share/doc/simple-application/ in my package. It hasn't helped(((

How can i reach the same effect in case apt changelog git and see my changelog file content?


问:
is the possible for nested level preloading in GORM GOLANG?
Example

```<code>db.Preload("Orders.Orders.Orders").Preload(clause.Associations).Find(&users)
</code>```

So can i put dynamically Nth level preloading in golang?

Actually what I want

If I write only Orders in preaload so I want to get n level preloading data

```<code>db.Preload("Orders").Preload(clause.Associations).Find(&users)
</code>```

For an example we can take post has many comment and comment has many comments

```<code>db.Preload("comments.comments.comments").Preload(clause.Associations).Find(&users)
</code>```

So instead of multiple time write comments.comments.comments
is the possible can I write with single comment ?

SO I WANT DYNAMICALLY NESTED PRELOADING IN GOLANG
THANK YOU IN ADVANCE

Body:
Example

db.Preload("Orders.Orders.Orders").Preload(clause.Associations).Find(&users)

So can i put dynamically Nth level preloading in golang?

Actually what I want

If I write only Orders in preaload so I want to get n level preloading data

db.Preload("Orders").Preload(clause.Associations).Find(&users)

For an example we can take post has many comment and comment has many comments

db.Preload("comments.comments.comments").Preload(clause.Associations).Find(&users)

So instead of multiple time write comments.comments.comments
is the possible can I write with single comment ?

SO I WANT DYNAMICALLY NESTED PRELOADING IN GOLANG
THANK YOU IN ADVANCE


问:
Mean Squared Error calculation instead of Gini
I have an information criterion with help of Gini. How can I change my code for Mean Squared Error instead of Gini? Python, the random forest task.</p>
```<code>def gini(labels):
    #  to count the number of objects for different classes
    classes = {}
    for label in labels:
        if label not in classes:
            classes[label] = 0
        classes[label] += 1

    #  to calculate Gini criterion
    impurity = 1
    for label in classes:
        p = classes[label] / len(labels)
        impurity -= p ** 2
    return impurity
</code>```

Body:
I have an information criterion with help of Gini. How can I change my code for Mean Squared Error instead of Gini? Python, the random forest task.

def gini(labels):
    #  to count the number of objects for different classes
    classes = {}
    for label in labels:
        if label not in classes:
            classes[label] = 0
        classes[label] += 1

    #  to calculate Gini criterion
    impurity = 1
    for label in classes:
        p = classes[label] / len(labels)
        impurity -= p ** 2
    return impurity


问:
Message: stale element reference: element is not attached to the page document python selenium
I'm trying to parse a site and collect data from it. Everything works until the moment when he collects ngr_2. I looked that the DOM is changing and it cannot find the element, and the proposed solutions do not help

`

```<code>sort = driver.find_element(By.XPATH, '/html/body/ul/li[3]/a')
sort.click()
time.sleep(10)

listt = driver.find_element(By.XPATH, '//*[@id="resultViewSelectorOuter"]/a[1]')
listt.click()
time.sleep(10)

first = driver.find_element(By.XPATH, '//*[@id="result_8B3EF4B7-C77F-49E9-9C87-125CC83DDFD4"]/div/a')
first.click()
time.sleep(10)

ngr = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[2]/div/ul[1]/li/div/div/div[1]/div[1]/a')

ngr_1 = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[2]/div/ul[1]/li/div/div/div[1]/div[2]/div/div/span')

button = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[1]/div/span[3]/button')
button.click()
time.sleep(10)

df = pd.DataFrame({
  ngr.text:         [],
})

for j in range(2):

  ngr_1 = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[2]/div/ul[1]/li/div/div/div[1]/div[2]/div/div/span')

  df = df.append({ngr.text: ngr_1.text
                   })
  page = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[1]/div/span[3]/button')
  page.click()
  time.sleep(10)
</code>```

`
It turns out that I follow the links and open the page I need. I save the name in the ngr variable and one more field in ngr_1. I create an empty dataframe to write data there and the idea is that after a loop, I will take the value and throw it into the dataframe, but after going to the second page, the code gives an error
help me please

I tried to do it through StaleElementReferenceException, but it doesn't work for me

Body:
I'm trying to parse a site and collect data from it. Everything works until the moment when he collects ngr_2. I looked that the DOM is changing and it cannot find the element, and the proposed solutions do not help

`

sort = driver.find_element(By.XPATH, '/html/body/ul/li[3]/a')
sort.click()
time.sleep(10)

listt = driver.find_element(By.XPATH, '//*[@id="resultViewSelectorOuter"]/a[1]')
listt.click()
time.sleep(10)

first = driver.find_element(By.XPATH, '//*[@id="result_8B3EF4B7-C77F-49E9-9C87-125CC83DDFD4"]/div/a')
first.click()
time.sleep(10)

ngr = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[2]/div/ul[1]/li/div/div/div[1]/div[1]/a')

ngr_1 = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[2]/div/ul[1]/li/div/div/div[1]/div[2]/div/div/span')

button = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[1]/div/span[3]/button')
button.click()
time.sleep(10)

df = pd.DataFrame({
  ngr.text:         [],
})

for j in range(2):

  ngr_1 = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[2]/div/ul[1]/li/div/div/div[1]/div[2]/div/div/span')

  df = df.append({ngr.text: ngr_1.text
                   })
  page = driver.find_element(By.XPATH, '//*[@id="cardContainer"]/div[1]/div/span[3]/button')
  page.click()
  time.sleep(10)

`
It turns out that I follow the links and open the page I need. I save the name in the ngr variable and one more field in ngr_1. I create an empty dataframe to write data there and the idea is that after a loop, I will take the value and throw it into the dataframe, but after going to the second page, the code gives an error
help me please

I tried to do it through StaleElementReferenceException, but it doesn't work for me


问:
ForwardedHeaderFilter is not being added by Spring boot
Having added server.forward-headers-strategy=FRAMEWORK to my property file, I was expecting to see a ForwardedHeaderFilter configured by spring boot, but when the app starts it prints the list of all filters configured ("Will secure any request with"), and ForwardedHeaderFilter is not part of that list. Why??


问:
Show/Hide filter parameters based on condition with SSRS (.rdl) reports
I am trying to hide the SSRS (.rdl) report parameter based on some condition.

Example:
Parameter-1
Forecast Type :
Value-1 :Monthly
Value-2 :Yearly
Parameter-2
Fiscal year

so  if the user select Forecast Type = Monthly then the fiscal year parameter should show otherwise it should hide


问:
typeorm RAW is not covered in jest
Unit testing using jest is done in the code. But Raw of typeorm is not covered

```<code>queryobj.where.name = Raw(
         () =>
           `( "Tag__templateTag__template"."state" = '${TemplateState.Published}')`,
       )
</code>```

Raw is tried mock using jest.fn()
but

```<code> () =>
            `( "Tag__templateTag__template"."state" = '${TemplateState.Published}')`,
        )
</code>```

is not covered

Title: typeorm RAW is not covered in jest

Body:
Unit testing using jest is done in the code. But Raw of typeorm is not covered

queryobj.where.name = Raw(
         () =>
           `( "Tag__templateTag__template"."state" = '${TemplateState.Published}')`,
       )

Raw is tried mock using jest.fn()
but

 () =>
            `( "Tag__templateTag__template"."state" = '${TemplateState.Published}')`,
        )

is not covered


问:
issue in renaming the folder in sharepoint
```<code>from office365.sharepoint.client_context import ClientContext
from tests import test_user_credentials, test_team_site_url

ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)

file_url = "/sites"/Campany Controlled Documents/LTE-BusProc(OBs)/09 - ALU Supporting Processes""

ctx.web.get_folder_by_server_relative_url(file_url).rename("ALU Supporting Processes").execute_query()
</code>```

I am getting this error
(None, None, "400 Client Error: Bad Request for url: https://company.sharepoint.com/sites/lte-a/_api/Web/getFolderByServerRelativePath(DecodedUrl='%22Company%20Controlled%20Documents%2FLTE-BusProc(OBs)%2F09%20-%20ALU%20Supporting%20Processes%22%0A')/ListItemAllFields")

I do not know what is wrong in this code

Body:
from office365.sharepoint.client_context import ClientContext
from tests import test_user_credentials, test_team_site_url

ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)

file_url = "/sites"/Campany Controlled Documents/LTE-BusProc(OBs)/09 - ALU Supporting Processes""

ctx.web.get_folder_by_server_relative_url(file_url).rename("ALU Supporting Processes").execute_query()

I am getting this error
(None, None, "400 Client Error: Bad Request for url: https://company.sharepoint.com/sites/lte-a/_api/Web/getFolderByServerRelativePath(DecodedUrl='%22Company%20Controlled%20Documents%2FLTE-BusProc(OBs)%2F09%20-%20ALU%20Supporting%20Processes%22%0A')/ListItemAllFields")

I do not know what is wrong in this code


问:
VBA to copy formula across variable rows and columns
I'm entering a value in the last blank cell (as I can't do the last row in a column) due to other data being there. I was to add the sum of all the above cells to each column.
The number of columns is variable as is the number of names

I've been able to add the relevant formula but I can't get it to copy across in the same way my other code did.
This is the line with the error, to copy to the last used column, everything else works except this bit.

```<code>Range("O" & nextfree).AutoFill Range("O" & nextfree, Cells("O" & nextfree, lastcolumn))
</code>```

I get a run type error 13, Type mis-match.

The full code is here

```<code>Sub addrow()

'Checks the number of users then adds them to the active sheet section

Dim rowsToAdd As Integer
Dim lastcolumn As Long
Dim lastRow As Long
Dim ws As Worksheet, ws1 As Worksheet
Set ws = ThisWorkbook.Worksheets("Refs")
Set w1 = ThisWorkbook.Worksheets("Active events")

    With ws
    lastRow = Sheets("Refs").Cells(.Rows.Count, "A").End(xlUp).Row
    lastcolumn = Sheets("Active events").Cells.Find("*", searchorder:=xlByColumns, SearchDirection:=xlPrevious).Column
    MsgBox lastRow - 1
    MsgBox lastcolumn
    End With

With ws1
Rows("5:5").Resize(lastRow - 1).Insert Shift:=xlDown ' minus 2 to account for header row and also existing text in row 4
End With

Worksheets("Refs").Range("A2:A" & lastRow).Copy Worksheets("Active events").Range("M4")

Range("O4:O" & lastRow + 2).Formula = "=SUMIF($C$14:$C$5032,$M4,O$14:O$5032)"
Range("O4:O" & lastRow + 2).AutoFill Range("O4", Cells(lastRow + 2, lastcolumn))

'Find the next blank cell in the names range and adds totals and the sum value to all columns

nextfree = Range("M4:M" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("M" & nextfree).Value = "Total"
Range("O" & nextfree).Value = "=SUM(O4:O" & nextfree - 1 & ")"

'Problem code here
Range("O" & nextfree).AutoFill Range("O" & nextfree, Cells("O" & nextfree, lastcolumn))

End Sub
</code>```

Body:
I'm entering a value in the last blank cell (as I can't do the last row in a column) due to other data being there. I was to add the sum of all the above cells to each column.
The number of columns is variable as is the number of names

I've been able to add the relevant formula but I can't get it to copy across in the same way my other code did.
This is the line with the error, to copy to the last used column, everything else works except this bit.

Range("O" & nextfree).AutoFill Range("O" & nextfree, Cells("O" & nextfree, lastcolumn))

I get a run type error 13, Type mis-match.

The full code is here

Sub addrow()

'Checks the number of users then adds them to the active sheet section

Dim rowsToAdd As Integer
Dim lastcolumn As Long
Dim lastRow As Long
Dim ws As Worksheet, ws1 As Worksheet
Set ws = ThisWorkbook.Worksheets("Refs")
Set w1 = ThisWorkbook.Worksheets("Active events")

    With ws
    lastRow = Sheets("Refs").Cells(.Rows.Count, "A").End(xlUp).Row
    lastcolumn = Sheets("Active events").Cells.Find("*", searchorder:=xlByColumns, SearchDirection:=xlPrevious).Column
    MsgBox lastRow - 1
    MsgBox lastcolumn
    End With

With ws1
Rows("5:5").Resize(lastRow - 1).Insert Shift:=xlDown ' minus 2 to account for header row and also existing text in row 4
End With

Worksheets("Refs").Range("A2:A" & lastRow).Copy Worksheets("Active events").Range("M4")

Range("O4:O" & lastRow + 2).Formula = "=SUMIF($C$14:$C$5032,$M4,O$14:O$5032)"
Range("O4:O" & lastRow + 2).AutoFill Range("O4", Cells(lastRow + 2, lastcolumn))

'Find the next blank cell in the names range and adds totals and the sum value to all columns

nextfree = Range("M4:M" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("M" & nextfree).Value = "Total"
Range("O" & nextfree).Value = "=SUM(O4:O" & nextfree - 1 & ")"

'Problem code here
Range("O" & nextfree).AutoFill Range("O" & nextfree, Cells("O" & nextfree, lastcolumn))

End Sub


问:
Mock private static final variable
I am getting java.lang.ExceptionInInitializerError while using Mockito for writing Junit test case, could someonie tell me how to mock  below code snippet:

```<code> clazz SomeCntroller {

    /** The Constant DATE_TIME_FORMATTER. */
    private static final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
*#
 line 4 #   **private static final  FTPConfigPropery sampleProperty= SampleService.getInstance().getFTPConfigPropery(true);***

public void someMethod(){

-------------------------------

}
}
</code>```

getting error at line 4, surprisingly date variable is also final and static but i am not getting any error there.

Using @Mock/@InjectMocks for both FTPConfigProperty and SampleService class;

Making this class variable a local variable (this works but unfortunately i cant d that because it someone else's code)

Title: Mock private static final variable

Body:
I am getting java.lang.ExceptionInInitializerError while using Mockito for writing Junit test case, could someonie tell me how to mock  below code snippet:

 clazz SomeCntroller {

    /** The Constant DATE_TIME_FORMATTER. */
    private static final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
*#
 line 4 #   **private static final  FTPConfigPropery sampleProperty= SampleService.getInstance().getFTPConfigPropery(true);***

public void someMethod(){

-------------------------------

}
}

getting error at line 4, surprisingly date variable is also final and static but i am not getting any error there.

Using @Mock/@InjectMocks for both FTPConfigProperty and SampleService class;

Making this class variable a local variable (this works but unfortunately i cant d that because it someone else's code)


问:
Qt6 Installer SDK and Online Installation source
I am trying to create an online installer for a Qt6 application. In this case, it is a Python base GUI app, compiled with Nuitka.

After creating the repository and the installer itself

```<code>repogen -p packages repository
binarycreator --online-only -c config/config.xml -p packages Installer
</code>```

the repo folder is filled and the installer is created. But each time I call it, I get 'Cannot retrieve distant tree'.

The question is: which remote servers are allowed, and how do I access them?

SFTP: debug mode tells me 'unsupported protocol'

FTP: connects, but asks for pw forever. Probably due to secure ftp

Google drive: seems not to work, probably because of redirections?

Nextcloud server: seems not to work, probably because of redirections?

Office365 cloud: seems not to work, probably because of redirections?

Or is the only way to configure an http server to get access to an update folder w/o pw?

Body:
I am trying to create an online installer for a Qt6 application. In this case, it is a Python base GUI app, compiled with Nuitka.

After creating the repository and the installer itself

repogen -p packages repository
binarycreator --online-only -c config/config.xml -p packages Installer

the repo folder is filled and the installer is created. But each time I call it, I get 'Cannot retrieve distant tree'.

The question is: which remote servers are allowed, and how do I access them?

SFTP: debug mode tells me 'unsupported protocol'

FTP: connects, but asks for pw forever. Probably due to secure ftp

Google drive: seems not to work, probably because of redirections?

Nextcloud server: seems not to work, probably because of redirections?

Office365 cloud: seems not to work, probably because of redirections?

Or is the only way to configure an http server to get access to an update folder w/o pw?


问:
Chrome extension, event click doesn't work
I am creating for the first time a browser extension.

I created my popup, which contains different buttons that should trigger javascript functions. Except that when I click on a button, nothing happens.

popup.html

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <div>
        <button id="test">Test</button>
    </div>

    <script src="js/popup.js"></script>
</body>
</html>
</code>```

js/popup.js

```<code>function save() {
    console.log('I save !!');
}

// I tried :
document.getElementById('test').innerHTML = 'TOTO'; => KO
document.getElementById('test').addEventListener('click',
    save); => KO
document.getElementById('test').click(function () {
    save();
}); => KO
</code>```

manifest.json

```<code>{
  "manifest_version": 3,
  "name": "name of extension",
  "version": "2.0",
  "description": "Description about extension",
  "icons": {
    "512": "images/lbo_favicon.png"
  },
  "default_locale": "en",
  "action": {
    "default_title": "Click Me",
    "default_popup": "popup.html"
  },
  "commands": {
    "_execute_action": {
      "suggested_key": {
        "windows": "Ctrl+Shift+Y",
        "mac": "Command+Shift+Y",
        "chromeos": "Ctrl+Shift+Y",
        "linux": "Ctrl+Shift+Y"
      }
    }
  }
}

</code>```

No reaction, no error in console either.

How can I get my clicks in the popup to be taken into account by my javascript ?

Thank you.

Body:
I am creating for the first time a browser extension.

I created my popup, which contains different buttons that should trigger javascript functions. Except that when I click on a button, nothing happens.

popup.html

<!DOCTYPE html>

    <meta charset="UTF-8">

        <button id="test">Test</button>

js/popup.js

function save() {
    console.log('I save !!');
}

// I tried :
document.getElementById('test').innerHTML = 'TOTO'; => KO
document.getElementById('test').addEventListener('click',
    save); => KO
document.getElementById('test').click(function () {
    save();
}); => KO

manifest.json

{
  "manifest_version": 3,
  "name": "name of extension",
  "version": "2.0",
  "description": "Description about extension",
  "icons": {
    "512": "images/lbo_favicon.png"
  },
  "default_locale": "en",
  "action": {
    "default_title": "Click Me",
    "default_popup": "popup.html"
  },
  "commands": {
    "_execute_action": {
      "suggested_key": {
        "windows": "Ctrl+Shift+Y",
        "mac": "Command+Shift+Y",
        "chromeos": "Ctrl+Shift+Y",
        "linux": "Ctrl+Shift+Y"
      }
    }
  }
}

No reaction, no error in console either.

How can I get my clicks in the popup to be taken into account by my javascript ?

Thank you.


问:
How to create graphql-go *graphql.Schema from JavaScript string?
How to create graphql schema from string in Go?

This is my schema, here shown as a JavaScript string:

```<code>  const schemaContent = `type Query {
            greeting:String
            students:[Student]
         }

         type Student {
            id:ID!
            firstName:String
            lastName:String
            password:String
            collegeId:String
         }`
</code>```

How can I build from the schemaContent string a scheme of type schema *graphql.Schema in Go?

Body:
How to create graphql schema from string in Go?

This is my schema, here shown as a JavaScript string:

  const schemaContent = `type Query {
            greeting:String
            students:[Student]
         }

         type Student {
            id:ID!
            firstName:String
            lastName:String
            password:String
            collegeId:String
         }`

How can I build from the schemaContent string a scheme of type schema *graphql.Schema in Go?


问:
Optimization for scene with custom shader
I have a three.js scene made with rogue engine, which im using to make a VR experience.
In that im using a fairly complex shader, it takes world space location of two locators for transitioning between their normal shader and just some color, the transition is using noise for some effect (see video below, its showing the effect of the first locator but the second one is also similar, it goes bottom to top),
the location of the object is passed as Vector 3 uniforms., the shader itself im injecting to a MeshStandardMaterial using onBeforeCompile.

the performance is already bad and really tanks when im using textures, im using three texture sets for the scene, im using diffuse,rough,metal,emission and AO so each is sampled thrice and then masked using vertex colors. (not present in the code below)

```<code>        varying vec3 W_Pos; //world position vector
        varying vec3 F_Nrml; //normal vector
        varying vec3 camDir; // cam facing
        varying vec3 vertexColor;

        uniform vec3 astral_locator; // First locator
        uniform vec3 astral_spread; // i pass the locator's scale here and scale it up for the transition
        uniform vec3 starScatter_starScale_nScale; //three float parameters im passing as vector for easier control in rogue engine
        uniform vec3 breakPoints;
        uniform vec3 c1;
        uniform vec3 c2;
        uniform vec3 c3;

        uniform vec3 noise_locator; //Second locator
        uniform vec3 nStretch_nScale_emSharp;// same as above, three floats passed as a vector
        uniform vec3 emCol;

        vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}
        vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}
        vec3 rand2( vec3 p ) {
            return fract(
            sin(
                vec3(dot(p,vec3(127.1,310.7,143.54)),dot(p,vec3(269.5,183.3,217.42)),dot(p,vec3(2459.5,133.3,17.42))))*43758.5453);
        }
        float mapping(float number, float inMin, float inMax, float outMin, float outMax){return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;}
        vec4 vertexMask(vec4 map1, vec4 map2, vec4 map3, vec3 vertMask){vec4 me1 = mix(vec4(0.0), map1,vertMask.r); vec4 me2 = mix(me1, map2,vertMask.g); vec4 me3 = mix(me2, map3,vertMask.b); return me3;}

//Noises
float noise(vec3 p){
    vec3 a = floor(p);
    vec3 d = p - a;
    d = d * d * (3.0 - 2.0 * d);

    vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
    vec4 k1 = perm(b.xyxy);
    vec4 k2 = perm(k1.xyxy + b.zzww);

    vec4 c = k2 + a.zzzz;
    vec4 k3 = perm(c);
    vec4 k4 = perm(c + 1.0);

    vec4 o1 = fract(k3 * (1.0 / 41.0));
    vec4 o2 = fract(k4 * (1.0 / 41.0));

    vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
    vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);

    return o4.y * d.y + o4.x * (1.0 - d.y);
}
float facing(){
    vec3 nrml = F_Nrml;
    vec3 cam = camDir;
    vec3 normal = normalize(nrml.xyz);
    vec3 eye = normalize(-cam);
    float rim = smoothstep(-0.75, 1.0, 1.0 - dot(normal, eye));
    return clamp(rim, 0.0, 1.0);
}

//Function for the second locatior
vec2 noiseMove(vec3 loc,vec3 noiseDat){
    float noise_stretch = noiseDat.x;
    float noise_scale = noiseDat.y;
    float emission_sharp = noiseDat.z;
    float noise_move = -loc.y;
    float gen_Pattern;
    float gen_Pattern_invert;
    float emi_sharp_fac;
    float transparency;
    float emission;

    gen_Pattern = ((W_Pos.y+noise_move)*noise_stretch) + noise(W_Pos.xyz*noise_scale);
    gen_Pattern_invert = 1.0 - gen_Pattern;

    emi_sharp_fac =  clamp(emission_sharp*1000.0,1.0,1000.0)*gen_Pattern;

    emission = emission_sharp*gen_Pattern;
    emission = 1.0 - emission;
    emission = emission * emi_sharp_fac;
    emission = clamp(emission,0.0,1.0);
    transparency = clamp(gen_Pattern_invert,0.0,1.0);
    return vec2(emission,transparency);
}

//Function for the first locator
vec4 astral(vec3 loc, vec3 spr,vec3 cee1,vec3 cee2,vec3 cee3, vec3 breakks, vec3 star){//star is WIP
float f = facing();
float re1 = mapping(f,breakks.x,1.0,0.0,1.0);
float re2 = mapping(f,breakks.y,1.0,0.0,1.0);
float re3 = mapping(f,breakks.z,1.0,0.0,1.0);
vec3 me1 = mix(vec3(0.,0.,0.),cee1,re1);
vec3 me2 = mix(me1,cee2,re2);
vec3 me3 = mix(me2,cee3,re3);

float dist = distance(W_Pos.xyz + (noise(W_Pos.xyz*star.z)-0.5),loc);
float val = step(dist,spr.x);
return vec4(me3,val);
}

void main(){
  vec4 ast = astral(astral_locator,astral_spread,c1,c2,c3,breakPoints,starScatter_starScale_nScale);
vec2 noice = noiseMove(noise_locator,nStretch_nScale_emSharp);
vec3 outp =  mix(mix(outgoingLight,ast.xyz,ast.w),emCol,noice.x); //Take output light from the three.js shader and mix it with the custom shader
float t = noice.y;
#ifdef NONSCIFI
    t = 1.0 - noice.y;
#endif
t *= diffuseColor.a;

gl_FragColor = vec4(outp*t,t);
}

</code>```

is there a way to optimize it better? a couple things i can think of is storing the noise and then using it instead of calculating every frame, and figuring out occlusion culling (renderpass doesnt work well in VR so cant store the depth pass, gotta figure a way), objects in the scene are already instances to reduce draw calls. im assuming making some objects static might help, including the locators but i dont know if it will stop the uniform from updating every frame.
is there anything else that can be done?

also i apologize for the structure of the question, i rarely post questions thanks to stackoverflow :p

Body:
I have a three.js scene made with rogue engine, which im using to make a VR experience.
In that im using a fairly complex shader, it takes world space location of two locators for transitioning between their normal shader and just some color, the transition is using noise for some effect (see video below, its showing the effect of the first locator but the second one is also similar, it goes bottom to top),
the location of the object is passed as Vector 3 uniforms., the shader itself im injecting to a MeshStandardMaterial using onBeforeCompile.

the performance is already bad and really tanks when im using textures, im using three texture sets for the scene, im using diffuse,rough,metal,emission and AO so each is sampled thrice and then masked using vertex colors. (not present in the code below)

        varying vec3 W_Pos; //world position vector
        varying vec3 F_Nrml; //normal vector
        varying vec3 camDir; // cam facing
        varying vec3 vertexColor;

        uniform vec3 astral_locator; // First locator
        uniform vec3 astral_spread; // i pass the locator's scale here and scale it up for the transition
        uniform vec3 starScatter_starScale_nScale; //three float parameters im passing as vector for easier control in rogue engine
        uniform vec3 breakPoints;
        uniform vec3 c1;
        uniform vec3 c2;
        uniform vec3 c3;

        uniform vec3 noise_locator; //Second locator
        uniform vec3 nStretch_nScale_emSharp;// same as above, three floats passed as a vector
        uniform vec3 emCol;

        vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}
        vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}
        vec3 rand2( vec3 p ) {
            return fract(
            sin(
                vec3(dot(p,vec3(127.1,310.7,143.54)),dot(p,vec3(269.5,183.3,217.42)),dot(p,vec3(2459.5,133.3,17.42))))*43758.5453);
        }
        float mapping(float number, float inMin, float inMax, float outMin, float outMax){return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;}
        vec4 vertexMask(vec4 map1, vec4 map2, vec4 map3, vec3 vertMask){vec4 me1 = mix(vec4(0.0), map1,vertMask.r); vec4 me2 = mix(me1, map2,vertMask.g); vec4 me3 = mix(me2, map3,vertMask.b); return me3;}

//Noises
float noise(vec3 p){
    vec3 a = floor(p);
    vec3 d = p - a;
    d = d * d * (3.0 - 2.0 * d);

    vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
    vec4 k1 = perm(b.xyxy);
    vec4 k2 = perm(k1.xyxy + b.zzww);

    vec4 c = k2 + a.zzzz;
    vec4 k3 = perm(c);
    vec4 k4 = perm(c + 1.0);

    vec4 o1 = fract(k3 * (1.0 / 41.0));
    vec4 o2 = fract(k4 * (1.0 / 41.0));

    vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
    vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);

    return o4.y * d.y + o4.x * (1.0 - d.y);
}
float facing(){
    vec3 nrml = F_Nrml;
    vec3 cam = camDir;
    vec3 normal = normalize(nrml.xyz);
    vec3 eye = normalize(-cam);
    float rim = smoothstep(-0.75, 1.0, 1.0 - dot(normal, eye));
    return clamp(rim, 0.0, 1.0);
}

//Function for the second locatior
vec2 noiseMove(vec3 loc,vec3 noiseDat){
    float noise_stretch = noiseDat.x;
    float noise_scale = noiseDat.y;
    float emission_sharp = noiseDat.z;
    float noise_move = -loc.y;
    float gen_Pattern;
    float gen_Pattern_invert;
    float emi_sharp_fac;
    float transparency;
    float emission;

    gen_Pattern = ((W_Pos.y+noise_move)*noise_stretch) + noise(W_Pos.xyz*noise_scale);
    gen_Pattern_invert = 1.0 - gen_Pattern;

    emi_sharp_fac =  clamp(emission_sharp*1000.0,1.0,1000.0)*gen_Pattern;

    emission = emission_sharp*gen_Pattern;
    emission = 1.0 - emission;
    emission = emission * emi_sharp_fac;
    emission = clamp(emission,0.0,1.0);
    transparency = clamp(gen_Pattern_invert,0.0,1.0);
    return vec2(emission,transparency);
}

//Function for the first locator
vec4 astral(vec3 loc, vec3 spr,vec3 cee1,vec3 cee2,vec3 cee3, vec3 breakks, vec3 star){//star is WIP
float f = facing();
float re1 = mapping(f,breakks.x,1.0,0.0,1.0);
float re2 = mapping(f,breakks.y,1.0,0.0,1.0);
float re3 = mapping(f,breakks.z,1.0,0.0,1.0);
vec3 me1 = mix(vec3(0.,0.,0.),cee1,re1);
vec3 me2 = mix(me1,cee2,re2);
vec3 me3 = mix(me2,cee3,re3);

float dist = distance(W_Pos.xyz + (noise(W_Pos.xyz*star.z)-0.5),loc);
float val = step(dist,spr.x);
return vec4(me3,val);
}

void main(){
  vec4 ast = astral(astral_locator,astral_spread,c1,c2,c3,breakPoints,starScatter_starScale_nScale);
vec2 noice = noiseMove(noise_locator,nStretch_nScale_emSharp);
vec3 outp =  mix(mix(outgoingLight,ast.xyz,ast.w),emCol,noice.x); //Take output light from the three.js shader and mix it with the custom shader
float t = noice.y;
#ifdef NONSCIFI
    t = 1.0 - noice.y;
#endif
t *= diffuseColor.a;

gl_FragColor = vec4(outp*t,t);
}

is there a way to optimize it better? a couple things i can think of is storing the noise and then using it instead of calculating every frame, and figuring out occlusion culling (renderpass doesnt work well in VR so cant store the depth pass, gotta figure a way), objects in the scene are already instances to reduce draw calls. im assuming making some objects static might help, including the locators but i dont know if it will stop the uniform from updating every frame.
is there anything else that can be done?

also i apologize for the structure of the question, i rarely post questions thanks to stackoverflow :p


问:
GCP Image Import
For the GCP Image Import can I Import the images with ISO format or VDI format from on premise and use it in compute engine after converting into images or using gcloud compute images import.</p>

Title: GCP Image Import


问:
Blazor EventCallbacks not correctly "bubbling up"
I have a strange problem with binding to events.

In a component, I have this:

[Parameter]
public int Foo { get; set; }
[Parameter]
public EventCallback<int> FooChanged { get; set; }
```
<p>In the outer component:</p>
<pre class="lang-cs prettyprint-override"><code><FooComponent @bind-Foo="_foo" />
Foo is: @_foo

@code {
  private int _foo;
}
</code>```

If I do a await FooChanged.InvokeAsync(42) in the child component, _foo in the outer component is correctly updated and I get Foo is: 42.

However, if I bind the Foo in the child component to another component using the binding mechanism, like, e.g., a RadzenNumeric, this change is not reflected unless I explicitly supply an appropriate event.

That means:

<RadzenNumeric @bind-Value="Foo" />
```
<p>does not work, the <code>FooChanged</code> event never fires.</p>
<p>I have to use:</p>
<pre class="lang-cs prettyprint-override"><code><RadzenNumeric Value="Foo"
               ValueChanged="(async (int i) => await FooChanged.InvokeAsync(i))" />
</code>```

This seems rather clunky, coming from WPF with its binding through INotifyPropertyChanged. Is this the desired way or is there anything I am missing?

To my understanding, @bind-... should automatically set up the correct events, firing the ...Changed event appropriately, or not?

Body:
I have a strange problem with binding to events.

In a component, I have this:

[Parameter]
public int Foo { get; set; }
[Parameter]
public EventCallback<int> FooChanged { get; set; }

In the outer component:

<FooComponent @bind-Foo="_foo" />
Foo is: @_foo

@code {
  private int _foo;
}

If I do a await FooChanged.InvokeAsync(42) in the child component, _foo in the outer component is correctly updated and I get Foo is: 42.

However, if I bind the Foo in the child component to another component using the binding mechanism, like, e.g., a RadzenNumeric, this change is not reflected unless I explicitly supply an appropriate event.

That means:

<RadzenNumeric @bind-Value="Foo" />

does not work, the FooChanged event never fires.

I have to use:

<RadzenNumeric Value="Foo"
               ValueChanged="(async (int i) => await FooChanged.InvokeAsync(i))" />

This seems rather clunky, coming from WPF with its binding through INotifyPropertyChanged. Is this the desired way or is there anything I am missing?

To my understanding, @bind-... should automatically set up the correct events, firing the ...Changed event appropriately, or not?


问:
Tox and pre-commit hook "error: unrecognized arguments" or not running test envs
Everything is inside a docker container.
Tox works fine separately inside docker. What I'm trying to do is to add Tox to the pre-commit hook to run it for files with changes to be committed.

.pre-commit-config.yaml

```<code>-   repo: local
    hooks:
    -   id: tox-project
        name: tox
        entry: tox
        language: system
        types: [python]
        args: [-c, path_inside_docker/tox.ini,--workdir=path_inside_docker, -e, "fix,pylint,[other_tests]"]
</code>```

When tox runs as a part of a pre-commit hook (defined as above), it generates an error that refers to the file with changes that I want to commit:

```<code>tox......................................................................Failed
- hook id: tox-project
- exit code: 2

usage: tox [-h] [--colored {yes,no}] [-v | -q] [--exit-and-dump-after seconds] [-c file]
[--workdir dir] [--root dir] [--runner {virtualenv}] [--version] [--no-provision [REQ_JSON]]
[--no-recreate-provision] [-r] [-x OVERRIDE]
{run,r,run-parallel,p,depends,de,list,l,devenv,d,config,c,quickstart,q,exec,e,legacy,
le} ...

tox: error: unrecognized arguments: path/to/file/to/be/commited/main.py hint: if you tried to pass
    arguments to a command use -- to separate them from tox ones
</code>```

What I tried:

1st solution.
To add "--" to args for tox, to pass files from commit.
Which I found here: Add -- as argument for tox

```<code>args: [-c, path_inside_docker/tox.ini,--workdir=path_inside_docker, -e,"fix,pylint,[other_tests]",--]
</code>```

Now tox runs as a hook, but it doesn't work properly. Hook pass tox with success, and commit is done. But the tox is not generating any results as supposed to (when the same file is tested by a separate tox outside hook, it generates a list of errors).

2nd solution.
Turn off passing filenames.

I've found this solution for a similar issue, solved by: pass_filenames: false.
I tried this as well. But then tox is (as I understand) not getting any files from the commit to process and finish everything with success - again not generating any results that it suppose to generate.

Any ideas?

Body:
Everything is inside a docker container.
Tox works fine separately inside docker. What I'm trying to do is to add Tox to the pre-commit hook to run it for files with changes to be committed.

.pre-commit-config.yaml

-   repo: local
    hooks:
    -   id: tox-project
        name: tox
        entry: tox
        language: system
        types: [python]
        args: [-c, path_inside_docker/tox.ini,--workdir=path_inside_docker, -e, "fix,pylint,[other_tests]"]

When tox runs as a part of a pre-commit hook (defined as above), it generates an error that refers to the file with changes that I want to commit:

tox......................................................................Failed
- hook id: tox-project
- exit code: 2

usage: tox [-h] [--colored {yes,no}] [-v | -q] [--exit-and-dump-after seconds] [-c file]
[--workdir dir] [--root dir] [--runner {virtualenv}] [--version] [--no-provision [REQ_JSON]]
[--no-recreate-provision] [-r] [-x OVERRIDE]
{run,r,run-parallel,p,depends,de,list,l,devenv,d,config,c,quickstart,q,exec,e,legacy,
le} ...

tox: error: unrecognized arguments: path/to/file/to/be/commited/main.py hint: if you tried to pass
    arguments to a command use -- to separate them from tox ones

What I tried:

1st solution.
To add "--" to args for tox, to pass files from commit.
Which I found here: Add -- as argument for tox

args: [-c, path_inside_docker/tox.ini,--workdir=path_inside_docker, -e,"fix,pylint,[other_tests]",--]

Now tox runs as a hook, but it doesn't work properly. Hook pass tox with success, and commit is done. But the tox is not generating any results as supposed to (when the same file is tested by a separate tox outside hook, it generates a list of errors).

2nd solution.
Turn off passing filenames.

I've found this solution for a similar issue, solved by: pass_filenames: false.
I tried this as well. But then tox is (as I understand) not getting any files from the commit to process and finish everything with success - again not generating any results that it suppose to generate.

Any ideas?


问:
JSON Query | URL Parameter | JSONPATH
I have an API below and I'm wondering how I can query the "name"? in the URL and also I'm trying to use this API with retrofit.

https://i.stack.imgur.com/kqZeV.jpg

```<code>{
"code": 200,
"status": "OK",
"data": {
    "surahs": [
        {
            "number": 1,
            "name": "سُورَةُ ٱلْفَاتِحَةِ",
            "englishName": "Al-Faatiha",
            "englishNameTranslation": "The Opening",
            "revelationType": "Meccan",
            "ayahs": [
            .
            .
            .
            ]
        },
    .
    .
    .
}
</code>```

Title: JSON Query | URL Parameter | JSONPATH

Body:
I have an API below and I'm wondering how I can query the "name"? in the URL and also I'm trying to use this API with retrofit.

https://i.stack.imgur.com/kqZeV.jpg

{
"code": 200,
"status": "OK",
"data": {
    "surahs": [
        {
            "number": 1,
            "name": "سُورَةُ ٱلْفَاتِحَةِ",
            "englishName": "Al-Faatiha",
            "englishNameTranslation": "The Opening",
            "revelationType": "Meccan",
            "ayahs": [
            .
            .
            .
            ]
        },
    .
    .
    .
}


问:
Html - Wistia player gets cropped on getting out from the full video player mode and rotating the screen
Screen Recording

```<code>import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:hub/utils/system_ui.dart';

class WistiaPlayerx extends StatelessWidget {
  final String videoHash;
  final BuildContext context;

  WistiaPlayerx({Key? key, required this.videoHash, required  this.context}) : super(key: key);

  late final String body2 = """"
  <!DOCTYPE html>
      <html>
        <head>
        <style>
          html,
            body {
                margin: 0;
                padding: 0;
                background-color: #000000;
                opacity: 0
                overflow: hidden;
                position: fixed;
                height: 100%;
                width: 100%;
            }
            iframe, .player {
              display: block;
              width: 100%;
              height: 100%;
              border: 0px;
              }
            </style>
            <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>
        </head>
        <body>
           <script src="https//fast.wistia.com/embed/medias/$videoHash.jsonp" async></script>
           <script src="https://fast.wistia.com/assets/external/E-v1.js" async></script>
           <div class="wistia_embed wistia_async_$videoHash autoPlay=true resumable=true playerColor=null endVideoBehavior=default playbar=true player"> </div>
          <script>
          window._wq = window._wq || []
          _wq.push({
            id: $videoHash,
            onReady: function(video) {
                if (video.hasData()) {
                  sendMessageToDart('Ready');
                }
                video.bind("play", function() {
                  sendMessageToDart('Playing')
                })

                video.bind('pause', function() {
                  sendMessageToDart('Paused')
                })
                video.bind("end", function(endTime) {
                  sendMessageToDart('Ended', { endTime: endTime });
                })

                video.bind("percentwatchedchanged", function(percent, lastPercent) {
                  sendMessageToDart('PercentChanged', { percent, percent, lastPercent: lastPercent })
                })

                video.bind("mutechange", function (isMuted)) {
                  sendMessageToDart('MuteChange', { isMuted: isMuted })
                }

                video.bind("enterfullscreen", function() {
                  sendMessageToDart('EnterFullscreen')
                })

                video.bind("cancelfullscreen", function() {
                  sendMessageToDart('CancelFullscreen')
                })

                video.bind("beforeremove", function() {
                  return video.unbind
                })

                window.play = function play() {
                  return video.play();
                }
                window.pause = function pause() {
                  return video.pause();
                }
                window.isMuted = function isMuted() {
                  return video.isMuted()
                }

                window.inFullscreen = function inFullscreen() {
                  return video.inFullscreen()
                }

                window.hasData = function hasData() {
                  return video.hasData()
                }

                window.aspect = function aspect() {
                  return video.aspect()
                }

                window.mute = function mute() {
                  return video.mute()
                }

                window.unmute = function unmute() {
                  return video.unmute()
                }

                window.duration = function duration() {
                  return video.duration()
                }

                window.requestFullscreen = function requestFullscreen() {
                  return video.requestFullscreen()
                }
              },
          });

          function sendMessageToDart(methodName, argsObject = {}) {
            var message = {
              'method': methodName,
              'args': argsObject
            };
            WistiaWebView.postMessage(JSON.stringify(message));
          }
          </script>
        </body>
      </html>
      """;

  InAppWebViewController? webViewController;

  onOrientationChange(Orientation orientation){
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
      DeviceOrientation.landscapeRight,
      DeviceOrientation.landscapeLeft,
    ]);

    return OrientationBuilder(builder: (context, orientation){
      if(webViewController != null){
        onOrientationChange(orientation);
      }

      debugPrint('orientation: $orientation');

      return InAppWebView(
        onWebViewCreated: (InAppWebViewController controller) {
          webViewController = controller;
          controller.loadData(
              data: body2, mimeType: 'text/html', encoding: 'utf-8');
        },
        initialOptions: InAppWebViewGroupOptions(
          crossPlatform: InAppWebViewOptions(
            supportZoom: false,
            disableVerticalScroll: true,
            disableHorizontalScroll: true,

          ),
          android: AndroidInAppWebViewOptions(
          )
        ),

        onLoadStop: (controller, index){
        },
      );
    });
  }
}

</code>```

On changing device orientation video player(Wistia)/web page size gets cropped. I think the height widget not getting update. It works perfectly if the video is playing in full screen but when we rotate to portrait is gets out from the full screen and page gets cropped.

How can make it responsive?
Is there any way to keep player in full screen mode on portrait mode.(player supports portrait full screen mode).

On Changing the orientation of the device, the full screen video player or page should be responsive.

Body:
Screen Recording

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:hub/utils/system_ui.dart';

class WistiaPlayerx extends StatelessWidget {
  final String videoHash;
  final BuildContext context;

  WistiaPlayerx({Key? key, required this.videoHash, required  this.context}) : super(key: key);

  late final String body2 = """"
  <!DOCTYPE html>

            <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>

      """;

  InAppWebViewController? webViewController;

  onOrientationChange(Orientation orientation){
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
      DeviceOrientation.landscapeRight,
      DeviceOrientation.landscapeLeft,
    ]);

    return OrientationBuilder(builder: (context, orientation){
      if(webViewController != null){
        onOrientationChange(orientation);
      }

      debugPrint('orientation: $orientation');

      return InAppWebView(
        onWebViewCreated: (InAppWebViewController controller) {
          webViewController = controller;
          controller.loadData(
              data: body2, mimeType: 'text/html', encoding: 'utf-8');
        },
        initialOptions: InAppWebViewGroupOptions(
          crossPlatform: InAppWebViewOptions(
            supportZoom: false,
            disableVerticalScroll: true,
            disableHorizontalScroll: true,

          ),
          android: AndroidInAppWebViewOptions(
          )
        ),

        onLoadStop: (controller, index){
        },
      );
    });
  }
}

On changing device orientation video player(Wistia)/web page size gets cropped. I think the height widget not getting update. It works perfectly if the video is playing in full screen but when we rotate to portrait is gets out from the full screen and page gets cropped.

How can make it responsive?
Is there any way to keep player in full screen mode on portrait mode.(player supports portrait full screen mode).

On Changing the orientation of the device, the full screen video player or page should be responsive.


问:
Terraform: How to implement s3 backend inside codebuild container?
I am using terraform inside codebuild along with codepipeline ( CI CD ) to deploy my resources. The resources ( all the tf files)  are present as a zip file.

This deployment for CI/CD ( codebuild + codepipeline ) is being done by CDK.

Now I am confused how and where do I implement terraform s3 backend, because I am using 2 codebuild stages: Plan stage  for terraform planning -> manual approval ( intermediate)  -> Deploy stager for terraform apply )

```<code>Conceptually I am not able to understand where should I implement s3 backend.
</code>```

Plan stage code build spec

```<code>pre_build:
    commands:
      - terraform init

  build:
    commands:
      - echo '{"fruit":{"name":"apple","color":"green","price":1.20}}' | jq '.'
      - terraform plan -no-color -input=false
</code>```

Deploy stage buidspec

```<code> pre_build:
        commands:
          - terraform init

      build:
        commands:
          - echo '{"fruit":{"name":"apple","color":"green","price":1.20}}' | jq '.'
          - terraform apply -auto-approve -no-color -input=false
</code>```

Body:
I am using terraform inside codebuild along with codepipeline ( CI CD ) to deploy my resources. The resources ( all the tf files)  are present as a zip file.

This deployment for CI/CD ( codebuild + codepipeline ) is being done by CDK.

Now I am confused how and where do I implement terraform s3 backend, because I am using 2 codebuild stages: Plan stage  for terraform planning -> manual approval ( intermediate)  -> Deploy stager for terraform apply )

Conceptually I am not able to understand where should I implement s3 backend.

Plan stage code build spec

pre_build:
    commands:
      - terraform init

  build:
    commands:
      - echo '{"fruit":{"name":"apple","color":"green","price":1.20}}' | jq '.'
      - terraform plan -no-color -input=false

Deploy stage buidspec

 pre_build:
        commands:
          - terraform init

      build:
        commands:
          - echo '{"fruit":{"name":"apple","color":"green","price":1.20}}' | jq '.'
          - terraform apply -auto-approve -no-color -input=false


问:
Excel template in JasperServer
I've created a report which uses excel template for export to xls. It' works well in JasperStudio.

But I got a trouble when tried to publish it to jasperserver. I got an error file not found for my template.

Excel template was loaded to the same directory as content resource.

So the question is: Is it possible to use excel templates in jasperserver for export? what type should have the templates? How i can fix this problem?

```<code>SecureExceptionHandlerImpl,pool-9-thread-2:125 - There was an error on the server. Try again or contact site administrators. (Error UID: ff3f0426-9b24-4339-916a-221f7f0c0699) com.jaspersoft.jasperserver.remote.exception.ExportExecutionRejectedException: net.sf.jasperreports.engine.JRException: Input stream not found at: chart.xls.
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.ReportExecutorImpl.exportReport(ReportExecutorImpl.java:210)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.generateReportOutput(RunReportServiceImpl.java:1170)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.executeExport(RunReportServiceImpl.java:617)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl$2.run(RunReportServiceImpl.java:509)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.api.logging.util.LoggableExecutorService$1.run(LoggableExecutorService.java:84)
jasper-jasperreports-1  |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jasper-jasperreports-1  |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jasper-jasperreports-1  |       at java.lang.Thread.run(Thread.java:750)
</code>```

I have tried different folders and path spelling, no luck

Title: Excel template in JasperServer

Body:
I've created a report which uses excel template for export to xls. It' works well in JasperStudio.

But I got a trouble when tried to publish it to jasperserver. I got an error file not found for my template.

Excel template was loaded to the same directory as content resource.

So the question is: Is it possible to use excel templates in jasperserver for export? what type should have the templates? How i can fix this problem?

SecureExceptionHandlerImpl,pool-9-thread-2:125 - There was an error on the server. Try again or contact site administrators. (Error UID: ff3f0426-9b24-4339-916a-221f7f0c0699) com.jaspersoft.jasperserver.remote.exception.ExportExecutionRejectedException: net.sf.jasperreports.engine.JRException: Input stream not found at: chart.xls.
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.ReportExecutorImpl.exportReport(ReportExecutorImpl.java:210)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.generateReportOutput(RunReportServiceImpl.java:1170)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.executeExport(RunReportServiceImpl.java:617)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl$2.run(RunReportServiceImpl.java:509)
jasper-jasperreports-1  |       at com.jaspersoft.jasperserver.api.logging.util.LoggableExecutorService$1.run(LoggableExecutorService.java:84)
jasper-jasperreports-1  |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jasper-jasperreports-1  |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jasper-jasperreports-1  |       at java.lang.Thread.run(Thread.java:750)

I have tried different folders and path spelling, no luck


问:
After updating from moment version 2.24.0 to 2.29.4 moment related jest test case failed
Below mentioned jest test case worked fine until moment got updated from 2.24.0 to 2.29.4.
What could be the reason for this?

Failing Jest test case:

```<code>test("Verify dates are validated properly", () => {
    expect((moment("048710", moment.ISO_8601, true)).isValid()).toBeFalse();
    expect((moment("22390", moment.ISO_8601, true)).isValid()).toBeFalse();
    expect((moment("2020-01-01T00:00:00-00:00", moment.ISO_8601, true)).isValid()).toBeTrue();
    expect((moment("2020-01-01T00:00:00Z", moment.ISO_8601, true)).isValid()).toBeTrue();
});
</code>```

Error message:

Body:
Below mentioned jest test case worked fine until moment got updated from 2.24.0 to 2.29.4.
What could be the reason for this?

Failing Jest test case:

test("Verify dates are validated properly", () => {
    expect((moment("048710", moment.ISO_8601, true)).isValid()).toBeFalse();
    expect((moment("22390", moment.ISO_8601, true)).isValid()).toBeFalse();
    expect((moment("2020-01-01T00:00:00-00:00", moment.ISO_8601, true)).isValid()).toBeTrue();
    expect((moment("2020-01-01T00:00:00Z", moment.ISO_8601, true)).isValid()).toBeTrue();
});

Error message:


问:
extract text from pdf for beginners
I need to build a model that extracts text from pdf and I have some questions.
By the way,I have to implement a model by myself, so I can't use libraries like tesseract, only with TensorFlow and so on.
And my questions are -

What is the dataset I need? Pictures of each individual letter, or pictures of long text like a picture of a scanned book page?

What is the PDF text recognition model?

What is the model for extracting pdf text?

I'm a little confused with it, and I'd appreciate some help.
Thank you

Title: extract text from pdf for beginners


问:
Gradle compileOnly vs implementation - code obfuscation (method parameter not visible)
there is a difference in obfuscation depending on usage in android library dependencies with 'implementation' and 'compileOnly'. Please read samples below, both have same Gradle and R8 configuration.

Env configuration:

Project type: Android Library (aar)

Gradle version: 7.4.2

Gradle plugin: 7.2.1

Kotlin 1.5.31

Obfuscation: R8

R8 config (MyClass is a part of this package):

```<code>-keep public class com.module.api.** {
 public <methods>;
 public <fields>;
}
</code>```

Sample #1 build.grade (valid - method parameter is visible):

```<code>dependencies{
 implementation "com.other.module"
}
</code>```

Outout code in aar:

```<code>public final class MyClass public constructor() {
 public final fun someMethodWithParameter(visibleId: kotlin.String): kotlin.Unit {}
}
</code>```

Sample #2 build.grade (invalid - parameter has different name)

```<code>dependencies{
 compileOnly "com.other.module"
}
</code>```

Outout code in aar:

```<code>public final class MyClass {
 public MyClass() {}

 //parameter should has name 'visibleId' and class should be in Kotlin!
 public final void someMethodWithParameter(String var1) {}
}
</code>```

Body:
there is a difference in obfuscation depending on usage in android library dependencies with 'implementation' and 'compileOnly'. Please read samples below, both have same Gradle and R8 configuration.

Env configuration:

Project type: Android Library (aar)

Gradle version: 7.4.2

Gradle plugin: 7.2.1

Kotlin 1.5.31

Obfuscation: R8

R8 config (MyClass is a part of this package):

-keep public class com.module.api.** {
 public <methods>;
 public <fields>;
}

Sample #1 build.grade (valid - method parameter is visible):

dependencies{
 implementation "com.other.module"
}

Outout code in aar:

public final class MyClass public constructor() {
 public final fun someMethodWithParameter(visibleId: kotlin.String): kotlin.Unit {}
}

Sample #2 build.grade (invalid - parameter has different name)

dependencies{
 compileOnly "com.other.module"
}

Outout code in aar:

public final class MyClass {
 public MyClass() {}

 //parameter should has name 'visibleId' and class should be in Kotlin!
 public final void someMethodWithParameter(String var1) {}
}


问:
r rticle package stopped compiling after recent updates
I have just installed R version 4.2.2 (2022-10-31 ucrt), under RStudio 2022.07.2 (Build 576), and the rticle package (v 0.24). At this moment, these are the most recent versions of the three systems.

I first tried to compile the basic MDPI template (\New File\R MarkDown\From Template\MDPI Journal Article) and got the following message:

```<code>! LaTeX Error: Command \gather already defined.
               Or name \end... illegal, see p.192 of the manual.

Erro: LaTeX failed to compile Novo.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Novo.log for more info.
</code>```

I tried also another file that I was normally compiling a couple of days ago, and got the same message.

Any help or clue of what I might be doing wrong?

Body:
I have just installed R version 4.2.2 (2022-10-31 ucrt), under RStudio 2022.07.2 (Build 576), and the rticle package (v 0.24). At this moment, these are the most recent versions of the three systems.

I first tried to compile the basic MDPI template (\New File\R MarkDown\From Template\MDPI Journal Article) and got the following message:

! LaTeX Error: Command \gather already defined.
               Or name \end... illegal, see p.192 of the manual.

Erro: LaTeX failed to compile Novo.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Novo.log for more info.

I tried also another file that I was normally compiling a couple of days ago, and got the same message.

Any help or clue of what I might be doing wrong?


问:
path name is updating on refresh in nextjs dynamic routing
In my application on refresh pathname is getting changed as shown in the below SS can someone please suggest why is it happening like this?


问:
.sh script returning branch name locally, but returns HEAD when run inside a github action
I am trying to access the branch name of the current PR inside a shell script that is triggered by a new commit. When I run the following locally, my terminal successfully prints out the branch name:

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
echo $BRANCH_NAME
```

However, if I run this in a github action, it instead prints out HEAD. Does anyone know why this discrepancy might happen, and what I can do to fix it?

It's important to note that I'm not trying to access the branch name in the workflow yaml file. I know that can be done with github's existing properties.

Body:
I am trying to access the branch name of the current PR inside a shell script that is triggered by a new commit. When I run the following locally, my terminal successfully prints out the branch name:

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
echo $BRANCH_NAME

However, if I run this in a github action, it instead prints out HEAD. Does anyone know why this discrepancy might happen, and what I can do to fix it?

It's important to note that I'm not trying to access the branch name in the workflow yaml file. I know that can be done with github's existing properties.


问:
Swift: Share object between processes
I need to manage an IO resource (UART telemetry device) that is connected to a computer and multiple processes need to interact with. So the traffic needs to be serialised and eventually prioritised.

The computer resources are extremely limited, so I thought avoiding an IPC/Websocked based "master process" would be good for overall performance.

I was thinking of creating a shared object like a singleton that can be accessed by other processes on the computer. But I don't know how to achieve that and if it's the best way to solve this problem.

This is a rough idea of the object:

class Telemetry {

    // This should be accessible from multiple processes and auto-created like normal singletons
    static var global: Telemetry = Telemetry()

    let queue: DispatchQueue = DispatchQueue(label: "telemetry-queue")
    var ioHandler: IOHandler = IOHandler(port: "/tty0")

    func send(data: DataPackage, clientID: UUID) {
        queue.sync { /* data sending logic */ }
    }

    func receive(clientID: UUID) -> DataPackage {
        queue.sync { /* read incoming data and return package for client */ }
    }

 }

struct DataPackage { }

struct IOHandler {
    init(port: String) {}
}
```

I'm also not sure if swift is the best choice for this task.

Any help appreciated.

Title: Swift: Share object between processes

Body:
I need to manage an IO resource (UART telemetry device) that is connected to a computer and multiple processes need to interact with. So the traffic needs to be serialised and eventually prioritised.

The computer resources are extremely limited, so I thought avoiding an IPC/Websocked based "master process" would be good for overall performance.

I was thinking of creating a shared object like a singleton that can be accessed by other processes on the computer. But I don't know how to achieve that and if it's the best way to solve this problem.

This is a rough idea of the object:

class Telemetry {

    // This should be accessible from multiple processes and auto-created like normal singletons
    static var global: Telemetry = Telemetry()

    let queue: DispatchQueue = DispatchQueue(label: "telemetry-queue")
    var ioHandler: IOHandler = IOHandler(port: "/tty0")

    func send(data: DataPackage, clientID: UUID) {
        queue.sync { /* data sending logic */ }
    }

    func receive(clientID: UUID) -> DataPackage {
        queue.sync { /* read incoming data and return package for client */ }
    }

 }

struct DataPackage { }

struct IOHandler {
    init(port: String) {}
}

I'm also not sure if swift is the best choice for this task.

Any help appreciated.