问:
Nested class doesn't work for JPA Repositories
I'm trying to make JPA repository work with a nested class, but it didn't, even I enabled considerNestedRepositories inside the @EnableJpaRepositories.

My class like this one:

```<code>class MyRepository{
    interface RepositioryCustom{
        void test()
    }
    interface DefaultRepository extends JPARepository<..,...>, RepositioryCustom{

    }
    class RepositioryCustomImpl : RepositoryCustom{

        public void test(){
            ...
        }

    }
}

</code>```

When I run the project, it throws exception like this:

```<code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyRepository.DefaultRepository' defined in MyRepository$DefaultRepository defined in @EnableJpaRepositories declared on MainProjectApplication: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract MyRepository$RepositioryCustom.test(long)! No property test found for type XXX!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:886)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:790)
    ... 34 more
</code>```

What should I do now? Thank you

Body:
I'm trying to make JPA repository work with a nested class, but it didn't, even I enabled considerNestedRepositories inside the @EnableJpaRepositories.

My class like this one:

class MyRepository{
    interface RepositioryCustom{
        void test()
    }
    interface DefaultRepository extends JPARepository<..,...>, RepositioryCustom{

    }
    class RepositioryCustomImpl : RepositoryCustom{

        public void test(){
            ...
        }

    }
}

When I run the project, it throws exception like this:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyRepository.DefaultRepository' defined in MyRepository$DefaultRepository defined in @EnableJpaRepositories declared on MainProjectApplication: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract MyRepository$RepositioryCustom.test(long)! No property test found for type XXX!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:886)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:790)
    ... 34 more

What should I do now? Thank you


来源: stackexchange

问:
Encrypting Password parameters in Powershell for GET request to ServiceNow
has anyone found a good solution to encrypting the password parameters in Powershell for ServiceNow API?

This is the default version :

```<code>`$user = "admin"
$pass = "admin"

# Build auth header
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $pass)))

# Set proper headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Authorization',('Basic {0}' -f $base64AuthInfo))
$headers.Add('Accept','application/json')
$response = Invoke-WebRequest -Header $headers -Method $method -Uri $uri
`

`Then I tried the most common way of encrypting the password using "ConvertTo-SecureString":
`
`# Convert the plain text password to an encrypted secure string
$securePassword = ConvertTo-SecureString '' -AsPlainText -Force

# Convert the encrypted password back to a plain text password
$pass = ConvertFrom-SecureString $securePassword

# Set the username
$username = "admin"
`
</code>```

But this didnt work. Gave me an unauthorised(401) error.

One method I found that did worked was using CredentialManager but I am hesitant to use it because it is not that secure at all. Anyone here has a better solution? Let me know and thanks for the help

ContentLicense: CC BY-SA 4.0

Body:
has anyone found a good solution to encrypting the password parameters in Powershell for ServiceNow API?

This is the default version :

`$user = "admin"
$pass = "admin"

# Build auth header
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $pass)))

# Set proper headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Authorization',('Basic {0}' -f $base64AuthInfo))
$headers.Add('Accept','application/json')
$response = Invoke-WebRequest -Header $headers -Method $method -Uri $uri
`

`Then I tried the most common way of encrypting the password using "ConvertTo-SecureString":
`
`# Convert the plain text password to an encrypted secure string
$securePassword = ConvertTo-SecureString '' -AsPlainText -Force

# Convert the encrypted password back to a plain text password
$pass = ConvertFrom-SecureString $securePassword

# Set the username
$username = "admin"
`

But this didnt work. Gave me an unauthorised(401) error.

One method I found that did worked was using CredentialManager but I am hesitant to use it because it is not that secure at all. Anyone here has a better solution? Let me know and thanks for the help


问:
Issue with button on swappable gallery in mobile view
I am trying to add a button on the cards in my swipeable gallery, which is made using the Swiper API. However, when I remove the overlay on the cards to make the button visible, the slider starts to behave erratically and does not work properly. I am new to coding and apologize if this is a simple issue, but I would appreciate any help or suggestions.

To make the button functional, I need to remove the "content: ''" property from the ".gallery-cards" class in the CSS. However, when I do this, the slider starts to glitch in the mobile view. The ".gallery-cards" class is only used in the JS code to make the cards swipeable. I have included the CSS, JS, and HTML code below. Thank you for any assistance.

My JS Code

```<code>/*=============== SWIPER JS GALLERY ===============*/
let swiperCards = new Swiper(".gallery-cards", {
  loop: true,
  loopedSlides: 5,
  cssMode: true,
  effect: 'fade',
});

let swiperThumbs = new Swiper(".gallery-thumbs", {
  loop: true,
  loopedSlides: 5,
  slidesPerView: 3,
  centeredSlides: true,
  slideToClickedSlide: true,

  pagination: {
    el: ".swiper-pagination",
    type: "fraction",
  },
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
});

swiperThumbs.controller.control = swiperCards;
</code>```

My CSS Code

```<code> .gallery {
  height: 100vh;
  display: grid;
  align-content: center;
  justify-content: center;
}

.gallery__card {
  position: relative;
  width: 228px;
  height: 288px;
  border-radius: 25px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

.gallery__img,
.gallery__card::after,
.gallery__data {
  position: absolute;
}

.gallery__img {
  inset: 0;
  margin: auto;
  transition: transform .3s;
}

.gallery__button {
  padding: 12px 20px;
  border-radius: 25px;
  margin-left: 60%;
  width: 100%;
  cursor: pointer;
  border: none;
  margin-bottom: 20px;
  z-index: 15;
}

.gallery__button:hover {
  background-color: #074bb1;
  color: white;
  transition: .6s;
}

.gallery__button-pink {
  padding: 12px 20px;
  border-radius: 25px;
  margin-left: 60%;
  width: 100%;
  cursor: pointer;
  border: none;
  margin-bottom: 20px;
  z-index: 15;
}

.gallery__button-pink:hover {
  background-color: #ff66c4;
  color: white;
  transition: .6s;
}

.gallery__card::after {
  content: '';
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, hsla(0, 0%, 100%, 0) 32%, hsla(0, 0%, 0%, .3) 100%);
  top: 0;
  z-index: 1;
}

.gallery__data {
  bottom: 1.5rem;
  left: 1.75rem;
  z-index: 10;
}

.gallery__title,
.gallery__subtitle {
  color: #fff;
  font-weight: 500;
}

.gallery__title {
  font-size: 1rem;
}

.gallery__subtitle {
  font-size: .75rem;
}

.gallery__overflow {
  position: relative;
}

.gallery__thumbnail {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 1.5rem;
  overflow: hidden;
  cursor: pointer;
  margin-left: auto;
  margin-right: auto;
  transition: transform .3s;
}

.gallery__thumbnail-img {
  position: absolute;
  inset: 0;
  margin: auto;
}

/* Swiper class */

.gallery-cards,
.gallery-thumbs {
  width: 260px;
}

.gallery-cards:hover .gallery__img {
  transform: scale(1.1);
}

.gallery .swiper-wrapper {
  padding: 2.5rem 0;
}

.gallery-thumbs {
  height: 132px;
}

/* Active thumbnail */

.swiper-slide-active .gallery__thumbnail {
  transform: translateY(-1.25rem) scale(1.2);
}

/* Rotate thumbnail */

.swiper-slide-next .gallery__thumbnail {
  transform: rotate(15deg);
}

.swiper-slide-prev .gallery__thumbnail {
  transform: rotate(-15deg);
}

/* Sliding numbers */

.swiper-pagination-fraction {
  font-size: .813rem;
  letter-spacing: -1px;
  font-weight: 500;
  color: hsl(30, 16%, 50%);
  bottom: 0;
}

/* Arrow buttons */

.swiper-button-next::after,
.swiper-button-prev::after {
  content: '';
}

.swiper-button-next,
.swiper-button-prev {
  font-size: 1.5rem;
  color: hsl(30, 8%, 15%);
  top: 5.5rem;
}

.swiper-button-next {
  right: -1.5rem;
  transform: rotate(15deg);
}

.swiper-button-prev {
  left: -1.5rem;
  transform: rotate(-15deg);
}

/* Other swiper settings */

.gallery-cards::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.swiper-horizontal.swiper-css-mode>.swiper-wrapper {
  scroll-snap-type: initial;
}

/*=============== BREAKPOINTS ===============*/

/* For small devices */

@media screen and (max-width: 320px) {
  .swiper-button-next,
  .swiper-button-prev {
    display: none;
  }
}

/* For medium devices */

@media screen and (min-width: 1024px) {
  .gallery__card {
    width: 290px;
    height: 370px;
  }
  .gallery__thumbnail {
    width: 65px;
    height: 65px;
  }
  .gallery-cards,
  .gallery-thumbs {
    width: 290px;
  }
}
</code>```

My HTML Code

```<code>    <div class="swiper-slide">
  <article class="gallery__card">
    <img src="../assets/img/hfsimageslider.png" alt="image gallery" class="gallery__img">
    <div class="gallery__data">
      <a href="google.com"> <button class="gallery__button">More Info</button></a>
    </div>
  </article>
</div>
</code>```

Body:
I am trying to add a button on the cards in my swipeable gallery, which is made using the Swiper API. However, when I remove the overlay on the cards to make the button visible, the slider starts to behave erratically and does not work properly. I am new to coding and apologize if this is a simple issue, but I would appreciate any help or suggestions.

To make the button functional, I need to remove the "content: ''" property from the ".gallery-cards" class in the CSS. However, when I do this, the slider starts to glitch in the mobile view. The ".gallery-cards" class is only used in the JS code to make the cards swipeable. I have included the CSS, JS, and HTML code below. Thank you for any assistance.

My JS Code

/*=============== SWIPER JS GALLERY ===============*/
let swiperCards = new Swiper(".gallery-cards", {
  loop: true,
  loopedSlides: 5,
  cssMode: true,
  effect: 'fade',
});

let swiperThumbs = new Swiper(".gallery-thumbs", {
  loop: true,
  loopedSlides: 5,
  slidesPerView: 3,
  centeredSlides: true,
  slideToClickedSlide: true,

  pagination: {
    el: ".swiper-pagination",
    type: "fraction",
  },
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
});

swiperThumbs.controller.control = swiperCards;

My CSS Code

 .gallery {
  height: 100vh;
  display: grid;
  align-content: center;
  justify-content: center;
}

.gallery__card {
  position: relative;
  width: 228px;
  height: 288px;
  border-radius: 25px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

.gallery__img,
.gallery__card::after,
.gallery__data {
  position: absolute;
}

.gallery__img {
  inset: 0;
  margin: auto;
  transition: transform .3s;
}

.gallery__button {
  padding: 12px 20px;
  border-radius: 25px;
  margin-left: 60%;
  width: 100%;
  cursor: pointer;
  border: none;
  margin-bottom: 20px;
  z-index: 15;
}

.gallery__button:hover {
  background-color: #074bb1;
  color: white;
  transition: .6s;
}

.gallery__button-pink {
  padding: 12px 20px;
  border-radius: 25px;
  margin-left: 60%;
  width: 100%;
  cursor: pointer;
  border: none;
  margin-bottom: 20px;
  z-index: 15;
}

.gallery__button-pink:hover {
  background-color: #ff66c4;
  color: white;
  transition: .6s;
}

.gallery__card::after {
  content: '';
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, hsla(0, 0%, 100%, 0) 32%, hsla(0, 0%, 0%, .3) 100%);
  top: 0;
  z-index: 1;
}

