问:
Coding a button on a form in MS Access
I'm trying to build a database with MS Access. I have two tables- StockFrames and Projects, and I have a form- FrameCheckOut. On the form I have a FrameID field (where we will type in a frame id number or scan its barcode) and a ProjectName field, with a drop down of project names from the Projects table. I also have a button- Assign Frame. I want the button to update the StockFrames table with the projectID number so that I can know whether or not a frame is currently in use (or "checked out") to a project. </p>

<p>I have tried assigning this code to the button On Click: </p>

```<code>UPDATE StockFrames
SET StockFrames.projectID = [SELECT Projects.projectID
FROM Projects WHERE Projects.projectName LIKE projectName]
WHERE frameID = frameID;
</code>```

<p>.. but that code contains invalid syntax. I am very new to Access and coding and I would really appreciate some help if anyone is willing. </p>

答:
Include key field in combobox (column can be hidden) RowSource. Value of combobox will be ID but users see and type name. Combobox properties:

RowSource: SELECT ProjectID, ProjectName FROM Projects ORDER BY ProjectName;

BoundColumn: 1

ColumnCount: 2

ColumnWidths: 0";2"

ControlSource: leave blank if control is used to enter search criteria, otherwise field you want to save into

If form is bound to StockFrames, an UPDATE action is not needed. Find record for specific FrameID and simply select project from combobox.

If you prefer to use UPDATE, then have UNBOUND comboboxes for Frames and Projects designed as described above. Example VBA:

```<code>Private Sub AssignFrame_Click()
CurrentDb.Execute "UPDATE StockFrames SET ProjectID = " & Me.cbxProject & _
      " WHERE FrameID = " & Me.cbxFrame
End Sub
</code>```

Title: Coding a button on a form in MS Access

Body:
I'm trying to build a database with MS Access. I have two tables- StockFrames and Projects, and I have a form- FrameCheckOut. On the form I have a FrameID field (where we will type in a frame id number or scan its barcode) and a ProjectName field, with a drop down of project names from the Projects table. I also have a button- Assign Frame. I want the button to update the StockFrames table with the projectID number so that I can know whether or not a frame is currently in use (or "checked out") to a project.

I have tried assigning this code to the button On Click:

UPDATE StockFrames
SET StockFrames.projectID = [SELECT Projects.projectID
FROM Projects WHERE Projects.projectName LIKE projectName]
WHERE frameID = frameID;

.. but that code contains invalid syntax. I am very new to Access and coding and I would really appreciate some help if anyone is willing.

Body:
Include key field in combobox (column can be hidden) RowSource. Value of combobox will be ID but users see and type name. Combobox properties:

RowSource: SELECT ProjectID, ProjectName FROM Projects ORDER BY ProjectName;

BoundColumn: 1

ColumnCount: 2

ColumnWidths: 0";2"

ControlSource: leave blank if control is used to enter search criteria, otherwise field you want to save into

If form is bound to StockFrames, an UPDATE action is not needed. Find record for specific FrameID and simply select project from combobox.

If you prefer to use UPDATE, then have UNBOUND comboboxes for Frames and Projects designed as described above. Example VBA:

Private Sub AssignFrame_Click()
CurrentDb.Execute "UPDATE StockFrames SET ProjectID = " & Me.cbxProject & _
      " WHERE FrameID = " & Me.cbxFrame
End Sub


来源: stackexchange

问:
mysqli, OOP vs Procedural
I just saw this for the first time.   I had no idea you can instantiate a mysqli class by doing something like

```<code>new mysqli( $host, $username, $password, $db );
</code>```

This is brand new to me...Every tutorial I have seen online or in books when connecting to database does something like this:

```<code>$conn = mysqli_connect( $host, $username, $password, $db );

if ( !$conn ) {
    die( 'Sorry, could not connect');
}
</code>```

Is there a reason why most tutorials do it the procedural way?  Even in tutorials I have seen on creating a separate database class, tell me to use the procedural style code...

What's the difference with mysqli procedural vs oop? Is there any?  Do I have to install any extensions of some kind or can I just start using in my code?  Total newb here, so not really sure.

Also, when is it a good idea to use PDO vs mysqli?  Is PDO used most commonly by developers that work on large scale Enterprise applications?  Or is simply a matter of preference.

Thanks for any help...

learning php has quickly become addictive...I just want to know more and more.

答:
99% of PHP tutorials on the internet are outdated, advocate terrible code or are written by people that probably shouldn't teach PHP (and commonly all of the above). You should find the handful of good ones.

PDO is generally favoured over mysqli by developers, including me. For one, it can handle many more databases than just MySQL.

ContentLicense: CC BY-SA 3.0

Title: mysqli, OOP vs Procedural

Body:
I just saw this for the first time.   I had no idea you can instantiate a mysqli class by doing something like

new mysqli( $host, $username, $password, $db );

This is brand new to me...Every tutorial I have seen online or in books when connecting to database does something like this:

$conn = mysqli_connect( $host, $username, $password, $db );

if ( !$conn ) {
    die( 'Sorry, could not connect');
}

Is there a reason why most tutorials do it the procedural way?  Even in tutorials I have seen on creating a separate database class, tell me to use the procedural style code...

What's the difference with mysqli procedural vs oop? Is there any?  Do I have to install any extensions of some kind or can I just start using in my code?  Total newb here, so not really sure.

Also, when is it a good idea to use PDO vs mysqli?  Is PDO used most commonly by developers that work on large scale Enterprise applications?  Or is simply a matter of preference.

Thanks for any help...

learning php has quickly become addictive...I just want to know more and more.


问:
Handle text overflow in flutter
How to manage input to Text widget below, when i am having a hardcoded value like "data" it works fine but when i pass variable which has input value i get overflow issue. I am able to understand why its giving error but not sure how to fix that.</p>

```<code> return Container(
      width: sizew,
      height: sizeh,
      decoration: boxDecoration,

      child: FlatButton(
        padding: EdgeInsets.all(10),
        onPressed: onTap,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.elliptical(10,10),)
        ),
        child: SingleChildScrollView(
            child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              child  ?? Container(),
              Text("data"),
            ],
          ),
        ),

      ),
    );
</code>```

答:
You can use Flexible widget like this</p>

```<code>Flexible(
   child:
         Container(child:
                        Text("yourdata")));
</code>```

ContentLicense: CC BY-SA 4.0

Title: Handle text overflow in flutter

Body:
How to manage input to Text widget below, when i am having a hardcoded value like "data" it works fine but when i pass variable which has input value i get overflow issue. I am able to understand why its giving error but not sure how to fix that.

 return Container(
      width: sizew,
      height: sizeh,
      decoration: boxDecoration,

      child: FlatButton(
        padding: EdgeInsets.all(10),
        onPressed: onTap,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.elliptical(10,10),)
        ),
        child: SingleChildScrollView(
            child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              child  ?? Container(),
              Text("data"),
            ],
          ),
        ),

      ),
    );

Body:
You can use Flexible widget like this

Flexible(
   child:
         Container(child:
                        Text("yourdata")));


问:
I can't set a different baseURL in my nuxt app using Axios
I am trying to set the baseURL for my nuxt app so it makes requests from the swapi api, but it always goes to localhost:3000, although I'm following the documentation it seems that I am unable to solve this issue.

My nuxt.config.js is this:

```<code>modules: [
'bootstrap-vue/nuxt',
'@nuxtjs/axios',
  ],

axios: {
    // proxyHeaders: false
    baseURL:"https://swapi.dev/api/"
},
</code>```

And in my file /.nuxt/axios.js the code for the baseURL looks at follow:

```<code> const baseURL = process.browser
  ? 'https://swapi.dev/api/'
  : (process.env._AXIOS_BASE_URL_ || 'https://swapi.dev/api/')
</code>```

For vue apps, I usually have a plugins/axios.js file where I would put:

```<code>axios.defaults.baseURL =
process.env.baseURL || process.env.apiUrl || "https://swapi.dev/api/";
</code>```

But I think I don't need this with Nuxt.

答:
If you would be using the base URL in the whole of your application, you must be setting the base URL in Nuxt config, or create const file, and import it anywhere!

In const file:

```<code>export const BASE_URL = process.env.NODE_ENV === "development" ? "https://localhost:3000" : "https://swapi.dev/api/";
</code>```

OR
In the Nuxt config:

```<code>const BASE_URL = process.env.NODE_ENV === "development" ? "https://localhost:3000" : "https://swapi.dev/api/";
</code>```

Body:
I am trying to set the baseURL for my nuxt app so it makes requests from the swapi api, but it always goes to localhost:3000, although I'm following the documentation it seems that I am unable to solve this issue.

My nuxt.config.js is this:

modules: [
'bootstrap-vue/nuxt',
'@nuxtjs/axios',
  ],

