问:
"ERROR" in running "GITHUB-ACTIONS" while running "SONARQUBE-QUALITY GATE" Action Pipeline
This is the workflow file that was created through the github actions for integration with the sonarqube

```<code>name: SonarQube Qualitygate check
on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request.
  push:
    branches:
      - development
  pull_request:
      types: [opened, synchronize, reopened]
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting.
        fetch-depth: 0

    # Triggering SonarQube analysis as results of it are required by Quality Gate check.
    - name: SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@master
      with:
        projectBaseDir: .
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

    # Check the Quality Gate status.
    - name: SonarQube Quality Gate check
      id: sonarqube-quality-gate-check
      uses: SonarSource/sonarqube-quality-gate-action@master
      # Force to fail step after specific time.
      timeout-minutes: 5
      env:
        SONAR_LOGIN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}
</code>```

Over the sonarqube scan the error is coming & couldn't resolve this issue . needed some support please .. Done adding project in sonarqube website ..

This is the output i got after running enter image description here          enter image description here

Body:
This is the workflow file that was created through the github actions for integration with the sonarqube

name: SonarQube Qualitygate check
on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request.
  push:
    branches:
      - development
  pull_request:
      types: [opened, synchronize, reopened]
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting.
        fetch-depth: 0

    # Triggering SonarQube analysis as results of it are required by Quality Gate check.
    - name: SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@master
      with:
        projectBaseDir: .
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

    # Check the Quality Gate status.
    - name: SonarQube Quality Gate check
      id: sonarqube-quality-gate-check
      uses: SonarSource/sonarqube-quality-gate-action@master
      # Force to fail step after specific time.
      timeout-minutes: 5
      env:
        SONAR_LOGIN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

Over the sonarqube scan the error is coming & couldn't resolve this issue . needed some support please .. Done adding project in sonarqube website ..

This is the output i got after running enter image description here          enter image description here


来源: stackexchange

问:
Change the status of record as "in_progress" during the processing
I have some records in a database that indicate some requests. In those records, there is a column for the request's status, which starts with "new" and changes to "completed" when the processing is finished.

What is the advantage of changing the status from "new" to "in_progress" and then back to "completed" over "new"->"completed"?

I was thinking that the benefit would be to avoid someone else accessing the records during the "in_progress" status. But only this process will change those records.

ContentLicense: CC BY-SA 4.0


问:
Alamofire request gets stuck when entering background
When I download a file and I'm inside the app everything works as it should, but when the user gets a call the download just stops

I read a bit and saw that it might be possible to use BGProcessingTaskRequest
But I don't know how to use it with Alamofire


问:
Flutter devices command not showing my phone
I am trying to run my flutter app in my phone but it is not showing the phone when i run

```<code>flutter devices
</code>```

Here is the command output:
command output

Body:
I am trying to run my flutter app in my phone but it is not showing the phone when i run

flutter devices

Here is the command output:
command output


问:
Animating grid elements to start from a common point and end up in its respective position
I am using framer motion, tailwind CSS ad react to try to animate grid elements in such a way that it starts from the first grid element's position and then moves on to its respective position in the grid

```<code><div
                className="
                mx-auto
                p-7 mt-10 md:mt-5
                grid
                grid-cols-1
                sm:grid-cols-2
                md:grid-cols-3
                lg:grid-cols-4
                gap-y-16
                gap-x-14
                ">

                {/* add button */}
                <motion.div
                    className="
                    p-5
                    border-2 border-[#6e3820] rounded-3xl
                    hidden
                    max-w-[13rem]
                    max-h-[13rem]
                    cursor-pointer
                    active:bg-[#c37f37]
                    hover:bg-[#f9cdc0]
                    md:flex justify-center
                    "
                    onClick={formOpen}
                    variants={button}
                    whileHover="hover"
                    whileTap="pressed"
                >
                    <div className="border-2 rounded-3xl border-dashed border-[#dfb589] flex items-center justify-center sm:p-5 md:p-10 lg:p-10 xl:p-14">
                        <button className="">
                                <motion.img
                                    src="https://img.icons8.com/ios/50/dfb589/plus-math--v1.png"
                                    whileHover={{ rotate: 45 }}
                                    transition={{ duration: 0.6 }}
                                    variants={plus}
                                />
                        </button>
                    </div>

                </motion.div>
                {
                    usersContent.map((item)=>{
                        return(
                            <NoteCard
                                key = {item.id}
                                id = {item.id}
                                companion = {item.companion}
                                title = {item.title}
                                content={item.content}
                                deleteNote={deleteNote}
                            />
                        )
                    })
                }
                </div>
</code>```

Here I want the other notecards to start from the same position the add button is in and then go to its default location. If not with framer motion is it possible any other way?