.gallery__data {
  bottom: 1.5rem;
  left: 1.75rem;
  z-index: 10;
}

.gallery__title,
.gallery__subtitle {
  color: #fff;
  font-weight: 500;
}

.gallery__title {
  font-size: 1rem;
}

.gallery__subtitle {
  font-size: .75rem;
}

.gallery__overflow {
  position: relative;
}

.gallery__thumbnail {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 1.5rem;
  overflow: hidden;
  cursor: pointer;
  margin-left: auto;
  margin-right: auto;
  transition: transform .3s;
}

.gallery__thumbnail-img {
  position: absolute;
  inset: 0;
  margin: auto;
}

/* Swiper class */

.gallery-cards,
.gallery-thumbs {
  width: 260px;
}

.gallery-cards:hover .gallery__img {
  transform: scale(1.1);
}

.gallery .swiper-wrapper {
  padding: 2.5rem 0;
}

.gallery-thumbs {
  height: 132px;
}

/* Active thumbnail */

.swiper-slide-active .gallery__thumbnail {
  transform: translateY(-1.25rem) scale(1.2);
}

/* Rotate thumbnail */

.swiper-slide-next .gallery__thumbnail {
  transform: rotate(15deg);
}

.swiper-slide-prev .gallery__thumbnail {
  transform: rotate(-15deg);
}

/* Sliding numbers */

.swiper-pagination-fraction {
  font-size: .813rem;
  letter-spacing: -1px;
  font-weight: 500;
  color: hsl(30, 16%, 50%);
  bottom: 0;
}

/* Arrow buttons */

.swiper-button-next::after,
.swiper-button-prev::after {
  content: '';
}

.swiper-button-next,
.swiper-button-prev {
  font-size: 1.5rem;
  color: hsl(30, 8%, 15%);
  top: 5.5rem;
}

.swiper-button-next {
  right: -1.5rem;
  transform: rotate(15deg);
}

.swiper-button-prev {
  left: -1.5rem;
  transform: rotate(-15deg);
}

/* Other swiper settings */

.gallery-cards::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.swiper-horizontal.swiper-css-mode>.swiper-wrapper {
  scroll-snap-type: initial;
}

/*=============== BREAKPOINTS ===============*/

/* For small devices */

@media screen and (max-width: 320px) {
  .swiper-button-next,
  .swiper-button-prev {
    display: none;
  }
}

/* For medium devices */

@media screen and (min-width: 1024px) {
  .gallery__card {
    width: 290px;
    height: 370px;
  }
  .gallery__thumbnail {
    width: 65px;
    height: 65px;
  }
  .gallery-cards,
  .gallery-thumbs {
    width: 290px;
  }
}

My HTML Code

       <button class="gallery__button">More Info</button>


问:
QML images are not loaded, but everything works in the QT Designer
I have a problem.
Set: QT Creator 9.01 and QT 6.4
I'm creating an empty project Quick QT Application
I use the Build System - Cmake

The project has only a Window with dimensions and an image as a background.
Here is my Code:

```<code>import QtQuick 2.6

Window {
    width: 375
    height: 812
    visible: true
    color: "#28333f"
    title: qsTr("Hello World")

    Image {
        id: background
        anchors.fill: parent
        source: "images/background.svg"
        fillMode: Image.PreserveAspectFit
    }
}

</code>```

When I launch the application I get an error
QML Image: Unable to open: qrc:/background.svg

But at the same time, if I open this project in designer mode, I see that the image is inserted correctly, it is present and there are no errors.
Here is a screenshot.
enter image description here

After Googling and reading the forums, I created a res resource file.qrc to which I added the prefix / and add image file.
In the code, I change the path to the image file to this:
source: "/images/background.svg"
^^

And then when I start the project, everything works correctly for me and an image appears.
But another problem arises.
If you switch to Designer mode. All images disappear

How to win it ?

Body:
I have a problem.
Set: QT Creator 9.01 and QT 6.4
I'm creating an empty project Quick QT Application
I use the Build System - Cmake

The project has only a Window with dimensions and an image as a background.
Here is my Code:

import QtQuick 2.6

Window {
    width: 375
    height: 812
    visible: true
    color: "#28333f"
    title: qsTr("Hello World")

    Image {
        id: background
        anchors.fill: parent
        source: "images/background.svg"
        fillMode: Image.PreserveAspectFit
    }
}

When I launch the application I get an error
QML Image: Unable to open: qrc:/background.svg

But at the same time, if I open this project in designer mode, I see that the image is inserted correctly, it is present and there are no errors.
Here is a screenshot.
enter image description here

After Googling and reading the forums, I created a res resource file.qrc to which I added the prefix / and add image file.
In the code, I change the path to the image file to this:
source: "/images/background.svg"
^^

And then when I start the project, everything works correctly for me and an image appears.
But another problem arises.
If you switch to Designer mode. All images disappear

How to win it ?


问:
Getting Null from value using IOptionSnapshot<T>
I'm trying to implement Azure App Configuration to my Application that uses the ASP.NET Boilerplate Framework. I'm following this tutorial but when I try to access my settings everything comes null. When the Startup.cs get executed I can see the values in the constructor but  when I try to get them else where I get the null.

Program.cs:

```<code>    public class Program
    {
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args)
        {
            return WebHost.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration((config) =>
                {
                    // Retrieve the connection string
                    IConfiguration settings = config.Build();
                    string connectionString = settings.GetConnectionString("AppConfig");
                    // Load configuration from Azure App Configuration
                    config.AddAzureAppConfiguration(options =>
                    {
                        options.Connect(connectionString)
                               // Load all keys that start with `TestApp:` and have no label
                               .Select("TestApp:*", LabelFilter.Null)
                               // Configure to reload configuration if the registered sentinel key is modified
                               .ConfigureRefresh(refreshOptions => refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true));

                    }).Build();
                })
                .UseStartup<Startup>()
                .Build();
        }
    }
</code>```

Startup.cs:

```<code>  public class Startup
    {
        private const string _defaultCorsPolicyName = "localhost";

        private const string _apiVersion = "v1";

        public IConfigurationRoot _appConfiguration;

        public IConfiguration Configuration { get; }

        public Startup(IWebHostEnvironment env, IConfiguration configuration)
        {
            _appConfiguration = env.GetAppConfiguration();
            Configuration = configuration; //Azure App Configuration
        }

        public IServiceProvider ConfigureServices(IServiceCollection services)
        {

            //MVC
            services.AddControllersWithViews(
                options =>
                {
                    options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
                }
            ).AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ContractResolver = new AbpMvcContractResolver(IocManager.Instance)
                {
                    NamingStrategy = new CamelCaseNamingStrategy()
                };
            });

            IdentityRegistrar.Register(services);
            AuthConfigurer.Configure(services, _appConfiguration);

            services.AddSignalR();

            // Configure CORS for angular2 UI
            services.AddCors(
                options => options.AddPolicy(
                    _defaultCorsPolicyName,
                    builder => builder
                        .WithOrigins(
                            // App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
                            _appConfiguration["App:CorsOrigins"]
                                .Split(",", StringSplitOptions.RemoveEmptyEntries)
                                .Select(o => o.RemovePostFix("/"))
                                .ToArray()
                        )
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials()
                )
            );

                options.DocInclusionPredicate((docName, description) => true);

                // Define the BearerAuth scheme that's in use
                options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
                {
                    Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
                    Name = "Authorization",
                    In = ParameterLocation.Header,
                    Type = SecuritySchemeType.ApiKey
                });
            });

            services.AddAzureAppConfiguration();
            // Bind configuration "TestApp:Settings" section to the Settings object
            services.AddOptions();
            services.Configure<Settings>(Configuration.GetSection("TestApp:Settings"));

            // Configure Abp and Dependency Injection
            return services.AddAbp<RptWebHostModule>(
                // Configure Log4Net logging
                options => options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig("log4net.config")
                )
            );
        }

        public void Configure(IApplicationBuilder app,  ILoggerFactory loggerFactory)
        {
            app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework.

            app.UseCors(_defaultCorsPolicyName); // Enable CORS!

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();

            app.UseAbpRequestLocalization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHub<AbpCommonHub>("/signalr");
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
            });

                options.IndexStream = () => Assembly.GetExecutingAssembly()
                options.DisplayRequestDuration(); // Controls the display of the request duration (in milliseconds) for "Try it out" requests.
            });
            // Use Azure App Configuration middleware for dynamic configuration refresh.
            app.UseAzureAppConfiguration();
        }
    }
</code>```

Custom Controller where I get the null values:

```<code>   [Route("api/[controller]/[action]")]
    public class AzureAppConfigTest : AbpControllerBase
    {
        public Settings _settings { get; }

        public AzureAppConfigTest(IOptionsSnapshot<Settings> options
)
        {
            _settings = options.Value;
        }
        [HttpPost]
        public string Test()
        {
            return _settings.Message; // The Problem is here
        }

    }
</code>```

I need to get the values else where in the Application, I tried changing IOptionsSnapshot for IOptions but I can't make it work, Iv'e been stuck with this about two week but since I'm new in the Microsoft world I can't see clearly where the problem is, Thanks in Advance

Update:

I am able to use the configuration at the Presentation Layer, but If I try to use it on the Application layer I don't get the values.

Body:
I'm trying to implement Azure App Configuration to my Application that uses the ASP.NET Boilerplate Framework. I'm following this tutorial but when I try to access my settings everything comes null. When the Startup.cs get executed I can see the values in the constructor but  when I try to get them else where I get the null.

Program.cs:

    public class Program
    {
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args)
        {
            return WebHost.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration((config) =>
                {
                    // Retrieve the connection string
                    IConfiguration settings = config.Build();
                    string connectionString = settings.GetConnectionString("AppConfig");
                    // Load configuration from Azure App Configuration
                    config.AddAzureAppConfiguration(options =>
                    {
                        options.Connect(connectionString)
                               // Load all keys that start with `TestApp:` and have no label
                               .Select("TestApp:*", LabelFilter.Null)
                               // Configure to reload configuration if the registered sentinel key is modified
                               .ConfigureRefresh(refreshOptions => refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true));

                    }).Build();
                })
                .UseStartup<Startup>()
                .Build();
        }
    }