axios: {
    // proxyHeaders: false
    baseURL:"https://swapi.dev/api/"
},

And in my file /.nuxt/axios.js the code for the baseURL looks at follow:

 const baseURL = process.browser
  ? 'https://swapi.dev/api/'
  : (process.env._AXIOS_BASE_URL_ || 'https://swapi.dev/api/')

For vue apps, I usually have a plugins/axios.js file where I would put:

axios.defaults.baseURL =
process.env.baseURL || process.env.apiUrl || "https://swapi.dev/api/";

But I think I don't need this with Nuxt.

Body:
If you would be using the base URL in the whole of your application, you must be setting the base URL in Nuxt config, or create const file, and import it anywhere!

In const file:

export const BASE_URL = process.env.NODE_ENV === "development" ? "https://localhost:3000" : "https://swapi.dev/api/";

OR
In the Nuxt config:

const BASE_URL = process.env.NODE_ENV === "development" ? "https://localhost:3000" : "https://swapi.dev/api/";


问:
Copy a string to another variable x86 Assembly
I would like to make a copy of a string and store the copy in another variable. I want to do it the most basic way, cause I have just started learning Assembly.
I have something like this:

```<code>section .data
        mystring db "string goes here", 10  ;string
        mystringlen equ $- mystring         ;length
        helper dw 0                         ;variable to help me in a loop
</code>```