Body:
I am using framer motion, tailwind CSS ad react to try to animate grid elements in such a way that it starts from the first grid element's position and then moves on to its respective position in the grid

                {/* add button */}
                <motion.div
                    className="
                    p-5
                    border-2 border-[#6e3820] rounded-3xl
                    hidden
                    max-w-[13rem]
                    max-h-[13rem]
                    cursor-pointer
                    active:bg-[#c37f37]
                    hover:bg-[#f9cdc0]
                    md:flex justify-center
                    "
                    onClick={formOpen}
                    variants={button}
                    whileHover="hover"
                    whileTap="pressed"
                >

                        <button className="">
                                <motion.img
                                    src="https://img.icons8.com/ios/50/dfb589/plus-math--v1.png"
                                    whileHover={{ rotate: 45 }}
                                    transition={{ duration: 0.6 }}
                                    variants={plus}
                                />
                        </button>

                </motion.div>
                {
                    usersContent.map((item)=>{
                        return(
                            <NoteCard
                                key = {item.id}
                                id = {item.id}
                                companion = {item.companion}
                                title = {item.title}
                                content={item.content}
                                deleteNote={deleteNote}
                            />
                        )
                    })
                }

Here I want the other notecards to start from the same position the add button is in and then go to its default location. If not with framer motion is it possible any other way?


问:
Outsource parallel computation to HPC via Slurm from local machine
I want to run a loop in parallel from my local machine, but connect it to remote machines that sit on an HPC system. Here is my approach:

library("future.batchtools")
library("future.apply")
library("future")
f <- function(x) {
  paste0("x = ",x , ": PID ", Sys.getpid(), " @ ", Sys.info()[["nodename"]])
}

options(parallelly.debug = TRUE)

plan(batchtools_slurm, workers = 2, nodename = "login.example.com")
future_lapply(1:4,f)
```
<p>where <code>login.example.com</code> is the address of the HPC login node I can <code>ssh</code> into to submit Slurm jobs. The above code gives an error</p>
```Error: Failed to submit BatchtoolsSlurmFuture (future_lapply-1). The reason was: error in running command
TROUBLESHOOTING INFORMATION:
batchtools::submitJobs() was called with the following 'resources' argument:
 list()
```
<p>What works nicely is</p>
<pre class="lang-r prettyprint-override"><code>library("future.apply")
library("future")
f <- function(x) {
  paste0("x = ",x, ": PID ", Sys.getpid(), " @ ", Sys.info()[["nodename"]])
}

cl <- makeClusterPSOCK(workers = rep("login.example.com",2))
plan(cluster, workers = cl)
future_lapply(1:4,f)
</code>```

which gives

```<code>[[1]]
[1] "x = 1: PID 68779 @ login.example.com"

[[2]]
[1] "x = 2: PID 68779 @ login.example.com"

[[3]]
[1] "x = 3: PID 15327 @ login.example.com"

[[4]]
[1] "x = 4: PID 15327 @ login.example.com"
</code>```

How can I make the above code work, i.e. to use the Slurm scheduler on 'login.example.com'?

Body:
I want to run a loop in parallel from my local machine, but connect it to remote machines that sit on an HPC system. Here is my approach:

library("future.batchtools")
library("future.apply")
library("future")
f <- function(x) {
  paste0("x = ",x , ": PID ", Sys.getpid(), " @ ", Sys.info()[["nodename"]])
}

options(parallelly.debug = TRUE)

plan(batchtools_slurm, workers = 2, nodename = "login.example.com")
future_lapply(1:4,f)

where login.example.com is the address of the HPC login node I can ssh into to submit Slurm jobs. The above code gives an error

Error: Failed to submit BatchtoolsSlurmFuture (future_lapply-1). The reason was: error in running command
TROUBLESHOOTING INFORMATION:
batchtools::submitJobs() was called with the following 'resources' argument:
 list()

What works nicely is

library("future.apply")
library("future")
f <- function(x) {
  paste0("x = ",x, ": PID ", Sys.getpid(), " @ ", Sys.info()[["nodename"]])
}

cl <- makeClusterPSOCK(workers = rep("login.example.com",2))
plan(cluster, workers = cl)
future_lapply(1:4,f)

which gives

[[1]]
[1] "x = 1: PID 68779 @ login.example.com"

[[2]]
[1] "x = 2: PID 68779 @ login.example.com"

[[3]]
[1] "x = 3: PID 15327 @ login.example.com"

[[4]]
[1] "x = 4: PID 15327 @ login.example.com"

How can I make the above code work, i.e. to use the Slurm scheduler on 'login.example.com'?


问:
How to change a particular section of code at a mass scale?
I want to scan a code base with approximately 150k python + java files and want to find a specific kind of hardcoding. For ex:

```<code># some code above
if get_city() == 'Delhi': # they way of checking can be different like city = get_city() and then checking city == 'Delhi'
   country = 'India'
else:
    country = 'US'
# some code below
</code>```

Now I want to move this hardcoding to a configuration like

```<code>---
'delhi': 'India'
'SanFransico': 'US'
'paris': 'France'
</code>```

and change the code to

```<code># some code above
data = yaml.loads(city_mapping)
country = data[get_city()]
# some code below
</code>```

How to find such code patterns and change them programmatically?

Body:
I want to scan a code base with approximately 150k python + java files and want to find a specific kind of hardcoding. For ex:

# some code above
if get_city() == 'Delhi': # they way of checking can be different like city = get_city() and then checking city == 'Delhi'
   country = 'India'
else:
    country = 'US'
# some code below

Now I want to move this hardcoding to a configuration like

---
'delhi': 'India'
'SanFransico': 'US'
'paris': 'France'

and change the code to

# some code above
data = yaml.loads(city_mapping)
country = data[get_city()]
# some code below

How to find such code patterns and change them programmatically?


问:
Not getting output entity in single entity. eg. Shinzo B-per Abe I-per. required output Shinzo Abe PER
I want spacy ner out should be without Starts with "B-" and "I-". instead of Shinzo B-per Abe I-per output should be Shinzo Abe per.

nlp_ner = spacy.load("model-best")

doc = nlp_ner(main_str)
colors = {"B-gpe": "#F67DE3","I-gpe": "#F67DE3" ,"B-geo": "#7DF6D9","I-geo": "#7DF6D9","B-tim":"#a6e22d","I-tim":"#a6e22d","B-per":'#88ba9d',"I-per":'#88ba9d',"B-org":'#488583',"I-org":'#488583','B-art':'#cf9d53','I-art':'#cf9d53','B-nat':'#dee81e','I-nat':'#dee81e','B-eve':'#e8571e'}
options = {"colors": colors}
stp=spacy.displacy.render(doc, style="ent",jupyter=True,options=options)
print(stp)


问:
my React-native is build successfully but my Emulator is not showing output

Task :app:installDebug
Installing APK 'app-debug.apk' on 'Pixel_5_API_31(AVD) - 12' for app:debug
Installed on 1 device.
w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions

BUILD SUCCESSFUL in 4m 49s
346 actionable tasks: 346 executed
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.loveformusicapp/.MainActivity }

but I got some warnings at the top of the terminal like this

Configure project :react-native-blur-overlay
WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.

Second warning

Configure project :react-native-flipper
WARNING:: The specified Android SDK Build Tools version (25.0.0) is  ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.2.
Android SDK Build Tools 30.0.2 will be used.

To suppress this warning, remove "buildToolsVersion '25.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Third warning

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.

This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if           they specify explicit versions, even if the versions are equal.

Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.

Please guide me where the problem might be.


问:
SAMLRequest and Signature parameters in SSO
I am using django-saml-sp library, I have one working idp and I try to implement SSO log in to my Django project.

For doing it, I need to generate SAMLRequest and Signature parameters in the query string to redirecting SSO Log on page. I couldn't find a way to do that.


问:
Embedded infinispan - Initial state transfer timed out Error
In the past few months I had an error during the Cache Manager initialization, resulting in my server being in an error state.

I use infinispan v13.0.13.Final in cluster mode with jgroups and 3 nodes that reboot each morning at different times: the first one @ 6:00, followed by the next one @ 6:05 and finally the last one.

Sometimes the first server (only the first) enters in a timeout status that throws an exeception. So, the cache manager and all my caches are never initializied.

Inifinispan prints the following log so at lest the method org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded() is executed correctly

```<code>Jan 11 06:00:32 hostname foo[3293956]: -------------------------------------------------------------------
Jan 11 06:00:32 hostname foo[3293956]: GMS: address=hostname-51836, cluster=cache-cluster-name, physical address=x.x.x.x:xxxx
Jan 11 06:00:32 hostname foo[3293956]: -------------------------------------------------------------------
</code>```

After ~4 minute (so before the next server reboots) I have this timeout error catched by my app. I guess that is generated by the method org.infinispan.statetransfer.StateTransferManagerImpl.waitForInitialStateTransferToComplete() that is called by the start() method in the cacheImpl class

```<code>06:04:33.270 | ERROR (CacheServiceImpl.java:308) - Error init cache service
org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.commons.CacheException: Initial state transfer timed out for cache org.infinispan.CONFIG on hostname-51836
    at org.infinispan.manager.DefaultCacheManager.internalStart(DefaultCacheManager.java:770) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
    at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:734) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
    at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:302) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
    at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:224) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
</code>```

Why that timeout occours and why the cache that throws this error is org.infinispan.CONFIG? i've never created such cache.

To fix this problem with a dirty solution i can disable the "wait for initial state" but i don't think it could be a good solution. Anyway i kindly ask you how can I programmatically disable this feature?

As an additional info, this error appears using infinispan v12 also and changing the reboot schedule a few hour before the other member.

Thanks in advance.

Body:
In the past few months I had an error during the Cache Manager initialization, resulting in my server being in an error state.

I use infinispan v13.0.13.Final in cluster mode with jgroups and 3 nodes that reboot each morning at different times: the first one @ 6:00, followed by the next one @ 6:05 and finally the last one.

Sometimes the first server (only the first) enters in a timeout status that throws an exeception. So, the cache manager and all my caches are never initializied.

Inifinispan prints the following log so at lest the method org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded() is executed correctly

Jan 11 06:00:32 hostname foo[3293956]: -------------------------------------------------------------------
Jan 11 06:00:32 hostname foo[3293956]: GMS: address=hostname-51836, cluster=cache-cluster-name, physical address=x.x.x.x:xxxx
Jan 11 06:00:32 hostname foo[3293956]: -------------------------------------------------------------------

After ~4 minute (so before the next server reboots) I have this timeout error catched by my app. I guess that is generated by the method org.infinispan.statetransfer.StateTransferManagerImpl.waitForInitialStateTransferToComplete() that is called by the start() method in the cacheImpl class

06:04:33.270 | ERROR (CacheServiceImpl.java:308) - Error init cache service
org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.commons.CacheException: Initial state transfer timed out for cache org.infinispan.CONFIG on hostname-51836
    at org.infinispan.manager.DefaultCacheManager.internalStart(DefaultCacheManager.java:770) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
    at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:734) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
    at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:302) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]
    at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:224) ~[infinispan-core-13.0.13.Final.jar:13.0.13.Final]

Why that timeout occours and why the cache that throws this error is org.infinispan.CONFIG? i've never created such cache.

To fix this problem with a dirty solution i can disable the "wait for initial state" but i don't think it could be a good solution. Anyway i kindly ask you how can I programmatically disable this feature?

As an additional info, this error appears using infinispan v12 also and changing the reboot schedule a few hour before the other member.

Thanks in advance.


问:
C# - How can I specify in appsettings.json which interface implementation has to be used?
I am working on a console application and I read configuration parameters from appsettings.json.
This is what appsettings.json looks like:

```<code>{
 "ConfigurationParameters": {
     "par1": "val1",
     "par2": "val2",
     "par3": [
       {
         "Id": 1,
         "value": val_1,
         "type": "type_1"
       },
       {
         "Id": 2,
         "value": val_2,
         "type": "type_2"
       }
     ]
 }
}
</code>```

I read this file through

```<code>public static void Main(string[] args)
{
    CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureServices((hostContext, services) =>
        {
            IConfiguration iConfiguration = hostContext.Configuration;
            Configuration Configuration = iConfiguration.GetSection("ConfigurationParameters").Get<Configuration>();

            services.AddSingleton(Configuration);
        })
</code>```

Configuration.cs:

```<code>public class Configuration
{
    public int par1 { get; set; }
    public int par2 { get; set; }
    public List<Type1OfPar3> par3{ get; set; }
}
</code>```

TypeOfPar3.cs:

```<code>public class Type1OfPar3 : ITypeOfPar3
{
    public int Id { get; set; }
    public int value { get; set; }
    public string type { get; set; }

    public void DoSomething()
    {
        // do something;
    }
}
</code>```

Everything works until this point.

Now I want to make List par3 more generic. In Configuration.cs, I would like to substitute public List<Type1OfPar3> par3{ get; set; } with public List<ITypeOfPar3> par3{ get; set; }.
In this way my list can contain all object whose class implements ITypeOfPar3.
I know that interface can not have direct implementation from appsettings.json, so my aim is to define, during initialization, the type of any par3 element, looking at variable “type” in appsettings.json.
Is that possible?

Otherwise how can I exploit interfaces and their implementations using appsettings.json?

The only workaround I found is to declare a generic class which implements the interface:

```<code>public class GenericTypeOfPar3 : ITypeOfPar3
{
    public int Id { get; set; }
    public int value { get; set; }
    public string type { get; set; }

    public void DoSomething(){}
}
</code>```

New Configuration.cs:

```<code>public class Configuration
{
    public int par1 { get; set; }
    public int par2 { get; set; }
    public List<GenericTypeOfPar3> par3{ get; set; }
}
</code>```

Then I created a new List public List<ITypeOfPar3> par3New{ get; set; } (after the app settings reading) and run a function like that:

```<code>public void par3Setup()
{
    foreach (var par3Element in par3)
    {
        if (par3NewElement.type.Equals("Type1OfPar3"))
        {
            Type1OfPar3 par3El = new Type1OfPar3();
            par3New.Add(par3El );
        }
        else if (par3NewElement.type.Equals("Type2OfPar3"))
        {
            Type2OfPar3 par3El = new Type2OfPar3();
            par3New.Add(par3El );
        }
    }
}
</code>```

Where Type2OfPar3 is another class implementing ITypeOfPar3.

Body:
I am working on a console application and I read configuration parameters from appsettings.json.
This is what appsettings.json looks like:

{
 "ConfigurationParameters": {
     "par1": "val1",
     "par2": "val2",
     "par3": [
       {
         "Id": 1,
         "value": val_1,
         "type": "type_1"
       },
       {
         "Id": 2,
         "value": val_2,
         "type": "type_2"
       }
     ]
 }
}

I read this file through