Startup.cs:

  public class Startup
    {
        private const string _defaultCorsPolicyName = "localhost";

        private const string _apiVersion = "v1";

        public IConfigurationRoot _appConfiguration;

        public IConfiguration Configuration { get; }

        public Startup(IWebHostEnvironment env, IConfiguration configuration)
        {
            _appConfiguration = env.GetAppConfiguration();
            Configuration = configuration; //Azure App Configuration
        }

        public IServiceProvider ConfigureServices(IServiceCollection services)
        {

            //MVC
            services.AddControllersWithViews(
                options =>
                {
                    options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
                }
            ).AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ContractResolver = new AbpMvcContractResolver(IocManager.Instance)
                {
                    NamingStrategy = new CamelCaseNamingStrategy()
                };
            });

            IdentityRegistrar.Register(services);
            AuthConfigurer.Configure(services, _appConfiguration);

            services.AddSignalR();

            // Configure CORS for angular2 UI
            services.AddCors(
                options => options.AddPolicy(
                    _defaultCorsPolicyName,
                    builder => builder
                        .WithOrigins(
                            // App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
                            _appConfiguration["App:CorsOrigins"]
                                .Split(",", StringSplitOptions.RemoveEmptyEntries)
                                .Select(o => o.RemovePostFix("/"))
                                .ToArray()
                        )
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials()
                )
            );

                options.DocInclusionPredicate((docName, description) => true);

                // Define the BearerAuth scheme that's in use
                options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
                {
                    Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
                    Name = "Authorization",
                    In = ParameterLocation.Header,
                    Type = SecuritySchemeType.ApiKey
                });
            });

            services.AddAzureAppConfiguration();
            // Bind configuration "TestApp:Settings" section to the Settings object
            services.AddOptions();
            services.Configure<Settings>(Configuration.GetSection("TestApp:Settings"));

            // Configure Abp and Dependency Injection
            return services.AddAbp<RptWebHostModule>(
                // Configure Log4Net logging
                options => options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig("log4net.config")
                )
            );
        }

        public void Configure(IApplicationBuilder app,  ILoggerFactory loggerFactory)
        {
            app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework.

            app.UseCors(_defaultCorsPolicyName); // Enable CORS!

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();

            app.UseAbpRequestLocalization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHub<AbpCommonHub>("/signalr");
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
            });

                options.IndexStream = () => Assembly.GetExecutingAssembly()
                options.DisplayRequestDuration(); // Controls the display of the request duration (in milliseconds) for "Try it out" requests.
            });
            // Use Azure App Configuration middleware for dynamic configuration refresh.
            app.UseAzureAppConfiguration();
        }
    }

Custom Controller where I get the null values:

   [Route("api/[controller]/[action]")]
    public class AzureAppConfigTest : AbpControllerBase
    {
        public Settings _settings { get; }

        public AzureAppConfigTest(IOptionsSnapshot<Settings> options
)
        {
            _settings = options.Value;
        }
        [HttpPost]
        public string Test()
        {
            return _settings.Message; // The Problem is here
        }

    }

I need to get the values else where in the Application, I tried changing IOptionsSnapshot for IOptions but I can't make it work, Iv'e been stuck with this about two week but since I'm new in the Microsoft world I can't see clearly where the problem is, Thanks in Advance

Update:

I am able to use the configuration at the Presentation Layer, but If I try to use it on the Application layer I don't get the values.


问:
Cypress run fail show gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported
enter image description herei run cypress on github actions, but after open cypress, will show
Opening Cypress...
[2687:1227/141010.802368:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

and  can not run all case, because  CypressError: cy.visit() failed trying to load:
and i check video, found it have no send ip to brower, how i can fix it?

my yml like this:

```<code>integration_testing_portal_edge:
    name: Testing EDGE Portal
    runs-on: ubuntu-20.04
    needs: [deploy_edge_service]
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Install node
        uses: actions/setup-node@v3
        with:
            node:version: '16'

      - name: Install dependencies
        working-directory: ./integration_test/NetProbe_E2E/cypress
        run: |
            npm ci
            npm i -D cypress
            npm i -D @cypress/grep
            npm install -D @cypress/xpath
            npm i -D cypress-wait-until
            npm i --save-dev cypress-mochawesome-reporter

      - name: Cypress run
        working-directory: ./integration_test/NetProbe_E2E/cypress
        run: npx cypress run --env grepTags="@trap @probe"
</code>```

actions result show:

```<code>  Running:  Configuration/TC6_1_10.cy.js                                                   (1 of 27)

  TC6_1_10 忘記密碼測試
    1) "before all" hook: Login,新增一個測試帳號, 權限為admin for "不輸入任何資訊點選取消以及確認"
    2) "after all" hook: 刪除測試帳號 for "不輸入任何資訊點選取消以及確認"

  0 passing (31s)
  2 failing

  1) TC6_1_10 忘記密碼測試
       "before all" hook: Login,新增一個測試帳號, 權限為admin for "不輸入任何資訊點選取消以及確認":
     CypressError: `cy.visit()` failed trying to load:

https://192.168.11.96:9999/Edge

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: ETIMEDOUT

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer

</code>```

Body:
enter image description herei run cypress on github actions, but after open cypress, will show
Opening Cypress...
[2687:1227/141010.802368:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

and  can not run all case, because  CypressError: cy.visit() failed trying to load:
and i check video, found it have no send ip to brower, how i can fix it?

my yml like this:

integration_testing_portal_edge:
    name: Testing EDGE Portal
    runs-on: ubuntu-20.04
    needs: [deploy_edge_service]
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Install node
        uses: actions/setup-node@v3
        with:
            node:version: '16'

      - name: Install dependencies
        working-directory: ./integration_test/NetProbe_E2E/cypress
        run: |
            npm ci
            npm i -D cypress
            npm i -D @cypress/grep
            npm install -D @cypress/xpath
            npm i -D cypress-wait-until
            npm i --save-dev cypress-mochawesome-reporter

      - name: Cypress run
        working-directory: ./integration_test/NetProbe_E2E/cypress
        run: npx cypress run --env grepTags="@trap @probe"

actions result show:

  Running:  Configuration/TC6_1_10.cy.js                                                   (1 of 27)

  TC6_1_10 忘記密碼測試
    1) "before all" hook: Login,新增一個測試帳號, 權限為admin for "不輸入任何資訊點選取消以及確認"
    2) "after all" hook: 刪除測試帳號 for "不輸入任何資訊點選取消以及確認"

  0 passing (31s)
  2 failing

  1) TC6_1_10 忘記密碼測試
       "before all" hook: Login,新增一個測試帳號, 權限為admin for "不輸入任何資訊點選取消以及確認":
     CypressError: `cy.visit()` failed trying to load:

https://192.168.11.96:9999/Edge

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: ETIMEDOUT

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer


问:
App Script authorizations associated with Google Sheets
I have managed to incorporate an app into a Google sheet I was able to copy from a tutorial video. The app provides a Custom Menu in the sheet that allows a user to conduct a search of content across the sheet.

The sheet, with editor access and Custom Menu showing, is available here:

https://docs.google.com/spreadsheets/d/1fl2B9yrZA75Vm5KwVsLsZ4K2_GUYO35LQLYxDcSoauY/edit?usp=share_link

and it works fine even if I may do some more formatting.

The sheet is available via the Search Test button near bottom right on this page:

https://www.victoriasforestryheritage.org.au/resources/records.html

but, as you will see, I am unable to set authorizations in the back end so that any user on the front end can access the sheet with the custom menu showing so they can search the data. The link above shows the sheet, but without the Custom Menu.(The custom Menu appears to work if I prove Editor access, but obviously I do not wish to do that)

The use of Apps Script is totally new to me, and I have searched widely for help, but obviously have found no solution. I read  what I think are the relevant Google documents but I simply do not have the depth of understanding to interpret them.

In summary, I wish any user of the website to be able to access a linked google sheet and be able to search that sheet using the Apps Script created Custom Menu .

I am functional with HTML and CSS and just beginning to try and learn some JavaScript. In other words you are corresponding with a relative novice.

I have tried different file access levels as indicated above, I have looked through Apps Script authorization process but frankly I have trouble understanding how and where the Script links to the sheet.

Any help would be much appreciated.

Richard


问:
Spanish Dictionary Download
I want to download all the words in Spanish from A-Z. No definitions or any of that, just the words.

When I search "download Spanish dictionary" I just get either an English to Spanish dictionary or some app that has the words.

Title: Spanish Dictionary Download


问:
APP crashing on realme , oppo and oneplus Phones
Here are Crash details from Crashes and ANRs

com.$$$$$$.fieldforce.activity.ProvisioningScreenActivity.lambda$getAccountDetails$3$ProvisioningScreenActivity

java.lang.NullPointerException

```<code>Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
  at android.widget.ArrayAdapter.createViewFromResource (ArrayAdapter.java:454)
  at android.widget.ArrayAdapter.getDropDownView (ArrayAdapter.java:502)
  at androidx.appcompat.widget.AppCompatSpinner$DropDownAdapter.getDropDownView (AppCompatSpinner.java:756)
  at androidx.appcompat.widget.AppCompatSpinner$DropDownAdapter.getView (AppCompatSpinner.java:750)
  at androidx.appcompat.widget.AppCompatSpinner.compatMeasureContentWidth (AppCompatSpinner.java:590)
  at androidx.appcompat.widget.AppCompatSpinner$DropdownPopup.computeContentWidth (AppCompatSpinner.java:1026)
  at androidx.appcompat.widget.AppCompatSpinner$DropdownPopup.show (AppCompatSpinner.java:1053)
  at androidx.appcompat.widget.AppCompatSpinner.showPopup (AppCompatSpinner.java:616)
  at androidx.appcompat.widget.AppCompatSpinner.performClick (AppCompatSpinner.java:460)
  at com.$$$$$$$.fieldforce.activity.ProvisioningScreenActivity.lambda$getAccountDetails$3$ProvisioningScreenActivity (ProvisioningScreenActivity.java:230)
  at com.$$$$$$$.fieldforce.activity.-$$Lambda$ProvisioningScreenActivity$YnrGP_9DLrME_v-i79em930emIg.onClick
  at android.view.View.performClick (View.java:7558)
  at android.view.View.performClickInternal (View.java:7534)
  at android.view.View.-$$Nest$mperformClickInternal
  at android.view.View$PerformClick.run (View.java:29652)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:240)
  at android.os.Looper.loop (Looper.java:351)
  at android.app.ActivityThread.main (ActivityThread.java:8355)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:584)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1013)
</code>```

App is crashing on clicking the Model spinner.

I'm not able to fix it because its working fine on my Samsung

this is the function which causing the problem

