text:
Q: Spring batch partition with RepositoryItemReader I'm trying to learn spring batch using partition together with RepositoryItemReader
I'm using yugabytedb - its postgresdb
If I understood well then with partition one will have a master step which do the partition (splitting ids to id lists)
example:
[1,2,3,4...1000] to
[1,2,3..100] [101.102--200] [201..300]...[901..1000]
and then a true batch job step (I will call them slave1, slave2...) which consists of reader, processor, writer, these steps can run parallel
slave1 read by ids [1..100] from db and make entity objects out of them, put into list and give to processor, processor process all those 100, put into a list and give next to writer to persist to db
slave2 do the same but from ids [101 to 200]
same for other slaves
without partition my job works (gridsize=1)
as long as i aktivate partition by setting gridSize > 1 he batch job will fail
I'm not sure its because of database -  postgres/yugabyte or because of my readers (I tried RepositoryItemReader and later HibernateCursorItemReader both failed)
According to other stackoverflow posts and console log it seems transaction caused some locking problem. that is why i also tried HibernateCursorItemReader.
reason i am trying partition is for optimising performance, RepositoryItemReader is because i want to be lazy and reusing spring data jpa instead of writing query(sql, jpql, hql or criteriabuilder ^^ of cource writing native sql is better for performance (at least i heard about it)). any hint/workaround is welcomed.
Entity

package com.example.liquibase2.entity;

import lombok.Data;

import javax.persistence.*;

@Entity
@Table(name = "chili", indexes = {
        @Index(columnList = "name", name="index_chili_name")
})
@Data
public class Chili {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "art")
    private Art art;
    @Column(name = "name", unique = true)
    private String name;
}

Repository

package com.example.liquibase2.repository;

import com.example.liquibase2.entity.Chili;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

public interface ChiliRepository extends JpaRepository<Chili, Long>, JpaSpecificationExecutor<Chili> {
}

Specification

package com.example.liquibase2.repository;

import com.example.liquibase2.entity.Chili;
import org.springframework.data.jpa.domain.Specification;

public final class ChiliSpecification {
    public static Specification<Chili> findChiliA() {
        return (root, query, builder) -> builder.like(root.get("name"),"a%");
    }
    public static Specification<Chili> findChiliAAndIdRange(Long min, Long max) {
        return (root, criteriaQuery, criteriaBuilder) -> {
            criteriaQuery.orderBy(criteriaBuilder.desc(root.get("id")));
            return criteriaBuilder.and(
                    criteriaBuilder.like(root.get("name"),"a%"),
                    criteriaBuilder.between(root.get("id"), min, max)
            ) ;
        };
    }
}

Partitioner  copy pasted from some other stackoverflow, but it does what i expected

package com.example.liquibase2.batch;

import lombok.Data;
import org.springframework.batch.core.partition.support.Partitioner;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;
@Data
@Component
public class ColumnRangePartitioner implements Partitioner
{
    private String table;
    private String column;
    private JdbcTemplate jdbcTemplate;

    //    public void setDataSource(DataSource dataSource) {
    public void setDataSource() {
        DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
        dataSourceBuilder.driverClassName("org.postgresql.Driver");
        dataSourceBuilder.url("jdbc:postgresql://localhost:5433/liquibase");
        dataSourceBuilder.username("yugabyte");
        dataSourceBuilder.password("yugabyte");
        jdbcTemplate = new JdbcTemplate(dataSourceBuilder.build());
    }

    @Override
    public Map<String, ExecutionContext> partition(int gridSize)
    {
        int min = jdbcTemplate.queryForObject("SELECT MIN(" + column + ") FROM " + table, Integer.class);
//
        int max = jdbcTemplate.queryForObject("SELECT MAX(" + column + ") FROM " + table, Integer.class);
//        int min = 1;
//
//        int max = 4000;

        int targetSize = (max - min) / gridSize + 1;

        Map<String, ExecutionContext> result = new HashMap<>();

        int number = 0;
        int start = min;
        int end = start + targetSize - 1;

        while (start <= max)
        {
            ExecutionContext value = new ExecutionContext();
            result.put("partition" + number, value);

            if(end >= max) {
                end = max;
            }

            value.putInt("minValue", start);
            value.putInt("maxValue", end);

            start += targetSize;
            end += targetSize;

            number++;
        }
        System.out.println("partition result:"+result.toString());
        return result;
    }
}

very basic processor just add some character to name field

package com.example.liquibase2.batch;

import com.example.liquibase2.entity.Chili;
import org.springframework.batch.item.ItemProcessor;

public class JpaProcessor implements ItemProcessor<Chili, Chili> {
    @Override
    public Chili process(Chili chili) throws Exception {
        chili.setName(chili.getName()+"_L");
        return chili;
    }
}

writer - also very basic

package com.example.liquibase2.batch;

import com.example.liquibase2.entity.Chili;
import com.example.liquibase2.repository.ChiliRepository;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class JpaWriter implements ItemWriter<Chili> {
    @Autowired
    private ChiliRepository chiliRepository;

    @Override
    public void write(List<? extends Chili> list) throws Exception {
        System.out.println("Writer "+list.get(0).getId()+" - "+list.get(list.size()-1).getId());
        chiliRepository.saveAll(list);
    }
}

the RepositoryReader which didnt work when gridSize > 1

package com.example.liquibase2.batch;

import com.example.liquibase2.entity.Chili;
import org.springframework.batch.item.data.RepositoryItemReader;

public class JpaReader extends RepositoryItemReader<Chili> {
}

HibernateCursorItemReader which didnt work either

package com.example.liquibase2.batch;

import com.example.liquibase2.entity.Chili;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.item.database.HibernateCursorItemReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.persistence.EntityManagerFactory;

@Component
@StepScope
public class HibernateReader extends HibernateCursorItemReader<Chili> {
    public HibernateReader(EntityManagerFactory entityManagerFactory,
                           @Value("#{stepExecution}") StepExecution stepExecution) {
        this.setName("HibernateCursorItemReader");
        this.setSessionFactory(entityManagerFactory.createEntityManager().unwrap(org.hibernate.Session.class).getSessionFactory());
        this.setQueryString("from Chili");
        this.setUseStatelessSession(true);
        this.setFetchSize(5);
    }

    @Override
    public Chili read() throws Exception {
        Chili item = this.doRead();
        return item;
    }
}

whole batch cofigurer:

package com.example.liquibase2.batch;

import com.example.liquibase2.entity.Chili;
import com.example.liquibase2.repository.ChiliRepository;
import com.example.liquibase2.repository.ChiliSpecification;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.core.partition.PartitionHandler;
import org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler;
import org.springframework.batch.item.data.RepositoryItemReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.domain.Sort;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.Collections;

@Configuration
public class BatchConfig {
    @Autowired
    private ChiliRepository chiliRepository;

    @Autowired
    private JpaWriter writer;

    @Autowired
    private StepBuilderFactory steps;

    @Autowired
    private JobBuilderFactory jobs;

    @Bean
    @StepScope
    public RepositoryItemReader<Chili> readerAsBean(@Value("#{stepExecutionContext['minValue']}") Long minValue,
                                                    @Value("#{stepExecutionContext['maxValue']}") Long maxValue){
        JpaReader reader = new JpaReader();
        reader.setRepository(chiliRepository);
        reader.setPageSize(1000);
        reader.setSort(Collections.<String, Sort.Direction>singletonMap("id", Sort.Direction.ASC));
        reader.setMethodName("findAll");
        reader.setArguments(Collections.singletonList(ChiliSpecification.findChiliAAndIdRange(minValue, maxValue)));
        return reader;
    }

    @Bean
    public ColumnRangePartitioner partitioner()
    {
        ColumnRangePartitioner columnRangePartitioner = new ColumnRangePartitioner();
        columnRangePartitioner.setColumn("id");
        columnRangePartitioner.setTable("chili");
        columnRangePartitioner.setDataSource();
        return columnRangePartitioner;
    }

    @Bean
    public PartitionHandler partitionHandler() {
        TaskExecutorPartitionHandler retVal = new TaskExecutorPartitionHandler();
        retVal.setTaskExecutor(taskExecutor());
        retVal.setStep(slaveStep());
        retVal.setGridSize(2);
        return retVal;
    }

    @Bean
    public TaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setMaxPoolSize(4);
        taskExecutor.setCorePoolSize(4);
        taskExecutor.setQueueCapacity(4);
        taskExecutor.afterPropertiesSet();
        return taskExecutor;
    }

    @Bean
    public Job job(@Qualifier("masterStep") Step step1) {
        return jobs.get("myJob").start(masterStep()).build();
    }

    //new master which do partition
    @Bean
    public Step masterStep()
    {
        return steps.get("master")
                .transactionManager(null)
                .partitioner(slaveStep().getName(), partitioner())
                .partitionHandler(partitionHandler())
                .listener(new MyStepExecutionListener())
                .build();
    }

    @Autowired
    private HibernateReader hibernateReader;
    //original step, but now will be the slave
    @Bean
    public Step slaveStep() {

        JpaProcessor processor = new JpaProcessor();

        return steps.get("slaveStep")
                .listener(new MyStepExecutionListener())
                .<Chili, Chili> chunk(1000)
//                .reader(readerAsBean(null, null))
                .reader(hibernateReader)
                .processor(processor)
                .writer(writer)
                .build();
    }
}

console log when grid=1

grid = 1
partition result:{partition0={minValue=1, maxValue=2000}}
step listener called before slaveStep:partition0
Writer 1 - 1000
Writer 1001 - 2000
step listener called after slaveStep:partition0 exitCode=COMPLETED;exitDescription=
commit count:3 slaveStep:partition0
batch status of step?:COMPLETED
2022-01-02 07:07:23.798  INFO 11528 --- [ taskExecutor-1] o.s.batch.core.step.AbstractStep         : Step: [slaveStep:partition0] executed in 4s883ms
step listener called after master exitCode=COMPLETED;exitDescription=
commit count:3 master
batch status of step?:COMPLETED
2022-01-02 07:07:23.807  INFO 11528 --- [nio-8080-exec-2] o.s.batch.core.step.AbstractStep         : Step: [master] executed in 5s221ms
2022-01-02 07:07:23.826  INFO 11528 --- [nio-8080-exec-2] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=myJob]] completed with the following parameters: [{time=1641103638216}] and the following status: [COMPLETED] in 5s371ms
Disconnected from the target VM, address: '127.0.0.1:50607', transport: 'socket'
2022-01-02 07:07:38.029  INFO 11528 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-01-02 07:07:38.031  INFO 11528 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2022-01-02 07:07:38.041  INFO 11528 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

console when gridsize = 2 or more (simplied)