public static void Main(string[] args)
{
    CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureServices((hostContext, services) =>
        {
            IConfiguration iConfiguration = hostContext.Configuration;
            Configuration Configuration = iConfiguration.GetSection("ConfigurationParameters").Get<Configuration>();

            services.AddSingleton(Configuration);
        })

Configuration.cs:

public class Configuration
{
    public int par1 { get; set; }
    public int par2 { get; set; }
    public List<Type1OfPar3> par3{ get; set; }
}

TypeOfPar3.cs:

public class Type1OfPar3 : ITypeOfPar3
{
    public int Id { get; set; }
    public int value { get; set; }
    public string type { get; set; }

    public void DoSomething()
    {
        // do something;
    }
}

Everything works until this point.

Now I want to make List par3 more generic. In Configuration.cs, I would like to substitute public List<Type1OfPar3> par3{ get; set; } with public List<ITypeOfPar3> par3{ get; set; }.
In this way my list can contain all object whose class implements ITypeOfPar3.
I know that interface can not have direct implementation from appsettings.json, so my aim is to define, during initialization, the type of any par3 element, looking at variable “type” in appsettings.json.
Is that possible?

Otherwise how can I exploit interfaces and their implementations using appsettings.json?

The only workaround I found is to declare a generic class which implements the interface:

public class GenericTypeOfPar3 : ITypeOfPar3
{
    public int Id { get; set; }
    public int value { get; set; }
    public string type { get; set; }

    public void DoSomething(){}
}

New Configuration.cs:

public class Configuration
{
    public int par1 { get; set; }
    public int par2 { get; set; }
    public List<GenericTypeOfPar3> par3{ get; set; }
}

Then I created a new List public List<ITypeOfPar3> par3New{ get; set; } (after the app settings reading) and run a function like that:

public void par3Setup()
{
    foreach (var par3Element in par3)
    {
        if (par3NewElement.type.Equals("Type1OfPar3"))
        {
            Type1OfPar3 par3El = new Type1OfPar3();
            par3New.Add(par3El );
        }
        else if (par3NewElement.type.Equals("Type2OfPar3"))
        {
            Type2OfPar3 par3El = new Type2OfPar3();
            par3New.Add(par3El );
        }
    }
}

Where Type2OfPar3 is another class implementing ITypeOfPar3.


问:
How to preview of html content in A4 pages format with dynamic content changes with fixed page size in angular
Unable to send the excess data from one page to another page.

I tried with Adding Child Element if content touches the bottom of the current page then new child element will be created, but unable to move the excess content to the newly created child element.


问:
Appium logs are displayed with each character on a single line on Terminal but are displaying fine when I run from IDE
When I run Appium from terminal logs are left-sided with each character on a single line. But from the IDE its displaying correctly. I am certain it has to do with the encoding but I really do not know where to start. I have attached a screenshot below for more detailed description.


问:
How we can configure Reporting Task 'SiteToSiteBulletinReportingTask 1.17.0' from NiFi CLI
Can anybody let me know, How i can configure NiFi ReportingTask 'SiteToSiteBulletinReportingTask 1.17.0' using NiFi CLI command.


问:
Kendo React Grid validaation when edit
I am using the Kendo React Grid component in batch mode for editing inside the grid, but I need to validate some required columns and check if they are not empty and validation is ok, then enable a specific button.

How can I implement validation of required columns while showing a validation message in each column?

I didn't find any solution for that

Title: Kendo React Grid validaation when edit


问:
How to integrate Karate Framework with qTest
My requirement is to once API test execution is completed, I need to update that result to qTest. qTest is providing API that can be invoked after test execution is completed but not sure how it can be invoke from Karate Framework through common code. Probably in TestRunner file general code can be written but not sure how to pass qTest test case id from feature file to TestRunner file. qTest is also providing SDK as well.

can someone please help me with this?

I have used Result class of Karate which is providing result details but not providing any metadata of from feature file.


问:
How to change Filamentphp Heroicon version?
Filamentphp is using Heroicon v1 as it says in the documentation.

But I wanted to change the version to v2. It wasn't successful.

I installed the blade-ui-kit/blade-heroicons package and required it. Then I updated the composer.

"require": {
   "blade-ui-kit/blade-heroicons": "^1.2|^2.10",
}
```
<p>The reason why I put <code>^1.2|^2.10</code> instead of <code>^2.10</code> for the version is that it had given me an error:</p>
```Problem 1
    - filament/forms[v2.16.0, ..., 2.x-dev] require blade-ui-kit/blade-heroicons ^1.2 -> found blade-ui-kit/blade-heroicons[1.2.0, 1.2.1, 1.3.0, 1.3.1] but it conflicts with your root
```

It doesn't give me this error now when I changed the version like I said, but it still isn't working and I can't use Heroicon v2 icons in Filamentphp.

Body:
Filamentphp is using Heroicon v1 as it says in the documentation.

But I wanted to change the version to v2. It wasn't successful.

I installed the blade-ui-kit/blade-heroicons package and required it. Then I updated the composer.

"require": {
   "blade-ui-kit/blade-heroicons": "^1.2|^2.10",
}

The reason why I put ^1.2|^2.10 instead of ^2.10 for the version is that it had given me an error:

Problem 1
    - filament/forms[v2.16.0, ..., 2.x-dev] require blade-ui-kit/blade-heroicons ^1.2 -> found blade-ui-kit/blade-heroicons[1.2.0, 1.2.1, 1.3.0, 1.3.1] but it conflicts with your root

It doesn't give me this error now when I changed the version like I said, but it still isn't working and I can't use Heroicon v2 icons in Filamentphp.


问:
Magento2 catalog product grid
Create a custom colum in the product grid. It shows that how many size options available against that product. If the product has (S,M,L) then 3, if product has (XS,S,M,L,XL) then 5 and if product has (X,M,L and Color options like Green, Blue, Black) then shows 6, in other words show how many child products does this product have? if simple product then it shows 0.

i have been trying to solve it through ui components but the column is not created and also try to solve it like order id but not found answer.

Title: Magento2 catalog product grid


问:
why ads disappears in flutter?
I had banner and native test ad inside my app and now it disappears. I am getting this error now.</p>
```<code>E/ApsLdfGameIdentify(24814): binder error
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
I/Ads     (24814): Use
RequestConfiguration.Builder().
setTestDeviceIds(Arrays.asList("B14F98FEF3A77FA1E6"))
 to get test ads on this device.
 I/AdCheck (24814): APS: blockAdView!
</code>```

Title: why ads disappears in flutter?

Body:
I had banner and native test ad inside my app and now it disappears. I am getting this error now.

E/ApsLdfGameIdentify(24814): binder error
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
E/Hwaps   (24814): no data in database of APSAPPINFO
I/Ads     (24814): Use
RequestConfiguration.Builder().
setTestDeviceIds(Arrays.asList("B14F98FEF3A77FA1E6"))
 to get test ads on this device.
 I/AdCheck (24814): APS: blockAdView!


问:
Shapely Intersection, registering that there is an intersection but not calculating area
I am having trouble calculating the area of an intersection of two shapely GeometryCollections which have been created from two GeoJSON multipolygons that represent drivetimes.

I want to check for two possible scenarios and have set up test data to help write the code:

In the first scenario, one drivetime is wholly within the other drivetime and I have confirmed this is the case through rendering the drivetimes on a folium map in Jupyter. I assume that in this case I can just use ".within" and, if it returns "True", I can apportion 100% of the smaller catchment to the area shared?

But in the second scenario, visually far more than 95% of the smaller catchment is clearly within the larger one but when I use the following code, it only registers that 49% is within the area.  Is the conversion from GeoJSON multipolygon to Shapely that I am using, losing the relative scale of the actual catchments?

My code and outputs, along with images of each of the catchments, are below, if someone could tell me where I am going wrong in calculating the size of the intersection, that would be great.

```<code>from shapely.geometry import GeometryCollection, shape

catchment1 = GeometryCollection([shape(value[0][1]['data']['features'][0]['geometry']).buffer(0) for feature in features])
catchment2 = GeometryCollection([shape(value[1][1]['data']['features'][0]['geometry']).buffer(0) for feature in features])

if catchment2.within(catchment1):
    print("Within")
else:
    print("Not Within")

if catchment1.intersects(catchment2):
    print("intersects")
    print(f"Shape 1 Area: {catchment1.area}")
    print(f"Shape 2 Area: {catchment2.area}")
    print(f"Shape 2 Area as a percentage of Shape1 Area {(catchment2.area/catchment1.area) * 100}")

    print(f"Intersection {catchment1.intersects(catchment2)}")
    print(f"Intersection Area1 : {catchment1.intersection(catchment2).area}")
    print(f"Intersection Area1 : {catchment2.intersection(catchment1).area}")

    print( (catchment1.intersection(catchment2).area/catchment2.area)*100)
else:
    print("does not intersect")

catchment2.intersection(catchment1)
</code>```

And the output I am getting is:

```<code>Not Within
intersects
Shape 1 Area: 0.026273957817
Shape 2 Area: 0.015491099132000195
Shape 2 Area as a percentage of Shape1 Area 58.959899532064455
Intersection True
Intersection Area1 : 0.0076861602514691355
Intersection Area1 : 0.0076861602514691225
49.616622977976554
</code>```

Catchment 1

Catchment 2

Body:
I am having trouble calculating the area of an intersection of two shapely GeometryCollections which have been created from two GeoJSON multipolygons that represent drivetimes.

I want to check for two possible scenarios and have set up test data to help write the code:

In the first scenario, one drivetime is wholly within the other drivetime and I have confirmed this is the case through rendering the drivetimes on a folium map in Jupyter. I assume that in this case I can just use ".within" and, if it returns "True", I can apportion 100% of the smaller catchment to the area shared?

But in the second scenario, visually far more than 95% of the smaller catchment is clearly within the larger one but when I use the following code, it only registers that 49% is within the area.  Is the conversion from GeoJSON multipolygon to Shapely that I am using, losing the relative scale of the actual catchments?

My code and outputs, along with images of each of the catchments, are below, if someone could tell me where I am going wrong in calculating the size of the intersection, that would be great.

from shapely.geometry import GeometryCollection, shape

catchment1 = GeometryCollection([shape(value[0][1]['data']['features'][0]['geometry']).buffer(0) for feature in features])
catchment2 = GeometryCollection([shape(value[1][1]['data']['features'][0]['geometry']).buffer(0) for feature in features])

if catchment2.within(catchment1):
    print("Within")
else:
    print("Not Within")

if catchment1.intersects(catchment2):
    print("intersects")
    print(f"Shape 1 Area: {catchment1.area}")
    print(f"Shape 2 Area: {catchment2.area}")
    print(f"Shape 2 Area as a percentage of Shape1 Area {(catchment2.area/catchment1.area) * 100}")

    print(f"Intersection {catchment1.intersects(catchment2)}")
    print(f"Intersection Area1 : {catchment1.intersection(catchment2).area}")
    print(f"Intersection Area1 : {catchment2.intersection(catchment1).area}")

    print( (catchment1.intersection(catchment2).area/catchment2.area)*100)
else:
    print("does not intersect")

catchment2.intersection(catchment1)

And the output I am getting is:

Not Within
intersects
Shape 1 Area: 0.026273957817
Shape 2 Area: 0.015491099132000195
Shape 2 Area as a percentage of Shape1 Area 58.959899532064455
Intersection True
Intersection Area1 : 0.0076861602514691355
Intersection Area1 : 0.0076861602514691225
49.616622977976554

Catchment 1

Catchment 2


问:
How to extract values from JSONArray object from JSON response in java?
I have a problem in extracting JSONObject from Array. This is JSON response. I want to extract values from it. Now I have to read "name" property value from time JSONArray and label property value from "Azure-Services" JSONArray.

```<code>{
  "dimensions": [
    {
      "time": [
        {
          "name": "total",
          "label": "Total"
        },
        {
          "excluded": false,
          "parent": -1,
          "name": "2022-01",
          "direct": null,
          "populated": true,
          "label": "2022-01",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": false,
          "parent": -1,
          "name": "2022-02",
          "direct": null,
          "populated": true,
          "label": "2022-02",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": false,
          "parent": -1,
          "name": "2022-03",
          "direct": null,
          "populated": true,
          "label": "2022-03",
          "sort_order": null,
          "extended": false
        }
      ]
    },
    {
      "Azure-Services": [
        {
          "name": "total",
          "label": "Total"
        },
        {
          "excluded": null,
          "parent": -1,
          "name": "1700",
          "direct": null,
          "populated": null,
          "label": "Marketplace",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": null,
          "parent": 0,
          "name": "1701",
          "direct": false,
          "populated": null,
          "label": "Marketplace",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": null,
          "parent": -1,
          "name": "3000",
          "direct": null,
          "populated": null,
          "label": "Storage",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": null,
          "parent": -1,
          "name": "azure_other",
          "direct": null,
          "populated": null,
          "label": "Other",
          "sort_order": null,
          "extended": false
        }
      ]
    }
  ]
}
</code>```

I want time and Azure-Services object separately. I tried this way:

```<code>JSONObject jsonObj = new JSONObject(reportData);
System.out.println("Json Object = "+jsonObj);
JSONArray jsonArr = jsonObj.getJSONArray("dimensions");
System.out.println("Dimension array = "+jsonArr); // dimensions object response is shown above
for(int i = 0; i < jsonArr.length(); i++) {
    System.out.println("JSON Array : "+jsonArr.getJSONObject(i));;
    // how to iterate in for loop to get time and azure services seperately.
}
</code>```

Now, I want to iterate time array and Azure-Services array object to get property's value.

How should I do that?

Body:
I have a problem in extracting JSONObject from Array. This is JSON response. I want to extract values from it. Now I have to read "name" property value from time JSONArray and label property value from "Azure-Services" JSONArray.

{
  "dimensions": [
    {
      "time": [
        {
          "name": "total",
          "label": "Total"
        },
        {
          "excluded": false,
          "parent": -1,
          "name": "2022-01",
          "direct": null,
          "populated": true,
          "label": "2022-01",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": false,
          "parent": -1,
          "name": "2022-02",
          "direct": null,
          "populated": true,
          "label": "2022-02",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": false,
          "parent": -1,
          "name": "2022-03",
          "direct": null,
          "populated": true,
          "label": "2022-03",
          "sort_order": null,
          "extended": false
        }
      ]
    },
    {
      "Azure-Services": [
        {
          "name": "total",
          "label": "Total"
        },
        {
          "excluded": null,
          "parent": -1,
          "name": "1700",
          "direct": null,
          "populated": null,
          "label": "Marketplace",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": null,
          "parent": 0,
          "name": "1701",
          "direct": false,
          "populated": null,
          "label": "Marketplace",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": null,
          "parent": -1,
          "name": "3000",
          "direct": null,
          "populated": null,
          "label": "Storage",
          "sort_order": null,
          "extended": false
        },
        {
          "excluded": null,
          "parent": -1,
          "name": "azure_other",
          "direct": null,
          "populated": null,
          "label": "Other",
          "sort_order": null,
          "extended": false
        }
      ]
    }
  ]
}

I want time and Azure-Services object separately. I tried this way:

JSONObject jsonObj = new JSONObject(reportData);
System.out.println("Json Object = "+jsonObj);
JSONArray jsonArr = jsonObj.getJSONArray("dimensions");
System.out.println("Dimension array = "+jsonArr); // dimensions object response is shown above
for(int i = 0; i < jsonArr.length(); i++) {
    System.out.println("JSON Array : "+jsonArr.getJSONObject(i));;
    // how to iterate in for loop to get time and azure services seperately.
}

Now, I want to iterate time array and Azure-Services array object to get property's value.

How should I do that?


问:
Steam Api Cors with Nuxt Vercel
I have a simple task, I need to get an item from the steam workshop. But the cors error appears. The request is correct.

I have uploaded my project to vercel.

According to the versel documentation, I created vercel.json with this content

{
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "Access-Control-Allow-Credentials", "value": "true" },
        { "key": "Access-Control-Allow-Origin", "value": "*" },
        { "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
        { "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }
      ]
    }
  ]
}```
</div>
</div>
</p>
<p>How do I get rid of the error?</p>
<p><strong>NUXT CODE</strong>
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code> let { data, error } = useFetch(
      `https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/?key=${
        config.public.env.api_key
      }&itemcount=1&publishedfileids%5B0%5D=${id}`,
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
      }
    );</code>```

Title: Steam Api Cors with Nuxt Vercel

Body:
I have a simple task, I need to get an item from the steam workshop. But the cors error appears. The request is correct.

I have uploaded my project to vercel.

According to the versel documentation, I created vercel.json with this content

{
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "Access-Control-Allow-Credentials", "value": "true" },
        { "key": "Access-Control-Allow-Origin", "value": "*" },
        { "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
        { "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }
      ]
    }
  ]
}

How do I get rid of the error?

NUXT CODE

 let { data, error } = useFetch(
      `https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/?key=${
        config.public.env.api_key
      }&itemcount=1&publishedfileids%5B0%5D=${id}`,
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
      }
    );


问:
Python in vscode terminal - executes program when file not saved, but throws syntaxError: invalid syntax when saved, pointing to /bin/python3
Installed extensions on vscodium:
autoDocstring, Python, isort, and several Jupyer extensions.

OS: Ubuntu 20

Process: Open VsCodium (not via ctrl+t, but via clicking), create a python file, write a program, run it - get weird terminal behavior, save it - get even more weird terminal behavior (as shown below).

The terminal works very weirdly overall. I don't understand how it's handling the execution steps, and when/if it's even asking me for input. Maybe I've got some wrong extensions installed?
On the pic, how u be, Jowey is before saving the file to documents. The /bin/python3 is after saving to documents.
enter image description here

Tried making new files, running without saving. Both described above.


问:
How can I change the default exports dir in a nodejs package?
I am using pnpm as the package manager with multiple workspaces in my project.

Every workspace in my project has a src dir for sourcing code and a lib dir for compiled output.

For example:

```<code>// workspace @x/a