```<code>public void getAccountDetails() {

    try {
        binding.tvModel.setOnClickListener(v -> binding.spModel.performClick());
        binding.spModel.setOnItemSelectedListener(this);
        inAnimation = new AlphaAnimation(0f, 1f);
        inAnimation.setDuration(200);
        binding.progressLayout.progressOverlay.setAnimation(inAnimation);
        binding.progressLayout.progressOverlay.setVisibility(View.VISIBLE);
        AccountInfoRequest accountInfoRequest = new AccountInfoRequest();
        accountInfoRequest.setAuthkey(Constants.AUTH_KEY);
        accountInfoRequest.setAction(Constants.GET_ACCOUNT_DETAILS);
        accountInfoRequest.setCanId(strCanId);
        ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class);
        Call<AccountDetailsResponse> call = apiService.getAccountDetails(accountInfoRequest);
        call.enqueue(new Callback<AccountDetailsResponse>() {
            @Override
            `public void onResponse(Call<AccountDetailsResponse> call,  Response<AccountDetailsResponse> response)` {
                if (response.isSuccessful() && response.body() != null) {
                    outAnimation = new AlphaAnimation(1f, 0f);
                    outAnimation.setDuration(200);
                    binding.progressLayout.progressOverlay.setAnimation(outAnimation);
                    binding.progressLayout.progressOverlay.setVisibility(View.GONE);

                    if (response.body().getStatus().equals("Success")) {
                        try {
                            binding.setResponse(response.body().getResponse().data);
                            `if(response.body().getResponse().data.onuProfile!=null||response.body().getResponse().data.onuProfile.size()!=0) {`
                                `onuProfile = response.body().getResponse().getData().getOnuProfile();`
                            }
                            `if(response.body().getResponse().data.towerDetail!=null||response.body().getResponse().data.towerDetail.size()!=0) {`
                               ` strTowerId = response.body().getResponse().getData().getTowerDetail().get(0).getTowerId();`
                                `strSplitterId = response.body().getResponse().getData().getTowerDetail().get(0).getServingDB();`
                            }
                            modelName = new ArrayList<>();
                            modelId = new ArrayList<>();
                            modelName.add("Select Model Name");
                            for (AccountDetailsResponse.OnuProfile onuProfile : onuProfile)
                                modelName.add(onuProfile.getModelName());
                            for (AccountDetailsResponse.OnuProfile id : onuProfile)
                                modelId.add(id.getProfileName());
                            if(modelName!=null) {
                               ` ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(ProvisioningScreenActivity.this, android.R.layout.simple_spinner_item, modelName);`
                                `adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);`
                                binding.spModel.setAdapter(adapter1);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if (response.body().getStatus().equals("Failure")) {
                        `Toast.makeText(ProvisioningScreenActivity.this, response.body().getResponse().getMessage(), Toast.LENGTH_LONG).show();`
                        nextScreen();
                    }
                }

            }

            @Override
            public void onFailure(Call<AccountDetailsResponse> call, Throwable t) {
                binding.progressLayout.progressOverlay.setVisibility(View.GONE);
                Log.e("RetroError", t.toString());
            }
        });
    }catch (Exception ex){
        ex.getMessage();
    }
}
</code>```
```<code>@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if(parent.getId() == R.id.sp_model){
        binding.tvModel.setText(modelName.get(position));
        if (position != 0) strModel = "" + modelId.get(position - 1);
        else strModel = " ";
        binding.tvProfileName.setText(strModel);

    }
}
</code>```

this screenshot of above code and line 230 is highlighted

Body:
Here are Crash details from Crashes and ANRs

com.$$$$$$.fieldforce.activity.ProvisioningScreenActivity.lambda$getAccountDetails$3$ProvisioningScreenActivity

java.lang.NullPointerException

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
  at android.widget.ArrayAdapter.createViewFromResource (ArrayAdapter.java:454)
  at android.widget.ArrayAdapter.getDropDownView (ArrayAdapter.java:502)
  at androidx.appcompat.widget.AppCompatSpinner$DropDownAdapter.getDropDownView (AppCompatSpinner.java:756)
  at androidx.appcompat.widget.AppCompatSpinner$DropDownAdapter.getView (AppCompatSpinner.java:750)
  at androidx.appcompat.widget.AppCompatSpinner.compatMeasureContentWidth (AppCompatSpinner.java:590)
  at androidx.appcompat.widget.AppCompatSpinner$DropdownPopup.computeContentWidth (AppCompatSpinner.java:1026)
  at androidx.appcompat.widget.AppCompatSpinner$DropdownPopup.show (AppCompatSpinner.java:1053)
  at androidx.appcompat.widget.AppCompatSpinner.showPopup (AppCompatSpinner.java:616)
  at androidx.appcompat.widget.AppCompatSpinner.performClick (AppCompatSpinner.java:460)
  at com.$$$$$$$.fieldforce.activity.ProvisioningScreenActivity.lambda$getAccountDetails$3$ProvisioningScreenActivity (ProvisioningScreenActivity.java:230)
  at com.$$$$$$$.fieldforce.activity.-$$Lambda$ProvisioningScreenActivity$YnrGP_9DLrME_v-i79em930emIg.onClick
  at android.view.View.performClick (View.java:7558)
  at android.view.View.performClickInternal (View.java:7534)
  at android.view.View.-$$Nest$mperformClickInternal
  at android.view.View$PerformClick.run (View.java:29652)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:240)
  at android.os.Looper.loop (Looper.java:351)
  at android.app.ActivityThread.main (ActivityThread.java:8355)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:584)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1013)

App is crashing on clicking the Model spinner.

I'm not able to fix it because its working fine on my Samsung

this is the function which causing the problem

public void getAccountDetails() {

    try {
        binding.tvModel.setOnClickListener(v -> binding.spModel.performClick());
        binding.spModel.setOnItemSelectedListener(this);
        inAnimation = new AlphaAnimation(0f, 1f);
        inAnimation.setDuration(200);
        binding.progressLayout.progressOverlay.setAnimation(inAnimation);
        binding.progressLayout.progressOverlay.setVisibility(View.VISIBLE);
        AccountInfoRequest accountInfoRequest = new AccountInfoRequest();
        accountInfoRequest.setAuthkey(Constants.AUTH_KEY);
        accountInfoRequest.setAction(Constants.GET_ACCOUNT_DETAILS);
        accountInfoRequest.setCanId(strCanId);
        ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class);
        Call<AccountDetailsResponse> call = apiService.getAccountDetails(accountInfoRequest);
        call.enqueue(new Callback<AccountDetailsResponse>() {
            @Override
            `public void onResponse(Call<AccountDetailsResponse> call,  Response<AccountDetailsResponse> response)` {
                if (response.isSuccessful() && response.body() != null) {
                    outAnimation = new AlphaAnimation(1f, 0f);
                    outAnimation.setDuration(200);
                    binding.progressLayout.progressOverlay.setAnimation(outAnimation);
                    binding.progressLayout.progressOverlay.setVisibility(View.GONE);

                    if (response.body().getStatus().equals("Success")) {
                        try {
                            binding.setResponse(response.body().getResponse().data);
                            `if(response.body().getResponse().data.onuProfile!=null||response.body().getResponse().data.onuProfile.size()!=0) {`
                                `onuProfile = response.body().getResponse().getData().getOnuProfile();`
                            }
                            `if(response.body().getResponse().data.towerDetail!=null||response.body().getResponse().data.towerDetail.size()!=0) {`
                               ` strTowerId = response.body().getResponse().getData().getTowerDetail().get(0).getTowerId();`
                                `strSplitterId = response.body().getResponse().getData().getTowerDetail().get(0).getServingDB();`
                            }
                            modelName = new ArrayList<>();
                            modelId = new ArrayList<>();
                            modelName.add("Select Model Name");
                            for (AccountDetailsResponse.OnuProfile onuProfile : onuProfile)
                                modelName.add(onuProfile.getModelName());
                            for (AccountDetailsResponse.OnuProfile id : onuProfile)
                                modelId.add(id.getProfileName());
                            if(modelName!=null) {
                               ` ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(ProvisioningScreenActivity.this, android.R.layout.simple_spinner_item, modelName);`
                                `adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);`
                                binding.spModel.setAdapter(adapter1);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if (response.body().getStatus().equals("Failure")) {
                        `Toast.makeText(ProvisioningScreenActivity.this, response.body().getResponse().getMessage(), Toast.LENGTH_LONG).show();`
                        nextScreen();
                    }
                }

            }

            @Override
            public void onFailure(Call<AccountDetailsResponse> call, Throwable t) {
                binding.progressLayout.progressOverlay.setVisibility(View.GONE);
                Log.e("RetroError", t.toString());
            }
        });
    }catch (Exception ex){
        ex.getMessage();
    }
}

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if(parent.getId() == R.id.sp_model){
        binding.tvModel.setText(modelName.get(position));
        if (position != 0) strModel = "" + modelId.get(position - 1);
        else strModel = " ";
        binding.tvProfileName.setText(strModel);

    }
}

this screenshot of above code and line 230 is highlighted


问:
tf.strings.operations raises TypeError: Value passed to parameter 'input' has DataType string not in list of allowed
I'm trying to create a superficial layer to pre-process data inside models. Here is an my Layer:

```<code>class StringLayer(tf.keras.layers.Layer):
  def __init__(self):
    super(StringLayer, self).__init__()

  def call(self, inputs):
    return tf.strings.join([some_python_function(word) for word in tf.strings.split(tf.strings.as_string(inputs), sep=" " )], separator=" ")

#model = tf.keras.models.Sequential()
#model.add(tf.keras.Input(shape=(1,), dtype=tf.string))
#model.add(StringLayer())
</code>```

But it keeps giving me: TypeError: Value passed to parameter 'input' has DataType string not in list of allowed values: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, float16, uint32, uint64, complex64, complex128, bool, variant

I know I can do this thing out of the model, but my main goal is to somehow do this inside the model; this way, I'll be able to maximize the GPU utilization.

Body:
I'm trying to create a superficial layer to pre-process data inside models. Here is an my Layer:

class StringLayer(tf.keras.layers.Layer):
  def __init__(self):
    super(StringLayer, self).__init__()

  def call(self, inputs):
    return tf.strings.join([some_python_function(word) for word in tf.strings.split(tf.strings.as_string(inputs), sep=" " )], separator=" ")

#model = tf.keras.models.Sequential()
#model.add(tf.keras.Input(shape=(1,), dtype=tf.string))
#model.add(StringLayer())

But it keeps giving me: TypeError: Value passed to parameter 'input' has DataType string not in list of allowed values: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, float16, uint32, uint64, complex64, complex128, bool, variant

I know I can do this thing out of the model, but my main goal is to somehow do this inside the model; this way, I'll be able to maximize the GPU utilization.


问:
How to be more declarative in React when grabbing data from an input field?
I wrote the following React component earlier today and I can't help but wonder if the way I'm using onSubmit is optimized. It feels wrong -- more like imperative design vs. a more declarative approach.

Should I use useRef here (in the setReduxCounter) method, or should I use a different approach?