partition result:{partition1={minValue=1001, maxValue=2000}, partition0={minValue=1, maxValue=1000}}
step listener called before slaveStep:partition1
step listener called before slaveStep:partition0
Writer 1 - 1000
Writer 1001 - 2000
2022-01-02 07:08:24.634  WARN 12160 --- [ taskExecutor-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 40001
2022-01-02 07:08:24.634 ERROR 12160 --- [ taskExecutor-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: Operation failed. Try again.: aeedd7cc-1905-4fb7-807c-46d1a025fca7 Conflicts with higher priority transaction: e095897b-73a2-41a3-bd97-50379799d656
2022-01-02 07:08:24.637  INFO 12160 --- [ taskExecutor-2] o.h.e.j.b.internal.AbstractBatchImpl     : HHH000010: On release of batch it still contained JDBC statements
2022-01-02 07:08:24.645  INFO 12160 --- [ taskExecutor-2] o.s.batch.core.step.tasklet.TaskletStep  : Commit failed while step execution data was already updated. Reverting to old version.
2022-01-02 07:08:24.655 ERROR 12160 --- [ taskExecutor-2] o.s.batch.core.step.AbstractStep         : Encountered an error executing step slaveStep in job myJob
org.springframework.dao.CannotAcquireLockException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.LockAcquisitionException: could not execute statement
Caused by: org.postgresql.util.PSQLException: ERROR: Operation failed. Try again.: aeedd7cc-1905-4fb7-807c-46d1a025fca7 Conflicts with higher priority transaction: e095897b-73a2-41a3-bd97-50379799d656
commit count:0 slaveStep:partition1
batch status of step?:FAILED
2022-01-02 07:08:24.660  INFO 12160 --- [ taskExecutor-2] o.s.batch.core.step.AbstractStep         : Step: [slaveStep:partition1] executed in 496ms
step listener called after slaveStep:partition0 exitCode=COMPLETED;exitDescription=
commit count:2 slaveStep:partition0
batch status of step?:COMPLETED
2022-01-02 07:08:27.089  INFO 12160 --- [ taskExecutor-1] o.s.batch.core.step.AbstractStep         : Step: [slaveStep:partition0] executed in 2s926ms
2022-01-02 07:08:27.098 ERROR 12160 --- [nio-8080-exec-3] o.s.batch.core.step.AbstractStep         : Encountered an error executing step master in job myJob

org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step
step listener called after master exitCode=FAILED;exitDescription=org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step
commit count:2 master
batch status of step?:FAILED
2022-01-02 07:08:27.105  INFO 12160 --- [nio-8080-exec-3] o.s.batch.core.step.AbstractStep         : Step: [master] executed in 3s305ms
2022-01-02 07:08:27.128  INFO 12160 --- [nio-8080-exec-3] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=myJob]] completed with the following parameters: [{time=1641103703486}] and the following status: [FAILED] in 3s445ms

full console log cannot be added, cause of max body limit 80k character


text:
Q: Populate many Html elements inside a div with golang templates? I receive from my frontend a json with a string containing 1 or more HTML elements for example:
"textTop" : "bold
italic..."
I want to use this string to create Html elements inside a div, but I'm not really sure if I can do this with golang templates.
type FooBar struct {
    TextTop    string
}

So I'm currently storing the TextTop in a string, and then displaying it in html with:

            {{.TextTop}}

But of course this produces the following result in the browser. just a div containing the string, I'm passing.:

So should I use a different type for TextTop inside Foobar struct instead of type string, which one? or can I use a golang function that reads all html elements from a string and renders them in the html as part of the DOM and not just a string?

A: To prevent escaping, declare the field as type template.HTML:
type FooBar struct {
    TextTop    template.HTML
}

See the linked documentation for information about the security risks of using template.HTML.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How is it possible that to prove theorems about some set (say, the naturals) we have to introduce elements from outside that set? Take as an example, Analytic Number Theory. As far as I have read, it used the tools of complex numbers to reach conclusions about Number Theory (the set here would be the naturals). However, assuming that there exist Number Theory theorems without elementary proofs, how can it be that we don't have enough information about the naturals in the naturals themselves for us to introduce new elements (Reals and i) which don't have to do with the naturals? Why can't we prove them using only the naturals and nothing else?
This question also extends to theorems about the rationals and the reals.
Also, I'm sorry if this is a stupid question, or if the tags are not appropiate. Thanks.

A: I'm not fully qualified to answer this question, but I will give it a shot anyway.
Studying objects is hard, but not because of a reason you may suspect. Studying objects is hard because objects are too general. If I can't tell you what those objects do or how they interact with each other (or with other things) then you basically have no hope of understanding them beyond the simple fact that they are objects.
So now consider the natural numbers. I can tell you what they are, I can tell you what you can do with them (add them and multiply them), I can tell you how certain properties of natural numbers behave under those operations, but truly your tools are limited. The "language" of Peano Arithmetic is, in a certain sense, incredibly narrow. There are so very few things we can talk about.
But, natural numbers don't just show up in Peano Arithmetic. We know how to find them in much more robust "languages", like ZFC. And in this wider world of mathematical objects the natural numbers have a chance to interact with so many more types of objects, and certain truths that used to be inaccessible can now be proven. We can now say more about the naturals because our expressive power has increased.
Does that mean that every proof which leverages some object outside of Peano Arithmetic is necessarily revealing a non-elementary truth? No. There are often times equivalent proofs in more restrictive "languages", but they are almost always "harder" to find, or lack a certain sense of "beauty". Indeed, there may even be questions that cannot be phrased without the expressive power of "stonger languages".
A full accounting of the core idea here, that there are true statements that cannot be proven without finding a "language" with more "power" than the one you currently have, is very deep. You can whet your appetite with this aritcle on Goedel's Incompleteness Theorems.