package.json

lib
    index.js
    sub
        index.js
        other.js
</code>```

I want to make this workspace can be required (or imported) in the following ways:

require( '@x/a' ) // lib/index.js
require( '@x/a/sub' ) // lib/sub/index.js
require( '@x/a/sub/other' ) // lib/sub/other.js
```
<p>In a word, I want to make the workspace to be required like it has no the <code>lib</code> dir.</p>
<p>I tried using exports config in package.json:</p>
<pre class="lang-json prettyprint-override"><code>{
    "exports" : {
        "." : "./lib/index.js",
        "./*" : "./lib/*",
        "./*" : "./lib/*.js"
    }
}
</code>```

But there are some issues while using the config:

With the "./*" : "./lib/*", nodejs module loader doesn't try adding .js extension so that @x/a/sub/other cannot be resolved.

With "./*" : "./lib/*" nodejs moudle loader doesn't try resolving folders as modules, it causes that @x/a/sub can't be resolved.

I know I can add "./sub" : "./lib/sub/index.js" to fix the problem, but I really don't want to add all my folders into the configuration, there are too many folders and there are nested.

Body:
I am using pnpm as the package manager with multiple workspaces in my project.

Every workspace in my project has a src dir for sourcing code and a lib dir for compiled output.

For example:

// workspace @x/a

package.json

lib
    index.js
    sub
        index.js
        other.js

I want to make this workspace can be required (or imported) in the following ways:

require( '@x/a' ) // lib/index.js
require( '@x/a/sub' ) // lib/sub/index.js
require( '@x/a/sub/other' ) // lib/sub/other.js

In a word, I want to make the workspace to be required like it has no the lib dir.

I tried using exports config in package.json:

{
    "exports" : {
        "." : "./lib/index.js",
        "./*" : "./lib/*",
        "./*" : "./lib/*.js"
    }
}

But there are some issues while using the config:

With the "./*" : "./lib/*", nodejs module loader doesn't try adding .js extension so that @x/a/sub/other cannot be resolved.

With "./*" : "./lib/*" nodejs moudle loader doesn't try resolving folders as modules, it causes that @x/a/sub can't be resolved.

I know I can add "./sub" : "./lib/sub/index.js" to fix the problem, but I really don't want to add all my folders into the configuration, there are too many folders and there are nested.


问:
How to Change a Color of Clusters in Google Map
How can I change the color of Clusters in google map from Blue(default) to Red. I tried so many times to code by add third attribute where cluster is rendered but all in vain. Kindly have a look into code and advice.</p>
```<code> var options = {
                maxZoom: 15,
                styles: [{
                    url: 'https://maps.gstatic.com/mapfiles/transparent.png',
                    width: 53,
                    height: 53,
                    textColor: '#fff',
                    color: "red",
                }]
            }

            const markerCluster = new markerClusterer.MarkerClusterer({
                map,
                markers,
                options
            });
            // new MarkerClusterer({ markers, map });

            setInterval(function() {
                if (!infowindow.getMap()) {
                    $('.marker_google_map').removeClass('selected');
                }
            }, 1000);