```<code>import { FormEvent, useEffect, useState, useRef } from "react";
import { useDispatch } from "react-redux";
import { set } from "../redux/actions";

function CounterForm({ reduxCount }: { reduxCount: number }) {
  const dispatch = useDispatch();
  const ctrRef = useRef<HTMLInputElement>(null);

  const [formCount, setFormCount] = useState<string>("0");

  const inputFocus = () => {
    if (ctrRef.current) {
      ctrRef.current.focus();
    }
  };

  useEffect(() => {
    inputFocus();

    setFormCount(String(reduxCount));
  }, [reduxCount]);

  const setReduxCounter = (e: FormEvent<HTMLFormElement>) => {
    e.preventDefault();

    if (ctrRef.current) {
      const value = parseInt(ctrRef.current.value, 10);

      if (isNaN(+ctrRef.current.value)) {
        dispatch(set(0));
      } else {
        dispatch(set(+ctrRef.current.value));
      }

      inputFocus();
    }
  };

  return (
    <div className="flex flex-col mt-2 mb-2">
      <div className="flex flex-col justify-center items-center mb-2">
        Set Count
      </div>
      <form
        className="flex flex-col justify-center items-center"
        onSubmit={(e) => setReduxCounter(e)}
      >
        <input
          ref={ctrRef}
          className="input flex-1 w-1/2"
          type="text"
          onChange={(e) => {
            // e.target.value is of type "string"
            setFormCount(e.target.value);
          }}
          value={formCount}
        />
        <input className="btn flex-1" type="submit" />
      </form>
    </div>
  );
}

export default CounterForm;
</code>```

Body:
I wrote the following React component earlier today and I can't help but wonder if the way I'm using onSubmit is optimized. It feels wrong -- more like imperative design vs. a more declarative approach.

Should I use useRef here (in the setReduxCounter) method, or should I use a different approach?

import { FormEvent, useEffect, useState, useRef } from "react";
import { useDispatch } from "react-redux";
import { set } from "../redux/actions";

function CounterForm({ reduxCount }: { reduxCount: number }) {
  const dispatch = useDispatch();
  const ctrRef = useRef<HTMLInputElement>(null);

  const [formCount, setFormCount] = useState<string>("0");

  const inputFocus = () => {
    if (ctrRef.current) {
      ctrRef.current.focus();
    }
  };

  useEffect(() => {
    inputFocus();

    setFormCount(String(reduxCount));
  }, [reduxCount]);

  const setReduxCounter = (e: FormEvent<HTMLFormElement>) => {
    e.preventDefault();

    if (ctrRef.current) {
      const value = parseInt(ctrRef.current.value, 10);

      if (isNaN(+ctrRef.current.value)) {
        dispatch(set(0));
      } else {
        dispatch(set(+ctrRef.current.value));
      }

      inputFocus();
    }
  };

  return (

        Set Count

      <form
        className="flex flex-col justify-center items-center"
        onSubmit={(e) => setReduxCounter(e)}
      >
        <input
          ref={ctrRef}
          className="input flex-1 w-1/2"
          type="text"
          onChange={(e) => {
            // e.target.value is of type "string"
            setFormCount(e.target.value);
          }}
          value={formCount}
        />
        <input className="btn flex-1" type="submit" />
      </form>

  );
}

export default CounterForm;


问:
Bold Terminal window title using zsh using xterm-kitty
I have been able to change the terminal title using the following code in ~/.zshrc. I do not really understand escape sequences.
The code is:

```<code>precmd () {echo -ne "\033]0;${PWD/#$HOME/~}\007"}

</code>```

I do not know what exactly \033]0; and \007 is doing in the string. I tried googling the code but nothing comes up that is of relevance. I want to understand what it does. I also want to make the text bold.

In my attempt to make it bold, I visited the webpage: https://misc.flogisoft.com/bash/tip_colors_and_formatting

Where I found out the escape sequence to make it bold is \e[1m:

```<code>echo -e "Normal \e[1mBold \e[21mNormal"
</code>```

So, I tried the following:

```<code>precmd () {echo -ne "\033]0;\e[1m${PWD/#$HOME/~}\e[21m\007"}

</code>```

but it did not make the characters bold. I assumed that \003]0; sets the position of printing so I kept it.

Body:
I have been able to change the terminal title using the following code in ~/.zshrc. I do not really understand escape sequences.
The code is:

precmd () {echo -ne "\033]0;${PWD/#$HOME/~}\007"}

I do not know what exactly \033]0; and \007 is doing in the string. I tried googling the code but nothing comes up that is of relevance. I want to understand what it does. I also want to make the text bold.

In my attempt to make it bold, I visited the webpage: https://misc.flogisoft.com/bash/tip_colors_and_formatting

Where I found out the escape sequence to make it bold is \e[1m:

echo -e "Normal \e[1mBold \e[21mNormal"

So, I tried the following:

precmd () {echo -ne "\033]0;\e[1m${PWD/#$HOME/~}\e[21m\007"}

but it did not make the characters bold. I assumed that \003]0; sets the position of printing so I kept it.


问:
Pytesseract missing characters in black and white image
I have used pytesseract in the past and it has always worked perfeclty however I am running into quite a few problems with it now. I give it images like:
Binarized text ATE
Binarized text TOG

With ATE, I end up with the string "BOE" and with TOG it only detects the "OG". I am currently just using the default function:

```<code>letters_top = pytesseract.image_to_string(img)
</code>```

I have tried using different psm configuration as suggested on other questions but to no avail.

Body:
I have used pytesseract in the past and it has always worked perfeclty however I am running into quite a few problems with it now. I give it images like:
Binarized text ATE
Binarized text TOG

With ATE, I end up with the string "BOE" and with TOG it only detects the "OG". I am currently just using the default function:

letters_top = pytesseract.image_to_string(img)

I have tried using different psm configuration as suggested on other questions but to no avail.


问:
How to fix the "No module named 'pygame.base'" error?
I've tried to use my installed pygame module in a script, but got an error "No module named 'pygame.base'". I am using a Mac. My Python version is 3.10.9.

I have searched for solutions available and tried to run pip3 uninstall pygame, pip cache purge, and pip3 install pygame to resolve this issue, but this did not help.

Thank you!


问:
Apply colour to menu and title bar
I would like to change the default colour of menu bar (and title). What would be the right approach?
As I understood, changing title bar color is at the moment not possible window's bar title option TCL/TK are there some workarounds in windows?

I tried without sucess to change the colour of atleast the menu bar. Below is a sample code

```<code>package require Tk

#§§§§§
# Start: Icons
#§§§§§
image create photo Icon_Exit -data {
    iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAFMN540AAAABGdBTUEAAYagMeiWXwAAA8tJ
    REFUSInFl01PG1cUhp87H0YVoMYZ27iVYAHlo2LTSpSEdFFIpULFRxYhP6C/IV11ESVZ5G9U
    lbozrVSgLaYL3A0xKVIjRbQBGioRBRuPjasAauJh5mYx2MT22GMgVd+Vfee+57zn3HPPmYEK
    CIDgD7syX3AAUADyBQc5HT1ZABAz6Up2EbGUJJaSfz63pHFz8bYCsD0e5v149sRGx49muVti
    KellzUg+uqO8viCnozwdD8Nr27Xij7XPQohYGgTIG9GSTAFg3Fy87eXCaQokagXjspVvt6XT
    pHs+LIm7YhxvkJTElR4WHOhpVdmdihQDPlG9mi3wZCLC1HK+2uyza210/WySLzioogFBWvDh
    +l2k9EynANC+fiId3ZtdC8GH63c1AEfXqeW6JqSUSuXa4EUdOR3lcjFvtmR7PMzORASccvVa
    JfnBnoWYSdPdqiKno2wd2nTMm26AiqhPRsLTiTABRSBiaQYu6sgbUfriWdb3j3zIQPtcxvUi
    YDXvKqlwWoMsAFG90/E8rHNAGF/+cif/Qe+t05AUy+Loiy6hIWXN8vI1ciaWJ1nCH6OhspsO
    buGEmqr9VJAlLZpgZzICtmthIKizctWgp0X1ISuCjnkTBdi51sZ7LSq/fWowtJRjOWf5kAEE
    ROcy/GtLNsfC9MZNkh5EbzJwydDpbFbZOrRJfGKUQvAld7eoJK+6Urt+MhHHIVQmsYqsCtgY
    C9MXz7pSBbwzlwFgbSxURS6rbVuC9l26XKWAd2d33XoXdchFA9X6PK5UpezTQnOaAgkj+eh0
    LCFEjuKA/CoxrBSskVot9o1BCOEE9KX8veGEBqC8LAznP+y7ddab2SiUlxbB3x9LIHGuXJ9L
    hO8O6dZsQ73TkW4xNbC1rmNVwNpoiKPrUZ5NtdHbqnkble6435lqw74eZW0sVBreZ3JsS+iP
    Z+lZMHGk5PFoiN2piDs8j184BoI6qckI66NhAPriWfoXsrVaRwmeI64MAjYPbNpnM1wKB4gN
    XeD+iMHWoQ1AZ7NK6oXD5aUcK5mCmyafaH0jLoMqWMlZjCT22Dw4orNZpbNZ5e9Dm+Ffc6xk
    LXzze2rHxylNT0b46/MwLZpCb9yke8FEV2B9NFx+BA2gfqodyWAowMzQBdrfclM6tJQjWUwp
    0D6bYSAU4Psr7hGkXjhM38+zbBZq9kt/x0KwsX/EviX5OJljOeu2/7KUqoLVvEXHvMmgofPN
    R2+zcWB7vs2cwjH8Y0n6F7Ol//X2PtizSp8RfgX2v3UuN2IhhGJ5D/w3CcWyQPicwX+NVw59
    Zhn1SGGgAAAAAElFTkSuQmCC
}
image create photo Icon_Resize -data {
    iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAFMN540AAAABGdBTUEAAYagMeiWXwAAAxxJ
    REFUSIntlj1oFEEUx3+7lzuNJzEj2ogflakEScBCC3UQxWhhZ4hgpyBqISjIgoE0Mo3YCQHt
    Dk60S6EBTVxioWUQBEFQVBCUE8fPJN4luxY7k8ztbe5Oo5X+4Zh7b/b/PmbevBloBhGEZd/8
    iY1u0Espsnk9ruwDm12KD+RcO9aoANYD64Ai0AGglRyzdnc5Pl6bsWpNAqw0yldayS1Gl2+a
    ZVuwAfYAFeCTVrJ+BUQQDmQxbWDbzEeb0gsBcEkEYUzMaANdBOE1M9alYZmnm2/Fn4bnxNUD
    9BpxCjgODAMjWsmTIgjLWsljdgSzmwYVYEor+dzIQyIIJ4zhSa3kHqMvWYJL/gR8SUW2hhgP
    jz5HN55FlsBh4Lzx9jLy2fr5spx3UvO0kjUr+9TDcwU/wh4Rz/3ekdvHb5H+Ctx97tdKjjnj
    fpKV3Qk8IzmwABWtpIb6BTueGo+a+X5D7DW/9aQhgrDcKkwRhANut3H3uZT6cBRYbcQpreQF
    krKtZJFHgYIjn/WJuyK8p6nUxoBHUJ9z0fW8yq9+jPCe+vH8dkc9DDzO8lwVQbggTEdQqM10
    VfOd3cA3ox4BbgP3XUcNTbmdzpCu7aYQQVgWQdifFXZL2CZg4VZYVpgF4DtwhMXiKS1cBf9R
    h+U0jlbchklTAneBm7bFA4PAIdMiqiS3rj1CVaCmlSy04rYdpQjCXLtZLIe7kLEIwnipltTK
    gDtvDlHsHiSLlkYaXh00PeYP7UW6FHdJx6bN3wNuaCVPLkXccC4sznQyCfQBb4GNwAOt5D7H
    1nXgBHBAK1nXtLJayDimcNJvnvnYj4q5H8XZKD8+AzuIeVKYm+6q5lcJ4E2GrVPAaWAuPZHl
    WAITwFfgA05zzHlRNBvlNwEdhRrd76/Iz2bqG4uPQ3eJh4GLwF7MBdHMsUVJK3kmrRRB+ArY
    Us0znUVK7WvJOHyW/u6XWv1voJekUTfc5M0y3i2C8CqwwtHNAmutYM7qCPBOKzlkbvthYFQr
    eatZRFmOp4CDQC1jDuAOyUrZgrlNcg1B8lIoAS8cW19wXhD/Ln4CQ7A8G4GVhN4AAAAASUVO
    RK5CYII=
}
#
#§§§§§
# End: Icons
#§§§§§
#§§§§§
# Start: Menu Bar
#§§§§§
menu .menu_bar
. configure -menu .menu_bar
menu .level_0 -tearoff 0
.menu_bar add cascade -menu .level_0 -label "Menu" -underline 0
.level_0 add command -label "Resize App" -command {Resize_Win1} \
-image                 Icon_Resize   -compound left
#
.level_0 add separator
.level_0 add command -label Exit -underline 0 -command {exit} \
-image                 Icon_Exit  -compound left

.menu_bar configure -bg black -activebackground black \
-fg white -activeforeground white ;# effects not visible on GUI
#§§§§§
# End: Menu Bar
#§§§§§
</code>```