A: Just to clarify: you are asking why we can't prove all statements concerning the natural numbers using only facts about natural numbers?
The integers $\mathbb{Z}$ are created using natural numbers (i.e., it's $\mathbb{N} \times \mathbb{N}$ modulo an equivalence relation), the rationals $\mathbb{Q}$ are constructed from $\mathbb{Z}$, the reals $\mathbb{R}$ are constructed from subsets of $\mathbb{Q}$, and complex numbers $\mathbb{C}$ is, formally, $\mathbb{R}^2$ (with $i = (0,1)$).
By this, you can say that $\mathbb{C}$ is constructed from $\mathbb{N}$, and any result using $\mathbb{C}$ is a result based on $\mathbb{N}$. Adding in a field-theoretic structure is again, still using $\mathbb{N}$ (e.g., multiplication on $\mathbb{C}$ is, formally, simply a subset of $\mathbb{C}^3$, a set that is based on $\mathbb{C}$ (and hence based on $\mathbb{N}$)).
Apologies if the above is unclear; I'm unsure if I understood your question correctly.


text:
Q: Why does Lang need finite measure support in the proof Lemma 3.2 (Real and Functional Analysis)? If anyone has the book, Lemma 3.2 and its proof are on pages 130-132.
Here is the statement of the lemma:

Let $\{g_n\}$ and $\{h_n\}$ be Cauchy sequences of step mappings of $X$ into $E$, converging almost everywhere to the same map.  Then the following limits exist and are equal: $$\lim\int_X g_n=\lim\int_X h_n$$ Furthermore, the Cauchy sequences $\{g_n\}$ and $\{h_n\}$ are equivalent, i.e. $\{g_n-h_n\}$ is an $L^1$-null sequence.

For context, $X$ is a measure space, $E$ is a Banach space, and Lang has previously defined a step mapping from $X$ to $E$ as a function that is measurable, has finite image, and whose support has finite measure (this is not Lang's precise definition but an equivalent one).
The proof starts by showing that $\lim\int_X g_n$ (and $\lim\int_X h_n$ exist; once we have done that we can define $f_n=g_n-h_n$, and it only remains to show that $\int_X f_n$ and $\int_X |f_n|$ go to 0, from our knowledge that $f_n\rightarrow 0$ almost everywhere.  It suffices to prove the latter.
Fixing $\epsilon>0$ and choosing $N$ such that the Cauchy condition for $f_n$ holds, we have to show that $\int_X|f_n|$ is arbitrarily small for $n$ arbitrarily great.  To do this, Lang divides $X$ into three parts and bounds the integral on each part.  This is the step that my question is about, because it seems sufficient to just divide $X$ into two parts.
First Lang lets $A\subseteq X$ be a set of finite measure which includes the support of $f_N$.  Then $$\int_{X-A}|f_n|=\int_{X-A}|f_n-f_N|\leq\int_X|f_n-f_N|<\epsilon$$ as long as $n\geq N$.
Then Lang cuts $A$ into two parts, using Lemma 3.1, which I will reproduce the statement of:

Let $\{f_n\}$ be a Cauchy sequence of step mappings.  Then there exists a subsequence which converges pointwise almost everywhere, and satisfies the additional property: given $\epsilon$ there exists a set $Z$ of measure $<\epsilon$ such that this subsequence converges absolutely and uniformly outside $Z$.

Lang uses this lemma to produce a set $Z\subseteq A$ with measure $< \frac{\epsilon}{1+\|f_N\|}$ (where $\|\cdot\|$ is sup norm) such that $f_n$ has a subsequence which converges absolutely on $A-Z$.  Choosing $Z$ to also include the measure zero set on which $f_n$ doesn't converge to $0$, we see that this subsequence converges absolutely on $A-Z$ to $0$.  Then clearly $\int_{A-Z} |f_n|<\epsilon$ for $n$ great enough in this subsequence, and we are left with the third part, $Z$.
For this, we do $$\int_Z|f_n|\leq \int_Z|f_n-f_N|+\int_Z|f_N|\leq \int_X|f_n-f_N|+\mu(Z)\|f_N\|<2\epsilon$$
which works for $n$ great enough in the subsequence.
A possible objection is that we have not proved that $\int_X|f_n|$ is eventually $<\epsilon$, only that it is frequently $<\epsilon$.  However, the Cauchy condition will show the former from the latter.
My question is, what is the point of $A$?  Why don't we apply Lemma 3.1 directly to $X$ and break $X$ up into $Z$ and $X-Z$?  Apparently Lang would rather work in $A$ because it has finite measure, but I am not sure where he uses this condition in the proof.

A: I just figured out the answer.  It really helped to write it all out.  To show that $\int_{A-Z}|f_n|<\epsilon$ from the uniform convergence of the subsequence of $f_n$ on $A-Z$, we need the fact that $A-Z$ has finite measure.  Uniform convergence says that we can make the sup norm, not the $L^1$ norm, of $f_n$, as small as we want.  So we make it smaller than $\frac{\epsilon}{\mu(A)}$; then $\int_{A-Z}|f_n|<\epsilon$.

A: For my own understanding I will try to rewrite the proof. In this proof there are three norms at play :

*

*The Banach space norm $|\cdot|$ defined for vectors in $E$.

*The step map seminorm $||\cdot||_1$ defined for step maps $f:X\to E$ by $||f||_1:=\int |f|$

*The sup norm $||\cdot||$ defined for any map $f:X\to E$ by $||f||:=\sup \{ |f(x)|:x\in X\}$
Now we begin the proof. Let $(g_n),(h_n)$ be Cauchy sequences of step maps with respect to $||\cdot||_1$, both converging almost everywhere to some $f:X\to E$. Using the properties of the integral for step maps we have
$$\bigg|\int g_n -\int g_m\bigg|=\bigg|\int ( g_n-g_m)\bigg|\leq\int |g_n-g_m|=||g_n- g_m||_1\to 0$$
as $n,m\to \infty$. This shows that that $\int g_n$ is a Cauchy sequence in $E$ with respect to $|\cdot|$. Since $E$ is complete, $\lim_{n\to\infty} \int g_n$ exist in $E$. The same argument shows that $\lim_{n\to\infty}\int h_n$ also exists in $E$.
Let $f_n=g_n-h_n$ for each $n$. Note that $(f_n)$ is a sequence of step maps which is Cauchy with respect to $||\cdot||_1$ and converges almost everywhere to zero. What remains to be shown is that $\int f_n$ and $\int |f_n|$ both converge to zero, for then $\lim_{n\to\infty} \int g_n=\lim_{n\to\infty} \int h_n$ and $ \lim_{n\to\infty} ||g_n-h_n||_1=0$. Moreover, from the inequality $|\int f_n|\leq \int |f_n|$ it suffices to show $\lim_{n\to\infty}\int |f_n|=0$.
Let $\varepsilon>0$ be given. There exist $N\geq 1 $ such that $m,n\geq N$ implies $||f_n-f_m||_1<\varepsilon$. Since $f_N$ is a step map, there exist a measurable set $A$ of finite measure outside of which $f_N$ vanishes. Then for all $n\geq N$ we have
$$\int_{X\setminus A} |f_n|=\int_{X\setminus A} |f_n-f_N|\leq \int|f_n-f_N|=||f_n-f_N||_1<\epsilon $$
By Lemma 3.1 there exist a measurable set $B$ with $\mu(B)<\frac{\varepsilon}{1+||f_N||}$ and a subsequece $(f_{n_k})$ of $(f_n)$ such that $(f_{n_k})$ converges uniformly on $X\setminus B$. Moreover, there exist a null set $N$ outside of which $(f_n)$ converges to zero pointwise. Let $Z:=B\cup N$. Then it follows that $(f_{n_k})$ converges uniformly to zero on $X\setminus Z$, and in particular on $A\setminus Z$. Hence there exist $N'\geq 1$ such that $k\geq N'$ implies $|f_{n_k}(x)|<\frac{\varepsilon}{1+\mu(A\setminus Z)}$ for all $x\in A\setminus Z$. Then for all $k\geq N'$ we have
$$ \int_{A\setminus Z} |f_{n_k}|\leq \int_{A\setminus Z} \frac{\varepsilon}{1+\mu(A\setminus Z)}=  \frac{\varepsilon \mu(A\setminus Z)}{1+\mu(A\setminus Z)}<\varepsilon$$
If in addition $k$ large enough that $n_k\geq N$, then by the choice of $B$ we also have
$$ \int_Z |f_{n_k}|\leq \int_Z |f_{n_k}-f_N|+\int_Z |f_N|\leq ||f_{n_k}-f_N||_1 +\mu(Z)||f_N||<\varepsilon+\varepsilon=2\varepsilon$$
Putting everything together we obtain that, for $k$ large enough,
$$ ||f_{n_k}||_1= \int |f_{n_k}|=\int_{X\setminus A} |f_{n_k}|+\int_{A\setminus Z} |f_{n_k}|+\int_{A\cap Z} |f_{n_k}|$$
$$\leq \int_{X\setminus A} |f_{n_k}|+\int_{A\setminus Z} |f_{n_k}|+\int_{ Z} |f_{n_k}|$$
$$\leq \varepsilon + \varepsilon + 2\varepsilon = 4\varepsilon $$
As $\varepsilon>0$ is arbitrary, it follows that $||f_{n_k}||_1\to 0$ as $k\to \infty$.
We have shown that, for every $\varepsilon>0$, $||f_{n}||_1<\varepsilon$ for infinitely many $n$. The final step is to show that $||f_{n}||_1\to 0$ as $n\to \infty$. Let $\varepsilon>0$ be given. Since $(f_n)$ is Cauchy with respect to $||\cdot||_1$ there exist $N\geq 1$ such that $||f_n-f_m||_1<\varepsilon/2$ for all $n,m\geq N$. Also, by what we just did there exist $m\geq N$ such that $||f_{m}||_1<\varepsilon/2$. It follows that for all $n\geq N$ we have
$$ ||f_{n}||_1\leq ||f_n-f_m||_1+||f_m||_1<\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon$$
As $\varepsilon>0$ is arbitrary it follows that $||f_{n}||_1\to 0$ as $n\to \infty$.


text:
Q: Extract substring in batch script set line = xxx/yyy/xxx/xxxxxxxx.h:32:#include "../../xxxx/xxxxx.h"

if this is the string, how can i extract just xxxxxxxx.h, between / and : in batch script?
i have included the bin path of cygwin to my windows environment variables so it can run grep commands.
Current, this is my script:
   @echo off

SETLOCAL enabledelayedexpansion

set /p search_parameter="Type your search: "

rem run grep seach commmand
grep -nri %search_parameter% --colour --include=*.{c,h} > text.txt

rem filter required lines into new text file
type text.txt | findstr /I "#include" | findstr /V "examples DELIVERY_REL" > text2.txt

rem read text file line-by-line
for /F "tokens=* delims=" %%G in (text2.txt) do (
set "line=%%G"
rem echo line: !line!
for /f "delims=:" %%i in ("!line!") do set "line=%%i"
for %%i in (!line:/= !) do set "line=%%i"
echo line: !line!

)

pause

echo on

Currently, this is my output:
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/

The problem is this line:
for %%i in (!line:/= !) do set "line=%%i"

A: Use a for /f loop to get the part before the first :.
Then use a plain for to get the last token of this part (tokenize by replacing / with spaces):
@echo off
setlocal
set "line=xxx/yyy/xxx/xxxxxxxx.h:32:#include "../../xxxx/xxxxx.h""
set line
for /f "delims=:" %%a in ("%line%") do set "line=%%a"
set line
for %%a in (%line:/= %) do set "line=%%a"
set line

Output of this code:
line=xxx/yyy/xxx/xxxxxxxx.h:32:#include "../../xxxx/xxxxx.h"
line=xxx/yyy/xxx/xxxxxxxx.h
line=xxxxxxxx.h

due to the exact format of your string, you can just:
set "line=xxx/yyy/xxx/xxxxxxxx.h:32:#include "../../xxxx/xxxxx.h""
for /f "delims=:" %%a in ("%line%") do set "line=%%~nxa"

(Thanks, @dbenham). This works because the parser "translates" the "wrong" slash (not valid for a filename) to the "correct" backslash and %%~nxa just extracts the "filename and extension" from the "full file name". (for treats the string as a filename but doesn't even care, if it's valid)
Edit
...
rem read text file line-by-line
for /F "tokens=* delims=" %%G in (text2.txt) do (
  set "line=%%G"
  for /f "delims=:" %%i in ("!line!") do set "line=%%~nxi"
  echo line: !line!
)

A:   @echo off

SETLOCAL enabledelayedexpansion

set /p search_parameter="Type your search: "

rem run grep seach commmand
grep -nri %search_parameter% --colour --include=*.{c,h} > text.txt

rem filter required lines into new text file
type text.txt | findstr /I "#include" | findstr /V "examples DELIVERY_REL" > text2.txt

rem read text file line-by-line
for /F "tokens=* delims=" %%G in (text2.txt) do (
set "line=%%G"
rem echo line: !line!
for /f "delims=:" %%i in ("!line!") do set "line=%%~nxi"
echo line: !line!

)

pause

echo on


text:
Q: Reducing apk size for hybrid apps on Intel XDK I started making apps with Intel XDK a while ago and I embraced like if I had no choice the 20+ MB apks, slow app start up and crazy permissions that I didn't ask for.
Searching today for a better css framework to make material design complying apps (I was using Material Design Lite, from google) I found Framework7.
Really neat framework if you ask me, and the showcase is awesome: http://framework7.io/showcase/
Some apps I installed from the showcase range from 988KB to 4MB.
How is that even possible?
I read that HTML5 is one of the most popular language to build apps and I'm doing it completely wrong.
Please, guide me in the right direction for the best practice to make fast and lightweight apps for Android and iOs.

A: XDK has a feature to easily embedded CrossWalk into your APK. While this does give you a consistent WebView, i.e. your app won't look or act different when running on Android 4.0 vs Android 5.0, it does add to the size of your APK.
Review the documentation on why you should use CrossWalk: CrossWalk Project FAQ
NOTE: Intel had retired Crosswalk -  Intel XDK FAQ and CrossWalk Final Release


text:
Q: How can I add values to an empty SELECT? I know change the value of an INPUT TEXT.
<script>
    document.write('<input type="text" id="1" value="Hello">');
    document.getElementById('1').value = ("Good bye");
</script>

How can I add values to an empty SELECT with this method?
<script>
    document.write('<select><option id="2"></option><option id="3"></option></select>');
    document.getElementById ........;
</script>

I want my empty SELECT becomes a SELECT with two options: "Hello" and "Good bye."

A: Why not write:
document.write('<select><option id="2">Hello</option><option id="3">Good bye</option></select>');

Or if you want to add one programmatically:
document.write('<select id="s"></select>');
var s = document.getElementById("s");

var option = document.createElement("option");
option.text = "Hello";
s.add(option);

var option = document.createElement("option");
option.text = "Good bye";
s.add(option);

A: this is very simple ....
<script>
    var add = function(){
    var sel = document.getElementById("sel");
    var in1 = document.getElementById("in").value;

    var opt = document.createElement("option");
    opt.innerHTML = in1;

    sel.appendChild(opt);
}
</script>
<select id="sel">

</select>
<input id="in" type="text" />
<button onclick="add();">add</button>

here is the demo: CLICK
another exanple how to do this thing by using innerHTML is here: jsfiddle
this is done by making a element as you know option by using javascript and then it is appended in the element select and the option text is the value of input box... and hope you are understood.

A: You can do it easily with jQuery
$(document).ready(function() {
$("select").append('<option id="3" value="somevalue">Some text</option>"');
});


text:
Q: Accessing array value is null Hello I have decoded a json string that I sent to my server and Im trying to get the values from him.
My problem is that I cant get the values from the inner arrays.
This is my code:
<?php

    $post = file_get_contents('php://input');

    $arrayBig = json_decode($post, true);

    foreach ($arrayBig as $array)
    {

    $exercise = $array['exercise'];

    $response["exercise"] = $exercise;
    $response["array"] = $array;

    echo json_encode($response);

    }

?>

When I get the answer from my $response I get this values:
{"exercise":null,"array":[{"exercise":"foo","reps":"foo"}]}

Why is $array['exercise'] null if I can see that is not null in the array
Thanks.

A: Because of the [{...}] you are getting an array in an array when you decode your array key.
So:
$exercise = $array['exercise'];

Should be:
$exercise = $array[0]['exercise'];

See the example here.

A: From looking at the result of $response['array'], it looks like $array is actually this
[['exercise' => 'foo', 'reps' => 'foo']]

that is, an associative array nested within a numeric one. You should probably do some value checking before blindly assigning values but in the interest of brevity...
$exercise = $array[0]['exercise'];


text:
Q: Why do I get a "io.jsonwebtoken.ExpiredJwtException"? I have a problem with my Spring Security JWT Application. I am getting an error because my JWT is expired, but I can't find, where it gets the 2022-04-12 as an expiration date. I can't find a single piece of code, which says that the expiration date is the 2022-04-12. After my understanding, it is creating a new token, each time I am logging in with a new expiration time, which also has to be true, because in my output I get a new token everytime. But because the 2022-04-12 has already passed, I am getting a "io.jsonwebtoken.ExpiredJwtException". So where does it get the 2022-04-12 from???
I am just providing the parts of my code, I think are neccesary, but if you need more code, just let me know!( I am using Spring Security, if that matters)
Filter:
package de.gabriel.springsecurityjwt.filters;

import de.gabriel.springsecurityjwt.services.MyUserDetailsService;
import de.gabriel.springsecurityjwt.util.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

@Component
public class JwtRequestFilter extends OncePerRequestFilter {

    @Autowired
    private MyUserDetailsService userDetailsService;

    @Autowired
    private JwtUtil jwtUtil;

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
            throws ServletException, IOException {

        final String authorizationHeader = request.getHeader("Authorization");

        String username = null;
        String jwt = null;

        if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
            jwt = authorizationHeader.substring(7);
            username = jwtUtil.extractUsername(jwt);
        }

        if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
            UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
           if (jwtUtil.validateToken(jwt, userDetails)) { // If token is valid
                UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(
                        userDetails, null, userDetails.getAuthorities());
                usernamePasswordAuthenticationToken
                        .setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
                SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);

          }

        }
        chain.doFilter(request, response);
    }

}