</code>```

Body:
How can I change the color of Clusters in google map from Blue(default) to Red. I tried so many times to code by add third attribute where cluster is rendered but all in vain. Kindly have a look into code and advice.

 var options = {
                maxZoom: 15,
                styles: [{
                    url: 'https://maps.gstatic.com/mapfiles/transparent.png',
                    width: 53,
                    height: 53,
                    textColor: '#fff',
                    color: "red",
                }]
            }

            const markerCluster = new markerClusterer.MarkerClusterer({
                map,
                markers,
                options
            });
            // new MarkerClusterer({ markers, map });

            setInterval(function() {
                if (!infowindow.getMap()) {
                    $('.marker_google_map').removeClass('selected');
                }
            }, 1000);


问:
R: Remove data from memory
i have like 10 datasets which are quite big in size. I need to combine them into one dataframe.
The first .rda file has like 2gb, the second 4gb.

I want to load them sequentially and use bind_rows to combine them into one big dataframe. However I did notice the following behavior. Whenever I load the data and overwrite it with new data, R keeps saying that the memory is not free from the previous data. Example

```<code>load("path_to_2gb.rda")
rm(data)
gc()
load("path_to_4gb.rda")
</code>```

From my ubuntu machine I see that the r-session uses over 6gb of RAM. I do not have enough memory to keep all previous data in the memory and at the same time create some new dataframe holding all data.

Is there any other option?

Title: R: Remove data from memory

Body:
i have like 10 datasets which are quite big in size. I need to combine them into one dataframe.
The first .rda file has like 2gb, the second 4gb.

I want to load them sequentially and use bind_rows to combine them into one big dataframe. However I did notice the following behavior. Whenever I load the data and overwrite it with new data, R keeps saying that the memory is not free from the previous data. Example

load("path_to_2gb.rda")
rm(data)
gc()
load("path_to_4gb.rda")

From my ubuntu machine I see that the r-session uses over 6gb of RAM. I do not have enough memory to keep all previous data in the memory and at the same time create some new dataframe holding all data.

Is there any other option?


问:
How to resolve response.cookie is not a function: graphQL Nest.js
I'm trying to set up cookie to response (GraphQL, Nest.js), but getting an error - response.cookie is not a function. How can I resolve it?

app.module.ts file:

```<code> GraphQLModule.forRootAsync({
      imports: [KitStatusModule],
      inject: [KitStatusService],
      useFactory: (kitStatusService: KitStatusService) => ({
        playground: true,
        autoSchemaFile: 'schema.gql',
        context: ({ req, res }) => {
          return { req, res }
        },
        introspection: true,
        cors: {
          credentials: true,
          origin: true,
        }
}
</code>```

main.ts file:

```<code>import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as cookieParser from 'cookie-parser';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.use(cookieParser());
  app.enableCors({
    origin: true,
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
    credentials: true,
  });
  await app.listen(process.env.PORT || 3000);
}
bootstrap();
</code>```

account.resolver.ts file:

```<code>async login(
    @Res({ passthrough: true }) response: Response,
    @GetExecutionContext() context: GqlExecutionContext,
    @Args('AccountInput') AccountInput: AccountInput
): Promise<AccountTokenOutput> {
    console.log(response.cookie('refreshtoken', 'refreshtoken'))
    return await this.accountService.login(AccountInput, context);
};
</code>```

Body:
I'm trying to set up cookie to response (GraphQL, Nest.js), but getting an error - response.cookie is not a function. How can I resolve it?

app.module.ts file:

 GraphQLModule.forRootAsync({
      imports: [KitStatusModule],
      inject: [KitStatusService],
      useFactory: (kitStatusService: KitStatusService) => ({
        playground: true,
        autoSchemaFile: 'schema.gql',
        context: ({ req, res }) => {
          return { req, res }
        },
        introspection: true,
        cors: {
          credentials: true,
          origin: true,
        }
}

main.ts file:

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as cookieParser from 'cookie-parser';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.use(cookieParser());
  app.enableCors({
    origin: true,
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
    credentials: true,
  });
  await app.listen(process.env.PORT || 3000);
}
bootstrap();

account.resolver.ts file:

async login(
    @Res({ passthrough: true }) response: Response,
    @GetExecutionContext() context: GqlExecutionContext,
    @Args('AccountInput') AccountInput: AccountInput
): Promise<AccountTokenOutput> {
    console.log(response.cookie('refreshtoken', 'refreshtoken'))
    return await this.accountService.login(AccountInput, context);
};


问:
Owl carousel is not working slider in wordpress
I want to slider the "dhelp_lite_slider"'s  post thumbnails using owl carousel in wordpress site. I'm calling my guess wrong. I would be glad if you help.</p>
```<code>
function main_slider()
{

    $html = '';
    $slider = get_posts( array(
        'post_type'=> 'dhelp_lite_slider',
        'numberposts' => 10,
        'post_status' => 'private',
        'meta_key' => '_ordering_slider',
        'orderby' => 'meta_value_num',
        'order' => 'ASC',

    ));

    $html .= '<div class="owl-carousel owl-theme">';
    foreach ( $slider as $post ) {

            //var_dump($post);
$html .= '<div class="item">'.$post->post_title.'</div>';
    }
    $html .= '</div>';

    return $html;

}
add_shortcode( 'main_slider_hook', 'main_slider' );
</code>```

Body:
I want to slider the "dhelp_lite_slider"'s  post thumbnails using owl carousel in wordpress site. I'm calling my guess wrong. I would be glad if you help.

function main_slider()
{

    $html = '';
    $slider = get_posts( array(
        'post_type'=> 'dhelp_lite_slider',
        'numberposts' => 10,
        'post_status' => 'private',
        'meta_key' => '_ordering_slider',
        'orderby' => 'meta_value_num',
        'order' => 'ASC',

    ));

    $html .= '
';
    foreach ( $slider as $post ) {

            //var_dump($post);
$html .= '
'.$post->post_title.'
';
    }
    $html .= '
';

    return $html;

}
add_shortcode( 'main_slider_hook', 'main_slider' );


问:
nth-child doesn't combine with previous selector
I have this HTML and CSS. I expect the nth-child will select "Test2" and "Test3" because the previous selector already filters out the "Nothing" element.

If I remove the :nth-child(n+2):nth-child(-n+3), the result selects Test1, Test2, Test3, Test4 (except Nothing). It's correct.

If I remove the :has(> div[role='article']), the result selects "Test1" and "Test2". It's correct.

Why doesn't nth-child combine with the previous selector? How can I fix it?

.container[role='feed'] > div:has(> div[role='article']):nth-child(n+2):nth-child(-n+3) {
  background: green;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container" role="feed">
  <div>
    <div role="nothing">
        Nothing
    </div>
  </div>

  <div>
    <div role="article">
      Test1
    </div>
  </div>

  <div>
    <div role="article">
      Test2
    </div>
  </div>

  <div>
    <div role="article">
      Test3
    </div>
  </div>

  <div>
    <div role="article">
      Test4
    </div>
  </div>

</div></code>```

Body:
I have this HTML and CSS. I expect the nth-child will select "Test2" and "Test3" because the previous selector already filters out the "Nothing" element.

If I remove the :nth-child(n+2):nth-child(-n+3), the result selects Test1, Test2, Test3, Test4 (except Nothing). It's correct.

If I remove the :has(> div[role='article']), the result selects "Test1" and "Test2". It's correct.

Why doesn't nth-child combine with the previous selector? How can I fix it?

.container[role='feed'] > div:has(> div[role='article']):nth-child(n+2):nth-child(-n+3) {
  background: green;
}

        Nothing

      Test1

      Test2

      Test3

      Test4


问:
Adding the number of found search results in elementor form
Does anyone know how can i display in heading or paragraph number(count, summary) of founded search results from Elementor form ?

I coudlnt find simple solution for this


问:
How can I connect to DigitalOcean's MongoDB (v5.0) Dtabase with Trusted Sources set?
I createad a DigitalOcean's MongoDB (v5.0) Database and was able to connect to it from my machine, both from Mongo Compass and Mongo CLI .
But as soons as I add my machine IP (using DigitalOcean's automatic detect ip tool) as Trusted Sources on my MongoDB database console in DigitalOcean, I stop beign able to connect to it through my machine.

On Mongo Compass I got the error:
Server selection timed out after 30000 ms

On Mongo CLI I got the error:
MongoDB shell version v5.0.2 connecting to: mongodb://<HOST>:27017/admin?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=<REPLICA>&ssl=true&tls=true {"t":{"$date":"2023-01-11T01:41:23.185Z"},"s":"I",  "c":"NETWORK",  "id":*******, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"RSM host selection timeout","attr":{"replicaSet":"<REPLICA>","error":"FailedToSatisfyReadPreference: Could not find host matching read preference { mode: \"nearest\" } for set <REPLICA>"}} Error: Could not find host matching read preference { mode: "nearest" } for set <REPLICA>, <REPLICA>/<HOST>:27017 : connect@src/mongo/shell/mongo.js:372:17 @(connect):2:6 exception: connect failed exiting with code 1

I already tried to paste my ipv6 that I got from the command line curl ifconfig.io as Trusted Source of my database in DigitalOcean's console, but even after that I'm still getting the same error.


问:
How do I specify the name of the packages.yml file in the dbt deps command?
I have 2 packages.yml file in my project directory to address my use case. The files are as below:

packages.yml

packages_1.yml

Each of the above 2 packages files have different packages with different versions.

Therefore how do I specify the names of the packages.yml file in my dbt deps command?

I have tried using the following commands:

```<code>dbt deps --profiles-dir ${DBT_PROFILES_DIR} --project-dir ${DBT_PROJECT_DIR} packages.yml
dbt deps --profiles-dir ${DBT_PROFILES_DIR} --project-dir ${DBT_PROJECT_DIR} packages_1.yml
</code>```

I expected the dbt deps command to pick up the packages.yml files from my project directory and install the packages.

However this doesn't seem to work. It only picks up the first one.

Body:
I have 2 packages.yml file in my project directory to address my use case. The files are as below:

packages.yml

packages_1.yml

Each of the above 2 packages files have different packages with different versions.

Therefore how do I specify the names of the packages.yml file in my dbt deps command?

I have tried using the following commands:

dbt deps --profiles-dir ${DBT_PROFILES_DIR} --project-dir ${DBT_PROJECT_DIR} packages.yml
dbt deps --profiles-dir ${DBT_PROFILES_DIR} --project-dir ${DBT_PROJECT_DIR} packages_1.yml

I expected the dbt deps command to pick up the packages.yml files from my project directory and install the packages.

However this doesn't seem to work. It only picks up the first one.


问:
Windows filesystem operations become unreliable under load
I work on a relatively large C++ Windows application. When running multiple instances of the application in parallel (with 100% CPU usage), for example during execution of our test suite, several file related operations start failing randomly. Some examples include:

extracting a zip archive and the loading one of the extracted files

writing / copying a bunch of files  and then adding them all to a zip archive

reading files that were just written by a child process

I have read that filesystem operations aren't guaranteed to be immediately visible upon closing a file handle, so I have created a little helper function that waits until a specified file becomes accessible and littered it about the code at some of the points where I noticed the failures, but:

It doesn't seem to be 100% reliable

It feels a bit ugly, especially since I have to put it at every point where the problem might present itself

So, my question is whether anyone has any ideas for a better or more reliable solution to this or any additional insight into the problem.


问:
Issue with decoding json, "The data couldn’t be read because it isn’t in the correct format."
New to Swift and coding in general. I can't seem to find what is wrong with my json / struct.

I am only including a small part of my json here.

```<code>[
    {

    "name": "pollock",
    "price": 749.99,
    "avaliableStock": [
        {
        "size": "xs",
        "stock": 0
        },
        {
        "size": "s",
        "stock": 4
        },
        {
            "size": "m",
            "stock": 0
        },
        {
            "size": "l",
            "stock": 3
        },
        {
            "size": "xl",
            "stock": 2
        }
    ],
    "gender": "men",
    "category": "summer",
    "mainImage": "pollockMain",
    "sideImage": "pollockSide1",
    "sideImage2": "pollockSide2",
    "backImage": "pollockBack"

    }

]

</code>```

My struct for the json:

```<code>struct Product: Identifiable, Decodable {

    var id: UUID?
    var name: String
    var price: Double
    var avaliableStock: AvaliableStock
    var gender: String
    var category: String
    var mainImage: String
    var sideImage: String
    var sideImage2: String
    var backImage: String

}

struct AvaliableStock: Identifiable, Decodable {

    var id: UUID?
    var size: String
    var stock: Int

}
</code>```

and finally my json decoder:

```<code>//
//  dataServices.swift
//  tgkb
//
//  Created by Jude Comninos on 2023/01/11.
//

import Foundation

class DataService {

    static func getLocalData() -> [Product] {

        let pathString = Bundle.main.path(forResource: "data", ofType: "json")
        guard pathString != nil else {
            return [Product]()
        }

        let url = URL(fileURLWithPath: pathString!)

        do {
            let data = try Data(contentsOf: url)

            let decoder = JSONDecoder()

             do {
                let productData = try decoder.decode([Product].self, from: data)

                for var p in productData {
                    p.id = UUID()
                }
                for var s in productData {
                    s.avaliableStock.id = UUID()
                }
                return productData
            }
            catch {
                print("DEBUG: \(error.localizedDescription)")
            }
        }
        catch {
            print("DEBUG: \(error.localizedDescription)")

        }
        return [Product]()
    }

}

</code>```

I have checked all the variables, I think they are all correct and correspond with each other. I am getting the following error: DEBUG: The data couldn’t be read because it isn’t in the correct format.

Thank you.

Body:
New to Swift and coding in general. I can't seem to find what is wrong with my json / struct.

I am only including a small part of my json here.

[
    {

    "name": "pollock",
    "price": 749.99,
    "avaliableStock": [
        {
        "size": "xs",
        "stock": 0
        },
        {
        "size": "s",
        "stock": 4
        },
        {
            "size": "m",
            "stock": 0
        },
        {
            "size": "l",
            "stock": 3
        },
        {
            "size": "xl",
            "stock": 2
        }
    ],
    "gender": "men",
    "category": "summer",
    "mainImage": "pollockMain",
    "sideImage": "pollockSide1",
    "sideImage2": "pollockSide2",
    "backImage": "pollockBack"

    }

]

My struct for the json:

struct Product: Identifiable, Decodable {

    var id: UUID?
    var name: String
    var price: Double
    var avaliableStock: AvaliableStock
    var gender: String
    var category: String
    var mainImage: String
    var sideImage: String
    var sideImage2: String
    var backImage: String

}

struct AvaliableStock: Identifiable, Decodable {

    var id: UUID?
    var size: String
    var stock: Int

}

and finally my json decoder:

//
//  dataServices.swift
//  tgkb
//
//  Created by Jude Comninos on 2023/01/11.
//

import Foundation

class DataService {

    static func getLocalData() -> [Product] {

        let pathString = Bundle.main.path(forResource: "data", ofType: "json")
        guard pathString != nil else {
            return [Product]()
        }

        let url = URL(fileURLWithPath: pathString!)

        do {
            let data = try Data(contentsOf: url)

            let decoder = JSONDecoder()

             do {
                let productData = try decoder.decode([Product].self, from: data)

                for var p in productData {
                    p.id = UUID()
                }
                for var s in productData {
                    s.avaliableStock.id = UUID()
                }
                return productData
            }
            catch {
                print("DEBUG: \(error.localizedDescription)")
            }
        }
        catch {
            print("DEBUG: \(error.localizedDescription)")

        }
        return [Product]()
    }

}

I have checked all the variables, I think they are all correct and correspond with each other. I am getting the following error: DEBUG: The data couldn’t be read because it isn’t in the correct format.

Thank you.


问:
Authorisation error with AWS API Gateway using access token
I have followed the AWS documentation for enabling an authoriser for API access using Cognito tokens.

When I test the authoriser with the ID token within the AWS console, it works fine.
On using the access tokens and trying to access via Postman I repeatedly get and "unauthorised" error (401).

I have tried the following but to no avail

Disabling and enabling CORS (both combinations)

Using the ID token instead of the access token

Republishing the API after changing the auth scope params

Deleting and recreating the API again

When I turn off authorisation the API works fine via Postman/ Browser. When I turn it back on again the problem resurfaces.


问:
OpenLayers Problem with adding custom wms address
I have a problem with specific wms address. I would like to add another one wms server with specific layer to my project.

```<code>const wmsSource1 = new TileWMS({
    url: "http://geoportal.powiatboleslawiecki.pl:80/ggp?",
    params: {
    LAYERS: "kontury",
    },
    serverType: "geoserver",
    crossOrigin: "anonymous",
})
</code>```

coordinates of the center of view [EPSG:3857]

```<code> [1731811, 6665020]
</code>```

The address works fine in other applications such qgis. I've checked layers name, address and everything looks ok. I do not know why I can not see it...

In qgis description of this wms you can see:

```<code>GetCapabilitiesUrl  http://geoportal.powiatboleslawiecki.pl/ggp?
</code>```
```<code>GetMapUrl   http://geoportal.powiatboleslawiecki.pl:80/ggp?SERVICE=WMS&
</code>```
```<code>GetFeatureInfoUrl   http://geoportal.powiatboleslawiecki.pl:80/ggp?SERVICE=WMS&
</code>```
```<code>GetLegendGraphic    http://geoportal.powiatboleslawiecki.pl:80/ggp?service=WMS&request=GetLegendGraphic&format=image/png&width=20&height=20&layer=kontury&
</code>```

thanks in advance,

Piotr

Body:
I have a problem with specific wms address. I would like to add another one wms server with specific layer to my project.

const wmsSource1 = new TileWMS({
    url: "http://geoportal.powiatboleslawiecki.pl:80/ggp?",
    params: {
    LAYERS: "kontury",
    },
    serverType: "geoserver",
    crossOrigin: "anonymous",
})

coordinates of the center of view [EPSG:3857]

 [1731811, 6665020]

The address works fine in other applications such qgis. I've checked layers name, address and everything looks ok. I do not know why I can not see it...

In qgis description of this wms you can see:

GetCapabilitiesUrl  http://geoportal.powiatboleslawiecki.pl/ggp?

GetMapUrl   http://geoportal.powiatboleslawiecki.pl:80/ggp?SERVICE=WMS&

GetFeatureInfoUrl   http://geoportal.powiatboleslawiecki.pl:80/ggp?SERVICE=WMS&

GetLegendGraphic    http://geoportal.powiatboleslawiecki.pl:80/ggp?service=WMS&request=GetLegendGraphic&format=image/png&width=20&height=20&layer=kontury&

thanks in advance,

Piotr


问:
How to use multiple classes inside @RunWith()?
I am trying to run an integration test using junit4 for which I need to use @RunWith(SpringRunner.class) but I also need to use @RunWith(RunIfRunner.class) for implementing the solution mentioned here

How to ensure the use of both on these? Or is there any other way to deal with this other than using @RunWith()?

Note: I need to use the solution mentioned in the link above(check here - 1).


问:
Some deep links may be failing because your web domains aren't associated with your app notification in google play store
This means that on Android 12 and above, your app can't accept traffic from some web URLs. To fix issues and make sure that users go directly to your app, go to the Deep links page.

is it require to do something on this notification?

notification received but could not understood whats wrong in my app even i didnt integrated deep link functionality.


问:
Download of ftp-file and transfer to PHP standard output not working correctly
I have .mp4 video files on a server, the only access to these files is FTP (or WebDAV). The files are typically < 100 MB. To use these videos in a webpage, I targetted to build a PHP script that reads the video file via FTP and outputs the content to the standard output. Something like this:

```<code>$ftp = ftp_connect( $FTPaccount['server'] );
ftp_login( $ftp, $FTPaccount['user'], $FTPaccount['pass'] );
ftp_set_option( $ftp, FTP_USEPASVADDRESS, false );
ftp_pasv( $ftp, true );
$fout = fopen( 'php://output', 'w+' );
ftp_fget( $ftp, $fout, $filepath, FTP_BINARY, 0 );
fclose( $fout );
ftp_close( $ftp );
</code>```

Roughly this works, but with the following disadvantages:

looking into the devtools (Network), I see request is in status pending forever

loading time is quite long (30s for 20 MB)

for comparision: when I map the ftp-server in Windows Explorer as WebDAV and open a video file with chrome it takes 1s

when the transfer looks complete, the video can be started and stopped but it's not possible to position within the video on the timeline, which is a severe restriction for any usage

All this strange behaviour may have to do with the handling of video streams between server and browser, also with buffering. I tested several variants including

```<code>stream_set_write_buffer( $fout, 0 );
flush();
</code>```

or

```<code>$url = 'ftp://' . $FTPaccount['user'] . ':' . urlescape( $FTPaccount['pass'] ) . '@' . $FTPaccount['server'] . '/' . $filepath;
$ctx = stream_context_create();
@readfile( $url, false, $ctx );
</code>```

but no improvement.

So I appreciate any help or suggestion how and where to look deeper

Body:
I have .mp4 video files on a server, the only access to these files is FTP (or WebDAV). The files are typically < 100 MB. To use these videos in a webpage, I targetted to build a PHP script that reads the video file via FTP and outputs the content to the standard output. Something like this:

$ftp = ftp_connect( $FTPaccount['server'] );
ftp_login( $ftp, $FTPaccount['user'], $FTPaccount['pass'] );
ftp_set_option( $ftp, FTP_USEPASVADDRESS, false );
ftp_pasv( $ftp, true );
$fout = fopen( 'php://output', 'w+' );
ftp_fget( $ftp, $fout, $filepath, FTP_BINARY, 0 );
fclose( $fout );
ftp_close( $ftp );

Roughly this works, but with the following disadvantages:

looking into the devtools (Network), I see request is in status pending forever

loading time is quite long (30s for 20 MB)

for comparision: when I map the ftp-server in Windows Explorer as WebDAV and open a video file with chrome it takes 1s

when the transfer looks complete, the video can be started and stopped but it's not possible to position within the video on the timeline, which is a severe restriction for any usage

All this strange behaviour may have to do with the handling of video streams between server and browser, also with buffering. I tested several variants including

stream_set_write_buffer( $fout, 0 );
flush();

or

$url = 'ftp://' . $FTPaccount['user'] . ':' . urlescape( $FTPaccount['pass'] ) . '@' . $FTPaccount['server'] . '/' . $filepath;
$ctx = stream_context_create();
@readfile( $url, false, $ctx );

but no improvement.

So I appreciate any help or suggestion how and where to look deeper


问:
PHP Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect()
I don't seem to be able to load the correct drivers for SQL server.

I work with Windows 10, PHP Version 8.2.1

In phpinfo():

```<code>Loaded Configuration File   C:\Windows\PHP\php.ini
extension_dir   C:\Windows\PHP\ext
</code>```

in php.ini:

```<code>extension=php_pdo_sqlsrv_81_nts_x64.dll
extension=php_sqlsrv_81_nts_x64.dll
</code>```

But when I look in the phpinfo() there is no sqlsrv.

Can anyone help me and tell me what I did wrong? How do I load those drivers?

I already read the post about this error, but none of them offer a solution.

I tried PDO.

When I use mysql, I can see it in phpinfo()
But when I try with sql server I get "no value" in the PDO section under PDO drivers.

If I check with "print_r(get_loaded_extensions());", I can see that PDO is loaded.

When I try to connect, I get the message "Connection failed: could not find driver"

Body:
I don't seem to be able to load the correct drivers for SQL server.

I work with Windows 10, PHP Version 8.2.1

In phpinfo():

Loaded Configuration File   C:\Windows\PHP\php.ini
extension_dir   C:\Windows\PHP\ext

in php.ini:

extension=php_pdo_sqlsrv_81_nts_x64.dll
extension=php_sqlsrv_81_nts_x64.dll

But when I look in the phpinfo() there is no sqlsrv.

Can anyone help me and tell me what I did wrong? How do I load those drivers?

I already read the post about this error, but none of them offer a solution.

I tried PDO.

When I use mysql, I can see it in phpinfo()
But when I try with sql server I get "no value" in the PDO section under PDO drivers.

If I check with "print_r(get_loaded_extensions());", I can see that PDO is loaded.

When I try to connect, I get the message "Connection failed: could not find driver"


问:
How to dump ResultSet into mongodb obtained from microsoft access file
I'm reading data from access file with mdb extension after that I'm saving this data into Mongo Database, now what I want is not to use the while loop while saving the data I just want to save the whole result obtained and dump it into mongodb if data present I want to override the existing data, using while loop takes much time so what I figure out may be I should dump the whole resultset obtained and at the second upload it should ovewrite the data if exists.

what I'm having right now

```<code>@Autowired
    private CustomerRepository customerRepository;

@Async
    public void processData(Path filepath, String basename) throws IOException {

try {

            String msAccDB = "jdbc:ucanaccess://" + filepath;
            Connection conn = DriverManager.getConnection(msAccDB);

            // Fetching Patient Visits
            Statement customers = conn.createStatement();
                ResultSet result = customers .executeQuery("SELECT * FROM customers");

            while(result.next()) {
            Customer customer = new Customer();
            customer.setCustomerId(result.getString(1));
            customer.setCustomerDate(result.getString(2));
            customer.setWeight(result.getString(3));
            customer.setCustomerCode(result.getString(9));
            customer.setDateAdded(LocalDateTime.now());
            customer.setFacilityName(basename);
            customerRepository.save(customer );
            }

            }
}
            result.close();
            visits.close();
</code>```

Also I want to check if data exists in database it should be overwitten, any help

Body:
I'm reading data from access file with mdb extension after that I'm saving this data into Mongo Database, now what I want is not to use the while loop while saving the data I just want to save the whole result obtained and dump it into mongodb if data present I want to override the existing data, using while loop takes much time so what I figure out may be I should dump the whole resultset obtained and at the second upload it should ovewrite the data if exists.

what I'm having right now

@Autowired
    private CustomerRepository customerRepository;

@Async
    public void processData(Path filepath, String basename) throws IOException {

try {

            String msAccDB = "jdbc:ucanaccess://" + filepath;
            Connection conn = DriverManager.getConnection(msAccDB);

            // Fetching Patient Visits
            Statement customers = conn.createStatement();
                ResultSet result = customers .executeQuery("SELECT * FROM customers");

            while(result.next()) {
            Customer customer = new Customer();
            customer.setCustomerId(result.getString(1));
            customer.setCustomerDate(result.getString(2));
            customer.setWeight(result.getString(3));
            customer.setCustomerCode(result.getString(9));
            customer.setDateAdded(LocalDateTime.now());
            customer.setFacilityName(basename);
            customerRepository.save(customer );
            }

            }
}
            result.close();
            visits.close();

Also I want to check if data exists in database it should be overwitten, any help


问:
Is there any np.select alternative in pyspark Pandas API
I know that numpy.where and numpy.select function is really fast for dataframe processing. But now im using pyspark with Pandas API so it can be multi node processing. is there any alternatives for using numpy select without changing the dataframe into pandas or pyspark, but using pyspark Pandas API? Thanks.</p>


问:
How to force widgets with grid with different width (tkinter)
I'm trying to create a GUI with tkinter which controls some ports with ON/OFF toggle. I have a frame which has a Text label and 4 buttons underneath it.

I have an issue with grid() placement. The frame text bigger, on row=0 and column =0.
Button titles  are on row=1 and consecutive columns (with some padding).
And buttons same as tittles but with row=2.

The first button with its title will be placed in a space as wide as the text title above (sticky='w'). I've read that :"The column will default to the smallest width that will accommodate the widest item. That, or elsewhere in your code you give a non-zero weight to some of those columns that is causing them to expand"

Issue:
I want all buttons to be towards the left, and s2 to be placed after the end of s1 with same padding as the others. I do not want s1 with its title to be in a cell as wide as the cell above.

How could I achieve this? Can I use the weight parameter?

One idea I have is to create another frame within this frame that has only the buttons and place it on row=1,column=0.

Thanks!

I've tried on all my titles and buttons with sticky='w', it works only on S1 with its title, but not on the rest.


问:
Is Private the default CloudKit database while in TestFlight
I'm beta testing an app in TestFlight. I thought I had set things up so that all data would be stored in the Public Database in my CloudKit container (which I deployed to Production). But all records are going to the Private Database. Is this the default for TestFlight? Will it automatically switch to Public if/when the app is released?
For reference, here is the code (following this video)
Did I goof up somehow?</p>
```<code>class DataController: ObservableObject {
var container: NSPersistentCloudKitContainer

init(inMemory: Bool = false) {
    container = NSPersistentCloudKitContainer(name: "Main")
    if inMemory { // this is set in static var preview
        container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null")
    }

    guard let description = container.persistentStoreDescriptions.first else {
         print("###########Can't set description")
         fatalError("Error")
     }

    let publicStoreURL = description.url!.deletingLastPathComponent().appendingPathComponent("public.sqlite")
    let containerIdentifier = description.cloudKitContainerOptions!.containerIdentifier

    let publicDescription = NSPersistentStoreDescription(url: publicStoreURL)
    publicDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
    publicDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)

    let publicOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier)
    publicOptions.databaseScope = .public

    publicDescription.cloudKitContainerOptions = publicOptions

    container.persistentStoreDescriptions.append(publicDescription)

    container.loadPersistentStores { _, error in
        if let error = error {
            fatalError("##########Error loading store: \(error.localizedDescription)")
        }
    }

}
</code>```

Body:
I'm beta testing an app in TestFlight. I thought I had set things up so that all data would be stored in the Public Database in my CloudKit container (which I deployed to Production). But all records are going to the Private Database. Is this the default for TestFlight? Will it automatically switch to Public if/when the app is released?
For reference, here is the code (following this video)
Did I goof up somehow?

class DataController: ObservableObject {
var container: NSPersistentCloudKitContainer

init(inMemory: Bool = false) {
    container = NSPersistentCloudKitContainer(name: "Main")
    if inMemory { // this is set in static var preview
        container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null")
    }

    guard let description = container.persistentStoreDescriptions.first else {
         print("###########Can't set description")
         fatalError("Error")
     }

    let publicStoreURL = description.url!.deletingLastPathComponent().appendingPathComponent("public.sqlite")
    let containerIdentifier = description.cloudKitContainerOptions!.containerIdentifier

    let publicDescription = NSPersistentStoreDescription(url: publicStoreURL)
    publicDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
    publicDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)

    let publicOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier)
    publicOptions.databaseScope = .public

    publicDescription.cloudKitContainerOptions = publicOptions

    container.persistentStoreDescriptions.append(publicDescription)

    container.loadPersistentStores { _, error in
        if let error = error {
            fatalError("##########Error loading store: \(error.localizedDescription)")
        }
    }

}


问:
My shadertoy fbm example has discontinuities, is it the browser or me?
I'm trying to understand GLSL and shaders and have copied an example shader to generate FBM noise and I'm getting discontinuities in the output.

My shader is here: https://www.shadertoy.com/view/mtSGRz

I've copied the example from https://thebookofshaders.com/13/ and reduced it to a single octave and scaled to make the discontinuity visible:

I'm not sure if:

a) I'm not understanding the algorithm correctly and this is the expected output (I doubt that though as I thought that the point of FBM noise was it was continuous and differentiable).

b) There's a bug in the code (I expected that when I was trying to implement the algorithm from scratch, but not since I've now just copied the code from The Book of Shaders.)