Title: Apply colour to menu and title bar

Body:
I would like to change the default colour of menu bar (and title). What would be the right approach?
As I understood, changing title bar color is at the moment not possible window's bar title option TCL/TK are there some workarounds in windows?

I tried without sucess to change the colour of atleast the menu bar. Below is a sample code

package require Tk

#§§§§§
# Start: Icons
#§§§§§
image create photo Icon_Exit -data {
    iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAFMN540AAAABGdBTUEAAYagMeiWXwAAA8tJ
    REFUSInFl01PG1cUhp87H0YVoMYZ27iVYAHlo2LTSpSEdFFIpULFRxYhP6C/IV11ESVZ5G9U
    lbozrVSgLaYL3A0xKVIjRbQBGioRBRuPjasAauJh5mYx2MT22GMgVd+Vfee+57zn3HPPmYEK
    CIDgD7syX3AAUADyBQc5HT1ZABAz6Up2EbGUJJaSfz63pHFz8bYCsD0e5v149sRGx49muVti
    KellzUg+uqO8viCnozwdD8Nr27Xij7XPQohYGgTIG9GSTAFg3Fy87eXCaQokagXjspVvt6XT
    pHs+LIm7YhxvkJTElR4WHOhpVdmdihQDPlG9mi3wZCLC1HK+2uyza210/WySLzioogFBWvDh
    +l2k9EynANC+fiId3ZtdC8GH63c1AEfXqeW6JqSUSuXa4EUdOR3lcjFvtmR7PMzORASccvVa
    JfnBnoWYSdPdqiKno2wd2nTMm26AiqhPRsLTiTABRSBiaQYu6sgbUfriWdb3j3zIQPtcxvUi
    YDXvKqlwWoMsAFG90/E8rHNAGF/+cif/Qe+t05AUy+Loiy6hIWXN8vI1ciaWJ1nCH6OhspsO
    buGEmqr9VJAlLZpgZzICtmthIKizctWgp0X1ISuCjnkTBdi51sZ7LSq/fWowtJRjOWf5kAEE
    ROcy/GtLNsfC9MZNkh5EbzJwydDpbFbZOrRJfGKUQvAld7eoJK+6Urt+MhHHIVQmsYqsCtgY
    C9MXz7pSBbwzlwFgbSxURS6rbVuC9l26XKWAd2d33XoXdchFA9X6PK5UpezTQnOaAgkj+eh0
    LCFEjuKA/CoxrBSskVot9o1BCOEE9KX8veGEBqC8LAznP+y7ddab2SiUlxbB3x9LIHGuXJ9L
    hO8O6dZsQ73TkW4xNbC1rmNVwNpoiKPrUZ5NtdHbqnkble6435lqw74eZW0sVBreZ3JsS+iP
    Z+lZMHGk5PFoiN2piDs8j184BoI6qckI66NhAPriWfoXsrVaRwmeI64MAjYPbNpnM1wKB4gN
    XeD+iMHWoQ1AZ7NK6oXD5aUcK5mCmyafaH0jLoMqWMlZjCT22Dw4orNZpbNZ5e9Dm+Ffc6xk
    LXzze2rHxylNT0b46/MwLZpCb9yke8FEV2B9NFx+BA2gfqodyWAowMzQBdrfclM6tJQjWUwp
    0D6bYSAU4Psr7hGkXjhM38+zbBZq9kt/x0KwsX/EviX5OJljOeu2/7KUqoLVvEXHvMmgofPN
    R2+zcWB7vs2cwjH8Y0n6F7Ol//X2PtizSp8RfgX2v3UuN2IhhGJ5D/w3CcWyQPicwX+NVw59
    Zhn1SGGgAAAAAElFTkSuQmCC
}
image create photo Icon_Resize -data {
    iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAFMN540AAAABGdBTUEAAYagMeiWXwAAAxxJ
    REFUSIntlj1oFEEUx3+7lzuNJzEj2ogflakEScBCC3UQxWhhZ4hgpyBqISjIgoE0Mo3YCQHt
    Dk60S6EBTVxioWUQBEFQVBCUE8fPJN4luxY7k8ztbe5Oo5X+4Zh7b/b/PmbevBloBhGEZd/8
    iY1u0Espsnk9ruwDm12KD+RcO9aoANYD64Ai0AGglRyzdnc5Pl6bsWpNAqw0yldayS1Gl2+a
    ZVuwAfYAFeCTVrJ+BUQQDmQxbWDbzEeb0gsBcEkEYUzMaANdBOE1M9alYZmnm2/Fn4bnxNUD
    9BpxCjgODAMjWsmTIgjLWsljdgSzmwYVYEor+dzIQyIIJ4zhSa3kHqMvWYJL/gR8SUW2hhgP
    jz5HN55FlsBh4Lzx9jLy2fr5spx3UvO0kjUr+9TDcwU/wh4Rz/3ekdvHb5H+Ctx97tdKjjnj
    fpKV3Qk8IzmwABWtpIb6BTueGo+a+X5D7DW/9aQhgrDcKkwRhANut3H3uZT6cBRYbcQpreQF
    krKtZJFHgYIjn/WJuyK8p6nUxoBHUJ9z0fW8yq9+jPCe+vH8dkc9DDzO8lwVQbggTEdQqM10
    VfOd3cA3ox4BbgP3XUcNTbmdzpCu7aYQQVgWQdifFXZL2CZg4VZYVpgF4DtwhMXiKS1cBf9R
    h+U0jlbchklTAneBm7bFA4PAIdMiqiS3rj1CVaCmlSy04rYdpQjCXLtZLIe7kLEIwnipltTK
    gDtvDlHsHiSLlkYaXh00PeYP7UW6FHdJx6bN3wNuaCVPLkXccC4sznQyCfQBb4GNwAOt5D7H
    1nXgBHBAK1nXtLJayDimcNJvnvnYj4q5H8XZKD8+AzuIeVKYm+6q5lcJ4E2GrVPAaWAuPZHl
    WAITwFfgA05zzHlRNBvlNwEdhRrd76/Iz2bqG4uPQ3eJh4GLwF7MBdHMsUVJK3kmrRRB+ArY
    Us0znUVK7WvJOHyW/u6XWv1voJekUTfc5M0y3i2C8CqwwtHNAmutYM7qCPBOKzlkbvthYFQr
    eatZRFmOp4CDQC1jDuAOyUrZgrlNcg1B8lIoAS8cW19wXhD/Ln4CQ7A8G4GVhN4AAAAASUVO
    RK5CYII=
}
#
#§§§§§
# End: Icons
#§§§§§
#§§§§§
# Start: Menu Bar
#§§§§§
menu .menu_bar
. configure -menu .menu_bar
menu .level_0 -tearoff 0
.menu_bar add cascade -menu .level_0 -label "Menu" -underline 0
.level_0 add command -label "Resize App" -command {Resize_Win1} \
-image                 Icon_Resize   -compound left
#
.level_0 add separator
.level_0 add command -label Exit -underline 0 -command {exit} \
-image                 Icon_Exit  -compound left

.menu_bar configure -bg black -activebackground black \
-fg white -activeforeground white ;# effects not visible on GUI
#§§§§§
# End: Menu Bar
#§§§§§


问:
Why do I get error: 'init(_:)' requires that 'Binding<String>' conform to 'StringProtocol' when trying to iterate through a binding object?
I am trying to iterate through an array called: contacts that is an array of Contact (a hashable struct with contact data). This works when I iterate through the array directly (as in, placing the array directly into the Foreach block without using any type of binding) however, when I try to pass in the array via a binding, using the key: $contacts, I get the error: Initializer 'init(_:)' requires that 'Binding<String>' conform to 'StringProtocol'

I feel like the concept is similar but I am still wrapping my head around how swift works. Please see the below code:

Here is where I set up the binding (where the error appears)

```<code>struct ContactsGridView: View {

@Binding var contacts: [Contact]

let threeColumnGrid = [GridItem(.flexible(), spacing: 20),
                       GridItem(.flexible(), spacing: 20),
                       GridItem(.flexible(), spacing: 20)]

var body: some View {

    NavigationStack {
        VStack {
            // Contacts Scroll View
            ScrollView {
                LazyVGrid(columns: threeColumnGrid, spacing: 20) {
                    ForEach($contacts, id: \.self) { contact in
                        VStack {
                            Circle()
                                .fill(.white)
                            Text(contact.firstName) // Here is where I get the error.
                        }
                    }
                }.padding(EdgeInsets(top: 20,
                                     leading: 20,
                                     bottom: 20,
                                     trailing: 20))
            }
        }.background(Color(CustomColors.background.rawValue))
    }
}
</code>```

}

And here is where I set up the State:

```<code>struct ContactsViewController: View {

@State private var selectedTab: Int = 0
@State private var employeeContacts: [Contact] = employeeContactsTempData
@State private var clientContacts: [Contact] = clientContactsTempData

var body: some View {
    NavigationStack {
        Divider()
            .background(.thinMaterial)
            .navigationTitle("Contacts")
        VStack {
            Picker("", selection: $selectedTab) {
                Text("Employees").tag(0)
                Text("Clients").tag(1)
            }
            .pickerStyle(SegmentedPickerStyle())
            .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))

            switch(selectedTab) {
            case 0: ContactsGridView(contacts: $employeeContacts)
            case 1: ContactsGridView(contacts: $clientContacts)
            default:
                ContactsGridView(contacts: $employeeContacts)
            }
        }
    }
}
</code>```

}