Util class for JWT:
package de.gabriel.springsecurityjwt.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

@Service
public class JwtUtil { // JwtUtil is a class that is used to create and parse JWT tokens

    private final String SECRET_KEY = "secret";

    public String extractUsername(String token) {
        return extractClaim(token, Claims::getSubject);
    }

    public Date extractExpiration(String token) {
        return extractClaim(token, Claims::getExpiration);
    }

    public <T> T extractClaim(String token, Function<Claims, T> claimsResolver) {
        final Claims claims = extractAllClaims(token);
        return claimsResolver.apply(claims);
    }
    private Claims extractAllClaims(String token) {
        return Jwts.parser().setSigningKey(SECRET_KEY).parseClaimsJws(token).getBody();
    }

    private Boolean isTokenExpired(String token) {
        return extractExpiration(token).before(new Date());
    }

    public String generateToken(UserDetails userDetails) {
        Map<String, Object> claims = new HashMap<>();
        return createToken(claims, userDetails.getUsername());
    }

    private String createToken(Map<String, Object> claims, String subject) {
        return Jwts.builder().setClaims(claims).setSubject(subject).setIssuedAt(new Date(System.currentTimeMillis()))
                .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 10))
                .signWith(SignatureAlgorithm.HS256, SECRET_KEY).compact();
    }

    public Boolean validateToken(String token, UserDetails userDetails) {
        final String username = extractUsername(token);
        return (username.equals(userDetails.getUsername()) && !isTokenExpired(token));
    }
}

Rest Controller class:
package de.gabriel.springsecurityjwt;

import de.gabriel.springsecurityjwt.models.AuthenticationRequest;
import de.gabriel.springsecurityjwt.models.AuthenticationResponse;
import de.gabriel.springsecurityjwt.services.MyUserDetailsService;
import de.gabriel.springsecurityjwt.util.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class HelloResource {

    @Autowired
    private AuthenticationManager authenticationManager;

    @Autowired
    private JwtUtil jwtTokenUtil;

    @Autowired
    private MyUserDetailsService userDetailsService;

    @RequestMapping( "/hello" )
    public String hello() {
        return "Hello World";
    }

    @RequestMapping(value = "/authenticate", method = RequestMethod.POST)
    public ResponseEntity<?> createAuthenticationToken(@RequestBody AuthenticationRequest authenticationRequest) throws Exception {

        try {
            authenticationManager.authenticate(
                    new UsernamePasswordAuthenticationToken(authenticationRequest.getUsername(), authenticationRequest.getPassword())
            );
        }
        catch (BadCredentialsException e) {
            throw new Exception("Incorrect username or password", e);
        }

        final UserDetails userDetails = userDetailsService
                .loadUserByUsername(authenticationRequest.getUsername());

        final String jwt = jwtTokenUtil.generateToken(userDetails);

        return ResponseEntity.ok(new AuthenticationResponse(jwt)); // Return token

    }

}

Security Configurer class:
package de.gabriel.springsecurityjwt;

import de.gabriel.springsecurityjwt.filters.JwtRequestFilter;
import de.gabriel.springsecurityjwt.services.MyUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

@EnableWebSecurity
public class SecurityConfigurer extends WebSecurityConfigurerAdapter {

    @Autowired
    private UserDetailsService myUserDetailsService;
    @Autowired
    private JwtRequestFilter jwtRequestFilter;

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(myUserDetailsService);
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return NoOpPasswordEncoder.getInstance();
    }

    @Override
    @Bean
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }

    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
        httpSecurity.csrf().disable()
                .authorizeRequests().antMatchers("/authenticate").permitAll().
                anyRequest().authenticated().and().
                exceptionHandling().and().sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
                httpSecurity.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);

    }

}

Here is the error log:
io.jsonwebtoken.ExpiredJwtException: JWT expired at 2022-04-12T21:27:05Z. Current time: 2022-04-14T22:20:23Z, a difference of 175998276 milliseconds.  Allowed clock skew: 0 milliseconds.
    at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:385) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:481) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:541) ~[jjwt-0.9.1.jar:0.9.1]
    at de.gabriel.springsecurityjwt.util.JwtUtil.extractAllClaims(JwtUtil.java:31) ~[classes/:na]
    at de.gabriel.springsecurityjwt.util.JwtUtil.extractClaim(JwtUtil.java:27) ~[classes/:na]
    at de.gabriel.springsecurityjwt.util.JwtUtil.extractUsername(JwtUtil.java:19) ~[classes/:na]
    at de.gabriel.springsecurityjwt.filters.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:41) ~[classes/:na]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar:5.6.2]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) ~[spring-web-5.3.18.jar:5.3.18]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.18.jar:5.3.18]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.18.jar:5.3.18]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.60.jar:9.0.60]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

This is the token used:
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJmb28iLCJleHAiOjE2NTAwMDIyOTEsImlhdCI6MTY0OTk2NjI5MX0.tzfB0Wy9Dp3Y9pl-5_Oc4gwPClOHlIjE8kHUcgvKhUs

And this is the token (payload) decoded:
{
  "sub": "foo",
  "exp": 1650002291, (2022-04-15)
  "iat": 1649966291
}

This is a
image of the decoded JWT from jwt.io
And this this is the request I use

A: I made a mistake, while sending the request in Postman. Instead of passing the JWT in the Header I passed it as an Parameter, which of course won't work because I have nothing that extracts the JWT from the URL♂


text:
Q: CSS 100% width is more that 100% I'm learning CSS and I tried to create a simple layout.
I set the "header" to have a width of 100%, the "left" to have a width of 20% and the "right" 80%. But the width of the header is greater than the total width of the left and the right. Why is that and how to fix it?

    div {
        border-radius: 10px;
    }

    #header {
        z-index: 1;
        background-color: #80B7ED;
        height: 50px;
     width: 100%;
        position: fixed;
    }

    .left {
        background-color: #5A9DE0;
        height: 400px;
        width: 20%;
        float: left;
        position: relative;
    }

    .right {
        background-color: #BFD9F2;
        height: 400px;
        width: 80%;
        float: right;
        position: relative;
    }

    #footer {
        background-color: #80B7ED;
        clear: both;
        height:70px;
    }
    <!DOCTYPE html>

      <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
      <title></title>

Edit
Thanks to your answers and to some reading I get now that the problem is the margin of the body section. When I use body {margin: 0;} the "left" plus the "right" take a bigger place in the page and the "header" takes a smaller place, so their widths are equal.
Another solution with the same result is adding a "container" div around everything with "left: 0; right: 0; position: absolute;".
I understand why these solutions make the "left" plus the "right" bigger (so they take the whole page), what I don't get is why the "header" is suddenly smaller. If the fixed "header" is out of the regular flow, why changing the margin of the body influeces it?

body {
    margin: 0;
}

div {
    border-radius: 10px;
}

#header {
    z-index: 1;
    background-color: #80B7ED;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    top: 0;
    height: 50px;
 width: 100%;
    position: fixed;
}

.left {
    background-color: #5A9DE0;
    height: 400px;
    width: 20%;
    float: left;
    position: relative;
}

.right {
    background-color: #BFD9F2;
    height: 400px;
    width: 80%;
    float: right;
    position: relative;
}

#footer {
    background-color: #80B7ED;
    clear: both;
    height:70px;
}
<!DOCTYPE html>

    <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
    <title></title>

Thanks

A: When using percentage widths the margin, padding and border are not included in the calculation. So you want to be sure all of those are set to 0 on the corresponding elements.
margin: 0;
padding: 0;
border: none;

Alternatively, you could use the box-sizing property which will make the calculation include padding and border. Then you would only have to account for the margins elsewhere.
box-sizing: border-box;

A: Here you go:

body{
    margin:0px;
}
div {
    border-radius: 10px;
}
#wrapper {
    padding: 0%;
}
#wrap {
    float: left;
    position: relative;
    width: 100%;
}
#header {
    position:fixed;
    width:inherit;
    z-index:1;
    padding:0px;
    height:50px;
    border-radius:10px;
    background-color: #80B7ED;
}
.left {
    background-color: #5A9DE0;
    height: 400px;
    width: 20%;
    float: left;
    position: relative;
}
.right {
    background-color: #BFD9F2;
    height: 400px;
    width: 80%;
    float: right;
    position: relative;
}
#footer {
    background-color: #80B7ED;
    clear: both;
    height:70px;
}

See here jsfiddle
EDIT:
If you wish to add a margin, I'd suggest you add a variable margin, for instance 2% or 3%, and then you substract that quantity from the left column, the right column, or both. And then you set the width of the #wrapp to be 100-2*x %, where x is the amount of margin you added.

A: Another way is to use overflow: hidden; for parent div and set width:100%; for the child element. This way, more width will be hidden.


text:
Q: Is it possible to unset a JVM option? Our app server, OpenLiberty, supports config defaults and overrides as defined at https://openliberty.io/docs/latest/reference/config/server-configuration-overview.html#jvm-options

Options are read and provided to the JVM in order. If you provide multiple options, then they are all seen by the JVM.

Currently, we're setting an initial min heap size for our server (via configDropins/defaults/jvm.options).
I'd like it to be possible to override that min heap size with the JVM's default (as if -Xms was never specified).
I confirmed that I can pass a new value to -Xms via configDropins/overrides, but what I'd really like to do is somehow override the initial setting so that it takes the JVM default (instead of a different custom value).
I tried setting -Xms (with no value) in the override, but it seems to just use the value from configDropins/defaults.
There is a good related question at Duplicated Java runtime options : what is the order of preference? wrt how common JVMs handles duplicate options and a choice exceprt from one of the answers:

there are often deeply nested command lines from batch files where people can only add to the end, and want to make that the winner.

This makes me hope that maybe I'm not alone in wanting this feature. Does anyone know if there's already some way to achieve it?

A: To be honest, you should not set heap sizes, when running in containers.
Since Java8 there is built in support via UseContainerSupport setting which adjusts available heap size based on the container memory limits.
If you want to fine tune that you could use  -XX:MaxRAMPercentage / -XX:InitialRAMPercentage settings.
This allows you to change heap sizes in more dynamic way, without the need of rebuilding the image.
Update
Based on https://www.ibm.com/docs/en/sdk-java-technology/8?topic=options-xxinitialrampercentage InitialRAMPercentage is kind of -Xms equivalent:
-XX:InitialRAMPercentage=N  Set initial heap size as a percentage of total memory

Note:
If you set a value for -Xms, the -XX:InitialRAMPercentage option is ignored.
If you set a value for -Xmx, the -XX:MaxRAMPercentage option is ignored.


text:
Q: Ember Bootstrap plugin I am using the Bootstrap Table plugin with Ember. When I execute the following code it works:
HBS

But I am trying to move all my javascript out of the temmplate and into the javascript file. The following does not work:
HBS

JS
didInsertElement: function() {
  this.$('#table').bootstrapTable(this.get('table'));
}

I receive the following error: Uncaught TypeError: this.$(...).bootstrapTable is not a function.
I have the following in my ember-cli-build.js:
app.import('bower_components/jquery/dist/jquery.min.js');
app.import('bower_components/bootstrap/dist/css/bootstrap.min.css');
app.import('bower_components/bootstrap/dist/js/bootstrap.min.js');
app.import('bower_components/bootstrap-table/dist/bootstrap-table.min.css');
app.import('bower_components/bootstrap-table/dist/bootstrap-table.min.js');

So it should be importing bootstrapTable. It clearly is importing because it works when I execute the command from the template file. Any help is greatly appreciated.


text:
Q: Sending a stream to a .Net WCF Service I have to access a .Net WCF Service from a desktop application. Basically I need to pass some data entered in a textbox. However the data can not be passed in raw format. And there's no way change the method on Web Service side since its client/third party service.
Method signature is as follows
Stream ProcessStream(Stream request);
The only thing I came to know regarding whats done to the stream is as followed.
        HandleRequestHeaders();
        XmlDocument reqDoc = new XmlDocument();
        XmlDocument resDoc = new XmlDocument();

        if (ConfigurationManager.AppSettings["MaintenanceMode"] == null || !Boolean.Parse(ConfigurationManager.AppSettings["MaintenanceMode"]))
        {
            Stream ms = new MemoryStream();
            inStream.CopyTo(ms);
            ms.Position = 0;
            try
            {
                reqDoc.Load(ms);
            }
            catch (Exception ex)
            {
            }
        }

So basically I need to send an xml document pasted/entered in a textbox of a desktop application.


text:
Q: Selenium - are ExpectedConditions reliable? eg visibility, clickabiliy how reliable are Selenium's ExpectedConditions, namely the abilities to tell whether or not an element is clickable or visible?
(eg ExpectedConditions.visibilityOfElementLocated, and
ExpectedConditions.elementToBeClickable)
several years ago i had some frustration with these tools and have been essentially re-inventing the wheel since then, to accomplish the same goals.
I'm wondering, today: are these ExpectedConditions reliable against all webpages?
if not, when should they be avoided?
and, when can they be trusted?
that is, have they ever caused you grief also?  if so, when? vs. when have they worked?  by "when", i mean which flavors of html/javascript


text:
Q: C memcpy causing segmentation fault So I'm trying to implement a simple memory pool as part of an assignment for University however I've ran in to trouble with storing values inside the memory I have allocated.
This is my main.c file:
#include <stdio.h>
#include "Pool.h"

int main(int argc, char** argv)
{
    Pool* pool = allocate_pool(64);

    printf("Pool Size: %d bytes...\n", pool->size_bytes);

    int* a = (int*)100;

    store_in_pool(pool, 20, sizeof(int), a);

    void* ap = retrieve_from_pool(pool, 20, sizeof(int));

    printf("%d\n", ap);

    free_pool(pool);

    return 0;
}

My Pool.h file:
#ifndef ASSIGNMENT_2_POOL_H
#define ASSIGNMENT_2_POOL_H

typedef struct MemoryPool
{
    int size_bytes;
    void* data;
} Pool;

Pool* allocate_pool(int size_bytes);
void  free_pool(Pool* pool);
void  store_in_pool(Pool* pool, int offset_bytes, int size_bytes, void* object);
void* retrieve_from_pool(Pool* pool, int offset_bytes, int size_bytes);

#endif

And my Pool.c file:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "Pool.h"

Pool* allocate_pool(int size_bytes)
{
    Pool* pool = (Pool*)malloc(sizeof(Pool*));
    pool->size_bytes = size_bytes;
    pool->data = malloc(size_bytes);

    int i = 0;
    while(i < pool->size_bytes)
    {
        void* temp = (int*)pool->data + i++;
        temp = 0;
    }

    return pool;
}

void free_pool(Pool* pool)
{
    free(pool->data);
    free(pool);
}

void store_in_pool(Pool* pool, int offset_bytes, int size_bytes, void* object)
{
    memcpy((void*)((char*)pool->data + offset_bytes), object, size_bytes);
}

void* retrieve_from_pool(Pool* pool, int offset_bytes, int size_bytes)
{
    return (void*)((char*)pool->data + offset_bytes);
}

The issue appears whenever I call 'store_in_pool' which contains a line that calls memcpy. I'm not sure what the issue is as I'm certain I'm passing the correct values to the function however a segmentation fault occurs every time I try and run the program.
What could be the cause of the problem?

A: The problem is here:
Pool* pool = (Pool*)malloc(sizeof(Pool*));

On 32 bit systems sizeof(Pool*)==4.  This is because the Pool* argument indicates that you want the size of a pointer to Pool.  Pointer sizes are constant (4 on 32 bit, 8 on 64 bit).  It should be:
Pool* pool = (Pool*)malloc(sizeof(Pool));

In this case the size of the the Pool struct will be sent to malloc.  One other thing I noticed in your code.  It's not a bug, per se, but it is code with zero effect:
while(i < pool->size_bytes)
{
    void* temp = (int*)pool->data + i++;
    temp = 0;
}

You are setting the temp pointer to NULL, essentially, not setting the variable to which it pointed to 0.  This means that your pool->data is never initialized.  One way to modify it:
while(i < pool->size_bytes)
{
    char* temp = (char*)pool->data + i++;
    *temp = 0;
}

Or simply:
memset(pool->data, 0, pool->size_bytes);

Or just catch it at the source and remove the initialization code if all you need is initialization to 0:
   pool->data = calloc(1, pool->size_bytes);

In this case, calloc sets all bytes to 0.

A: The segmentation fault is happening because of this:
int* a = (int*)100;

This sets a to be a pointer to the address 100, which is not part of your accessible memory. So when you then try to copy from that address with memcpy(), you get a fault.
If you want a to point to an integer with the value 100, the correct way is:
int aval = 100;
int *a = &aval;

You also need to fix the way you call malloc() in allocate_pool:
Pool* pool = malloc(sizeof Pool);

Your code is just allocating enough space for a pointer, not the entire Pool structure.
The while loop that looks like it's trying to initialize data to zero is also wrong. You can simply use memset:
memset(pool->data, 0, size_bytes);

You could also have used calloc() instead of malloc() to allocate the space, since it automatically initializes the space to zeroes.

A: Change this:
Pool* pool = (Pool*)malloc(sizeof(Pool*));

to this:
Pool* pool = malloc(sizeof Pool);


text:
Q: Custom information pages not using SEO friendly URLs in OpenCart I am having issues with the opencart layout override feature.  I have created a new information page and I set the layout override to "test". The route for this layout is "information/test". The controller is in the right place, as is the template.  I gave the new page the seo-friendly url of "test-page".
My issue is that if I type in "domain.com/test-page" it will get there, but it uses the regular information layout instead of my customized test layout.  I can type in domain.com/index.php?route=information/test&information_id=119 and it will now show the page with the right layout.
Is there a way to have it go the customized layout page (domain.com/index.php?route=information/test&information_id=119) when I type in the seo-frindly URL that I created when I created the new information page.
My issue is I am trying to add a carousel to just one information page, while still using seo-friendly URLs.

A: actually what you coded in template file test.tpl is not a layout, its actually a page accessed using test.php controller ,  and that page can be opened by accessing url domain.com/index.php?route=information/test&information_id=119 as you already mentioned.
How to create layout then ?
You have already created layout named test by going to System >> Design >> Layouts, now go to module carousel and a module to test layout at say content-top , set your test-page layout override to test and now go to domain.com/test-page and you will see carousel at the top, this is how layout works. what you previously doing was creating a new page by duplicating information controller and template.
A similar discussion on opencart forum Here