Now, I thought of a loop that will take each byte of the string and assign it to new string.
I have this (I know it only changes initial string, but doesn't work either):

```<code>loopex:
    mov [mystring+helper], byte 'n' ;change byte of string to 'n'
    add helper, 1                   ;helper+=1
    cmp helper,mystringlen          ;compare helper with lenght of string
    jl loopex

    ;when loop is done
    mov eax, 4
    mov ecx, mystring           ; print changed string
    mov edx, mystringlen        ; number of bytes to write

    ;after printing
    int 0x80                 ; perform system call
    mov eax, 1               ; sys_exit system call
    mov ebx, 0               ;exit status 0
    int 0x80
</code>```

So I would need something like:

```<code>old_string = 'old_string'
new_string = ''
counter=0
while(counter!=len(old_string)):
  new_string[counter] = old_string[counter]
  counter+=1
print(new_string)
</code>```

答:
The code after help I received:

```<code>section .data
        mystring db "This is the string we are looking for", 10
        mystringlen equ $- mystring

section .bss
    new_string: resb mystringlen

 section .text
    global _start

_start:
    mov ecx, 0
    mov esi, mystring
    mov edi, new_string

loopex:                 ; do {
    mov byte al, [esi]
    mov byte [edi], al
    inc esi
    inc edi
    inc ecx
    cmp ecx, mystringlen
    jl loopex           ; }while(++ecx < mystringlen)

;when loop is done
    mov eax, 4                   ; __NR_write (asm/unistd_32.h)
    mov ebx, 1                   ; fd = STDOUT_FILENO
    mov ecx, new_string          ; bytes to write
    mov edx, mystringlen         ; number of bytes to write
    int 0x80                  ; perform system call: write(1, new_string, mystringlen)

    ;after printing
    mov eax, 1           ; sys_exit system call number
    mov ebx, 0           ; exit status 0
    int 0x80
</code>```

Body:
I would like to make a copy of a string and store the copy in another variable. I want to do it the most basic way, cause I have just started learning Assembly.
I have something like this:

section .data
        mystring db "string goes here", 10  ;string
        mystringlen equ $- mystring         ;length
        helper dw 0                         ;variable to help me in a loop

Now, I thought of a loop that will take each byte of the string and assign it to new string.
I have this (I know it only changes initial string, but doesn't work either):

loopex:
    mov [mystring+helper], byte 'n' ;change byte of string to 'n'
    add helper, 1                   ;helper+=1
    cmp helper,mystringlen          ;compare helper with lenght of string
    jl loopex

    ;when loop is done
    mov eax, 4
    mov ecx, mystring           ; print changed string
    mov edx, mystringlen        ; number of bytes to write

    ;after printing
    int 0x80                 ; perform system call
    mov eax, 1               ; sys_exit system call
    mov ebx, 0               ;exit status 0
    int 0x80

So I would need something like:

old_string = 'old_string'
new_string = ''
counter=0
while(counter!=len(old_string)):
  new_string[counter] = old_string[counter]
  counter+=1
print(new_string)

Body:
The code after help I received:

section .data
        mystring db "This is the string we are looking for", 10
        mystringlen equ $- mystring

section .bss
    new_string: resb mystringlen

 section .text
    global _start

_start:
    mov ecx, 0
    mov esi, mystring
    mov edi, new_string

loopex:                 ; do {
    mov byte al, [esi]
    mov byte [edi], al
    inc esi
    inc edi
    inc ecx
    cmp ecx, mystringlen
    jl loopex           ; }while(++ecx < mystringlen)

;when loop is done
    mov eax, 4                   ; __NR_write (asm/unistd_32.h)
    mov ebx, 1                   ; fd = STDOUT_FILENO
    mov ecx, new_string          ; bytes to write
    mov edx, mystringlen         ; number of bytes to write
    int 0x80                  ; perform system call: write(1, new_string, mystringlen)

    ;after printing
    mov eax, 1           ; sys_exit system call number
    mov ebx, 0           ; exit status 0
    int 0x80


问:
Execute CHECKOUT GIT commad before commit
i had worked in code source for 2 hours; unfortunately, by mistake ( terminal history ) i had execute checkout before commit can i revert it ?

Command revert, reset doent's same working in this case

答:
Sorry. Unless you had git added those changes, they never went into Git.

At this point your best chance is a file recovery utility that can maybe find the edited content of those files. But the odds are slim. You can make your chances better by not adding more writes to that disk which might overwrite the deleted changes. For example, put the recovery software on a different drive.


问:
How to build boost with correct paths
I tried to build boost in a separate path on my Ubuntu 18 Linux system. I cloned the GIT repository since I want to have the latest version available (the package repositories provide an old version only). The library I want to use is boost::timer.

This is what I did:

```<code>git clone --recursive https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh
./b2 headers
./b2
</code>```

This kind of worked. However I expected the static library to be located in a different path. It was compiled into this path:

.../boost/bin.v2/libs/timer/build/gcc-9/release/link-static/threading-multi/visibility-hidden/libboost_timer.a

This path is very verbos and it contains the compiler and its version which means I would need to update the paths when updating GCC or changing the compiler.

I would have expected it here:

.../boost/libs/timer/libboost_timer.a

Did I do something wrong? Is the placement expected that way?

答: Ok, when reading the build output carefully even a fool like me could notice that the actual path is boost/stage/lib. All built libs can be found there.

Title: How to build boost with correct paths

Body:
I tried to build boost in a separate path on my Ubuntu 18 Linux system. I cloned the GIT repository since I want to have the latest version available (the package repositories provide an old version only). The library I want to use is boost::timer.

This is what I did:

git clone --recursive https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh
./b2 headers
./b2

This kind of worked. However I expected the static library to be located in a different path. It was compiled into this path:

.../boost/bin.v2/libs/timer/build/gcc-9/release/link-static/threading-multi/visibility-hidden/libboost_timer.a

This path is very verbos and it contains the compiler and its version which means I would need to update the paths when updating GCC or changing the compiler.

I would have expected it here:

.../boost/libs/timer/libboost_timer.a

Did I do something wrong? Is the placement expected that way?


问:
how i can resolve the error "status": 500, "error": "Internal Server Error"
I am developing the backend part of a registration page for my website, the problem is that when I test this in postman I get the following error:

and I also get this error in my eclipse console:

```<code>2020-05-29 17:58:06.226 ERROR 1368 --- [nio-8484-exec-8] o.h.engine.jdbc.spi.SqlExceptionHelper   : ORA-01400: impossible d'insérer NULL dans ("NAWFEL"."ORDO_DEP_UTILISATEUR"."IDENTIFIANT")

2020-05-29 17:58:06.230 ERROR 1368 --- [nio-8484-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause

oracle.jdbc.OracleDatabaseException: ORA-01400: impossible d'insérer NULL dans ("NAWFEL"."ORDO_DEP_UTILISATEUR"."IDENTIFIANT")

    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:270) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:91) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
</code>```

I see that the error comes from the id but as you can see here I inserted the id in postman in the json part :

```<code>{
    "id":2,
    "EMPLOI":2,
    "ENTITE":2,
    "LOGIN":"hr",
    "MOTDEPASSE":"hr",
    "NOM":"bougrine",
    "PRENOM":"rachid",
    "STATUT":"br",
    "CREEPAR": 2
}
</code>```

this is my code for configure spring security in my app :

```<code>package com.app.habilitation.config;

import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure (HttpSecurity http) throws Exception {

        http.cors();
        http.csrf().disable();
        http.authorizeRequests().antMatchers("/**").
        fullyAuthenticated().and().httpBasic();
    }

    @Override
    protected void configure (AuthenticationManagerBuilder auth) throws Exception {

        auth.inMemoryAuthentication()
        .withUser("hr")
        .password("{noop}hr").roles("USER");
    }

}
</code>```

and this is my controller :

```<code>package com.app.habilitation.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.app.habilitation.entity.UserEntity;
import com.app.habilitation.service.UserService;

@SpringBootApplication
@RestController
@CrossOrigin(origins = "*")
public class UserController {

    private UserService userService;

    @Autowired
    public UserController (UserService theuserService) {
        userService=theuserService;
    }

    @GetMapping("/")
    public String login() {
        return "authenticaated succesfully";
    }

    @GetMapping("/getUsers")
    public String getUsers() {
        return "users";
    }

    @PostMapping("/addUser")
    public UserEntity addUser (@RequestBody UserEntity theUser) {

        System.out.println("test");
        userService.save(theUser);

        return theUser;
    }
}
</code>```

and this is my dao ( i use jpa) :

```<code>package com.app.habilitation.dao;

import org.springframework.data.jpa.repository.JpaRepository;

import com.app.habilitation.entity.UserEntity;

public interface UserDao extends JpaRepository<UserEntity, Integer> {

}
</code>```

this is my entity class :

```<code>package com.app.habilitation.entity;

import java.sql.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="ORDO_DEP_UTILISATEUR")
public class UserEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="IDENTIFIANT")
    private Integer IDENTIFIANT;

    /*@ManyToOne(cascade = {CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
    @JoinColumn(name="EMPLOI") */
    @Column(name="EMPLOI")
    private Integer emploi;

    /* @ManyToOne(cascade = {CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
    @JoinColumn(name="ENTITE") */
    @Column(name="ENTITE")
    private Integer entite;

    @Column(name="LOGIN")
    private String login;

    @Column(name="MOTDEPASSE")
    private String mdp;

    @Column(name="nom")
    private String nom;

    @Column(name="prenom")
    private String prenom;

    @Column(name="CREEPAR")
    private Integer creerpar;

    @Column(name="ANNULEPAR")
    private Integer annulepar;

    @Column(name="STATUT")
    private String statut;

    @Column(name="DATEEFFET")
    private Date dateeffet;

    @Column(name="DATEFIN")
    private Date datefin;

    @Column(name="CREELE")
    private Date creele;

    @Column(name="MOTIFDEDESACTIVATION")
    private String motifdedesactivation;

    @Column(name="ANNULELE")
    private Date annulele;

    public Integer getIDENTIFIANT() {
        return IDENTIFIANT;
    }

    public void setIDENTIFIANT(Integer iDENTIFIANT) {
        IDENTIFIANT = iDENTIFIANT;
    }

    public Integer getEmploi() {
        return emploi;
    }

    public void setEmploi(Integer emploi) {
        this.emploi = emploi;
    }

    public Integer getEntite() {
        return entite;
    }

    public void setEntite(Integer entite) {
        this.entite = entite;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getMdp() {
        return mdp;
    }

    public void setMdp(String mdp) {
        this.mdp = mdp;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public Integer getCreerpar() {
        return creerpar;
    }

    public void setCreerpar(Integer creerpar) {
        this.creerpar = creerpar;
    }

    public Integer getAnnulepar() {
        return annulepar;
    }

    public void setAnnulepar(Integer annulepar) {
        this.annulepar = annulepar;
    }

    public String getStatut() {
        return statut;
    }

    public void setStatut(String statut) {
        this.statut = statut;
    }

    public Date getDateeffet() {
        return dateeffet;
    }

    public void setDateeffet(Date dateeffet) {
        this.dateeffet = dateeffet;
    }

    public Date getDatefin() {
        return datefin;
    }

    public void setDatefin(Date datefin) {
        this.datefin = datefin;
    }

    public Date getCreele() {
        return creele;
    }

    public void setCreele(Date creele) {
        this.creele = creele;
    }

    public String getMotifdedesactivation() {
        return motifdedesactivation;
    }

    public void setMotifdedesactivation(String motifdedesactivation) {
        this.motifdedesactivation = motifdedesactivation;
    }

    public Date getAnnulele() {
        return annulele;
    }

    public void setAnnulele(Date annulele) {
        this.annulele = annulele;
    }

    public UserEntity(Integer iDENTIFIANT, Integer emploi, Integer entite, String login, String mdp, String nom,
            String prenom, Integer creerpar, Integer annulepar, String statut, Date dateeffet, Date datefin,
            Date creele, String motifdedesactivation, Date annulele) {
        IDENTIFIANT = iDENTIFIANT;
        this.emploi = emploi;
        this.entite = entite;
        this.login = login;
        this.mdp = mdp;
        this.nom = nom;
        this.prenom = prenom;
        this.creerpar = creerpar;
        this.annulepar = annulepar;
        this.statut = statut;
        this.dateeffet = dateeffet;
        this.datefin = datefin;
        this.creele = creele;
        this.motifdedesactivation = motifdedesactivation;
        this.annulele = annulele;
    }

    public UserEntity() {
    }

    @Override
    public String toString() {
        return "UserEntity [IDENTIFIANT=" + IDENTIFIANT + ", emploi=" + emploi + ", entite=" + entite + ", login="
                + login + ", mdp=" + mdp + ", nom=" + nom + ", prenom=" + prenom + ", creerpar=" + creerpar
                + ", annulepar=" + annulepar + ", statut=" + statut + ", dateeffet=" + dateeffet + ", datefin="
                + datefin + ", creele=" + creele + ", motifdedesactivation=" + motifdedesactivation + ", annulele="
                + annulele + "]";
    }

}
</code>```

this is my service interface :

```<code>package com.app.habilitation.service;

import java.util.List;

import com.app.habilitation.entity.UserEntity;

public interface UserService {

    public void save (UserEntity theUser);

}
</code>```

and this is my service interface Impl :

```<code>package com.app.habilitation.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.app.habilitation.dao.UserDao;
import com.app.habilitation.entity.UserEntity;

@Service
public class UserServiceImpl implements UserService {

    private UserDao userDao;

    @Autowired

    public UserServiceImpl (UserDao theuserDao) {

        userDao = theuserDao;
    }

    @Override
    @Transactional
    public void save(UserEntity theUser) {

        userDao.save(theUser);

    }

}
</code>```

this is my application.properties ( i change port 8080 to 8484 because a nother application use this port) :

```<code>spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:XE
spring.datasource.username=nawfel
spring.datasource.password=hr

spring.jpa.show-sql=true
server.port=8484
</code>```

and this is my table in oracle 10g :

答:
I think the problem is that you are telling in your entity that id is a generated value. Doing so the value is removed by Jpa during insert. You have to change your strategy, if you are supplying the id you should not mark it as autogenerated.
hth</p>

Body:
I am developing the backend part of a registration page for my website, the problem is that when I test this in postman I get the following error:

and I also get this error in my eclipse console:

2020-05-29 17:58:06.226 ERROR 1368 --- [nio-8484-exec-8] o.h.engine.jdbc.spi.SqlExceptionHelper   : ORA-01400: impossible d'insérer NULL dans ("NAWFEL"."ORDO_DEP_UTILISATEUR"."IDENTIFIANT")

2020-05-29 17:58:06.230 ERROR 1368 --- [nio-8484-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause

oracle.jdbc.OracleDatabaseException: ORA-01400: impossible d'insérer NULL dans ("NAWFEL"."ORDO_DEP_UTILISATEUR"."IDENTIFIANT")

    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:270) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:91) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0]

I see that the error comes from the id but as you can see here I inserted the id in postman in the json part :

{
    "id":2,
    "EMPLOI":2,
    "ENTITE":2,
    "LOGIN":"hr",
    "MOTDEPASSE":"hr",
    "NOM":"bougrine",
    "PRENOM":"rachid",
    "STATUT":"br",
    "CREEPAR": 2
}

this is my code for configure spring security in my app :

package com.app.habilitation.config;

import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure (HttpSecurity http) throws Exception {

        http.cors();
        http.csrf().disable();
        http.authorizeRequests().antMatchers("/**").
        fullyAuthenticated().and().httpBasic();
    }

    @Override
    protected void configure (AuthenticationManagerBuilder auth) throws Exception {

        auth.inMemoryAuthentication()
        .withUser("hr")
        .password("{noop}hr").roles("USER");
    }

}

and this is my controller :

package com.app.habilitation.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.app.habilitation.entity.UserEntity;
import com.app.habilitation.service.UserService;

