问:
Why does the output for this Sequential model constantly changes position everytime I run it back?
So, I'm making a rock paper scissors prediction using multiclass classification, but I have several problems with this code

(1) The data sorting code

```<code>import pandas
import sklearn
from sklearn import datasets
import zipfile
import os
from sklearn.model_selection import train_test_split
!pip install split_folders
import splitfolders
import shutil
import numpy

!wget --no-check-certificate \
  https://github.com/dicodingacademy/assets/releases/download/release/rockpaperscissors.zip \
  -O /tmp/rockpaperscissors.zip

lclzip = "/tmp/rockpaperscissors.zip"
zipref = zipfile.ZipFile(lclzip, "r")
zipref.extractall("/tmp")
zipref.close()

basedir = "/tmp/rockpaperscissors"
shutil.rmtree(os.path.join(basedir, "rps-cv-images"))
os.remove(os.path.join(basedir, "README_rpc-cv-images.txt"))
for dir in os.listdir(basedir):
  os.makedirs(basedir + "/train/" + dir, exist_ok = True)
  os.makedirs(basedir + "/val/" + dir, exist_ok = True)
  all = os.listdir(os.path.join(basedir, dir))
  numpy.random.shuffle(all)
  train, val = numpy.split(numpy.array(all), [int(len(all)*0.6)])
  train = [basedir + "/" + dir + "/" + name for name in train.tolist()]
  val = [basedir + "/" + dir + "/" + name for name in val.tolist()]
  for name in train:
    shutil.copy(name, basedir + "/train/" + dir)
  for name in val:
    shutil.copy(name, basedir + "/val/" + dir)
os.listdir(basedir)
</code>```

(2) The model making code

```<code>import tensorflow
from tensorflow.keras.preprocessing.image import ImageDataGenerator

datagentrain = ImageDataGenerator(
    rescale = 1./255,
    rotation_range = 20,
    horizontal_flip = True,
    shear_range = 0.2,
    fill_mode = "nearest"
)
datagenval = ImageDataGenerator(
    rescale = 1./255
)
traingenerator = datagentrain.flow_from_directory(
    os.path.join(basedir, "train"),
    target_size = (150,150),
    batch_size = 4,
    class_mode = "categorical"
)
valgenerator = datagenval.flow_from_directory(
    os.path.join(basedir, "val"),
    target_size = (150,150),
    batch_size = 4,
    class_mode = "categorical"
)
model = tensorflow.keras.models.Sequential([
    tensorflow.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(150, 150, 3)),
    tensorflow.keras.layers.MaxPooling2D(2, 2),
    tensorflow.keras.layers.Conv2D(64, (3,3), activation='relu'),
    tensorflow.keras.layers.MaxPooling2D(2,2),
    tensorflow.keras.layers.Conv2D(128, (3,3), activation='relu'),
    tensorflow.keras.layers.MaxPooling2D(2,2),
    tensorflow.keras.layers.Conv2D(512, (3,3), activation='relu'),
    tensorflow.keras.layers.MaxPooling2D(2,2),
    tensorflow.keras.layers.Flatten(),
    tensorflow.keras.layers.Dense(512, activation='relu'),
    tensorflow.keras.layers.Dense(3, activation='softmax')
])
model.compile(
    loss='categorical_crossentropy',
    optimizer = 'adam',
    metrics = ["accuracy"]
)
model.fit(
      traingenerator,
      steps_per_epoch=25,
      epochs=40,
      validation_data=valgenerator,
      validation_steps=5,
      verbose=2)
</code>```

(3) The model prediction code

```<code>import numpy as np
from google.colab import files
from tensorflow.keras.preprocessing import image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
%matplotlib inline

uploaded = files.upload()

for fn in uploaded.keys():

  path = fn
  img = image.load_img(path, target_size=(150,150))

  imgplot = plt.imshow(img)
  x = image.img_to_array(img)
  x = np.expand_dims(x, axis=0)
  images = np.vstack([x])

  classes = model.predict(images, batch_size=10)
  print(fn)
  print(classes)
  max = 0
  temp = 0
  for n in range(len(classes[0])):
    if classes[0][n] > max:
      max = classes[0][n]
      temp = n
  if temp == 0:
    print('paper')
  elif temp == 1:
    print('rock')
  elif temp == 2:
    print('scissors')
</code>```

For one, everytime I run it back, the (rock,paper,scissors) position constantly changes, so I can't make the temp position check in (3) consistent

But, even before that, for some reason, the results are sometimes only [[1 0 0]] and nothing else (In other cases, it's [[0 1 0]]). Only when scissors position is at 2 that it has any merit in giving something else.

So, I'm confused in where I'm going wrong:
Is it the scuffed way of seperating the train and val sources in (1), the lack of labelling consistency in (2) (if it is, I have no idea how to label), or this is only natural?

I thought that I used the class_mode wrong since I used sparse prior, so I changed it to categorical. In addition, I tried maybe changing the final Dense layer to 2, but nothing.

I really don't know what to do or even what to change. I would like some insight on this scenario and thank you prior

Body:
So, I'm making a rock paper scissors prediction using multiclass classification, but I have several problems with this code

(1) The data sorting code

import pandas
import sklearn
from sklearn import datasets
import zipfile
import os
from sklearn.model_selection import train_test_split
!pip install split_folders
import splitfolders
import shutil
import numpy

!wget --no-check-certificate \
  https://github.com/dicodingacademy/assets/releases/download/release/rockpaperscissors.zip \
  -O /tmp/rockpaperscissors.zip

lclzip = "/tmp/rockpaperscissors.zip"
zipref = zipfile.ZipFile(lclzip, "r")
zipref.extractall("/tmp")
zipref.close()

basedir = "/tmp/rockpaperscissors"
shutil.rmtree(os.path.join(basedir, "rps-cv-images"))
os.remove(os.path.join(basedir, "README_rpc-cv-images.txt"))
for dir in os.listdir(basedir):
  os.makedirs(basedir + "/train/" + dir, exist_ok = True)
  os.makedirs(basedir + "/val/" + dir, exist_ok = True)
  all = os.listdir(os.path.join(basedir, dir))
  numpy.random.shuffle(all)
  train, val = numpy.split(numpy.array(all), [int(len(all)*0.6)])
  train = [basedir + "/" + dir + "/" + name for name in train.tolist()]
  val = [basedir + "/" + dir + "/" + name for name in val.tolist()]
  for name in train:
    shutil.copy(name, basedir + "/train/" + dir)
  for name in val:
    shutil.copy(name, basedir + "/val/" + dir)
os.listdir(basedir)

(2) The model making code

import tensorflow
from tensorflow.keras.preprocessing.image import ImageDataGenerator

datagentrain = ImageDataGenerator(
    rescale = 1./255,
    rotation_range = 20,
    horizontal_flip = True,
    shear_range = 0.2,
    fill_mode = "nearest"
)
datagenval = ImageDataGenerator(
    rescale = 1./255
)
traingenerator = datagentrain.flow_from_directory(
    os.path.join(basedir, "train"),
    target_size = (150,150),
    batch_size = 4,
    class_mode = "categorical"
)
valgenerator = datagenval.flow_from_directory(
    os.path.join(basedir, "val"),
    target_size = (150,150),
    batch_size = 4,
    class_mode = "categorical"
)
model = tensorflow.keras.models.Sequential([
    tensorflow.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(150, 150, 3)),
    tensorflow.keras.layers.MaxPooling2D(2, 2),
    tensorflow.keras.layers.Conv2D(64, (3,3), activation='relu'),
    tensorflow.keras.layers.MaxPooling2D(2,2),
    tensorflow.keras.layers.Conv2D(128, (3,3), activation='relu'),
    tensorflow.keras.layers.MaxPooling2D(2,2),
    tensorflow.keras.layers.Conv2D(512, (3,3), activation='relu'),
    tensorflow.keras.layers.MaxPooling2D(2,2),
    tensorflow.keras.layers.Flatten(),
    tensorflow.keras.layers.Dense(512, activation='relu'),
    tensorflow.keras.layers.Dense(3, activation='softmax')
])
model.compile(
    loss='categorical_crossentropy',
    optimizer = 'adam',
    metrics = ["accuracy"]
)
model.fit(
      traingenerator,
      steps_per_epoch=25,
      epochs=40,
      validation_data=valgenerator,
      validation_steps=5,
      verbose=2)