text:
Q: MySQL Database Replication and Server Load I have an online service with around 5000 MySQL databases. Now, I am interested in building a development area of the exactly same environment in my office, therefore, I am about to setup MySQL replication between my live MySQL server and development MySQL server.
But my concern is the load which will occur on my live MySQL server once replication is started. Do you have any experience? Will this process cause extra load on my production server?
Thanks, have a nice weekend.

A: Turning on binary logging (for replication) can severely affect performance.  It calls fsync to ensure consistency, so everything is slower.  A few articles to read:

*

*http://jcole.us/blog/archives/2006/05/25/on-disk-performance-and-mysql-replication/

*http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/


text:
Q: my shoes have come apart OR torn? Is come apart used for torn clothes and shoes?
In the title which is the correct expression should be used ?
What is the difference between clothes torn and come apart ?

A: It's somewhat more common to use "come apart" when referring to breaking into pieces the thing has been made of (glued, seamed, etc) - so if your shoe has come apart, that would mean that the seams broke, and not that it has been cut in an arbitrary place.

A: Come apart, as Maciej implies, means that the method that joins two distinct pieces has failed. With clothing, or with the "upper" section of a shoe, it would be a seam; with the sole of a shoe the method could be stitching or, in the case of sports shoes|trainers|sneakers, etc, glue.
A tear (verb 'to tear' intransitive) is a rip that can occur at any location, the result of the fabric catching or snagging on something sharp or pointed.


text:
Q: Python: JPEGs from folder to a Multipage-PDF with img2pdf I'm an newbie and I'm trying to create a multipage pdf with img2pdf (recursive), but only the last picture is saved in a pdf file.
from pathlib import Path
import os
import img2pdf

main_dir = Path(Path.cwd(),'MAIN')

for subfolder in main_dir.iterdir():
if subfolder.is_file():
    continue

    for filename in subfolder.iterdir():
        #pdf as foldername
        pdf_name = os.path.basename(subfolder)
        #write image-file to pdf file
        with open(pdf_name+".pdf", "wb") as f:
                f.write(img2pdf.convert(str(filename)))

When I test it with print(filename) all images are going through the loop.
Maybe someone can tell me where my misconception is.

A: img2pdf module can directly take a list of image file names as an argument and converts them into pdf. Take a look at the documentation here
from pathlib import Path
import os
import img2pdf

main_dir = Path(Path.cwd(),'your/path/to/images/folder')

for subfolder in main_dir.iterdir():
    imgs = []

    if subfolder.is_file():
        continue

    for filename in subfolder.iterdir():
        imgs.append(os.path.join(subfolder, filename))

    pdf_name = os.path.basename(subfolder)

    with open(pdf_name+".pdf", "wb") as f:
        f.write(img2pdf.convert(imgs))


text:
Q: Return error message if password or user email wrong in flutter login form Hy Guys I have connected flutter to my firebase project and used AUTH feature in Firebase but what I would do is to show an error message when a wrong password or Email user is wrong.
this is my code:
Widget submitButton (){
    return Container(
      child: SizedBox(
        width: 220,
        height: 40,
        child: MaterialButton(
          elevation: 5,
          onPressed: () async {
            setState(() {
              showProgress = true;
            });

            try {
              final newUser = await _auth.signInWithEmailAndPassword(email: email, password: password);
              print(newUser.toString());
              if (newUser != null) {
                Navigator.push(context, PageTransition(
                  type: PageTransitionType.fade,
                  child: WelcomeScreen(),
                ));
                setState(() {
                  showProgress = false;
                });

              }
            } catch (e) {}
          },
          child: Text('Accedi',style: TextStyle(color: Colors.black),),
          color: Colors.white,
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(8),
              side: BorderSide(color: Colors.black12,width: 1)),
        ),

      ),
    );
  }

A: First you need to catch the error, you can do that by using catchError():
final newUser = await _auth.signInWithEmailAndPassword(email: email, password: password)
    .catchError((err) {
          showDialog(
          context: context,
          builder: (BuildContext context) {
            return AlertDialog(
              title: Text("Error"),
              content: Text(err.message),
              actions: [
                FlatButton(
                  child: Text("Ok"),
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                )
              ],
            );
          });
    });

Then the showDialog will have err.message which will contain the error received from Firebase Authentication.