c) There's a floating point precision (or similar) issue, but it seems this works for other people?

d) It's something buggy on my setup (Chrome 108 on Windows 10, Dell Precision 5530 laptop)

Can anyone point me in the right direction?


问:
how can i make bootstrap modal flow from right side?
```<code><div class="modal fade" id="request-quote" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <i class="flaticon-close"></i>
                </button>
            </div>
            <div class="modal-body">
                <div class="modal-loading-area">
                     <div class="title">
                       <h4>Request Quote</h4>
                     </div>
                     <div class="content">
                         <div class="common-name-field">
                                    <div class="col-md-12 common-field">
                                         <input type="text" name="company_address" class="form-control" id="inputEmail1" placeholder="Name" required="">
                                    </div>
                         </div>
                     </div>
                </div>
            </div>
        </div>
    </div>
<div>
</code>```

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

By default bootstrap modal gets poped from top to center,  but what i want to is pop show modal flow from right to left. Any idea how to do that?

Body:
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">

                </button>

Request Quote

                                         <input type="text" name="company_address" class="form-control" id="inputEmail1" placeholder="Name" required="">

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

By default bootstrap modal gets poped from top to center,  but what i want to is pop show modal flow from right to left. Any idea how to do that?


问:
esBuild Web Component error in consuming app
I have a basic WebComponent that adds text to a
. This WebComponent currently lives in my Angular v12 web app and works without any issues.