(3) The model prediction code

import numpy as np
from google.colab import files
from tensorflow.keras.preprocessing import image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
%matplotlib inline

uploaded = files.upload()

for fn in uploaded.keys():

  path = fn
  img = image.load_img(path, target_size=(150,150))

  imgplot = plt.imshow(img)
  x = image.img_to_array(img)
  x = np.expand_dims(x, axis=0)
  images = np.vstack([x])

  classes = model.predict(images, batch_size=10)
  print(fn)
  print(classes)
  max = 0
  temp = 0
  for n in range(len(classes[0])):
    if classes[0][n] > max:
      max = classes[0][n]
      temp = n
  if temp == 0:
    print('paper')
  elif temp == 1:
    print('rock')
  elif temp == 2:
    print('scissors')

For one, everytime I run it back, the (rock,paper,scissors) position constantly changes, so I can't make the temp position check in (3) consistent

But, even before that, for some reason, the results are sometimes only [[1 0 0]] and nothing else (In other cases, it's [[0 1 0]]). Only when scissors position is at 2 that it has any merit in giving something else.

So, I'm confused in where I'm going wrong:
Is it the scuffed way of seperating the train and val sources in (1), the lack of labelling consistency in (2) (if it is, I have no idea how to label), or this is only natural?

I thought that I used the class_mode wrong since I used sparse prior, so I changed it to categorical. In addition, I tried maybe changing the final Dense layer to 2, but nothing.

I really don't know what to do or even what to change. I would like some insight on this scenario and thank you prior


来源: stackexchange

问:
401 Unauthorized while resolving gradle dependencies
Suddenly I have started getting the below error.

```<code>> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.apache.xerces:xercesImpl:2.9.1.
     Required by:
         project : > io.spring.gradle:docbook-reference-plugin:0.3.1
      > Could not resolve org.apache.xerces:xercesImpl:2.9.1.
         > Could not get resource 'https://repo.spring.io/plugins-release/org/apache/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom'.
            > Could not GET 'https://repo.spring.io/plugins-release/org/apache/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom'. Received status code 401 from server: Unauthorized
   > Could not resolve org.apache.xerces:resolver:2.9.1.
     Required by:
         project : > io.spring.gradle:docbook-reference-plugin:0.3.1
      > Could not resolve org.apache.xerces:resolver:2.9.1.
         > Could not get resource 'https://repo.spring.io/plugins-release/org/apache/xerces/resolver/2.9.1/resolver-2.9.1.pom'.
            > Could not GET 'https://repo.spring.io/plugins-release/org/apache/xerces/resolver/2.9.1/resolver-2.9.1.pom'. Received status code 401 from server: Unauthorized
</code>```

It was working fine but from past few days it's happening.

below is the build.gradle file config.

```<code>buildscript {

repositories {
    mavenCentral()
    jcenter()
    // add spring repo for the docbook plugin
    maven {url 'https://repo.spring.io/plugins-release/'}

    flatDir {
        dirs. 'libs'
    }
}

dependencies {
    // Use the Spring docbook plugin to generate the help files
    classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'

    // import asciidoctor plugin
    classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15'
}
}
</code>```

I have googled it a lot but did not the actual cause for this error. As I checked the maven url(https://repo.spring.io/plugins-release/) for Docbook plugin is still the same as mentioned here

https://mvnrepository.com/artifact/io.spring.gradle/docbook-reference-plugin/0.3.1

Even when I try to open the maven url https://repo.spring.io/plugins-release in browser, it's asking for user/password.

ContentLicense: CC BY-SA 4.0

Body:
Suddenly I have started getting the below error.

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.apache.xerces:xercesImpl:2.9.1.
     Required by:
         project : > io.spring.gradle:docbook-reference-plugin:0.3.1
      > Could not resolve org.apache.xerces:xercesImpl:2.9.1.
         > Could not get resource 'https://repo.spring.io/plugins-release/org/apache/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom'.
            > Could not GET 'https://repo.spring.io/plugins-release/org/apache/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom'. Received status code 401 from server: Unauthorized
   > Could not resolve org.apache.xerces:resolver:2.9.1.
     Required by:
         project : > io.spring.gradle:docbook-reference-plugin:0.3.1
      > Could not resolve org.apache.xerces:resolver:2.9.1.
         > Could not get resource 'https://repo.spring.io/plugins-release/org/apache/xerces/resolver/2.9.1/resolver-2.9.1.pom'.
            > Could not GET 'https://repo.spring.io/plugins-release/org/apache/xerces/resolver/2.9.1/resolver-2.9.1.pom'. Received status code 401 from server: Unauthorized

It was working fine but from past few days it's happening.

below is the build.gradle file config.

buildscript {

repositories {
    mavenCentral()
    jcenter()
    // add spring repo for the docbook plugin
    maven {url 'https://repo.spring.io/plugins-release/'}

    flatDir {
        dirs. 'libs'
    }
}

dependencies {
    // Use the Spring docbook plugin to generate the help files
    classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'

    // import asciidoctor plugin
    classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15'
}
}

I have googled it a lot but did not the actual cause for this error. As I checked the maven url(https://repo.spring.io/plugins-release/) for Docbook plugin is still the same as mentioned here

https://mvnrepository.com/artifact/io.spring.gradle/docbook-reference-plugin/0.3.1

Even when I try to open the maven url https://repo.spring.io/plugins-release in browser, it's asking for user/password.


问:
lift in c5.0 rules -what is lift?
can someone assist in explain what is the lift i.e
Rule 1: (2554/165, lift 1.3)
Contract in {One year, Two year}
->  class No  [0.935]

what is the 1.3 in the lift

Title: lift in c5.0 rules -what is lift?


问:
Add time to Rails ActiveJob log lines
By default the Rails ActiveJob log does not have a timestamp on each log line. For example:

[ActiveJob] Enqueued FixtureJob (Job ID: 8405a963-312b-45dd-923f-5e6868a85a48) to Async(views) with arguments: #<GlobalID:0x00007fee44a7fe60 @uri=#<URI::GID gid://listings/Fixture/14565>>

I would like to include the timestamp on each line. For example:

[2022-10-19T09:04:31.556088+01:00] [ActiveJob] Enqueued FixtureJob (Job ID: 8405a963-312b-45dd-923f-5e6868a85a48) to Async(views) with arguments: #<GlobalID:0x00007fee44a7fe60 @uri=#<URI::GID gid://listings/Fixture/14565>>

I know that I can add tags using push_tags, like below, but how to add a timestamp tag?

```<code># config/application.rb
class Application < Rails::Application
  config.active_job.logger.push_tags('A useful tag')
end
</code>```

Title: Add time to Rails ActiveJob log lines

Body:
By default the Rails ActiveJob log does not have a timestamp on each log line. For example:

[ActiveJob] Enqueued FixtureJob (Job ID: 8405a963-312b-45dd-923f-5e6868a85a48) to Async(views) with arguments: #<GlobalID:0x00007fee44a7fe60 @uri=#<URI::GID gid://listings/Fixture/14565>>

I would like to include the timestamp on each line. For example:

[2022-10-19T09:04:31.556088+01:00] [ActiveJob] Enqueued FixtureJob (Job ID: 8405a963-312b-45dd-923f-5e6868a85a48) to Async(views) with arguments: #<GlobalID:0x00007fee44a7fe60 @uri=#<URI::GID gid://listings/Fixture/14565>>

I know that I can add tags using push_tags, like below, but how to add a timestamp tag?

# config/application.rb
class Application < Rails::Application
  config.active_job.logger.push_tags('A useful tag')
end


问:
I want to publish add-on on google workspace marketplace But i was rejected for the following reasons - Menu options not shown after App is installed
I want to publish add-on on google workspace marketplace But I was rejected for the following reasons:

Menu - Menu options not shown after App is installed. Please ensure that the add-on correctly uses onInstall() and onOpen() to populate its menu.

Here's some code of my Code.gs file

```<code>function onInstall(e){
  onOpen(e);
}

function onOpen(e) {
  SpreadsheetApp.getUi().createAddonMenu()
 .addItem("Open Connector", "openMethodPage")
 .addItem("Authorize", "launchAuthorizationDialog")
 .addItem("DisConnect", "deleteUserProperties")
 .addToUi();
 }
</code>```

and here appscript.json

```<code>{
 "timeZone": "Asia/Seoul",
 "dependencies": {},
 "exceptionLogging": "STACKDRIVER",
 "runtimeVersion": "V8",
 "oauthScopes": [
   "https://www.googleapis.com/auth/userinfo.profile",
   "https://www.googleapis.com/auth/userinfo.email",
   "https://www.googleapis.com/auth/script.container.ui",
   "https://www.googleapis.com/auth/script.external_request",
   "https://www.googleapis.com/auth/spreadsheets"
  ]
}
</code>```

I look forward to your help. Thank you.

Body:
I want to publish add-on on google workspace marketplace But I was rejected for the following reasons:

Menu - Menu options not shown after App is installed. Please ensure that the add-on correctly uses onInstall() and onOpen() to populate its menu.

Here's some code of my Code.gs file

function onInstall(e){
  onOpen(e);
}

function onOpen(e) {
  SpreadsheetApp.getUi().createAddonMenu()
 .addItem("Open Connector", "openMethodPage")
 .addItem("Authorize", "launchAuthorizationDialog")
 .addItem("DisConnect", "deleteUserProperties")
 .addToUi();
 }

and here appscript.json

{
 "timeZone": "Asia/Seoul",
 "dependencies": {},
 "exceptionLogging": "STACKDRIVER",
 "runtimeVersion": "V8",
 "oauthScopes": [
   "https://www.googleapis.com/auth/userinfo.profile",
   "https://www.googleapis.com/auth/userinfo.email",
   "https://www.googleapis.com/auth/script.container.ui",
   "https://www.googleapis.com/auth/script.external_request",
   "https://www.googleapis.com/auth/spreadsheets"
  ]
}

I look forward to your help. Thank you.


问:
How to dump decoded frames from a mp4 file
I was working with a android project in which it captures live feed from a cam and saves it as a mp4 file. My target is to to decode this mp4 video file using media-codecs ( android internal software decoder) and dump this raw data. Using the CameraX api, i was able to save the mp4 file to storage. I wasn't able to load the recorded video file to media codecs for decoding.
I won't be able to use any modules like opencv, ffmpeg.

Any help is appreciated.

I have no idea how to load file data to decoder. All the tutorials are loading it from surface textures.


问:
How to migrate to tinymce from cleditor
Hi I have a old application that uses cleditor now I need to update jquery but cleditor uses a function that isnt in modern version of jquery (Note I'm a total beginner in javascript, so sorry if this is a basic question)

So I was thinking to use selfhosted version of timymce

The first line is how it is today

```<code>this.ui.$emailBody.cleditor({ width: "100%" })[0].refresh();
</code>```

But I can't just replace cleditor with Tinymce in the line above, that doesn't work it gives me the following error:
Uncaught TypeError: ref.ui.$emailBody.Tinymce is not a function

Whare do I go from here?

Title: How to migrate to tinymce from cleditor

Body:
Hi I have a old application that uses cleditor now I need to update jquery but cleditor uses a function that isnt in modern version of jquery (Note I'm a total beginner in javascript, so sorry if this is a basic question)

So I was thinking to use selfhosted version of timymce

The first line is how it is today

this.ui.$emailBody.cleditor({ width: "100%" })[0].refresh();

But I can't just replace cleditor with Tinymce in the line above, that doesn't work it gives me the following error:
Uncaught TypeError: ref.ui.$emailBody.Tinymce is not a function

Whare do I go from here?


问:
python on raspberry pi 3b+: "no module named requests", despite the module being installed
first of all - I'm a newbie when it comes to Linux stuff. I follow commands and try to look up problems that I encounter along the way. I tried the same approach with this issue, but nothing has worked so far.

I'm trying to install a program on a fresh install of Raspberry Pi OS (version 11 Bullseye) on a Raspberry Pi 3b+. I'm not sure I can link the github page of the program here, but it's an application that's written mostly in Python. I have already installed that application successfully on a laptop running an Arch based distro. There were no such problems there.

I follow install instructions, I download dependencies, I create a virtualenv, activate it, download stuff from requirements.txt and then try to run the program.
Here's where the issue occurs:

```<code>Traceback (most recent call last):
  File "app.py", line 4, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
</code>```

So I try to install requests with

```<code>sudo pip install requests
</code>```

(while still being in the virtualenv):

```<code>(venv) pi@pimusic:~ $ sudo pip install requests
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (2.28.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests) (2.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests) (1.24.3)
Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.9/dist-packages (from requests) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests) (2020.6.20)

</code>```

So requests is already there, but is not recognized, somehow.
I have tried:

uninstalling requests from within venv and installing it again

uninstalling requests from outside venv and trying to install it from inside venv

uninstalling requests from outside venv and installing it again

removing everything with "requests" in the filename from /usr/loval/lib/python3.9/dist-packages and installing requests back from inside venv and from outside venv

none of these things worked. I'm stumped, what do I do?

Body:
first of all - I'm a newbie when it comes to Linux stuff. I follow commands and try to look up problems that I encounter along the way. I tried the same approach with this issue, but nothing has worked so far.

I'm trying to install a program on a fresh install of Raspberry Pi OS (version 11 Bullseye) on a Raspberry Pi 3b+. I'm not sure I can link the github page of the program here, but it's an application that's written mostly in Python. I have already installed that application successfully on a laptop running an Arch based distro. There were no such problems there.

I follow install instructions, I download dependencies, I create a virtualenv, activate it, download stuff from requirements.txt and then try to run the program.
Here's where the issue occurs:

Traceback (most recent call last):
  File "app.py", line 4, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

So I try to install requests with

sudo pip install requests

(while still being in the virtualenv):

(venv) pi@pimusic:~ $ sudo pip install requests
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (2.28.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests) (2.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests) (1.24.3)
Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.9/dist-packages (from requests) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests) (2020.6.20)

So requests is already there, but is not recognized, somehow.
I have tried:

uninstalling requests from within venv and installing it again

uninstalling requests from outside venv and trying to install it from inside venv

uninstalling requests from outside venv and installing it again

removing everything with "requests" in the filename from /usr/loval/lib/python3.9/dist-packages and installing requests back from inside venv and from outside venv

none of these things worked. I'm stumped, what do I do?


问:
Error org.hibernate.PropertyValueException: not-null property references a null or transient value : com.example.pgfinder.models.User.password
I encountered this error when I tried to submit my form. React form is being used to submit the details.

User.java

```<code>package com.example.pgfinder.models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")
public class User
{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long user_id;

    @Column(nullable= false)
    private String user_name;

    @Column(nullable= false)
    private String password;

    @Column(nullable= false)
    private String user_firstName;

    @Column(nullable= false)
    private String user_lastName;

    @Column(nullable= false)
    private String user_email;

    @Column(nullable= false)
    private String user_phone_no;

    public User() {
        super();
    }

    public User(String user_name, String password, String user_firstName, String user_lastName, String user_email,
            String user_phone_no) {
        super();
        this.user_name = user_name;
        this.password = password;
        this.user_firstName = user_firstName;
        this.user_lastName = user_lastName;
        this.user_email = user_email;
        this.user_phone_no = user_phone_no;
    }

    public long getUser_id() {
        return user_id;
    }
    public void setUser_id(long user_id) {
        this.user_id = user_id;
    }
    public String getUser_name() {
        return user_name;
    }
    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getUser_firstName() {
        return user_firstName;
    }
    public void setUser_firstName(String user_firstName) {
        this.user_firstName = user_firstName;
    }
    public String getUser_lastName() {
        return user_lastName;
    }
    public void setUser_lastName(String user_lastName) {
        this.user_lastName = user_lastName;
    }
    public String getUser_email() {
        return user_email;
    }
    public void setUser_email(String user_email) {
        this.user_email = user_email;
    }
    public String getUser_phone_no() {
        return user_phone_no;
    }
    public void setUser_phone_no(String user_phone_no) {
        this.user_phone_no = user_phone_no;
    }
}

</code>```

Here is the controller file
UserController.java

```<code>package com.example.pgfinder.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.pgfinder.models.repository.UserRepository;
import com.example.pgfinder.models.User;

@CrossOrigin(origins = "http://localhost:3000/")
@RestController
@RequestMapping("/api/v1/")
public class UserController
{
    @Autowired
    private UserRepository userRepository;

    //get all user
    @GetMapping("/user")
    public List<User> getAllUserDetails(){
        return userRepository.findAll();
    }

    //create the user
    @PostMapping("/user")
    public User createUser(@RequestBody User user)
    {
        return userRepository.save(user);
    }
}

</code>```

And the UserRepository.java

```<code>package com.example.pgfinder.models.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import com.example.pgfinder.models.PGDetails;

@Repository
public interface PGDetailsRepository extends JpaRepository<PGDetails,Long>{

}

</code>```

The form looks like this
SignUp.js

import React, { useEffect, useRef, useState } from "react";
import { FiMapPin } from 'react-icons/fi';
import { faCheck, faTimes, faInfoCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Navbar from "./Navbar";
import './signup.css';
import Footer from "./Footer";
import { useNavigate } from "react-router-dom";
import UserService from "../services/UserService";

const SignUp = () => {

    const USER_REGEX = /^[A-z][A-z0-9-_]{3,23}$/;
    const PWD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%]).{8,24}$/;
    const EMAIL_REGEX = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    const PHONE_REGEX = /^[0-9]{10}$/;

    const userRef = useRef(); //will set the focus on the user input when the component loads
    const errRef = useRef(); //this is for error reference

    const [user_name, setUser] = useState(''); //for the user name field
    const [validName, setValidName] = useState(false); //for setting validations in user name field
    const [userFocus, setUserFocus] = useState(false); //for checking if the focus is on user name field or not

    const [pwd, setPwd] = useState('');
    const [validPwd, setValidPwd] = useState(false);
    const [pwdFocus, setPwdFocus] = useState(false);

    const [matchPwd, setMatchPwd] = useState('');
    const [validMatch, setValidMatch] = useState(false);
    const [matchFocus, setMatchFocus] = useState(false);

    const [phone, setPhone] = useState('');
    const [validPhone, setValidPhone] = useState(false);
    const [phoneFocus, setPhoneFocus] = useState(false);

    const [email, setEmail] = useState('');
    const [validEmail, setValidEmail] = useState(false);
    const [emailFocus, setEmailFocus] = useState(false);

    const [fname, setFName] = useState('');
    const [fnameFocus, setFNameFocus] = useState(false);

    const [lname, setLName] = useState('');
    const [lnameFocus, setLNameFocus] = useState(false);

    const [errMsg, setErrMsg] = useState('');

    const navigate = useNavigate();

    useEffect(() => {
        userRef.current.focus();

    }, [])

    useEffect(() => {
        const result = USER_REGEX.test(user_name);
        console.log(result);
        console.log(user_name);
        setValidName(result);
    }, [user_name])

    useEffect(() => {
        const result = PHONE_REGEX.test(phone);
        console.log(result);
        console.log(phone);
        setValidPhone(result);
    }, [phone])

    useEffect(() => {
        const result = PWD_REGEX.test(pwd);
        console.log(result);
        console.log(pwd);
        setValidPwd(result);
        const match = pwd === matchPwd;
        setValidMatch(match);
    }, [pwd, matchPwd])

    useEffect(() => {
        const result = EMAIL_REGEX.test(email);
        console.log(result);
        console.log(email);
        setValidEmail(result);
    }, [email])

    useEffect(() => {
        setErrMsg('');
    }, [user_name, pwd, matchPwd, email])

    const saveUser = (e) =>{
        e.preventDefault();
        const userDetails = {user_name, pwd, phone, email, fname, lname};
        UserService.createUser(userDetails).then((response) =>{
            console.log(response.data);

        }).catch(error => {
            console.log(error);
        })

    }

    return (
        <>
            <Navbar />

 Hello, Friend!

 Fill up personal information and start the

                journey of finding PG

                <button className="btn-pgsearch">Search PG <FiMapPin/></button>

{errMsg}

Create Account

                <form>
                    {/*Username*/}

                        Username:

                            <FontAwesomeIcon icon={faCheck} />

                            <FontAwesomeIcon icon={faTimes} />

                    <input
                        text="text"
                        id="username"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        className="input-field"
                        onChange={(e) => setUser(e.target.value)}    /*Set to true when the input loads */
                        value={user_name}
                        required
                        aria-invalid={validName ? "false" : "true"}  /*Like when you start tying in that field it shows the required or the validation nire and then once you enter the valid name or you satisfy the given it will be removed*/
                        aria-describedby="uidnote"
                        onFocus={() => setUserFocus(true)}
                        onBlur={() => setUserFocus(false)}
                    />

 {/* if the focus is on userinput field and if user field is not empty and if all the validation are match */}
                        <FontAwesomeIcon icon={faInfoCircle} />
                        4 to 24 characters.

                        Must begin with a letter.

                        Letters, numbers, underscores, hyphens allowed.

                    {/*Password */}

                        Password:
                        <FontAwesomeIcon icon={faCheck} className={validPwd ? "valid" : "hide"} />
                        <FontAwesomeIcon icon={faTimes} className={validPwd || !pwd ? "hide" : "invalid"} />

                    <input
                        type="password"
                        id="password"
                        onChange={(e) => setPwd(e.target.value)}
                        className="input-field"
                        value={pwd}
                        required
                        aria-invalid={validPwd ? "false" : "true"}
                        aria-describedby="pwdnote"
                        onFocus={() => setPwdFocus(true)}
                        onBlur={() => setPwdFocus(false)}
                    />

                        <FontAwesomeIcon icon={faInfoCircle} />
                        8 to 24 characters.

                        Must include uppercase and lowercase letters, a number and a special character.

                        Allowed special characters: ! @
                        # $ %

                        Confirm Password:
                        <FontAwesomeIcon icon={faCheck} className={validMatch && matchPwd ? "valid" : "hide"} />
                        <FontAwesomeIcon icon={faTimes} className={validMatch || !matchPwd ? "hide" : "invalid"} />

                    <input
                        type="password"
                        id="confirm_pwd"
                        onChange={(e) => setMatchPwd(e.target.value)}
                        value={matchPwd}
                        className="input-field"
                        required
                        aria-invalid={validMatch ? "false" : "true"}
                        aria-describedby="confirmnote"
                        onFocus={() => setMatchFocus(true)}
                        onBlur={() => setMatchFocus(false)}
                    />

                        <FontAwesomeIcon icon={faInfoCircle} />
                        Must match the first password input field.

                    {/*First Name */}

                        First Name:

                    <input
                        text="text"
                        id="fname"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        onChange={(e) => setFName(e.target.value)}    /*Set to true when the input loads */
                        className="input-field"
                        value={fname}
                        required
                        onFocus={() => setFNameFocus(true)}
                        onBlur={() => setFNameFocus(false)}
                    />

                    {/*Last Name */}

                        Last Name:

                    <input
                        text="text"
                        id="lname"
                        ref={userRef}    /*Set focus on the input*/
                        className="input-field"
                        autoComplete="off"
                        onChange={(e) => setLName(e.target.value)}    /*Set to true when the input loads */
                        value={lname}
                        required
                        onFocus={() => setLNameFocus(true)}
                        onBlur={() => setLNameFocus(false)}
                    />

                    {/*Email*/}

                        Email Address:

                            <FontAwesomeIcon icon={faCheck} />

                            <FontAwesomeIcon icon={faTimes} />

                    <input
                        text="email"
                        id="email"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        onChange={(e) => setEmail(e.target.value)}    /*Set to true when the input loads */
                        className="input-field"
                        value={email}
                        required
                        aria-invalid={validEmail ? "false" : "true"}  /*Like when you start tying in that field it shows the required or the validation nire and then once you enter the valid name or you satisfy the given it will be removed*/
                        aria-describedby="eidnote"
                        onFocus={() => setEmailFocus(true)}
                        onBlur={() => setEmailFocus(false)}
                    />

 {/* if the focus is on userinput field and if user field is not empty and if all the validation are match */}
                        <FontAwesomeIcon icon={faInfoCircle} />
                        valid email.

                        Must have @ symbol.

                        Letters, numbers, hyphens allowed.

                    {/*Phone Number */}

                        Phone Number:

                            <FontAwesomeIcon icon={faCheck} />

                            <FontAwesomeIcon icon={faTimes} />

                    <input
                        text="text"
                        id="phone"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        onChange={(e) => setPhone(e.target.value)}    /*Set to true when the input loads */
                        className="input-field"
                        value={phone}
                        required
                        maxLength={10}
                        aria-invalid={validPhone ? "false" : "true"}  /*Like when you start tying in that field it shows the required or the validation nire and then once you enter the valid name or you satisfy the given it will be removed*/
                        aria-describedby="pidnote"
                        onFocus={() => setPhoneFocus(true)}
                        onBlur={() => setPhoneFocus(false)}
                    />

 {/* if the focus is on userinput field and if user field is not empty and if all the validation are match */}
                        <FontAwesomeIcon icon={faInfoCircle} />
                        Contains number only.

                        Maximum length is 10.

                    <button className="btn-signup-s" onClick={(e) => saveUser(e)} disabled={!validName || !validPwd || !validMatch || !validEmail || !validPhone ? true : false}>
                        Sign Up
                    </button>
                </form>

                    Already registered?

                        Sign In

        </>
    )

}

export default SignUp
```
<p>UserService.js</p>
```import axios from 'axios';
const USER_API_BASE_URL="http://localhost:8090/api/v1/user";

class UserService{

    getUserInfo(){
        return axios.get(USER_API_BASE_URL);
    }

    createUser(user)
    {
        return axios.post(USER_API_BASE_URL, user);
    }
}
export default new UserService();
```

Whenever I pass details on the console, they are printed. Please guide me why am I still getting null entry error in password field.

Console Pic

Thank you.

Body:
I encountered this error when I tried to submit my form. React form is being used to submit the details.

User.java

package com.example.pgfinder.models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")
public class User
{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long user_id;

    @Column(nullable= false)
    private String user_name;

    @Column(nullable= false)
    private String password;

    @Column(nullable= false)
    private String user_firstName;

    @Column(nullable= false)
    private String user_lastName;

    @Column(nullable= false)
    private String user_email;

    @Column(nullable= false)
    private String user_phone_no;

    public User() {
        super();
    }

    public User(String user_name, String password, String user_firstName, String user_lastName, String user_email,
            String user_phone_no) {
        super();
        this.user_name = user_name;
        this.password = password;
        this.user_firstName = user_firstName;
        this.user_lastName = user_lastName;
        this.user_email = user_email;
        this.user_phone_no = user_phone_no;
    }

    public long getUser_id() {
        return user_id;
    }
    public void setUser_id(long user_id) {
        this.user_id = user_id;
    }
    public String getUser_name() {
        return user_name;
    }
    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getUser_firstName() {
        return user_firstName;
    }
    public void setUser_firstName(String user_firstName) {
        this.user_firstName = user_firstName;
    }
    public String getUser_lastName() {
        return user_lastName;
    }
    public void setUser_lastName(String user_lastName) {
        this.user_lastName = user_lastName;
    }
    public String getUser_email() {
        return user_email;
    }
    public void setUser_email(String user_email) {
        this.user_email = user_email;
    }
    public String getUser_phone_no() {
        return user_phone_no;
    }
    public void setUser_phone_no(String user_phone_no) {
        this.user_phone_no = user_phone_no;
    }
}

Here is the controller file
UserController.java

package com.example.pgfinder.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.pgfinder.models.repository.UserRepository;
import com.example.pgfinder.models.User;

@CrossOrigin(origins = "http://localhost:3000/")
@RestController
@RequestMapping("/api/v1/")
public class UserController
{
    @Autowired
    private UserRepository userRepository;

    //get all user
    @GetMapping("/user")
    public List<User> getAllUserDetails(){
        return userRepository.findAll();
    }

    //create the user
    @PostMapping("/user")
    public User createUser(@RequestBody User user)
    {
        return userRepository.save(user);
    }
}

And the UserRepository.java

package com.example.pgfinder.models.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import com.example.pgfinder.models.PGDetails;

@Repository
public interface PGDetailsRepository extends JpaRepository<PGDetails,Long>{

}

The form looks like this
SignUp.js

import React, { useEffect, useRef, useState } from "react";
import { FiMapPin } from 'react-icons/fi';
import { faCheck, faTimes, faInfoCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Navbar from "./Navbar";
import './signup.css';
import Footer from "./Footer";
import { useNavigate } from "react-router-dom";
import UserService from "../services/UserService";

const SignUp = () => {

    const USER_REGEX = /^[A-z][A-z0-9-_]{3,23}$/;
    const PWD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%]).{8,24}$/;
    const EMAIL_REGEX = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    const PHONE_REGEX = /^[0-9]{10}$/;

    const userRef = useRef(); //will set the focus on the user input when the component loads
    const errRef = useRef(); //this is for error reference

    const [user_name, setUser] = useState(''); //for the user name field
    const [validName, setValidName] = useState(false); //for setting validations in user name field
    const [userFocus, setUserFocus] = useState(false); //for checking if the focus is on user name field or not

    const [pwd, setPwd] = useState('');
    const [validPwd, setValidPwd] = useState(false);
    const [pwdFocus, setPwdFocus] = useState(false);

    const [matchPwd, setMatchPwd] = useState('');
    const [validMatch, setValidMatch] = useState(false);
    const [matchFocus, setMatchFocus] = useState(false);

    const [phone, setPhone] = useState('');
    const [validPhone, setValidPhone] = useState(false);
    const [phoneFocus, setPhoneFocus] = useState(false);

    const [email, setEmail] = useState('');
    const [validEmail, setValidEmail] = useState(false);
    const [emailFocus, setEmailFocus] = useState(false);

    const [fname, setFName] = useState('');
    const [fnameFocus, setFNameFocus] = useState(false);

    const [lname, setLName] = useState('');
    const [lnameFocus, setLNameFocus] = useState(false);

    const [errMsg, setErrMsg] = useState('');

    const navigate = useNavigate();

    useEffect(() => {
        userRef.current.focus();

    }, [])

    useEffect(() => {
        const result = USER_REGEX.test(user_name);
        console.log(result);
        console.log(user_name);
        setValidName(result);
    }, [user_name])

    useEffect(() => {
        const result = PHONE_REGEX.test(phone);
        console.log(result);
        console.log(phone);
        setValidPhone(result);
    }, [phone])

    useEffect(() => {
        const result = PWD_REGEX.test(pwd);
        console.log(result);
        console.log(pwd);
        setValidPwd(result);
        const match = pwd === matchPwd;
        setValidMatch(match);
    }, [pwd, matchPwd])

    useEffect(() => {
        const result = EMAIL_REGEX.test(email);
        console.log(result);
        console.log(email);
        setValidEmail(result);
    }, [email])

    useEffect(() => {
        setErrMsg('');
    }, [user_name, pwd, matchPwd, email])

    const saveUser = (e) =>{
        e.preventDefault();
        const userDetails = {user_name, pwd, phone, email, fname, lname};
        UserService.createUser(userDetails).then((response) =>{
            console.log(response.data);

        }).catch(error => {
            console.log(error);
        })

    }

    return (
        <>
            <Navbar />

 Hello, Friend!

 Fill up personal information and start the

                journey of finding PG

                <button className="btn-pgsearch">Search PG <FiMapPin/></button>

{errMsg}

Create Account

                <form>
                    {/*Username*/}

                        Username:

                            <FontAwesomeIcon icon={faCheck} />

                            <FontAwesomeIcon icon={faTimes} />

                    <input
                        text="text"
                        id="username"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        className="input-field"
                        onChange={(e) => setUser(e.target.value)}    /*Set to true when the input loads */
                        value={user_name}
                        required
                        aria-invalid={validName ? "false" : "true"}  /*Like when you start tying in that field it shows the required or the validation nire and then once you enter the valid name or you satisfy the given it will be removed*/
                        aria-describedby="uidnote"
                        onFocus={() => setUserFocus(true)}
                        onBlur={() => setUserFocus(false)}
                    />

 {/* if the focus is on userinput field and if user field is not empty and if all the validation are match */}
                        <FontAwesomeIcon icon={faInfoCircle} />
                        4 to 24 characters.

                        Must begin with a letter.

                        Letters, numbers, underscores, hyphens allowed.

                    {/*Password */}

                        Password:
                        <FontAwesomeIcon icon={faCheck} className={validPwd ? "valid" : "hide"} />
                        <FontAwesomeIcon icon={faTimes} className={validPwd || !pwd ? "hide" : "invalid"} />

                    <input
                        type="password"
                        id="password"
                        onChange={(e) => setPwd(e.target.value)}
                        className="input-field"
                        value={pwd}
                        required
                        aria-invalid={validPwd ? "false" : "true"}
                        aria-describedby="pwdnote"
                        onFocus={() => setPwdFocus(true)}
                        onBlur={() => setPwdFocus(false)}
                    />

                        <FontAwesomeIcon icon={faInfoCircle} />
                        8 to 24 characters.

                        Must include uppercase and lowercase letters, a number and a special character.

                        Allowed special characters: ! @
                        # $ %

                        Confirm Password:
                        <FontAwesomeIcon icon={faCheck} className={validMatch && matchPwd ? "valid" : "hide"} />
                        <FontAwesomeIcon icon={faTimes} className={validMatch || !matchPwd ? "hide" : "invalid"} />

                    <input
                        type="password"
                        id="confirm_pwd"
                        onChange={(e) => setMatchPwd(e.target.value)}
                        value={matchPwd}
                        className="input-field"
                        required
                        aria-invalid={validMatch ? "false" : "true"}
                        aria-describedby="confirmnote"
                        onFocus={() => setMatchFocus(true)}
                        onBlur={() => setMatchFocus(false)}
                    />

                        <FontAwesomeIcon icon={faInfoCircle} />
                        Must match the first password input field.

                    {/*First Name */}

                        First Name:

                    <input
                        text="text"
                        id="fname"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        onChange={(e) => setFName(e.target.value)}    /*Set to true when the input loads */
                        className="input-field"
                        value={fname}
                        required
                        onFocus={() => setFNameFocus(true)}
                        onBlur={() => setFNameFocus(false)}
                    />

                    {/*Last Name */}

                        Last Name:

                    <input
                        text="text"
                        id="lname"
                        ref={userRef}    /*Set focus on the input*/
                        className="input-field"
                        autoComplete="off"
                        onChange={(e) => setLName(e.target.value)}    /*Set to true when the input loads */
                        value={lname}
                        required
                        onFocus={() => setLNameFocus(true)}
                        onBlur={() => setLNameFocus(false)}
                    />

                    {/*Email*/}

                        Email Address:

                            <FontAwesomeIcon icon={faCheck} />

                            <FontAwesomeIcon icon={faTimes} />

                    <input
                        text="email"
                        id="email"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        onChange={(e) => setEmail(e.target.value)}    /*Set to true when the input loads */
                        className="input-field"
                        value={email}
                        required
                        aria-invalid={validEmail ? "false" : "true"}  /*Like when you start tying in that field it shows the required or the validation nire and then once you enter the valid name or you satisfy the given it will be removed*/
                        aria-describedby="eidnote"
                        onFocus={() => setEmailFocus(true)}
                        onBlur={() => setEmailFocus(false)}
                    />

 {/* if the focus is on userinput field and if user field is not empty and if all the validation are match */}
                        <FontAwesomeIcon icon={faInfoCircle} />
                        valid email.

                        Must have @ symbol.

                        Letters, numbers, hyphens allowed.

                    {/*Phone Number */}

                        Phone Number:

                            <FontAwesomeIcon icon={faCheck} />

                            <FontAwesomeIcon icon={faTimes} />

                    <input
                        text="text"
                        id="phone"
                        ref={userRef}    /*Set focus on the input*/
                        autoComplete="off"
                        onChange={(e) => setPhone(e.target.value)}    /*Set to true when the input loads */
                        className="input-field"
                        value={phone}
                        required
                        maxLength={10}
                        aria-invalid={validPhone ? "false" : "true"}  /*Like when you start tying in that field it shows the required or the validation nire and then once you enter the valid name or you satisfy the given it will be removed*/
                        aria-describedby="pidnote"
                        onFocus={() => setPhoneFocus(true)}
                        onBlur={() => setPhoneFocus(false)}
                    />

 {/* if the focus is on userinput field and if user field is not empty and if all the validation are match */}
                        <FontAwesomeIcon icon={faInfoCircle} />
                        Contains number only.

                        Maximum length is 10.

                    <button className="btn-signup-s" onClick={(e) => saveUser(e)} disabled={!validName || !validPwd || !validMatch || !validEmail || !validPhone ? true : false}>
                        Sign Up
                    </button>
                </form>

                    Already registered?

                        Sign In

        </>
    )

}

export default SignUp

UserService.js

import axios from 'axios';
const USER_API_BASE_URL="http://localhost:8090/api/v1/user";

class UserService{

    getUserInfo(){
        return axios.get(USER_API_BASE_URL);
    }

    createUser(user)
    {
        return axios.post(USER_API_BASE_URL, user);
    }
}
export default new UserService();

Whenever I pass details on the console, they are printed. Please guide me why am I still getting null entry error in password field.

Console Pic

Thank you.


问:
How to run Broken DAGS in Airflow?
I am using Ubuntu to run Airflow DAGS on windows 10. I am able to only see the examples DAGS, and not the custom ones, because they are using Python eternal

```<code>Broken DAG: [/mnt/d/projects/pipeline/pipeline-v1/dags/prepare_data.py] Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/d/projects/pipeline/pipeline-v1/dags/prepare_data.py", line 12, in <module>
    from astro.files import File
ModuleNotFoundError: No module named 'astro'

 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/d/projects/dg-fcpq-data-pipeline-v2/dg-fcpq-data-pipeline-v2/dags/prepare_data.py", line 6, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'
</code>```

I have given the path of airflow.cfg file in the dags_folder variable to point to the project's path but I am not able to make the DAGS run.
How can I install the Python dependencies so that the DAGS could run? The project has a virtual environment where all the dependencies are installed, but I don't know how to link that to the Airflow webserver start.

Title: How to run Broken DAGS in Airflow?

Body:
I am using Ubuntu to run Airflow DAGS on windows 10. I am able to only see the examples DAGS, and not the custom ones, because they are using Python eternal

Broken DAG: [/mnt/d/projects/pipeline/pipeline-v1/dags/prepare_data.py] Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/d/projects/pipeline/pipeline-v1/dags/prepare_data.py", line 12, in <module>
    from astro.files import File
ModuleNotFoundError: No module named 'astro'

 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/d/projects/dg-fcpq-data-pipeline-v2/dg-fcpq-data-pipeline-v2/dags/prepare_data.py", line 6, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

I have given the path of airflow.cfg file in the dags_folder variable to point to the project's path but I am not able to make the DAGS run.
How can I install the Python dependencies so that the DAGS could run? The project has a virtual environment where all the dependencies are installed, but I don't know how to link that to the Airflow webserver start.


问:
Spring boot modify content-type header in actuator endpoint response
I have a spring boot application that returns content-type as application/json in response headers but in spring-boot admin it requires content-type as application/vnd.spring-boot.actuator.v2 in response header. Due to this the data is not shown on spring-boot admin UI. I have tried many different ways but nothing seems to work. Is there any way I can override this header in my application ?</p>


问:
Can I make changes in manage.py?
I am doing a django project where I want my manage.py to run the server automatically(python manage.py runserver command) if its called. I believe that manage.py uses "execute_from_command_line". So is it possible or I have to find some other way to solve my problem.

I want my manage.py to run the server automatically

Title: Can I make changes in manage.py?


问:
SQL Crosstab error :- return and sql tuple descriptions are incompatible
I have table as below and I am applying below CrossTab query on it.

```<code>select * from crosstab
(
    'SELECT dates,skillset, queued
    from hlfhrly
    order by 1,2') as ct ("dates" date,"skillset" text, "queued" bigint )
</code>```

However I am getting below error, what I am doing wrong here

ERROR:  return and sql tuple descriptions are incompatible
 SQL
state: 42601

enter image description here

I have table as below and I am applying below CrossTab query on it.

```<code>select * from crosstab
(
    'SELECT dates,skillset, queued
    from hlfhrly
    order by 1,2') as ct ("dates" date,"skillset" text, "queued" bigint )
</code>```

However I am getting below error, what I am doing wrong here

ERROR:  return and sql tuple descriptions are incompatible
 SQL
state: 42601

Body:
I have table as below and I am applying below CrossTab query on it.

select * from crosstab
(
    'SELECT dates,skillset, queued
    from hlfhrly
    order by 1,2') as ct ("dates" date,"skillset" text, "queued" bigint )

However I am getting below error, what I am doing wrong here

ERROR:  return and sql tuple descriptions are incompatible
 SQL
state: 42601

enter image description here

I have table as below and I am applying below CrossTab query on it.

select * from crosstab
(
    'SELECT dates,skillset, queued
    from hlfhrly
    order by 1,2') as ct ("dates" date,"skillset" text, "queued" bigint )

However I am getting below error, what I am doing wrong here

ERROR:  return and sql tuple descriptions are incompatible
 SQL
state: 42601


问:
Jest to test JS in a php file
I need to test some javascript I have in a php file (cannot be turned in any other extension file, for a few reasons, including it also contains php).

How can I achieve this using Jest?

For example, I have tried the following:

```<code>const parse = require('regenerator-runtime/runtime');

const jsdom = require("jsdom");
const { JSDOM } = jsdom;

test("test JavaScript code in PHP file", async () => {
    //create a mock of the DOM
    const dom = new JSDOM(`<!DOCTYPE html><body>
    <script>
    // Add JS code from php file in here
    let sum = function sum(a, b) {
        return a + b
    }
    </script>
    </body>`);
    global.document = dom.window.document;
    global.window = dom.window;
    global.navigator = dom.window.navigator;
    // run your tests here
    expect(sum(1, 2)).toBe(3);
});
</code>```

Unfortunately gives me an error:

ReferenceError: sum is not defined

How can I test the JS within the mock of the DOM since it is in it's own scope?

Is there a better way to test javascript in a php file?

Title: Jest to test JS in a php file

Body:
I need to test some javascript I have in a php file (cannot be turned in any other extension file, for a few reasons, including it also contains php).

How can I achieve this using Jest?

For example, I have tried the following:

const parse = require('regenerator-runtime/runtime');

const jsdom = require("jsdom");
const { JSDOM } = jsdom;

test("test JavaScript code in PHP file", async () => {
    //create a mock of the DOM
    const dom = new JSDOM(`<!DOCTYPE html>

    `);
    global.document = dom.window.document;
    global.window = dom.window;
    global.navigator = dom.window.navigator;
    // run your tests here
    expect(sum(1, 2)).toBe(3);
});

Unfortunately gives me an error:

ReferenceError: sum is not defined

How can I test the JS within the mock of the DOM since it is in it's own scope?

Is there a better way to test javascript in a php file?


问:
Android WebView does not resolve private DNS without active internet, but browser does
My setup:
Hardware:

Ubuntu 22.04

WiFi router connected to Ubuntu

Several android devices accessing the Ubuntu machine over wifi.

No internet.

Software:
On Ubuntu - I run Nginx to serve some webpages, DHCP server, MaraDNS with Deadwood to provide DNS lookup. DHCP & DNS runs fine. The URL being served by Nginx has an entry in the DNS.
On Android I run a WebView based App that essentially fetches the webpage from ubuntu.

Problem:
When I access the webpage from Android Browser I can, but when I use Webview I get the following error:
Web page not available
The web page at https://mycustomurl/ could not be loaded because:
net::ERR_NAME_NOT_RESOLVED

Debugging attempts:

When I type https://mycustomurl/ on Chrome using the same Android device that runs my WebView based app, Chrome loads the page successfully. I have ensured that there are no SSL errors as I am using proper signed certificated. I have also used onSSLReceivedError handling in WebView.

On Android device using chrome://net-internals/#dns I tried looking up https://mycustomurl and it resolved successfully.

If there is active internet connection, webview doesn't complain. It is only when there is no active internet connection that I see the problem.


问:
Measurement-repeated ANCOVA in 2x2 Mixed Design
I am calculating in R an ANOVA with repeated measures in 2x2 mixed design. For this I use one of the following inputs in R:

(1)
res.aov <- anova_test(data = datac, dv = Stress, wid = REF,between = Gruppe, within = time )
get_anova_table(res.aov)

(2)
aov <- datac %>%
anova_test(dv = Stress, wid = REF, between = Gruppe, within = time, type = 3)
aov

Both lead to the same results. Now I want to add a covariate from the 1st measurement time point. So far I could not find a suitable R input for the ANCOVA for this repeated measures design.

Does anyone of you perhaps have an idea?

Many greetings

ANOVA <- aov(Stress~time+covariate, data = data)
summary(ANOVA)

For a simple ANCOVA, the R input of an ANOVA with the addition of the covariate applies. Unfortunately, I have no idea how this works in the repeated measures design.


问:
Ruby sketchup cant load Dll file with Fiddle (tried user made 32bit dll and 64 bit dll)
I am working with Ruby in sketchup 2017 in windows. The following code gives me error.  the ruby version in sketchup 2017 is 2.2.4. Earlier with older sketchup I was using DL and there I dont get a problem, it is only when I have to use fiddle with a newer version of ruby I am getting this error. I tried with some other 64 bit user made library but I still have the problem there.

code below

```<code> require 'Win32API'
    require 'fiddle'
    require 'fiddle/import'
    require 'fiddle/types'

    require 'sketchup.rb'

    require "fiddle"
    require "fiddle/import"

    module MEMCLIENT
    extend Fiddle::Importer
      dlload("C:\\Users/infib/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins
      /MSPhysics/memclient.dll")
      extern "int valinit(int)"
      extern "float readval(int)"
    end
</code>```

error

```<code>    Error Loading File C:/Users/infib/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/MSPhysics/control_panel.rb
Error: #<Fiddle::DLError: can't load C:\Users/infib/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/MSPhysics/memclient.dll>
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/fiddle/import.rb:85:in `rescue in block in dlload'
</code>```

Body:
I am working with Ruby in sketchup 2017 in windows. The following code gives me error.  the ruby version in sketchup 2017 is 2.2.4. Earlier with older sketchup I was using DL and there I dont get a problem, it is only when I have to use fiddle with a newer version of ruby I am getting this error. I tried with some other 64 bit user made library but I still have the problem there.

code below

 require 'Win32API'
    require 'fiddle'
    require 'fiddle/import'
    require 'fiddle/types'

    require 'sketchup.rb'

    require "fiddle"
    require "fiddle/import"

    module MEMCLIENT
    extend Fiddle::Importer
      dlload("C:\\Users/infib/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins
      /MSPhysics/memclient.dll")
      extern "int valinit(int)"
      extern "float readval(int)"
    end

error

    Error Loading File C:/Users/infib/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/MSPhysics/control_panel.rb
Error: #<Fiddle::DLError: can't load C:\Users/infib/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/MSPhysics/memclient.dll>
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/fiddle/import.rb:85:in `rescue in block in dlload'


问:
com.github.nanchen2251:CompressHelper:1.0.6 gradle dependency is failing
The android gradle project that I started working has the dependency com.github.nanchen2251:CompressHelper:1.0.6. But whenever I try to build the project it failing with the following error.

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve com.github.nanchen2251:CompressHelper:1.0.6.
Required by:
project :app
> Could not resolve com.github.nanchen2251:CompressHelper:1.0.6.
> Could not get resource 'https://mapbox.bintray.com/mapbox/com/github/nanchen2251/CompressHelper/1.0.6/CompressHelper-1.0.6.pom'.
> Could not HEAD 'https://mapbox.bintray.com/mapbox/com/github/nanchen2251/CompressHelper/1.0.6/CompressHelper-1.0.6.pom'.
> Certificate for <mapbox.bintray.com> doesn't match any of the subject alternative names: [*.jfrog.io, jfrog.io]

How can we identify if the library is still available?


问:
Can I create a Gutenberg component for use within InspectorControls, that accepts child components?
I've written a couple of custom WordPress blocks that both share some similar functionality: they both include a section in the InspectorControls that allows for iterating an array of data and displaying relevant input components. However, the input components used in each are different, depending on the data types.

For example, an array of objects containing two string properties could use two TextControl components:

```<code>// dataArray
[
    {
        a: 'Lorem ipsum',
        b: 'dolor sit amet'
    },
    {
        a: 'consectetur adipiscing',
        b: 'elit sed do'
    }
]

<InspectorControls>
    { dataArray.map( (data, index) => {
        return (
            <div className='multi-input__group' key={index}>
                <div className='multi-input__group-content'>
                    <TextControl value={ data.a } ... />
                    <TextControl value={ data.b } ... />
                </div>
                <div className='multi-input__group-actions'>
                    <Button icon='remove' ... />
                </div>
            </div>
        )
    })}
</InspectorControls>
</code>```

Or a number of different components could be used:

```<code>// dataArray
[
    {
        a: 'Lorem ipsum...',
        b: 'first select value'
    },
    {
        a: 'dolor sit amet...',
        b: 'second select value'
    }
]

<InspectorControls>
    { dataArray.map( (data, index) => {
        return (
            <div className='multi-input__group' key={index}>
                <div className='multi-input__group-content'>
                    <TextAreaControl value={ data.a } ... />
                    <SelectControl value={ data.b } ... />
                </div>
                <div className='multi-input__group-actions'>
                    <Button icon='remove'/>
                </div>
            </div>
        )
    })}
</InspectorControls>
</code>```

What I'm wondering now is: is it possible to abstract this pattern into a new component that accepts a data array, as well as the required child components, so that I don't have to repeat the various event handlers?

I've tried Slot/Fill without any success, as well as passing the component names as props. My instinct is that it would be best to pass the components within a props object that could also map them to the correct data and methods; but again, I haven't had any joy this way. Is it even possible to render a component with a dynamic name?

Body:
I've written a couple of custom WordPress blocks that both share some similar functionality: they both include a section in the InspectorControls that allows for iterating an array of data and displaying relevant input components. However, the input components used in each are different, depending on the data types.

For example, an array of objects containing two string properties could use two TextControl components:

// dataArray
[
    {
        a: 'Lorem ipsum',
        b: 'dolor sit amet'
    },
    {
        a: 'consectetur adipiscing',
        b: 'elit sed do'
    }
]

<InspectorControls>
    { dataArray.map( (data, index) => {
        return (

                    <TextControl value={ data.a } ... />
                    <TextControl value={ data.b } ... />

                    <Button icon='remove' ... />

        )
    })}
</InspectorControls>

Or a number of different components could be used:

// dataArray
[
    {
        a: 'Lorem ipsum...',
        b: 'first select value'
    },
    {
        a: 'dolor sit amet...',
        b: 'second select value'
    }
]

<InspectorControls>
    { dataArray.map( (data, index) => {
        return (

                    <TextAreaControl value={ data.a } ... />
                    <SelectControl value={ data.b } ... />

                    <Button icon='remove'/>

        )
    })}
</InspectorControls>

What I'm wondering now is: is it possible to abstract this pattern into a new component that accepts a data array, as well as the required child components, so that I don't have to repeat the various event handlers?

I've tried Slot/Fill without any success, as well as passing the component names as props. My instinct is that it would be best to pass the components within a props object that could also map them to the correct data and methods; but again, I haven't had any joy this way. Is it even possible to render a component with a dynamic name?


问:
Keras doesn't find GPU, how to change that?
I am trying to build a simple NN with keras. I have 2 GPUs on my machine:

But Keras doesn't seem to recognize any of them:

```<code>print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
Num GPUs Available:  0
</code>```

Any ideas?

I am using python 3.9, tensorflow 2.11, keras 2.11.

Body:
I am trying to build a simple NN with keras. I have 2 GPUs on my machine:

But Keras doesn't seem to recognize any of them:

print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
Num GPUs Available:  0

Any ideas?

I am using python 3.9, tensorflow 2.11, keras 2.11.


问:
Type for icon in React Component's Interface
Using Radix-UI's Accordion, the reusable component is changed in order to accept as props an icon.

The interface:

```<code>interface AccordionTriggerProps {
  trigger: string;
  icon?: StyledComponent<
    React.FunctionComponent<
      React.SVGProps<SVGSVGElement> & {
        title?: string | undefined;
      }
    >,
    never
  >;
}
</code>```

The component that uses the above interface:

```<code>const AccordionTrigger = ({ trigger, icon }: AccordionTriggerProps) => (
  <header>
    {icon}
    {trigger}
  </header>
);
</code>```

The component reused in other place like following:

```<code><AccordionTrigger trigger="Learn" icon={<StyledLearnIcon />} />
</code>```

It works fine, it renders the component but it still says there is an error for the icon:

Type 'Element' is not assignable to type
'StyledComponent<FunctionComponent<SVGProps & { title?:
string | undefined; }>, never, {}, never>'

Any idea why and how to fix it?

How the icon is defined:

```<code>import { ReactComponent as LearnIcon } from 'svgs/learn.svg';

export const StyledLearnIcon = styled(LearnIcon)`
  width: 20px;
  fill: white;
`;
</code>```

Body:
Using Radix-UI's Accordion, the reusable component is changed in order to accept as props an icon.

The interface:

interface AccordionTriggerProps {
  trigger: string;
  icon?: StyledComponent<
    React.FunctionComponent<
      React.SVGProps<SVGSVGElement> & {
        title?: string | undefined;
      }
    >,
    never
  >;
}

The component that uses the above interface:

const AccordionTrigger = ({ trigger, icon }: AccordionTriggerProps) => (

    {icon}
    {trigger}

);

The component reused in other place like following:

<AccordionTrigger trigger="Learn" icon={


问:
Maven uber-jar generation uses application.properties of dependency instead of its own
I have a quarkus maven project which has properties in src/main/application.properties. This project also has a local dependency that also contains src/main/application.properties since there are tests in the dependency that rely on it (setting them in src/test/application.properties does not work). Example folder structure:

dependency

src/main/application.properties (contains some settings for integration tests in this dependency)

quarkus-project

src/main/application.properties (contains different settings for its own project)

When i build an uber-jar for the quarkus-project it successfully creates one, however it contains the application.properties file of the dependency instead of its own.

Uber-jar contents generated for quarkus-project:

...

application.properties (<- file from dependency, rather than from quarkus-project)

...

Why is that? Why does it use the application.properties of a dependency rather than its own when building the specific project? Is there a way to specify a priority or such?