A: You have two options:
1.Use an alert dialog
  void _showAlertDialog(String message) async {
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text(message),
          actions: <Widget>[
            FlatButton(
              child: Text('Ok'),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }

full example

*Use errorText property in InputDecoration
TextField(
    decoration: InputDecoration(
        errorText: this.errorText,
    ),
)

full example

A: You can use a Form() with TextFormField()
Something like this:
Form(
        key: _formKey,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            TextFormField(
              key: ValueKey('email'),
              validator: (value) {
                if (value.isEmpty || !value.contains('@'))
                  return 'Please enter a valid Email address';
                return null;
              },
              keyboardType: TextInputType.emailAddress,
              decoration: InputDecoration(labelText: 'Email address'),
              onSaved: (value) {
                _userEmail = value;
              },
            ),

It's just a dummy, but as you see there's some validation code in the validator attribute.
So what validator does is, if you return null everything is well and good, but if something is wrong, just return the String and it'll be shown below the text form field as an error message.
And to validate you can call a method like this to activate the method while form submission
void _trySubmit() {
final bool isValid = _formKey.currentState.validate();
FocusScope.of(context).unfocus();

if (isValid) {
  _formKey.currentState.save();
  widget.submitFn(
    _userEmail.trim(),
    _userName.trim(),
    _userPassword.trim(),
    _isLogin,
    context,
  );
}}

The method for getting isValid will invoke validation function of all TextFormFields, if all of them are okay, it'll return true else it'll return false.
All the _name are used to store the values in state variables using the onSaved attribute.
Let me know if you have anymore doubts.
Hope this helps✌


text:
Q: How to change the y ticks label for heatmap with matplotlib plt.imshow? I am trying to specify the tick location and frequency for y-axis for my heatmap using matplotlib plt.imshow.
I have a sample code below:
fig, ax = plt.subplots(1,1)

ax.imshow(dFF_snips, cmap= 'hot', interpolation = 'none', aspect = 'auto')
ax.set_yticks(np.arange(0.5, len(dFF_snips),1))
ax.set_yticklabels(np.arange(1, len(dFF_snips),1))

The dFF_snip here is a list with 2 numpy array elements (2x2). The value of dFF_snip is below:
print (dFF_snips)
[array([-1.8822885 , -1.8549905 , -1.8296311 , -1.8080201 , -1.7912312 ,
       -1.7804587 , -1.7767344 , -1.780715  , -1.7938154 , -1.8149264 ,
       -1.8465863 , -1.8899457 , -1.9409375 , -1.9931413 , -2.0453465 ,
       -2.0977397 , -2.15121   , -2.2029345 , -2.2531028 , -2.3032935 ,
       -2.3565419 , -2.4161592 , -2.479967  , -2.543494  , -2.5983462 ,
       -2.6451566 , -2.6862512 , -2.7176433 , -2.7372882 , -2.747169  ,
       -2.750199  , -2.7498198 , -2.7493978 , -2.7578523 , -2.7844353 ,
       -2.8315635 , -2.9044938 , -3.0043793 , -3.1294305 , -3.277962  ,
       -3.4421551 , -3.6112301 , -3.7806895 , -3.9461625 , -4.0972414 ,
       -4.2289515 , -4.3385363 , -4.424823  , -4.4883513 , -4.532503  ,
       -4.5646443 , -4.58944   , -4.6088505 , -4.6220293 , -4.6342707 ,
       -4.6473126 , -4.661791  , -4.6782117 , -4.696537  , -4.7196736 ,
       -4.7511196 , -4.7927513 , -4.8435016 , -4.89862   , -4.9564075 ,
       -5.0158553 , -5.0760636 , -5.1353955 , -5.1895895 , -5.238624  ,
       -5.2806144 , -5.3163066 , -5.3447247 , -5.36642   , -5.3814077 ,
       -5.3881364 , -5.3849244 , -5.3705726 , -5.3448462 , -5.308451  ,
       -5.2625375 , -5.207037  , -5.1442537 , -5.080445  , -5.0244327 ,
       -4.984356  , -4.9615374 , -4.954831  , -4.9617405 , -4.9791384 ,
       -5.0037413 , -5.0323377 , -5.059078  , -5.0806446 , -5.1011295 ,
       -5.122504  , -5.146725  , -5.175042  , -5.209402  , -5.255945  ,
       -5.314746  , -5.379836  , -5.44777   , -5.516466  , -5.583969  ,
       -5.648302  , -5.7048216 , -5.752765  , -5.7887063 , -5.811991  ,
       -5.8275847 , -5.8386745 , -5.8451476 , -5.8462815 , -5.8407607 ,
       -5.8266883 , -5.8025455 , -5.768773  , -5.72489   , -5.6673093 ,
       -5.5983315 , -5.5259886 , -5.458761  , -5.403886  , -5.36478   ,
       -5.3438416 , -5.342907  , -5.364466  , -5.404285  , -5.4572835 ,
       -5.517151  , -5.5742135 , -5.621361  , -5.6528864 , -5.6692514 ,
       -5.672536  , -5.6654186 , -5.6482277 , -5.6235633 , -5.599008  ,
       -5.580639  , -5.5739145 , -5.5779624 , -5.589749  , -5.606258  ,
       -5.624993  , -5.6418123 , -5.651057  , -5.6521254 , -5.643853  ,
       -5.627396  , -5.6036816 , -5.5739474 , -5.54002   , -5.5041423 ,
       -5.471208  , -5.445212  , -5.4309144 , -5.4306445 , -5.4438753 ,
       -5.4677343 , -5.498519  , -5.5353036 , -5.57779   , -5.6167226 ,
       -5.6415677 , -5.652169  , -5.6503644 , -5.6396747 , -5.62374   ,
       -5.6030574 , -5.5774198 , -5.5563984 , -5.5467024 , -5.5476923 ,
       -5.5576925 , -5.575279  , -5.602696  , -5.63887   , -5.679612  ,
       -5.717645  , -5.750725  , -5.7775197 , -5.797683  , -5.8123    ,
       -5.8214726 , -5.8264694 , -5.82957   , -5.8367686 , -5.8501425 ,
       -5.8717527 , -5.904425  , -5.9460497 , -5.994463  , -6.043525  ,
       -6.0860786 , -6.113253  , -6.117045  , -6.0944533 , -6.0426073 ,
       -5.9613705 , -5.853579  , -5.723713  , -5.577989  , -5.425921  ,
       -5.2748075 , -5.133173  , -5.0055504 , -4.893709  , -4.8013916 ,
       -4.729972  , -4.6693077 , -4.613176  , -4.5573344 , -4.4992185 ,
       -4.4381495 , -4.374554  , -4.305001  , -4.221483  , -4.1239524 ,
       -4.0080414 , -3.8665266 , -3.6785667 , -3.435253  , -3.1269002 ,
       -2.7396197 , -2.2662575 , -1.7103218 , -1.0797501 , -0.38504073,
        0.35231286,  1.1085372 ,  1.8604275 ,  2.5868106 ,  3.2650638 ,
        3.88009   ,  4.427451  ,  4.9026966 ,  5.310102  ,  5.659054  ,
        5.959997  ,  6.22682   ,  6.480126  ,  6.7403393 ,  7.0139074 ,
        7.307172  ,  7.6194806 ,  7.9485364 ,  8.29129   ,  8.642674  ,
        8.998259  ,  9.352926  ,  9.700551  , 10.040269  , 10.36643   ,
       10.67472   , 10.964947  , 11.2369175 , 11.491209  , 11.728639  ,
       11.951131  , 12.161948  , 12.36541   , 12.567936  , 12.771758  ,
       12.978437  , 13.188399  , 13.404184  , 13.626745  , 13.853698  ,
       14.082246  , 14.31026   , 14.528476  , 14.727809  , 14.900687  ,
       15.04402   , 15.156785  , 15.238539  , 15.289807  , 15.313582  ,
       15.31713   , 15.304714  , 15.280266  , 15.253396  , 15.230518  ,
       15.2263775 , 15.250487  , 15.304828  , 15.393541  , 15.515712  ,
       15.665333  , 15.832893  , 16.00457   , 16.16947   , 16.310741  ,
       16.4211    , 16.498234  , 16.541042  , 16.551107  , 16.532488  ,
       16.48923   , 16.435703  , 16.389143  , 16.365812  , 16.367193  ,
       16.396809  , 16.45823   , 16.546036  , 16.654066  , 16.765757  ,
       16.868177  , 16.948336  , 17.008982  , 17.0496    , 17.063437  ,
       17.050173  , 17.011639  , 16.94833   , 16.86501   , 16.769604  ,
       16.666597  , 16.55239   , 16.431707  , 16.311302  , 16.192154  ,
       16.071764  , 15.948116  , 15.819756  , 15.679544  , 15.523486  ,
       15.347094  , 15.156804  , 14.95653   , 14.751297  , 14.546366  ,
       14.34639   , 14.158085  , 13.986786  , 13.839194  , 13.715297  ,
       13.609531  , 13.519229  , 13.4388895 , 13.362569  , 13.286026  ,
       13.202943  , 13.1025715 , 12.980316  , 12.842534  , 12.69255   ,
       12.53745   , 12.386539  , 12.245493  , 12.122852  , 12.022797  ,
       11.948581  , 11.900274  , 11.871156  , 11.856454  , 11.848497  ,
       11.840949  , 11.829887  , 11.810318  , 11.782139  , 11.745777  ,
       11.701197  , 11.652182  , 11.606136  , 11.566988  , 11.545708  ,
       11.550325  , 11.581249  , 11.63827   , 11.719916  , 11.819736  ,
       11.932257  , 12.054184  , 12.182194  , 12.313297  , 12.445502  ,
       12.580897  , 12.724497  , 12.875883  , 13.036144  , 13.204837  ,
       13.381885  , 13.571632  , 13.775131  , 13.997929  , 14.24062   ,
       14.498061  , 14.769052  , 15.05298   , 15.349015  , 15.654352  ,
       15.96401   , 16.27362   , 16.577772  , 16.861462  , 17.122467  ,
       17.346304  , 17.518572  , 17.634878  , 17.694998  , 17.69741   ],
      dtype=float32), array([14.985913 , 15.0813265, 15.201618 , 15.339931 , 15.482807 ,
       15.622314 , 15.745328 , 15.845537 , 15.918395 , 15.9597025,
       15.970337 , 15.947713 , 15.892259 , 15.816352 , 15.728424 ,
       15.637668 , 15.560816 , 15.501743 , 15.459493 , 15.435576 ,
       15.427354 , 15.428045 , 15.4214325, 15.392995 , 15.336227 ,
       15.245654 , 15.122533 , 14.969285 , 14.797668 , 14.618191 ,
       14.441152 , 14.280328 , 14.139093 , 14.0161085, 13.906187 ,
       13.803871 , 13.704677 , 13.60463  , 13.495758 , 13.374351 ,
       13.240541 , 13.095286 , 12.940205 , 12.779708 , 12.619321 ,
       12.462998 , 12.321359 , 12.195814 , 12.088715 , 12.001717 ,
       11.93776  , 11.897891 , 11.875162 , 11.860579 , 11.854521 ,
       11.849422 , 11.838185 , 11.81166  , 11.767702 , 11.707357 ,
       11.63462  , 11.555485 , 11.47481  , 11.405646 , 11.3603325,
       11.349787 , 11.386207 , 11.469798 , 11.596573 , 11.758874 ,
       11.950013 , 12.1582575, 12.373628 , 12.59353  , 12.812452 ,
       13.027382 , 13.238621 , 13.446201 , 13.648696 , 13.844095 ,
       14.030461 , 14.206606 , 14.369981 , 14.51379  , 14.634885 ,
       14.732284 , 14.803246 , 14.850707 , 14.876606 , 14.882255 ,
       14.869549 , 14.843523 , 14.812805 , 14.780341 , 14.750411 ,
       14.726697 , 14.708117 , 14.692233 , 14.676164 , 14.656219 ,
       14.62422  , 14.574705 , 14.508799 , 14.428904 , 14.338353 ,
       14.241846 , 14.147425 , 14.056105 , 13.969798 , 13.888433 ,
       13.809785 , 13.7317505, 13.647875 , 13.554984 , 13.459616 ,
       13.367651 , 13.285801 , 13.220657 , 13.178888 , 13.16811  ,
       13.188882 , 13.240819 , 13.322815 , 13.431261 , 13.553786 ,
       13.677812 , 13.796276 , 13.909011 , 14.012255 , 14.100053 ,
       14.173452 , 14.236986 , 14.291727 , 14.335081 , 14.364861 ,
       14.378245 , 14.3722725, 14.340262 , 14.273232 , 14.167559 ,
       14.023277 , 13.839618 , 13.621736 , 13.374201 , 13.106571 ,
       12.829431 , 12.557793 , 12.303619 , 12.074016 , 11.874444 ,
       11.711173 , 11.5863495, 11.495105 , 11.428545 , 11.382363 ,
       11.346231 , 11.316199 , 11.289666 , 11.261737 , 11.225497 ,
       11.176408 , 11.108545 , 11.014187 , 10.8888645, 10.731119 ,
       10.541812 , 10.3226   , 10.077124 ,  9.811858 ,  9.543706 ,
        9.282138 ,  9.026755 ,  8.78138  ,  8.547419 ,  8.322434 ,
        8.101543 ,  7.8811502,  7.658479 ,  7.4329863,  7.203424 ,
        6.967441 ,  6.726277 ,  6.48304  ,  6.2404237,  5.999122 ,
        5.763114 ,  5.5331116,  5.308862 ,  5.08791  ,  4.866709 ,
        4.6443095,  4.4183106,  4.1867266,  3.9511278,  3.714395 ,
        3.484849 ,  3.2739005,  3.0899024,  2.9358234,  2.8153837,
        2.727375 ,  2.6660771,  2.6191638,  2.5712247,  2.5117695,
        2.4352205,  2.3356235,  2.2147193,  2.0792274,  1.9332346,
        1.786934 ,  1.6477907,  1.5201409,  1.4157685,  1.335785 ,
        1.2748284,  1.2278844,  1.1929066,  1.1664782,  1.1425498,
        1.119881 ,  1.0991426,  1.0819967,  1.0758952,  1.0952543,
        1.153253 ,  1.2662036,  1.4550017,  1.7340628,  2.107755 ,
        2.5685928,  3.1026032,  3.6955702,  4.318763 ,  4.9410887,
        5.533783 ,  6.070261 ,  6.528496 ,  6.8935337,  7.161574 ,
        7.333489 ,  7.4176044,  7.427965 ,  7.379712 ,  7.2934084,
        7.191278 ,  7.0916743,  7.008934 ,  6.9526563,  6.9229813,
        6.916075 ,  6.9264   ,  6.9488316,  6.9789352,  7.0105314,
        7.0356383,  7.0489025,  7.0510798,  7.044831 ,  7.0329638,
        7.020595 ,  7.0151157,  7.0165215,  7.0248165,  7.042253 ,
        7.071152 ,  7.1211853,  7.199633 ,  7.3065066,  7.4405656,
        7.5979733,  7.773173 ,  7.9608345,  8.157463 ,  8.361792 ,
        8.57324  ,  8.790566 ,  9.011866 ,  9.235196 ,  9.454955 ,
        9.658838 ,  9.834555 ,  9.972411 , 10.064418 , 10.109178 ,
       10.105817 , 10.05925  ,  9.97626  ,  9.865885 ,  9.746819 ,
        9.631683 ,  9.533817 ,  9.45777  ,  9.404203 ,  9.372148 ,
        9.363664 ,  9.377956 ,  9.412059 ,  9.457245 ,  9.508495 ,
        9.563546 ,  9.620097 ,  9.673766 ,  9.71818  ,  9.752294 ,
        9.775398 ,  9.7845125,  9.78442  ,  9.776973 ,  9.763239 ,
        9.744236 ,  9.721276 ,  9.696176 ,  9.674806 ,  9.662116 ,
        9.663079 ,  9.684327 ,  9.726172 ,  9.786347 ,  9.859422 ,
        9.939408 , 10.018817 , 10.077755 , 10.101078 , 10.084569 ,
       10.019482 ,  9.903698 ,  9.7449465,  9.552645 ,  9.336995 ,
        9.121732 ,  8.917354 ,  8.732036 ,  8.578597 ,  8.459781 ,
        8.375313 ,  8.325781 ,  8.30734  ,  8.313846 ,  8.335098 ,
        8.359409 ,  8.379589 ,  8.386902 ,  8.377978 ,  8.352097 ,
        8.308868 ,  8.243141 ,  8.151444 ,  8.034054 ,  7.8960104,
        7.7449217,  7.585512 ,  7.421139 ,  7.254254 ,  7.0934505,
        6.9450407,  6.811127 ,  6.6935964,  6.592676 ,  6.5094566,
        6.4417987,  6.390399 ,  6.3554926,  6.3369603,  6.3329616,
        6.3431134,  6.3648477,  6.3899426,  6.416245 ,  6.4398155,
        6.457299 ,  6.461171 ,  6.4458175,  6.408045 ,  6.3481317,
        6.2683845,  6.1794457,  6.086313 ,  5.9965906,  5.917904 ,
        5.8516035,  5.8051486,  5.7863135,  5.794681 ,  5.8297243,
        5.8908987,  5.980261 ,  6.0962725,  6.232703 ,  6.386052 ,
        6.5428267,  6.6911154,  6.823757 ,  6.93193  ,  7.0096216,
        7.0513644,  7.0608153,  7.04208  ,  7.004848 ,  6.956893 ,
        6.9008403,  6.848636 ,  6.808554 ,  6.785692 ,  6.781085 ],
      dtype=float32)]

I got the result below:

But this is not what I want and obviously it hides my data.
I am looking for something more like this (I draw with illustrator):

Thank you so much!

A: Change set_yticks to [0,1] or range(len(dFF_snips)):
fig, ax = plt.subplots()
ax.imshow(dFF_snips, cmap= 'hot', interpolation = 'none', aspect = 'auto')
ax.set_yticks([0,1])


text:
Q: how to declare no.of rows when data from diff. array needed to show which have diff. content I am working on a reminder app and in that i needed to show event name, event image and event time.All of them are getting values from diff array but problem is that if there are content of the first array is 2 and second is three then in No.of rows in a section  if I specified return[timeArray count]; then app crashes.What to do??
here is my code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   // return [timeArray count];

   // return [imagesArray count];

    return [nameArrayP2 count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{

    cell.timeLabel.text = [timeArray objectAtIndex:indexPath.row];
        cell.eventNameLbl.text =[nameArrayP2 objectAtIndex:indexPath.row];
        UIImage *image=[UIImage imageNamed:[imagesArray objectAtIndex:indexPath.row]];
        cell.imgView.image =image;

        return cell;
}

Updated Code 6 June:
 NSArray *timeA = [[NSUserDefaults standardUserDefaults]objectForKey:@"TimeArray"];
    timeArray =[[NSMutableArray alloc]init];
    [timeArray addObjectsFromArray:timeA];
    NSLog(@"%@",timeArray);

    NSArray *nameA = [[NSUserDefaults standardUserDefaults]objectForKey:@"nameArrayP2"];
    nameArrayP2 =[[NSMutableArray alloc]init];
    [nameArrayP2 addObjectsFromArray:nameA];
    NSLog(@"%@",nameArrayP2);

    NSArray *imageA =[[NSUserDefaults standardUserDefaults]objectForKey:@"images"];
    imagesArray =[[NSMutableArray alloc]init];
    [imagesArray addObjectsFromArray:imageA];
    NSLog(@"abhi%@",nameArrayP2);

    dataMutableArray = [[NSMutableArray alloc]init];

    NSDictionary *dataDict = [[NSDictionary alloc]initWithObjectsAndKeys:nameArrayP2,@"eventTitle", timeArray,@"eventTime",imagesArray, @"eventImage", nil];

     NSDictionary *dataDict1 = [[NSDictionary alloc]initWithObjectsAndKeys:nameArrayP2,@"eventTitle", timeArray,@"eventTime",imagesArray, @"eventImage", nil];
    //dataMutableArray =[NSMutableArray arrayWithArray:[dataDict allValues]];
    [dataMutableArray addObject:dataDict]; [dataMutableArray addObject:dataDict1];

   // [dataMutableArray addObject:dataDict];
    NSLog(@"All Data=%@",dataMutableArray);

A: You can create an object for the event, in which you can have property for name, image, time etc..,
Before reloading the tableView, create an object from the list of the array and save this event as an object in an array ad use the same for tableView.

A: You should have a Custom Object which should be initialized using different dataArray and then in tableview datasource methods use the array of custom object
NSArray *eventArray = [self loadEventArray:timeArray withImage:imageArray withName:nameArray];

- (NSArray*) loadEventArray:(NSArray*) timeArray withImage:(NSArray*) imageArray withName:(NSArray*) nameArray {

NSMutableArray *eventArray = [[NSMutableArray alloc] init];

for(int anIndex = 0; anIndex < [nameArray count]; anIndex++){
    Event *event = [[Event alloc] init]; // Custom Object
    // Your logic to identify event and assign name
}

for(int anIndex = 0; anIndex < [imageArray count]; anIndex++){
    // Fetch the linked event from event Array
    // assign image
}

for(int anIndex = 0; anIndex < [timeArray count]; anIndex++){
    // Fetch the linked event from event Array
    // assign time
}

return eventArray;
}

A: You can simply create an Array of Dictionaries.
Take property of NSMutableArray if you want to manipulate the array later for adding or removing the events.
NSMutableArray *dataMutableArray = [[NSMutableArray alloc]init];

You can create dictionary of data and add it inside your array. Something like this.
NSDictionary *dataDict = [[NSDictionary alloc]initWithObjectsAndKeys:@"I am event title",@"eventTitle", @"I am image",@"eventImage",@"I am event time", @"eventTime", nil];

[dataMutableArray addObject:dataDict];

You can also create a model class which hold events data like
@property (strong, nonatomic) NSString *eventName;
@property (strong, nonatomic) NSString *eventTime;
@property (strong, nonatomic) NSString *eventDate;

//Inside your view controller
    EventData *eventObject = [[EventData alloc]init];
    eventObject.eventTime = @"I am event time";
    eventObject.eventImage = @"I am image";
    eventObject.eventTitle = @"I am event title";

    [dataMutableArray addObject:eventObject];

Below will be your tableview datasource methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [dataMutableArray count];
}

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
        {
//You can use any of the one approach
//1)
            NSDictionary *dataDict = [dataMutableArray objectAtIndex:indexPath.row];

            cell.timeLabel.text = [dataDict valueForKey:@"eventTime"];
            cell.eventNameLbl.text =[dataDict valueForKey:@"eventTitle"];
            UIImage *image=[UIImage imageNamed:[dataDict valueForKey:@"eventImage"]];
            cell.imgView.image =image;

            return cell;

//2)
        EventData *eventObject = [dataMutableArray objectAtIndex:indexPath.row];

       cell.timeLabel.text = eventObject.eventTime;
       cell.eventNameLbl.text = eventObject.eventTitle;
       UIImage *image=[UIImage imageNamed:eventObject.eventImage];
       cell.imgView.image =image;

       return cell;

    }

A: You should follow this way
Take one NSObject class say EventBO
and take 2 NSString and 1 NSDate (or as per your requirement take other type) attribute like (eventName, eventImage, eventTime).
NB: Keep the image name in the image property
#import <Foundation/Foundation.h>
@interface EventBO : NSObject

@property (nonatomic, strong) NSString *eventName;
@property (nonatomic, strong) NSString *eventImage;
@property (nonatomic, strong) NSDate *eventTime;

@end

In Your Controller:
Take Global mutable array say NSMutableArray *arrEvents
Allocate the array (preferably on viewDidLoad)
arrEvents = [[NSMutableArray alloc] init];

Then assign the values of Event (i.e eventName, eventTime and eventImage) in the object and add the object in the Global array
EventBO *objEvent = [[EventBO alloc]init];
objEvent.eventName = @"test";
objEvent.eventImage = @"test.png";
objEvent.eventTime = [NSDate date]; //You can put your time, I have set current date-time

[arrEvents addObject:objEvent]

Now use the array in the table to fetch the object and display data.


text:
Q: How to get request body in lambda from API Gateway using c# I have an API Gateway post request to upload a PDF file to S3 bucket through a lambda function. The Content-Type is application/pdf, under it I define the template as {"content":"$input.body"}.
Inside my lambda function, I have:
public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)
    {
        Console.WriteLine(request.Body);
        return new APIGatewayProxyResponse
        {
            Body = request.Body,
            StatusCode = 200
        };
    }

However when I test it in Postman by attaching a PDF file in the request body with the Content-Type as application/pdf, the request body accessed within the lambda function is always empty. Why?

A: Binary support for API Gateway needs to be explicitly configured.
Hopefully this is what you're looking for: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-configure-with-console.html


text:
Q: Evaluate $\lim_\limits{x \to 0}\frac{x}{\sqrt[n]{1+ax} \cdot \sqrt[k]{1+bx} -1}$ For all $n,k \in N a,b > 0$
$$\lim_{x \to 0}\frac{x}{\sqrt[n]{1+ax} \cdot \sqrt[k]{1+bx} -1} = \lim_{x \to 0}\frac{x}{(1+ \frac{ax}{n})(1+ \frac{bx}{k})- 1}= \lim_{x \to 0}\frac{x}{x(\frac{a}{n} + \frac{b}{k}) + \frac{ab}{nk}x^2} = \lim_{x \to 0}\frac{1}{\frac{a}{n} + \frac{b}{k}} = \frac{nk}{ka+nb}$$
Am I right?

A: The limit is fine. Perhaps with a view to formalizing the procedure is appropriate to introduce an infinite series , and then Landau notation.
$$O(g(x)) = \left\{\begin{matrix} f(x) : \forall x\ge x_0 >0 , 0\le |f(x)|\le c|g(x)| \end{matrix}\right\}$$
We will also use:
$$f_1=O(g_1)\wedge f_2=O(g_2)\implies f_1f_2=O(g_1g_2)\,$$
Recalling, from MacLaurin series:
$${(1+ax)^{1/n}}={\sum_{i=0}^{\infty} \binom{1/n}{i} (ax)^i }={ (1+\dfrac{ax}{n}+O(x^2))}\\~\\
{(1+bx)^{1/k}}={( 1+\dfrac{bx}{k}+O(x^2))}
$$
Now, we have:
$${(1+ax)^{1/n}}{(1+bx)^{1/k}}={ (1+\dfrac{ax}{n}+O(x^2))}{( 1+\dfrac{bx}{k}+O(x^2))}={(1+\dfrac{ax}{n} + \dfrac{bx}{k}+O(x^2))}
$$
And finally
$$
\lim_{x \to 0}\frac{x}{\sqrt[n]{1+ax} \cdot \sqrt[k]{1+bx} -1} = \lim_{x \to 0}\frac{x}{{(1+\dfrac{ax}{n} + \dfrac{bx}{k}+O(x^2))}-1}\\~\\=  \lim_{x \to 0}\frac{(x^{-1})x}{{(x^{-1})(\dfrac{ax}{n} + \dfrac{bx}{k}+O(x^2))}} = \lim_{x \to 0}\frac{1}{\frac{a}{n} + \frac{b}{k} +O(x)} = \frac{1}{\frac{a}{n} + \frac{b}{k}}= \frac{nk}{ak+nb}
$$