Body:
I am trying to iterate through an array called: contacts that is an array of Contact (a hashable struct with contact data). This works when I iterate through the array directly (as in, placing the array directly into the Foreach block without using any type of binding) however, when I try to pass in the array via a binding, using the key: $contacts, I get the error: Initializer 'init(_:)' requires that 'Binding<String>' conform to 'StringProtocol'

I feel like the concept is similar but I am still wrapping my head around how swift works. Please see the below code:

Here is where I set up the binding (where the error appears)

struct ContactsGridView: View {

@Binding var contacts: [Contact]

let threeColumnGrid = [GridItem(.flexible(), spacing: 20),
                       GridItem(.flexible(), spacing: 20),
                       GridItem(.flexible(), spacing: 20)]

var body: some View {

    NavigationStack {
        VStack {
            // Contacts Scroll View
            ScrollView {
                LazyVGrid(columns: threeColumnGrid, spacing: 20) {
                    ForEach($contacts, id: \.self) { contact in
                        VStack {
                            Circle()
                                .fill(.white)
                            Text(contact.firstName) // Here is where I get the error.
                        }
                    }
                }.padding(EdgeInsets(top: 20,
                                     leading: 20,
                                     bottom: 20,
                                     trailing: 20))
            }
        }.background(Color(CustomColors.background.rawValue))
    }
}

}

And here is where I set up the State:

struct ContactsViewController: View {

@State private var selectedTab: Int = 0
@State private var employeeContacts: [Contact] = employeeContactsTempData
@State private var clientContacts: [Contact] = clientContactsTempData

var body: some View {
    NavigationStack {
        Divider()
            .background(.thinMaterial)
            .navigationTitle("Contacts")
        VStack {
            Picker("", selection: $selectedTab) {
                Text("Employees").tag(0)
                Text("Clients").tag(1)
            }
            .pickerStyle(SegmentedPickerStyle())
            .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))

            switch(selectedTab) {
            case 0: ContactsGridView(contacts: $employeeContacts)
            case 1: ContactsGridView(contacts: $clientContacts)
            default:
                ContactsGridView(contacts: $employeeContacts)
            }
        }
    }
}

}


问:
Can't connect to Ip addresses of hotspot connected devices using WifiManager.getConnectionInfo().getIpAddress()
whenever I try to connect to the Ip I get from WifiManager.getConnectionInfo().getIpAddress(), I get java.net.ConnectException or NoRouteToHostException exception. Also, in the hot-spot providing device, it returns 0.0.0.0 when called WifiManager.getConnectionInfo().getIpAddress(). Can't seem to send any messages using any of the devices. And FYI, I used port 8080 and all the hotspot devices are above android 10.
Help please!
Thank you.</p>


问:
How to get actual amount in google-validator
I am trying to provide Google payment service using nestjs.

const GoogleReceiptVerify = require('google-play-billing-validator');

...

constructor(
    grv = new GoogleReceiptVerify({
      email: myClientMail,
      key: myClientSecret,
    });
)

...

async googleValide(body){

      const data = Buffer.from(messageData, 'base64').toString('utf8');

      const jsonData = JSON.parse(data);

      const receipt = {
        packageName: jsonData.packageName,
        productId: jsonData.subscriptionNotification.subscriptionId,
        purchaseToken: jsonData.subscriptionNotification.purchaseToken,
      };

      const promiseData = await grv.verifySub(receipt);

      const payload = promiseData.payload;

}
```
<p>Above is my code.</p>
<p>When user pays for a subscription, user get the exact price.</p>
<p>However, when upgrade, user will see the price of subscription product, not the actual payment amount.</p>
<p>I wonder how to check the actual amount paid, not the price of the subscription product.</p>
<pre class="lang-js prettyprint-override"><code>
curreny : 'USD',
actualAmount : '1.5'

</code>```

The payment receipt received by e-mail will indicate the actual payment price.

Body:
I am trying to provide Google payment service using nestjs.

const GoogleReceiptVerify = require('google-play-billing-validator');

...

constructor(
    grv = new GoogleReceiptVerify({
      email: myClientMail,
      key: myClientSecret,
    });
)

...

async googleValide(body){

      const data = Buffer.from(messageData, 'base64').toString('utf8');

      const jsonData = JSON.parse(data);

      const receipt = {
        packageName: jsonData.packageName,
        productId: jsonData.subscriptionNotification.subscriptionId,
        purchaseToken: jsonData.subscriptionNotification.purchaseToken,
      };

      const promiseData = await grv.verifySub(receipt);

      const payload = promiseData.payload;

}

Above is my code.

When user pays for a subscription, user get the exact price.

However, when upgrade, user will see the price of subscription product, not the actual payment amount.

I wonder how to check the actual amount paid, not the price of the subscription product.

curreny : 'USD',
actualAmount : '1.5'

The payment receipt received by e-mail will indicate the actual payment price.


问:
How to Make Gutenberg Repeater Field
Want to make a Quiz application on WordPress Gutenberg with React? The problem goes, when I try to make a repeater field of the quiz section. I use UseState to make the components Repeat the section onClick. But I can't edit the input field after repeating it.

index.js

```<code>
import { registerBlockType } from "@wordpress/blocks";

import "./style.scss";

import Edit from "./edit";
import save from "./save";
import metadata from "./block.json";

registerBlockType(metadata.name, {
    attributes: {
        ids: { type: "array", default: 1},
        question: { type: "string", default:"Example Question"},
        answers: { type: "array", default: [""] },
        correctAnswer: { type: "number", default: undefined },
        bgColor: { type: "string", default: "#ededed" },
    },

    edit: Edit,
    save,
});
</code>```

edit.js `

```<code>

import { __ } from "@wordpress/i18n";
import {
    TextControl,
    Flex,
    FlexBlock,
    FlexItem,
    Button,
    Icon,
} from "@wordpress/components";

import { useBlockProps } from "@wordpress/block-editor";
const { useState} = wp.element;

import "./editor.scss";

import QuizWrapper from "./components/QuizWrapper";
import TestComponent from "./components/TestComponent";

export default function Edit(props) {
    const [quizwrapper, setQuizwrapper] = useState([<QuizWrapper props={props} key={0} />])
    const blockProps = useBlockProps({
        className: "quiz-wrapper",
    });

    function addSection() {
            setQuizwrapper([...quizwrapper,<QuizWrapper props={props} key={quizwrapper.length} />]);

    }
    return (
        <div {...blockProps}>
            <QuizWrapper props={props}></QuizWrapper>
            {quizwrapper}
            <Button isPrimary onClick={addSection}>
                Add Another Section
            </Button>
        </div>
    );
}
</code>```

When I use <QuizWraper /> as a component it works fine on editing and changing on Question and Answer section, image has been uploaded below

but for the UseState hook for repeating the component {quizwrapper} repeates the section but doesn't allow me to edit and change the section

Image of the editor WordPress dashboard

QuizWrapper.jsx

```<code>import React from 'react'
import Question from "./Question"
import Answers from "./Answers"

const QuizWrapper = ({props}) => {
  return (
    <div className='quizes'>
        <Question props={props}></Question>
        <Answers props={props}></Answers>
    </div>
  )
}

export default QuizWrapper
</code>```

Question.js

```<code>import { TextControl } from "@wordpress/components";

export default function Question({props}) {
    function updateQuestion(value) {
        props.setAttributes({ question: value });
    }
    return (
        <div className="question">
            <h2 style={{ fontSize: "20px", margin: "20px 0 8px 0" }}>Questions: </h2>
            <TextControl
                value={props.attributes.question}
                onChange={updateQuestion}
            />
        </div>
    );
}
</code>```

Answer.js

```<code>import { TextControl, Button, Icon } from "@wordpress/components";

export default function Answers({ ids, props }) {
    function markasCorrect(index) {
        props.setAttributes({ correctAnswer: index });
    }

    function deleteAnswer(indextoDelete) {
        const newAnswer = props.attributes.answers.filter(function (x, index) {
            return index != indextoDelete;
        });

        props.setAttributes({ answers: newAnswer });

        if (indextoDelete == props.attributes.correctAnswer) {
            props.setAttributes({ correctAnswer: undefined });
        }
    }
    return (
        <div className="answers" key={ids}>
            <p style={{ fontSize: "13px", margin: "20px 0 8px 0" }}>Answers: </p>
            {props.attributes.answers.map((answer, index) => {
                return (
                    <div className="answer-wrapper">
                        <Button onClick={() => markasCorrect(index)}>
                            <Icon
                                className="mark-as-correct"
                                icon={
                                    props.attributes.correctAnswer == index ? "yes-alt" : "yes"
                                }
                            />
                        </Button>
                        <TextControl
                            value={answer}
                            onChange={(updateanswer) => {
                                const newAnswers = props.attributes.answers.concat([]);
                                newAnswers[index] = updateanswer;
                                props.setAttributes({ answers: newAnswers });
                            }}
                        ></TextControl>
                        <Button
                            isLink
                            className="deleteBtn"
                            onClick={() => deleteAnswer(index)}
                        >
                            Delete
                        </Button>
                    </div>
                );
            })}
            <Button
                isPrimary
                onClick={() => {
                    props.setAttributes({
                        answers: props.attributes.answers.concat([""]),
                    });
                }}
            >
                Add Another Answer
            </Button>
        </div>
    );
}
</code>```

Need Solution: How I can make the repeater section of the <Quizwapper>component and how I can make the repeater section where the <Question/> and <Answer/> components will work fine.

Title: How to Make Gutenberg Repeater Field

Body:
Want to make a Quiz application on WordPress Gutenberg with React? The problem goes, when I try to make a repeater field of the quiz section. I use UseState to make the components Repeat the section onClick. But I can't edit the input field after repeating it.

index.js

import { registerBlockType } from "@wordpress/blocks";

import "./style.scss";

import Edit from "./edit";
import save from "./save";
import metadata from "./block.json";

registerBlockType(metadata.name, {
    attributes: {
        ids: { type: "array", default: 1},
        question: { type: "string", default:"Example Question"},
        answers: { type: "array", default: [""] },
        correctAnswer: { type: "number", default: undefined },
        bgColor: { type: "string", default: "#ededed" },
    },

    edit: Edit,
    save,
});

edit.js `

import { __ } from "@wordpress/i18n";
import {
    TextControl,
    Flex,
    FlexBlock,
    FlexItem,
    Button,
    Icon,
} from "@wordpress/components";

import { useBlockProps } from "@wordpress/block-editor";
const { useState} = wp.element;

import "./editor.scss";

import QuizWrapper from "./components/QuizWrapper";
import TestComponent from "./components/TestComponent";

export default function Edit(props) {
    const [quizwrapper, setQuizwrapper] = useState([<QuizWrapper props={props} key={0} />])
    const blockProps = useBlockProps({
        className: "quiz-wrapper",
    });

    function addSection() {
            setQuizwrapper([...quizwrapper,<QuizWrapper props={props} key={quizwrapper.length} />]);

    }
    return (

            <QuizWrapper props={props}></QuizWrapper>
            {quizwrapper}
            <Button isPrimary onClick={addSection}>
                Add Another Section
            </Button>

    );
}