I am attempting to move the WebComponent to a lib which is bundled with esBuild. After migrating the WebComponent, upon trying to start my Angular web app project, i am seeing many errors like:

```<code>./node_modules/faye-websocket/lib/faye/eventsource.js3:13-37 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
</code>```

The above error is just for 'stream', but i see same errors for:

```<code>'util' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye'
'net' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye\websocket'
'tls' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye\websocket'
'url' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye\websocket'
'assert' in 'C:\dev\myApp\node_modules\http-parser-js'
'fs' in 'C:\dev\myApp\node_modules\sockjs/lib'
'fs' in 'C:\dev\myApp\node_modules\sockjs/lib'
'stream' in 'C:\dev\myApp\node_modules\sockjs/lib'
'crypto' in 'C:\dev\myApp\node_modules\sockjs/lib'
'url' in 'C:\dev\myApp\node_modules\sockjs/lib'
'querystring' in 'C:\dev\myApp\node_modules\sockjs/lib'
</code>```

Spending a lot of time debugging, the errors above are displayed when the following line in the WebComponent is active:

```<code>import { Subject } from 'rxjs';

export class ListComponent extends HTMLElement {
    public contentSub: Subject<any> = new Subject(); // <-- line line
</code>```

If i comment out the above (contentSub), then the initial HTML of the WebComponent renders, albeit with a lack of functionality without above.