@SpringBootApplication
@RestController
@CrossOrigin(origins = "*")
public class UserController {

    private UserService userService;

    @Autowired
    public UserController (UserService theuserService) {
        userService=theuserService;
    }

    @GetMapping("/")
    public String login() {
        return "authenticaated succesfully";
    }

    @GetMapping("/getUsers")
    public String getUsers() {
        return "users";
    }

    @PostMapping("/addUser")
    public UserEntity addUser (@RequestBody UserEntity theUser) {

        System.out.println("test");
        userService.save(theUser);

        return theUser;
    }
}

and this is my dao ( i use jpa) :

package com.app.habilitation.dao;

import org.springframework.data.jpa.repository.JpaRepository;

import com.app.habilitation.entity.UserEntity;

public interface UserDao extends JpaRepository<UserEntity, Integer> {

}

this is my entity class :

package com.app.habilitation.entity;

import java.sql.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="ORDO_DEP_UTILISATEUR")
public class UserEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="IDENTIFIANT")
    private Integer IDENTIFIANT;

    /*@ManyToOne(cascade = {CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
    @JoinColumn(name="EMPLOI") */
    @Column(name="EMPLOI")
    private Integer emploi;

    /* @ManyToOne(cascade = {CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
    @JoinColumn(name="ENTITE") */
    @Column(name="ENTITE")
    private Integer entite;

    @Column(name="LOGIN")
    private String login;

    @Column(name="MOTDEPASSE")
    private String mdp;

    @Column(name="nom")
    private String nom;

    @Column(name="prenom")
    private String prenom;

    @Column(name="CREEPAR")
    private Integer creerpar;

    @Column(name="ANNULEPAR")
    private Integer annulepar;

    @Column(name="STATUT")
    private String statut;

    @Column(name="DATEEFFET")
    private Date dateeffet;

    @Column(name="DATEFIN")
    private Date datefin;

    @Column(name="CREELE")
    private Date creele;

    @Column(name="MOTIFDEDESACTIVATION")
    private String motifdedesactivation;

    @Column(name="ANNULELE")
    private Date annulele;

    public Integer getIDENTIFIANT() {
        return IDENTIFIANT;
    }

    public void setIDENTIFIANT(Integer iDENTIFIANT) {
        IDENTIFIANT = iDENTIFIANT;
    }

    public Integer getEmploi() {
        return emploi;
    }

    public void setEmploi(Integer emploi) {
        this.emploi = emploi;
    }

    public Integer getEntite() {
        return entite;
    }

    public void setEntite(Integer entite) {
        this.entite = entite;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getMdp() {
        return mdp;
    }

    public void setMdp(String mdp) {
        this.mdp = mdp;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public Integer getCreerpar() {
        return creerpar;
    }

    public void setCreerpar(Integer creerpar) {
        this.creerpar = creerpar;
    }

    public Integer getAnnulepar() {
        return annulepar;
    }

    public void setAnnulepar(Integer annulepar) {
        this.annulepar = annulepar;
    }

    public String getStatut() {
        return statut;
    }

    public void setStatut(String statut) {
        this.statut = statut;
    }

    public Date getDateeffet() {
        return dateeffet;
    }

    public void setDateeffet(Date dateeffet) {
        this.dateeffet = dateeffet;
    }

    public Date getDatefin() {
        return datefin;
    }

    public void setDatefin(Date datefin) {
        this.datefin = datefin;
    }

    public Date getCreele() {
        return creele;
    }

    public void setCreele(Date creele) {
        this.creele = creele;
    }

    public String getMotifdedesactivation() {
        return motifdedesactivation;
    }

    public void setMotifdedesactivation(String motifdedesactivation) {
        this.motifdedesactivation = motifdedesactivation;
    }

    public Date getAnnulele() {
        return annulele;
    }

    public void setAnnulele(Date annulele) {
        this.annulele = annulele;
    }

    public UserEntity(Integer iDENTIFIANT, Integer emploi, Integer entite, String login, String mdp, String nom,
            String prenom, Integer creerpar, Integer annulepar, String statut, Date dateeffet, Date datefin,
            Date creele, String motifdedesactivation, Date annulele) {
        IDENTIFIANT = iDENTIFIANT;
        this.emploi = emploi;
        this.entite = entite;
        this.login = login;
        this.mdp = mdp;
        this.nom = nom;
        this.prenom = prenom;
        this.creerpar = creerpar;
        this.annulepar = annulepar;
        this.statut = statut;
        this.dateeffet = dateeffet;
        this.datefin = datefin;
        this.creele = creele;
        this.motifdedesactivation = motifdedesactivation;
        this.annulele = annulele;
    }

    public UserEntity() {
    }

    @Override
    public String toString() {
        return "UserEntity [IDENTIFIANT=" + IDENTIFIANT + ", emploi=" + emploi + ", entite=" + entite + ", login="
                + login + ", mdp=" + mdp + ", nom=" + nom + ", prenom=" + prenom + ", creerpar=" + creerpar
                + ", annulepar=" + annulepar + ", statut=" + statut + ", dateeffet=" + dateeffet + ", datefin="
                + datefin + ", creele=" + creele + ", motifdedesactivation=" + motifdedesactivation + ", annulele="
                + annulele + "]";
    }

}

this is my service interface :

package com.app.habilitation.service;

import java.util.List;

import com.app.habilitation.entity.UserEntity;

public interface UserService {

    public void save (UserEntity theUser);

}

and this is my service interface Impl :

package com.app.habilitation.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.app.habilitation.dao.UserDao;
import com.app.habilitation.entity.UserEntity;

@Service
public class UserServiceImpl implements UserService {

    private UserDao userDao;

    @Autowired

    public UserServiceImpl (UserDao theuserDao) {

        userDao = theuserDao;
    }

    @Override
    @Transactional
    public void save(UserEntity theUser) {

        userDao.save(theUser);

    }

}

this is my application.properties ( i change port 8080 to 8484 because a nother application use this port) :

spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:XE
spring.datasource.username=nawfel
spring.datasource.password=hr

spring.jpa.show-sql=true
server.port=8484

and this is my table in oracle 10g :


问:
POJO class from JSON with a value that can either be string on integer
I have a JSON file with a value "code" that can either be a string or an integer.

```<code>{
    "code": 110005,
    "name": "abcd"
},
{
    "code": "090270",
    "name": "efgh"
}
</code>```

How do I create a POJO class with this?
Expected Output is string

答:
You can cast the fields that contain numbers to strings:</p>

```<code>const data = [{
    "code": 110005,
    "name": "abcd"
  },
  {
    "code": "090270",
    "name": "efgh"
  }
]

console.log(createObj(data))

function createObj(data) {
  return data.map(entry => {
    return {
      code: entry.code.toString(),
      name: entry.name
    }
  })
}
</code>```

Body:
I have a JSON file with a value "code" that can either be a string or an integer.

{
    "code": 110005,
    "name": "abcd"
},
{
    "code": "090270",
    "name": "efgh"
}

How do I create a POJO class with this?
Expected Output is string

Body:
You can cast the fields that contain numbers to strings:

const data = [{
    "code": 110005,
    "name": "abcd"
  },
  {
    "code": "090270",
    "name": "efgh"
  }
]

console.log(createObj(data))

function createObj(data) {
  return data.map(entry => {
    return {
      code: entry.code.toString(),
      name: entry.name
    }
  })
}


问:
Check whether an Excel Range represents entire row or column
I need to determine if a given Range object is actully an entire column OR entire row OR none of two.

What I do now is based on the next code which works for me.

```<code>If Range.Rows.Count = Range.EntireColumn.Rows.Count Then
...
ElseIf Range.Columns.Count = Range.EntireRow.Columns.Count Then
...
End If
</code>```

I'd like to know if there's more efficient and/or elegant way of doing the same? Perhaps, some built-in property that I've overlooked?

UPD: I get the range from:

```<code>Worksheet.Range("NamedRange")
</code>```

Thanks.

答:
Since I think the OP's own question contains a great answer (for most uses) and three years later no one has posted it, here it is.  I converted the same logic into these two functions:</p>

```<code>Function IsEntireRow(ByVal Target As Excel.Range) As Boolean
    IsEntireRow = Target.Columns.Count = Target.EntireRow.Columns.Count
End Function

Function IsEntireColumn(ByVal Target As Excel.Range) As Boolean
    IsEntireColumn = Target.Rows.Count = Target.EntireColumn.Rows.Count
End Function
</code>```

Body:
I need to determine if a given Range object is actully an entire column OR entire row OR none of two.

What I do now is based on the next code which works for me.

If Range.Rows.Count = Range.EntireColumn.Rows.Count Then
...
ElseIf Range.Columns.Count = Range.EntireRow.Columns.Count Then
...
End If

I'd like to know if there's more efficient and/or elegant way of doing the same? Perhaps, some built-in property that I've overlooked?

UPD: I get the range from:

Worksheet.Range("NamedRange")

Thanks.

Body:
Since I think the OP's own question contains a great answer (for most uses) and three years later no one has posted it, here it is.  I converted the same logic into these two functions:

Function IsEntireRow(ByVal Target As Excel.Range) As Boolean
    IsEntireRow = Target.Columns.Count = Target.EntireRow.Columns.Count
End Function

Function IsEntireColumn(ByVal Target As Excel.Range) As Boolean
    IsEntireColumn = Target.Rows.Count = Target.EntireColumn.Rows.Count
End Function


问:
Using Oracle database links without unreadable dynamic SQL
How can I write a neat PL/SQL stored procedure that can execute against a given database link?

It gets really messy, writing stuff like this:

```<code>   PROCEDURE my_proc(aDbLink IN VARCHAR2)
   IS
   BEGIN
       EXECUTE IMMEDIATE '
       SELECT mycolumn, anothercolumn
       FROM MYTABLE@' || aDbLink || '
       WHERE such-and-such...'
   END
</code>```

as the query gets bigger.

What else might I do? I'm stuck using stored procedures, and expect that my procedures will execute against one of several db links.

答:
If you don't want to use the synonym idea, you could try this method - use REPLACE and your own syntax to generate the SQL - I find this method makes debugging dynamic SQL a breeze:</p>

```<code>PROCEDURE my_proc(aDbLink IN VARCHAR2)
IS
BEGIN
    EXECUTE IMMEDIATE REPLACE('
    SELECT mycolumn, anothercolumn
    FROM MYTABLE@#DBLINK#
    WHERE such-and-such...'
       ,'#DBLINK#', aDbLink);
END
</code>```

Body:
How can I write a neat PL/SQL stored procedure that can execute against a given database link?

It gets really messy, writing stuff like this:

   PROCEDURE my_proc(aDbLink IN VARCHAR2)
   IS
   BEGIN
       EXECUTE IMMEDIATE '
       SELECT mycolumn, anothercolumn
       FROM MYTABLE@' || aDbLink || '
       WHERE such-and-such...'
   END

as the query gets bigger.

What else might I do? I'm stuck using stored procedures, and expect that my procedures will execute against one of several db links.

Body:
If you don't want to use the synonym idea, you could try this method - use REPLACE and your own syntax to generate the SQL - I find this method makes debugging dynamic SQL a breeze:

PROCEDURE my_proc(aDbLink IN VARCHAR2)
IS
BEGIN
    EXECUTE IMMEDIATE REPLACE('
    SELECT mycolumn, anothercolumn
    FROM MYTABLE@#DBLINK#
    WHERE such-and-such...'
       ,'#DBLINK#', aDbLink);
END


问:
K and &K using sense
world!
As I have to know the sense of existence of the each symbol in C++, I would like to get acquainted with the reason why in the first variant of my code we use &K (on the last line), and in the second variant - just K (also in the last line).
Hope you understood the question.

1-st

```<code>ifstream in("name.txt");

istream_iterator<int> it(in);
istream_iterator<int> eof;

ostream_iterator<int> out(cout, " ");

size_t K = 1;

remove_copy_if(it, eof, out, [&K](int a) {return K++ % 2 == 0; });

2-nd
````````````````````````````
size_t K;
cin >> K;

ifstream in ("name1.txt");

istream_iterator<string> it(in);
istream_iterator<string> eof;

ofstream out ("name2.txt");

ostream_iterator<string> fout(out, "\n");

remove_copy_if(it, eof, fout, [K](string e) {return e.length() > K; });
```

答:
why in the first variant of my code we use &K (on the last line), and in the second variant - just K (also in the last line)

Because the first lambda modifies K in K++ - each lambda execution increments K value. So K has to be captured with &K.

The second lambda only uses K value, but does not modify it. So capturing just K by value is enough.

Title: K and &K using sense

Body:
world!
As I have to know the sense of existence of the each symbol in C++, I would like to get acquainted with the reason why in the first variant of my code we use &K (on the last line), and in the second variant - just K (also in the last line).
Hope you understood the question.

1-st

ifstream in("name.txt");

istream_iterator<int> it(in);
istream_iterator<int> eof;

ostream_iterator<int> out(cout, " ");

size_t K = 1;

remove_copy_if(it, eof, out, [&K](int a) {return K++ % 2 == 0; });

2-nd
````````````````````````````
size_t K;
cin >> K;

ifstream in ("name1.txt");

istream_iterator<string> it(in);
istream_iterator<string> eof;

ofstream out ("name2.txt");

ostream_iterator<string> fout(out, "\n");

remove_copy_if(it, eof, fout, [K](string e) {return e.length() > K; });


问:
How do I fix a deprecated module for plotly.plotly
I am just beginning my Python journey and trying to replicate code from:
Using Python and Auto ARIMA to Forecast Seasonal Time Series

When I attempt to run the following:

```<code>import plotly.plotly as ply
</code>```

I receive the following import error:

The plotly.plotly module is deprecated,
please install the chart-studio package and use the
chart_studio.plotly module instead.

I have tried uninstalling and then reinstalling plotly into my Anaconda instance, but to no avail.

答: Install chart-studio with pip install chart-studio at the command line/terminal.

Body:
I am just beginning my Python journey and trying to replicate code from:
Using Python and Auto ARIMA to Forecast Seasonal Time Series

When I attempt to run the following:

import plotly.plotly as ply

I receive the following import error:

The plotly.plotly module is deprecated,
please install the chart-studio package and use the
chart_studio.plotly module instead.

I have tried uninstalling and then reinstalling plotly into my Anaconda instance, but to no avail.


问:
Working with ejs when using the script tag
I work in Node.js/Express + PostgreSQL and ejs.

I want to insert in tag script <%=result.dis%>. My result that I get from the DB query.

I trying to do something like this:

```<code>var vPlayer = `<%-JSON.stringify(avg.mark)%>`;
console.log(vPlayer);
</code>```

Or this:

```<code>const div = document.createElement('div');
div.innerText = `<%=avg.mark %>`
console.log(div);
</code>```

But it's don't worked. My full code where I want to draw a graph

```<code><script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

<% avg_t.rows.forEach(function(avg){%>
  <script type="text/javascript">
    var vPlayer = `<%-JSON.stringify(avg.mark)%>`;
    console.log(vPlayer);

    const div = document.createElement('div');
    div.innerText = `<%=avg.mark %>`
    console.log(div);

    google.charts.load('current', {
      'packages': ['corechart']
    });
    google.charts.setOnLoadCallback(drawChart);

    function drawChart() {
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Topping');
      data.addColumn('number', 'Slices');
      data.addRows([
        ['Mushrooms', vPlayer],
        ['Mu112', div],
        ['Onions', 1],
      ]);
      var barchart_options = {
        title: 'Barchart: How Much Pizza I Ate Last
        Night ',width:400,height:300,legend: '
        none '};
        var barchart = new google.visualization.BarChart(document.getElementById('barchart_div'));
        barchart.draw(data, barchart_options);
      }
  </script>
<%} ) %>
</code>```

答:
There are two lines I don't understand at all, but you're the owner of this code:

```<code>['Mushrooms', vPlayer /*I don't understand this*/],
['Mu112', div/*I don't understand this*/],
</code>```

New approach:

```<code><script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
  let rows = JSON.parse('<%= JSON.stringify(avg_t.rows) %>');
  let players = [];

  rows.forEach(function(avg, i) {
    players.push(avg.mark);

    let div = document.createElement('div');
    div.innerText = avg.mark; //I don't know
    div.setAttribute("id", `barchart_div${i}`);
    /*You should append this new div into a specific element*/
  });

  google.charts.load('current', {
    'packages': ['corechart']
  });

  function drawChart() {
    players.forEach(function(vPlayer, i) {
      let div = document.getElementById(`barchart_div${i}`);
      let data = new google.visualization.DataTable();
      data.addColumn('string', 'Topping');
      data.addColumn('number', 'Slices');
      data.addRows([
        ['Mushrooms', vPlayer /*I don't understand this*/],
        ['Mu112', div/*I don't understand this*/],
        ['Onions', 1],
      ]);
      var barchart_options = {
        title: 'Barchart: How Much Pizza I Ate Last Night ',
        width: 400,
        height: 300,
        legend: 'none'
      };
      var barchart = new google.visualization.BarChart(div);
      barchart.draw(data, barchart_options);
    });
  }

  google.charts.setOnLoadCallback(drawChart);
</script>
</code>```

Body:
I work in Node.js/Express + PostgreSQL and ejs.

I want to insert in tag script <%=result.dis%>. My result that I get from the DB query.

I trying to do something like this:

var vPlayer = `<%-JSON.stringify(avg.mark)%>`;
console.log(vPlayer);

Or this:

const div = document.createElement('div');
div.innerText = `<%=avg.mark %>`
console.log(div);

But it's don't worked. My full code where I want to draw a graph

<% avg_t.rows.forEach(function(avg){%>

<%} ) %>

Body:
There are two lines I don't understand at all, but you're the owner of this code:

['Mushrooms', vPlayer /*I don't understand this*/],
['Mu112', div/*I don't understand this*/],

New approach:

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
  let rows = JSON.parse('<%= JSON.stringify(avg_t.rows) %>');
  let players = [];

  rows.forEach(function(avg, i) {
    players.push(avg.mark);

    let div = document.createElement('div');
    div.innerText = avg.mark; //I don't know
    div.setAttribute("id", `barchart_div${i}`);
    /*You should append this new div into a specific element*/
  });

  google.charts.load('current', {
    'packages': ['corechart']
  });

  function drawChart() {
    players.forEach(function(vPlayer, i) {
      let div = document.getElementById(`barchart_div${i}`);
      let data = new google.visualization.DataTable();
      data.addColumn('string', 'Topping');
      data.addColumn('number', 'Slices');
      data.addRows([
        ['Mushrooms', vPlayer /*I don't understand this*/],
        ['Mu112', div/*I don't understand this*/],
        ['Onions', 1],
      ]);
      var barchart_options = {
        title: 'Barchart: How Much Pizza I Ate Last Night ',
        width: 400,
        height: 300,
        legend: 'none'
      };
      var barchart = new google.visualization.BarChart(div);
      barchart.draw(data, barchart_options);
    });
  }

  google.charts.setOnLoadCallback(drawChart);
</script>


问:
How To Hide AppBar When Scrolling Down
I have an AppBar and other things in my layout. When the user scrolls down, I want AppBar(actually, the Toolbar to hide. This is what I have tried, the app bar isn't hiding all small part it just stays there. Actually I think the problem is with my header of the screen it gets collapsed and adds a small space when I scroll.

As you can see in second image some part stays it doesn't hide. I need to hide that part while scrolling.
Please provide me solution what am I doing wrong?

```<code><?xml version="1.0" encoding="utf-8"?>

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:orientation="vertical">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:contentScrim="?attr/colorPrimary"
                app:expandedTitleTextAppearance="@style/TextAppearance.AppCompat.Title"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:titleEnabled="false">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:orientation="vertical">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:id="@+id/slideIV"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:adjustViewBounds="true"
                            android:src="@drawable/ic_dish" />

                        <View
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_above="@+id/bottomButtonRL"
                            android:layout_gravity="bottom"
                            android:background="@drawable/gradient_bg" />

                        <View style="@style/itemBottomViewLarge" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_margin="@dimen/_20"
                            android:gravity="center_vertical"
                            android:orientation="vertical">

                            <de.hdodenhof.circleimageview.CircleImageView
                                android:layout_width="80dp"
                                android:layout_height="80dp"
                                android:src="@drawable/fake_chef_bg"
                                app:civ_border_color="@color/border_grey_color"
                                app:civ_border_width="@dimen/_2" />

                            <LinearLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_margin="@dimen/_5"
                                android:orientation="vertical">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:fontFamily="@font/bold_font"
                                    android:text="@string/fatima_al_zahraa"
                                    android:textColor="@color/white"
                                    android:textSize="@dimen/large_text_size"
                                    android:textStyle="bold" />

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="match_parent"
                                    android:fontFamily="@font/regular_font"
                                    android:text="@string/presenter_of_the_cuient"
                                    android:textColor="@color/white"
                                    android:textSize="@dimen/app_text_size" />
                            </LinearLayout>
                        </LinearLayout>

                        <RelativeLayout
                            android:id="@+id/bottomButtonRL"
                            android:layout_width="match_parent"
                            android:layout_height="50dp"
                            android:layout_below="@+id/slideIV"
                            android:layout_marginTop="-25dp">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical">

                                <View
                                    android:layout_width="match_parent"
                                    android:layout_height="@dimen/_0"
                                    android:layout_weight="1" />

                                <View
                                    android:layout_width="match_parent"
                                    android:layout_height="@dimen/_0"
                                    android:layout_weight="1"
                                    android:background="@color/defaultColor" />
                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal"
                                android:paddingStart="@dimen/_20"
                                android:paddingLeft="@dimen/_20">

                                <ImageView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:adjustViewBounds="true"
                                    android:src="@drawable/ic_share" />

                                <RelativeLayout
                                    android:layout_width="220dp"
                                    android:layout_height="wrap_content"
                                    android:layout_marginStart="@dimen/_10"
                                    android:layout_marginLeft="@dimen/_10"
                                    android:background="@drawable/ic_rec1">

                                    <TextView
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:fontFamily="@font/regular_font"
                                        android:gravity="center"
                                        android:layout_centerInParent="true"
                                        android:text="@string/add_to_fav"
                                        android:textColor="@color/white"
                                        android:textSize="@dimen/medium_text_size" />
                                </RelativeLayout>

                            </LinearLayout>

                        </RelativeLayout>
                    </RelativeLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@drawable/bottom_radius_view">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:fontFamily="@font/regular_font"
                            android:padding="@dimen/_20"
                            android:text="@string/galetes_fires_au_plates_fires_au_plates_fires_au_plates_fires_au_plates_fires_au_plates"
                            android:textColor="@color/white"
                            android:textSize="@dimen/app_text_size" />
                    </LinearLayout>
                </LinearLayout>

                <androidx.appcompat.widget.Toolbar
                    android:visibility="gone"
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    app:layout_collapseMode="pin"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                    />
            </com.google.android.material.appbar.CollapsingToolbarLayout>
        </com.google.android.material.appbar.AppBarLayout>

        <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:paddingLeft="@dimen/_20"
                android:paddingTop="@dimen/_10"
                android:paddingRight="@dimen/_20">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/bold_font"
                    android:padding="@dimen/_5"
                    android:text="@string/les_videos"
                    android:textColor="@color/medium_grey_text_color"
                    android:textSize="@dimen/large_text_size" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/itemFRV"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="@dimen/_5" />
            </LinearLayout>

        </androidx.core.widget.NestedScrollView>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</layout>
</code>```

This is the header code:

```<code><?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/header_height"
        android:background="@color/white"
        android:gravity="center"
        android:orientation="horizontal"
        android:paddingLeft="@dimen/_20"
        android:paddingRight="@dimen/_20">

        <LinearLayout
            android:id="@+id/backLL"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="left"
            android:gravity="center"
            android:paddingRight="@dimen/_20"
            android:layout_marginBottom="@dimen/_10"
            android:visibility="gone">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:src="@drawable/ic_back" />
        </LinearLayout>

        <ImageView
            android:id="@+id/logoIV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:adjustViewBounds="true"
            android:paddingStart="0dp"
            android:paddingTop="@dimen/_15"
            android:paddingEnd="@dimen/_10"
            android:layout_marginBottom="@dimen/_10"
            android:src="@drawable/ic_header_logo" />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <ImageView
            android:id="@+id/profileIV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:adjustViewBounds="true"
            android:paddingStart="@dimen/_10"
            android:paddingTop="@dimen/_15"
            android:paddingEnd="0dp"
            android:layout_marginBottom="@dimen/_10"
            android:src="@drawable/ic_default_user" />
    </LinearLayout>
</layout>
</code>```

答:
Answer to the problem is just remove</p>

```<code>android:fitsSystemWindows="true"
</code>```

Title: How To Hide AppBar When Scrolling Down

Body:
I have an AppBar and other things in my layout. When the user scrolls down, I want AppBar(actually, the Toolbar to hide. This is what I have tried, the app bar isn't hiding all small part it just stays there. Actually I think the problem is with my header of the screen it gets collapsed and adds a small space when I scroll.

As you can see in second image some part stays it doesn't hide. I need to hide that part while scrolling.
Please provide me solution what am I doing wrong?

<?xml version="1.0" encoding="utf-8"?>

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:orientation="vertical">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:contentScrim="?attr/colorPrimary"
                app:expandedTitleTextAppearance="@style/TextAppearance.AppCompat.Title"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:titleEnabled="false">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:orientation="vertical">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:id="@+id/slideIV"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:adjustViewBounds="true"
                            android:src="@drawable/ic_dish" />

                        <View
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_above="@+id/bottomButtonRL"
                            android:layout_gravity="bottom"
                            android:background="@drawable/gradient_bg" />

                        <View style="@style/itemBottomViewLarge" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_margin="@dimen/_20"
                            android:gravity="center_vertical"
                            android:orientation="vertical">

                            <de.hdodenhof.circleimageview.CircleImageView
                                android:layout_width="80dp"
                                android:layout_height="80dp"
                                android:src="@drawable/fake_chef_bg"
                                app:civ_border_color="@color/border_grey_color"
                                app:civ_border_width="@dimen/_2" />

                            <LinearLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_margin="@dimen/_5"
                                android:orientation="vertical">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:fontFamily="@font/bold_font"
                                    android:text="@string/fatima_al_zahraa"
                                    android:textColor="@color/white"
                                    android:textSize="@dimen/large_text_size"
                                    android:textStyle="bold" />

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="match_parent"
                                    android:fontFamily="@font/regular_font"
                                    android:text="@string/presenter_of_the_cuient"
                                    android:textColor="@color/white"
                                    android:textSize="@dimen/app_text_size" />
                            </LinearLayout>
                        </LinearLayout>

                        <RelativeLayout
                            android:id="@+id/bottomButtonRL"
                            android:layout_width="match_parent"
                            android:layout_height="50dp"
                            android:layout_below="@+id/slideIV"
                            android:layout_marginTop="-25dp">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical">

                                <View
                                    android:layout_width="match_parent"
                                    android:layout_height="@dimen/_0"
                                    android:layout_weight="1" />

                                <View
                                    android:layout_width="match_parent"
                                    android:layout_height="@dimen/_0"
                                    android:layout_weight="1"
                                    android:background="@color/defaultColor" />
                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal"
                                android:paddingStart="@dimen/_20"
                                android:paddingLeft="@dimen/_20">

                                <ImageView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:adjustViewBounds="true"
                                    android:src="@drawable/ic_share" />

                                <RelativeLayout
                                    android:layout_width="220dp"
                                    android:layout_height="wrap_content"
                                    android:layout_marginStart="@dimen/_10"
                                    android:layout_marginLeft="@dimen/_10"
                                    android:background="@drawable/ic_rec1">

                                    <TextView
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:fontFamily="@font/regular_font"
                                        android:gravity="center"
                                        android:layout_centerInParent="true"
                                        android:text="@string/add_to_fav"
                                        android:textColor="@color/white"
                                        android:textSize="@dimen/medium_text_size" />
                                </RelativeLayout>

                            </LinearLayout>

                        </RelativeLayout>
                    </RelativeLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@drawable/bottom_radius_view">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:fontFamily="@font/regular_font"
                            android:padding="@dimen/_20"
                            android:text="@string/galetes_fires_au_plates_fires_au_plates_fires_au_plates_fires_au_plates_fires_au_plates"
                            android:textColor="@color/white"
                            android:textSize="@dimen/app_text_size" />
                    </LinearLayout>
                </LinearLayout>

                <androidx.appcompat.widget.Toolbar
                    android:visibility="gone"
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    app:layout_collapseMode="pin"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                    />
            </com.google.android.material.appbar.CollapsingToolbarLayout>
        </com.google.android.material.appbar.AppBarLayout>

        <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:paddingLeft="@dimen/_20"
                android:paddingTop="@dimen/_10"
                android:paddingRight="@dimen/_20">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/bold_font"
                    android:padding="@dimen/_5"
                    android:text="@string/les_videos"
                    android:textColor="@color/medium_grey_text_color"
                    android:textSize="@dimen/large_text_size" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/itemFRV"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="@dimen/_5" />
            </LinearLayout>

        </androidx.core.widget.NestedScrollView>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</layout>

This is the header code:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/header_height"
        android:background="@color/white"
        android:gravity="center"
        android:orientation="horizontal"
        android:paddingLeft="@dimen/_20"
        android:paddingRight="@dimen/_20">

        <LinearLayout
            android:id="@+id/backLL"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="left"
            android:gravity="center"
            android:paddingRight="@dimen/_20"
            android:layout_marginBottom="@dimen/_10"
            android:visibility="gone">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:src="@drawable/ic_back" />
        </LinearLayout>

        <ImageView
            android:id="@+id/logoIV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:adjustViewBounds="true"
            android:paddingStart="0dp"
            android:paddingTop="@dimen/_15"
            android:paddingEnd="@dimen/_10"
            android:layout_marginBottom="@dimen/_10"
            android:src="@drawable/ic_header_logo" />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <ImageView
            android:id="@+id/profileIV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:adjustViewBounds="true"
            android:paddingStart="@dimen/_10"
            android:paddingTop="@dimen/_15"
            android:paddingEnd="0dp"
            android:layout_marginBottom="@dimen/_10"
            android:src="@drawable/ic_default_user" />
    </LinearLayout>
</layout>

Body:
Answer to the problem is just remove

android:fitsSystemWindows="true"


问:
Chrome 83: Cannot upload file
I've update Chrome on version 83, and some of my forms that use an "Ajax upload" component (more info below) aren't working. I've read the issues of the new version (https://developers.google.com/web/updates/2020/05/nic83) but I can't find anything related on forms, iframes, files, ajax or posts.

I'll try to post a sample on fiddler, but I want to know if somebody knows anything about it.

By other way, on other forms I've a multifile, drag&drop uploader (dropzone.js) and it's working fine, but it isn't easy to convert and I need a fast solution.

A dummy sample (I don't have any sandbox to test upload): https://jsfiddle.net/drvespa/7ue8k94r/3/

On Chrome 83 (I've tried on Canary 85 version too): it throws no error cause the submit of the form isn't catched by AjaxUpload component. The callback is being called before the submit is done, and the response is empty.

On Firefox: it throws an error cause AjaxUpload component is trying to deserialize 404 of the dummy upload page.

I post the library on https://filebin.net/8sgsmq7sh14m0qen:

```<code>/**
* Ajax upload
* Project page - http://valums.com/ajax-upload/
* Copyright (c) 2008 Andris Valums, http://valums.com
* Licensed under the MIT license (http://valums.com/mit-license/)
* Version 3.6 (26.06.2009)
*/
</code>```

答:
Thank You! Also, for all still using Opencart 1.5 after this Chrome Update, image and document upload is fixed by adding:

```<code>iframe.setAttribute('srcdoc', this._settings.action);
</code>```

in \admin\view\javascript\jquery\ajaxupload.js

```<code>var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
            // src="javascript:false; was added
            // because it possibly removes ie6 prompt
            // "This page contains both secure and nonsecure items"
            // Anyway, it doesn't do any harm.
            iframe.setAttribute('id', id);
            iframe.setAttribute('srcdoc', this._settings.action);
            iframe.style.display = 'none';
            document.body.appendChild(iframe);
</code>```

Title: Chrome 83: Cannot upload file

Body:
I've update Chrome on version 83, and some of my forms that use an "Ajax upload" component (more info below) aren't working. I've read the issues of the new version (https://developers.google.com/web/updates/2020/05/nic83) but I can't find anything related on forms, iframes, files, ajax or posts.

I'll try to post a sample on fiddler, but I want to know if somebody knows anything about it.

By other way, on other forms I've a multifile, drag&drop uploader (dropzone.js) and it's working fine, but it isn't easy to convert and I need a fast solution.

A dummy sample (I don't have any sandbox to test upload): https://jsfiddle.net/drvespa/7ue8k94r/3/

On Chrome 83 (I've tried on Canary 85 version too): it throws no error cause the submit of the form isn't catched by AjaxUpload component. The callback is being called before the submit is done, and the response is empty.

On Firefox: it throws an error cause AjaxUpload component is trying to deserialize 404 of the dummy upload page.

I post the library on https://filebin.net/8sgsmq7sh14m0qen:

/**
* Ajax upload
* Project page - http://valums.com/ajax-upload/
* Copyright (c) 2008 Andris Valums, http://valums.com
* Licensed under the MIT license (http://valums.com/mit-license/)
* Version 3.6 (26.06.2009)
*/

Body:
Thank You! Also, for all still using Opencart 1.5 after this Chrome Update, image and document upload is fixed by adding:

iframe.setAttribute('srcdoc', this._settings.action);

in \admin\view\javascript\jquery\ajaxupload.js

var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
            // src="javascript:false; was added
            // because it possibly removes ie6 prompt
            // "This page contains both secure and nonsecure items"
            // Anyway, it doesn't do any harm.
            iframe.setAttribute('id', id);
            iframe.setAttribute('srcdoc', this._settings.action);
            iframe.style.display = 'none';
            document.body.appendChild(iframe);


问:
Deleting a selected row
I have the below code which effectively deletes three lines within a designated worksheet (Finding ranges etc). This code I have used for atleast a year without any issues. However I have recently transferred this code to a new work book and set up a worksheet which is exactly the same as the previous workbook.

The code errors where highlighted below with the error message

Run-Time error '1004'

Delete method of range class failed

Can anyone suggest why this error would occur?

```<code>Sub DeleteRowPIC()

Application.ScreenUpdating = False
Application.Calculation = xlManual
ActiveSheet.Unprotect Password:="Projects123"
ActiveSheet.Range("Total").Select
If Selection.Row = 12 Then
Else
ActiveSheet.Range("Total").Select
Selection.Offset(-2, 0).Select
ActiveCell.EntireRow.Delete

ActiveSheet.Range("Total_1").Select
Selection.Offset(-2, 0).Select
ActiveCell.EntireRow.Delete **ERROR OCCURS HERE**

ActiveSheet.Range("Total_2").Select
Selection.Offset(-2, 0).Select
ActiveCell.EntireRow.Delete

End If
Range("K2").Select
Application.Calculation = xlAutomatic
With ActiveSheet

      .Protect Password:="Projects123", UserInterfaceOnly:=True
      .EnableOutlining = True
End With
</code>```

答: I know it's been a long time but in case anyone else stumbles across this the way I did, when I had this problem it turned out that an external data query which overlaped that row was the problem. Even deleting the results of that query didn't resolve it. However, as soon as I moved that query to a different sheet -- problem solved.</p>

Title: Deleting a selected row

Body:
I have the below code which effectively deletes three lines within a designated worksheet (Finding ranges etc). This code I have used for atleast a year without any issues. However I have recently transferred this code to a new work book and set up a worksheet which is exactly the same as the previous workbook.

The code errors where highlighted below with the error message

Run-Time error '1004'

Delete method of range class failed

Can anyone suggest why this error would occur?

Sub DeleteRowPIC()

Application.ScreenUpdating = False
Application.Calculation = xlManual
ActiveSheet.Unprotect Password:="Projects123"
ActiveSheet.Range("Total").Select
If Selection.Row = 12 Then
Else
ActiveSheet.Range("Total").Select
Selection.Offset(-2, 0).Select
ActiveCell.EntireRow.Delete

ActiveSheet.Range("Total_1").Select
Selection.Offset(-2, 0).Select
ActiveCell.EntireRow.Delete **ERROR OCCURS HERE**

ActiveSheet.Range("Total_2").Select
Selection.Offset(-2, 0).Select
ActiveCell.EntireRow.Delete

End If
Range("K2").Select
Application.Calculation = xlAutomatic
With ActiveSheet

      .Protect Password:="Projects123", UserInterfaceOnly:=True
      .EnableOutlining = True
End With


问:
How to refer 'decider' in the where clause from the following mysql query?
How to refer 'decider' in the where clause from the following mysql query?

```<code>SELECT *,
       CASE
         WHEN (cond1) THEN 1
         WHEN (cond2) THEN 2
       END as decider
  FROM t1,
       t2
 WHERE cond12
   AND decider <> NULL
</code>```

I tried it, and I got a 1054: Unknown column in where clause error.

答:
Use:

```<code>SELECT *,
       CASE
         WHEN (cond1) THEN 1
         WHEN (cond2) THEN 2
         ELSE NULL
       END as decider
  FROM t1,
       t2
 WHERE cond12
HAVING decider IS NOT NULL
</code>```

The earliest MySQL allows you to use column aliases is the GROUP BY clause

You need to use IS NULL or IS NOT NULL (where appropriate) because NULL is not a value -- it's a placeholder for the lack of any value, which requires special handling in SQL

Body:
How to refer 'decider' in the where clause from the following mysql query?

SELECT *,
       CASE
         WHEN (cond1) THEN 1
         WHEN (cond2) THEN 2
       END as decider
  FROM t1,
       t2
 WHERE cond12
   AND decider <> NULL

I tried it, and I got a 1054: Unknown column in where clause error.

Body:
Use:

SELECT *,
       CASE
         WHEN (cond1) THEN 1
         WHEN (cond2) THEN 2
         ELSE NULL
       END as decider
  FROM t1,
       t2
 WHERE cond12
HAVING decider IS NOT NULL

The earliest MySQL allows you to use column aliases is the GROUP BY clause

You need to use IS NULL or IS NOT NULL (where appropriate) because NULL is not a value -- it's a placeholder for the lack of any value, which requires special handling in SQL


问:
NodeJS - https - TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token ["Accept"]
I have a NodeJS code that uses https module as: https.request(options, (res) => {...... where options is an object like

```<code>const options = {
    hostname: SERVICE_HOSTNAME,
    path: BASE_PATH,
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        ApplicationId,
        Authorization
    }
  };
</code>```

My problems start when I add Accept header. I getting an error:

```<code>TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token ["Accept"]
    at ClientRequest.setHeader (_http_outgoing.js:472:3)
    at new ClientRequest (_http_client.js:203:14)
    at Object.request (https.js:289:10)
</code>```

How Accept header would be invalid?

答:
I didn't eat because of your question T_T

As @hlfrmn said, you have a rare char in your Accept word!!

I reproduced the error:

```<code>const https = require('https');

//copied from origin question
var copiedOptions = {
  headers: {
    'Content-Type': 'application/json',
    "Accept": 'application/json'
  }
}

var writedOptions = {
  headers: {
    'Content-Type': 'application/json',
    "Accept": 'application/json'
  }
}

https.get('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY',writedOptions, (resp) => {
  let data = '';

  // A chunk of data has been recieved.
  resp.on('data', (chunk) => {
    data += chunk;
  });

  // The whole response has been received. Print out the result.
  resp.on('end', () => {
    console.log(JSON.parse(data).explanation);
  });

}).on("error", (err) => {
  console.log("Error: " + err.message);
});
</code>```

If you try with copiedOptions, you will get the same error.

Since Node v10.20.1

Searching in https://github.com/nodejs/node/tree/master and the stackTrace: _http_outgoing.js:472

```<code>at ClientRequest.setHeader (_http_outgoing.js:472:3)
</code>```

function setHeader https://github.com/nodejs/node/blob/v10.20.1/lib/_http_outgoing.js#L472

function validateHeaderName https://github.com/nodejs/node/blob/v10.20.1/lib/_http_outgoing.js#L446

function checkIsHttpToken https://github.com/nodejs/node/blob/master/lib/_http_common.js#L210

I founded this:

```<code>const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
/**
 * Verifies that the given val is a valid HTTP token
 * per the rules defined in RFC 7230
 * See https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6
 */
function checkIsHttpToken(val) {
  return tokenRegExp.test(val);
}
</code>```

That regex ensure that header name only has allowed tokens or chars according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6

Maybe a earlier validation in nodejs core could help:

You have a not allowed char in your header name!

Body:
I have a NodeJS code that uses https module as: https.request(options, (res) => {...... where options is an object like

const options = {
    hostname: SERVICE_HOSTNAME,
    path: BASE_PATH,
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        ApplicationId,
        Authorization
    }
  };

My problems start when I add Accept header. I getting an error:

TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token ["Accept"]
    at ClientRequest.setHeader (_http_outgoing.js:472:3)
    at new ClientRequest (_http_client.js:203:14)
    at Object.request (https.js:289:10)

How Accept header would be invalid?

Body:
I didn't eat because of your question T_T

As @hlfrmn said, you have a rare char in your Accept word!!

I reproduced the error:

const https = require('https');

//copied from origin question
var copiedOptions = {
  headers: {
    'Content-Type': 'application/json',
    "Accept": 'application/json'
  }
}

var writedOptions = {
  headers: {
    'Content-Type': 'application/json',
    "Accept": 'application/json'
  }
}

https.get('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY',writedOptions, (resp) => {
  let data = '';

  // A chunk of data has been recieved.
  resp.on('data', (chunk) => {
    data += chunk;
  });

  // The whole response has been received. Print out the result.
  resp.on('end', () => {
    console.log(JSON.parse(data).explanation);
  });

}).on("error", (err) => {
  console.log("Error: " + err.message);
});

If you try with copiedOptions, you will get the same error.

Since Node v10.20.1

Searching in https://github.com/nodejs/node/tree/master and the stackTrace: _http_outgoing.js:472

at ClientRequest.setHeader (_http_outgoing.js:472:3)

function setHeader https://github.com/nodejs/node/blob/v10.20.1/lib/_http_outgoing.js#L472

function validateHeaderName https://github.com/nodejs/node/blob/v10.20.1/lib/_http_outgoing.js#L446

function checkIsHttpToken https://github.com/nodejs/node/blob/master/lib/_http_common.js#L210

I founded this:

const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
/**
 * Verifies that the given val is a valid HTTP token
 * per the rules defined in RFC 7230
 * See https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6
 */
function checkIsHttpToken(val) {
  return tokenRegExp.test(val);
}

That regex ensure that header name only has allowed tokens or chars according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6

Maybe a earlier validation in nodejs core could help:

You have a not allowed char in your header name!