When I use <QuizWraper /> as a component it works fine on editing and changing on Question and Answer section, image has been uploaded below

but for the UseState hook for repeating the component {quizwrapper} repeates the section but doesn't allow me to edit and change the section

Image of the editor WordPress dashboard

QuizWrapper.jsx

import React from 'react'
import Question from "./Question"
import Answers from "./Answers"

const QuizWrapper = ({props}) => {
  return (

        <Question props={props}></Question>
        <Answers props={props}></Answers>

  )
}

export default QuizWrapper

Question.js

import { TextControl } from "@wordpress/components";

export default function Question({props}) {
    function updateQuestion(value) {
        props.setAttributes({ question: value });
    }
    return (

Questions:

            <TextControl
                value={props.attributes.question}
                onChange={updateQuestion}
            />

    );
}

Answer.js

import { TextControl, Button, Icon } from "@wordpress/components";

export default function Answers({ ids, props }) {
    function markasCorrect(index) {
        props.setAttributes({ correctAnswer: index });
    }

    function deleteAnswer(indextoDelete) {
        const newAnswer = props.attributes.answers.filter(function (x, index) {
            return index != indextoDelete;
        });

        props.setAttributes({ answers: newAnswer });

        if (indextoDelete == props.attributes.correctAnswer) {
            props.setAttributes({ correctAnswer: undefined });
        }
    }
    return (

Answers:

            {props.attributes.answers.map((answer, index) => {
                return (

                        <Button onClick={() => markasCorrect(index)}>
                            <Icon
                                className="mark-as-correct"
                                icon={
                                    props.attributes.correctAnswer == index ? "yes-alt" : "yes"
                                }
                            />
                        </Button>
                        <TextControl
                            value={answer}
                            onChange={(updateanswer) => {
                                const newAnswers = props.attributes.answers.concat([]);
                                newAnswers[index] = updateanswer;
                                props.setAttributes({ answers: newAnswers });
                            }}
                        ></TextControl>
                        <Button
                            isLink
                            className="deleteBtn"
                            onClick={() => deleteAnswer(index)}
                        >
                            Delete
                        </Button>

                );
            })}
            <Button
                isPrimary
                onClick={() => {
                    props.setAttributes({
                        answers: props.attributes.answers.concat([""]),
                    });
                }}
            >
                Add Another Answer
            </Button>

    );
}

Need Solution: How I can make the repeater section of the <Quizwapper>component and how I can make the repeater section where the <Question/> and <Answer/> components will work fine.


问:
Django templates question: How to display most of html page, while one part is still loading in the background
I'm a bit new to web development. I've created a django monolith project, which is working. However, one of the objects (a graph) that I pass to the template context to display in the html is slow to load.

I'd like to have the rest of the page load first, and this graph load last. That way, users can see the rest of the page while the graph is still loading. I'm stuck on how to get started. Any thoughts on the easiest way to accomplish this?

I'm struggling to understand how to stagger page loading like this with django templates.

I tried creating a custom tag to load the graph, but the browser still waited for the everything to load before showing anything on the page.

I'm wondering if some type of javascript call would accomplish this.


问:
Saleor Storefront Unhandled Runtime Error
I am trying to install Saleor storefront on EC2 and when start build command pnpm dev then this error shows in browser

Error: Invalid src prop (http://localhost:8000/media/products/saleor-apple-drink.png) on next/image, hostname "localhost" is not configured under images in your next.config.js
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host

I have created .env.local file and added NEXT_PUBLIC_API_URI but it still tries to load image from localhost:8000


问:
Appcelerator tableviewsection top margin on iOS
I have an ios app developed with titanium appcelerator. In the app I have some tablevies where I add some rows and some sections to create that sticky effect. But for some reason the sections have a top margin. Is there a way to remove that margin? The margin was not defined by me.

This is my TableView:

```<code>var mainView = Ti.UI.createTableViewRow({
        height: Ti.UI.SIZE,
        width: "100%",
        backgroundSelectedColor: 'transparent',
        backgroundSelectedColor: 'transparent',
        selectedColor: 'transparent',
        bottom: 0,
});
</code>```

And the I add some TableViewSections to it:

```<code>tableData.push(Ti.UI.createTableViewSection({
        headerView: require("addStickyHeader").addStickyHeader(letra.toUpperCase()),
}));
</code>```

The addStickyHeader function:

```<code>exports.addStickyHeader = function(text) {

var viewHeader = Ti.UI.createView({
    height : Ti.App.screenSize[0] * 0.08,
    width : "100%",
    backgroundColor : require("colors").fundo(),
    top : -100
});

viewHeader.add(Ti.UI.createLabel({
    text : text.toUpperCase(),
    color : require("colors").branco(),
    width : "84.6%",
    font : {
        fontSize : Ti.App.screenSize[0] * 0.019,
        fontFamily : require("fonts").semiBold()
    },
}));

return viewHeader;
</code>```

};

That white parte should not be there.

Body:
I have an ios app developed with titanium appcelerator. In the app I have some tablevies where I add some rows and some sections to create that sticky effect. But for some reason the sections have a top margin. Is there a way to remove that margin? The margin was not defined by me.

This is my TableView:

var mainView = Ti.UI.createTableViewRow({
        height: Ti.UI.SIZE,
        width: "100%",
        backgroundSelectedColor: 'transparent',
        backgroundSelectedColor: 'transparent',
        selectedColor: 'transparent',
        bottom: 0,
});

And the I add some TableViewSections to it:

tableData.push(Ti.UI.createTableViewSection({
        headerView: require("addStickyHeader").addStickyHeader(letra.toUpperCase()),
}));

The addStickyHeader function:

exports.addStickyHeader = function(text) {

var viewHeader = Ti.UI.createView({
    height : Ti.App.screenSize[0] * 0.08,
    width : "100%",
    backgroundColor : require("colors").fundo(),
    top : -100
});

viewHeader.add(Ti.UI.createLabel({
    text : text.toUpperCase(),
    color : require("colors").branco(),
    width : "84.6%",
    font : {
        fontSize : Ti.App.screenSize[0] * 0.019,
        fontFamily : require("fonts").semiBold()
    },
}));

return viewHeader;

};

That white parte should not be there.


问:
port forwarding to connect to a mysql database on a VPS
I have a mysql database runnnig on 127.0.0.1 on a VPS and now I need to connect to this database I saw that for this I must do a port forwarding in order to expose the mysql service to the internet otherwise I won't be able to connect, I saw here that I can do this connecting via SSH to the VPS and then run the command ssh -L 3306:127.0.0.1:3306 MY_SERVER_IP  but I am not sure if this could unset or damage the VPS, this VPS is on production and the developers that created this left the project without finishing it so I have fear of doing a bad configuration and crash the productino server, which could be another way of do this? i.e be able to connect to the database Or is this the safer and correct way?


问:
Xcode 14 not recognize custom font in storyboard
I added custom font in my project, but this font not show in storyboard to selected, i checked this font installed in font book. (font:  Pretendard)
Thank you for your help!

in project font folder
info.plist
font book
storyboard


问:
@Autowired is not working in Hazelcast MapListener
@Autowired is not working in Hazelcast MapListener</p>
```<code>I am not getting instance of myService
</code>```
```<code>@Slf4j
@Component
public class MyEntryListener implements EntryExpiredListener<String, String>,
        MapListener {

    @Autowired
    MyService myService;

    public void entryExpired(EntryEvent<String, String> entryEvent) {
        log.debug("myService :: "+myService);
        myService.process(entryEvent.getKey());
        log.debug("hazelcast entryExpired: "+entryEvent.getKey());
    }
}

@Service
@Slf4j
public class MyService {

public void process(String key){
``  log.debug("myService :: inside process :: "+ key);
    // From here we do invoke other classes
    //
}

}

I am not getting instance of myService
Response :

2022-12-27 22:24:48.431 DEBUG 30984 --- [p-local.event-5] MyEntryListener           : myService :: null
2022-12-27 22:24:48.431 DEBUG 30984 --- [p-local.event-5] MyEntryListener           : hazelcast entryExpired: ID51
</code>```

Body:
@Autowired is not working in Hazelcast MapListener

I am not getting instance of myService

@Slf4j
@Component
public class MyEntryListener implements EntryExpiredListener<String, String>,
        MapListener {

    @Autowired
    MyService myService;

    public void entryExpired(EntryEvent<String, String> entryEvent) {
        log.debug("myService :: "+myService);
        myService.process(entryEvent.getKey());
        log.debug("hazelcast entryExpired: "+entryEvent.getKey());
    }
}

@Service
@Slf4j
public class MyService {

public void process(String key){
``  log.debug("myService :: inside process :: "+ key);
    // From here we do invoke other classes
    //
}

}

I am not getting instance of myService
Response :

2022-12-27 22:24:48.431 DEBUG 30984 --- [p-local.event-5] MyEntryListener           : myService :: null
2022-12-27 22:24:48.431 DEBUG 30984 --- [p-local.event-5] MyEntryListener           : hazelcast entryExpired: ID51


问:
Sending ejs template using nodemailer
```<code>const nodemailer = require('nodemailer');
const fs = require('fs');
const ejs = require('ejs');

const sender = nodemailer.createTransport({
    service : 'gmail',
    auth : {
        user : "myemail@gmail.com",
        pass : "password"
    }
});

const data =  ejs.renderFile(__dirname + "/temp.ejs");

const composemail = {
    from: 'myemail@gmail.com',
    to: 'sample@gmail.com',
    subject: 'Sending with SendGrid is Fun',
    text: 'Testing Mail for test purpose',
    html: data
}
sender.sendMail(composemail,(err,data)=>{
    if(err){
        console.log('Mail not send'+err);
    }else{
        console.log('mail send successfully' +data.response);
    }
});
</code>```

This is my error

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Promise

Title: Sending ejs template using nodemailer

Body:
const nodemailer = require('nodemailer');
const fs = require('fs');
const ejs = require('ejs');

const sender = nodemailer.createTransport({
    service : 'gmail',
    auth : {
        user : "myemail@gmail.com",
        pass : "password"
    }
});

const data =  ejs.renderFile(__dirname + "/temp.ejs");

const composemail = {
    from: 'myemail@gmail.com',
    to: 'sample@gmail.com',
    subject: 'Sending with SendGrid is Fun',
    text: 'Testing Mail for test purpose',
    html: data
}
sender.sendMail(composemail,(err,data)=>{
    if(err){
        console.log('Mail not send'+err);
    }else{
        console.log('mail send successfully' +data.response);
    }
});

This is my error

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Promise


问:
Render one div of child component directly in app component or root component in react js
I have multiple components and I need to render one modal div at in main app,

tried using, but it's not working for me in react

```<code>const element = document.getElementsByClassName()[0].appendChild();

</code>```

Is there any way rather than putting that component directly to App

Body:
I have multiple components and I need to render one modal div at in main app,

tried using, but it's not working for me in react

const element = document.getElementsByClassName()[0].appendChild();

Is there any way rather than putting that component directly to App