esBuild config:

```<code>cost { dependencies, peerDependencies } = require('./package.json');

esbuild.build({
    entryPoints: ['src/index.ts'],
    outDir: 'dist',
    bundle: true,
    sourcemap: 'inline',
    minify: true,
    format: 'cjs',
    target: ['es6'],
    external: Object.keys(dependencies).concat(Object.keys(peerDependencies))
})
.then(result => {
    console.log('Complete');
});
</code>```

index.ts:

```<code>export { ListComponent } from './data/listComponent';
</code>```

Body:
I have a basic WebComponent that adds text to a
. This WebComponent currently lives in my Angular v12 web app and works without any issues.

I am attempting to move the WebComponent to a lib which is bundled with esBuild. After migrating the WebComponent, upon trying to start my Angular web app project, i am seeing many errors like:

./node_modules/faye-websocket/lib/faye/eventsource.js3:13-37 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }

The above error is just for 'stream', but i see same errors for:

'util' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye'
'net' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye\websocket'
'tls' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye\websocket'
'url' in 'C:\dev\myApp\node_modules\faye-websocket\lib\faye\websocket'
'assert' in 'C:\dev\myApp\node_modules\http-parser-js'
'fs' in 'C:\dev\myApp\node_modules\sockjs/lib'
'fs' in 'C:\dev\myApp\node_modules\sockjs/lib'
'stream' in 'C:\dev\myApp\node_modules\sockjs/lib'
'crypto' in 'C:\dev\myApp\node_modules\sockjs/lib'
'url' in 'C:\dev\myApp\node_modules\sockjs/lib'
'querystring' in 'C:\dev\myApp\node_modules\sockjs/lib'

Spending a lot of time debugging, the errors above are displayed when the following line in the WebComponent is active:

import { Subject } from 'rxjs';

export class ListComponent extends HTMLElement {
    public contentSub: Subject<any> = new Subject(); // <-- line line

If i comment out the above (contentSub), then the initial HTML of the WebComponent renders, albeit with a lack of functionality without above.

esBuild config:

cost { dependencies, peerDependencies } = require('./package.json');

esbuild.build({
    entryPoints: ['src/index.ts'],
    outDir: 'dist',
    bundle: true,
    sourcemap: 'inline',
    minify: true,
    format: 'cjs',
    target: ['es6'],
    external: Object.keys(dependencies).concat(Object.keys(peerDependencies))
})
.then(result => {
    console.log('Complete');
});

index.ts:

export { ListComponent } from './data/listComponent';


问:
How to access a dataframe from a Python dataframe list through a cell from a date column in the dataframe
I have created a list (df) which contains some dataframes after importing csv files. Instead of accessing this dataframes using df[0], df[1] etc, I would like to access them in a much easier way with something like df[20/04/22] or df[date=='20/04/22] or something similar. I am really new to Python and programming, thank you very much in advance. I attach the simplified code (contains only 2 items in the list) for simplyfying reasons.

I came up with two ways of achieving that but each time I have some trouble realising them.

Through my directory path names. Each csv (dataframe) file name includes the date in each original name file, something like : "5f05d5d83a442d4f78db0a19_2022-04-01.csv"

Each csv (dataframe), includes a date column (object type) which I have changed to datetime64 type so I can work with plots. So, I thought that maybe through this column what I ask would be possible.

```<code>import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
from datetime import date
from datetime import time
from pandas.tseries.offsets import DateOffset
import glob
import os

path = "C:/Users/dsdadsdsaa/"
all_files = glob.glob(path + '*.csv')
df = []
for filename in all_files:
    dataframe = pd.read_csv(filename, index_col=None, header=0)
    df.append(dataframe)

for i in range(0,2):
    df[i]['date'] = pd.to_datetime(df[i]['date'])
    df[i]['time'] = pd.to_datetime(df[i]['time'])

df[0]
</code>```

Body:
I have created a list (df) which contains some dataframes after importing csv files. Instead of accessing this dataframes using df[0], df[1] etc, I would like to access them in a much easier way with something like df[20/04/22] or df[date=='20/04/22] or something similar. I am really new to Python and programming, thank you very much in advance. I attach the simplified code (contains only 2 items in the list) for simplyfying reasons.

I came up with two ways of achieving that but each time I have some trouble realising them.

Through my directory path names. Each csv (dataframe) file name includes the date in each original name file, something like : "5f05d5d83a442d4f78db0a19_2022-04-01.csv"

Each csv (dataframe), includes a date column (object type) which I have changed to datetime64 type so I can work with plots. So, I thought that maybe through this column what I ask would be possible.

import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
from datetime import date
from datetime import time
from pandas.tseries.offsets import DateOffset
import glob
import os

path = "C:/Users/dsdadsdsaa/"
all_files = glob.glob(path + '*.csv')
df = []
for filename in all_files:
    dataframe = pd.read_csv(filename, index_col=None, header=0)
    df.append(dataframe)

for i in range(0,2):
    df[i]['date'] = pd.to_datetime(df[i]['date'])
    df[i]['time'] = pd.to_datetime(df[i]['time'])

df[0]