问:
Populate vector down or up with unique element value (like na.locf)
I have a large dataframe with each column containing one flag from the set {-1,1}, all the rest of the values are set to zero.  I want to fill up or down the rest of the column entries with a value corresponding to that flag value. for example, given a vector to represent 1 column, I have

```<code>v <- rep(0,15)
v[12] <- 1

#I'd want a function that is something like:
f <- function(v,flag){
for(i in 2:length(v)){ if(v[i-1]==flag) v[i] <- flag else v[i]<-v[i]}
v
}

> v
 [1] 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
> f(v,1)
 [1] 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
</code>```

The example works fine for filling forward some v and a flag 1. I'd also want to be able to fill backwards with 1 based on a -1 flag.  The obvious solution that comes to mind is na.locf, except I can't get it to work with a 1 in the middle and filling forward and backwards. Even if I populate the 0 elements with NA, it will still not partially fill up or down based on a flag.

Are there any simple and fast vectorized functions that could do this with a matrix or zoo object populated with all zeros, except where there is one element with 1 or -1 in each column, telling it to fill down or up with 1s depending on the value?

edit: thinking about it a bit more, I came up with a possible solution, that along with an illustration, (hopefully) makes it more clear what I want.
Also, the overall goal is to create a mask for Additions/Deletions to a fund index, by date, that fill forwards for additions (+1) and fill backwards for removals (-1). Also, why I thought of na.locf right away. Still not sure if this is the best approach for this block, though. Any thoughts appreciated.

```<code>#generate random matrix of flags
v.mtx <- matrix(0,15,10)
for(i in 1:10){
v.mtx[sample(1:15,1),i] <- sample(c(-1,1),1)
}

fill.flag <- function(v) {
if(any(-1 %in% v)) {v[1:which(v!=0)] <- 1}
else
if(any(1 %in% v)) {v[which(v!=0):length(v)] <- 1}
v
}

> v.mtx
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    0    0    0    0    1    0    0    0     0
 [2,]    0    0    0    0    0    0    0    0    0     0
 [3,]    0    0    0    0    0    0    0    0    0     0
 [4,]    0    0    0    0    0    0    0    0    0     0
 [5,]    0    0    0    0    0    0    0    0    0     0
 [6,]    0    0    0    0    1    0   -1    0    0     0
 [7,]    0    0    0   -1    0    0    0    0    0     0
 [8,]    0    0    0    0    0    0    0    0    0     0
 [9,]    0    0    0    0    0    0    0    1    0    -1
[10,]    0    0    0    0    0    0    0    0   -1     0
[11,]    0    0    0    0    0    0    0    0    0     0
[12,]    0    0    0    0    0    0    0    0    0     0
[13,]    0    0    1    0    0    0    0    0    0     0
[14,]    0    0    0    0    0    0    0    0    0     0
[15,]    1   -1    0    0    0    0    0    0    0     0
> apply(v.mtx,2,fill.flag)
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    1    0    1    0    1    1    0    1     1
 [2,]    0    1    0    1    0    1    1    0    1     1
 [3,]    0    1    0    1    0    1    1    0    1     1
 [4,]    0    1    0    1    0    1    1    0    1     1
 [5,]    0    1    0    1    0    1    1    0    1     1
 [6,]    0    1    0    1    1    1    1    0    1     1
 [7,]    0    1    0    1    1    1    0    0    1     1
 [8,]    0    1    0    0    1    1    0    0    1     1
 [9,]    0    1    0    0    1    1    0    1    1     1
[10,]    0    1    0    0    1    1    0    1    1     0
[11,]    0    1    0    0    1    1    0    1    0     0
[12,]    0    1    0    0    1    1    0    1    0     0
[13,]    0    1    1    0    1    1    0    1    0     0
[14,]    0    1    1    0    1    1    0    1    0     0
[15,]    1    1    1    0    1    1    0    1    0     0
</code>```

答:
As @G. Grothendieck commented, you can try cummax and cummin, i.e.

```<code>f1 <- function(x){
  if(sum(x) == 1){
    return(cummax(x))
  }else{
    return(rev(cummin(rev(x)))* -1)
  }
}

#apply as usual
apply(v.mtx, 2, f1)
</code>```

Body:
I have a large dataframe with each column containing one flag from the set {-1,1}, all the rest of the values are set to zero.  I want to fill up or down the rest of the column entries with a value corresponding to that flag value. for example, given a vector to represent 1 column, I have

v <- rep(0,15)
v[12] <- 1

#I'd want a function that is something like:
f <- function(v,flag){
for(i in 2:length(v)){ if(v[i-1]==flag) v[i] <- flag else v[i]<-v[i]}
v
}

> v
 [1] 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
> f(v,1)
 [1] 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1

The example works fine for filling forward some v and a flag 1. I'd also want to be able to fill backwards with 1 based on a -1 flag.  The obvious solution that comes to mind is na.locf, except I can't get it to work with a 1 in the middle and filling forward and backwards. Even if I populate the 0 elements with NA, it will still not partially fill up or down based on a flag.

Are there any simple and fast vectorized functions that could do this with a matrix or zoo object populated with all zeros, except where there is one element with 1 or -1 in each column, telling it to fill down or up with 1s depending on the value?

edit: thinking about it a bit more, I came up with a possible solution, that along with an illustration, (hopefully) makes it more clear what I want.
Also, the overall goal is to create a mask for Additions/Deletions to a fund index, by date, that fill forwards for additions (+1) and fill backwards for removals (-1). Also, why I thought of na.locf right away. Still not sure if this is the best approach for this block, though. Any thoughts appreciated.

#generate random matrix of flags
v.mtx <- matrix(0,15,10)
for(i in 1:10){
v.mtx[sample(1:15,1),i] <- sample(c(-1,1),1)
}

fill.flag <- function(v) {
if(any(-1 %in% v)) {v[1:which(v!=0)] <- 1}
else
if(any(1 %in% v)) {v[which(v!=0):length(v)] <- 1}
v
}

> v.mtx
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    0    0    0    0    1    0    0    0     0
 [2,]    0    0    0    0    0    0    0    0    0     0
 [3,]    0    0    0    0    0    0    0    0    0     0
 [4,]    0    0    0    0    0    0    0    0    0     0
 [5,]    0    0    0    0    0    0    0    0    0     0
 [6,]    0    0    0    0    1    0   -1    0    0     0
 [7,]    0    0    0   -1    0    0    0    0    0     0
 [8,]    0    0    0    0    0    0    0    0    0     0
 [9,]    0    0    0    0    0    0    0    1    0    -1
[10,]    0    0    0    0    0    0    0    0   -1     0
[11,]    0    0    0    0    0    0    0    0    0     0
[12,]    0    0    0    0    0    0    0    0    0     0
[13,]    0    0    1    0    0    0    0    0    0     0
[14,]    0    0    0    0    0    0    0    0    0     0
[15,]    1   -1    0    0    0    0    0    0    0     0
> apply(v.mtx,2,fill.flag)
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    1    0    1    0    1    1    0    1     1
 [2,]    0    1    0    1    0    1    1    0    1     1
 [3,]    0    1    0    1    0    1    1    0    1     1
 [4,]    0    1    0    1    0    1    1    0    1     1
 [5,]    0    1    0    1    0    1    1    0    1     1
 [6,]    0    1    0    1    1    1    1    0    1     1
 [7,]    0    1    0    1    1    1    0    0    1     1
 [8,]    0    1    0    0    1    1    0    0    1     1
 [9,]    0    1    0    0    1    1    0    1    1     1
[10,]    0    1    0    0    1    1    0    1    1     0
[11,]    0    1    0    0    1    1    0    1    0     0
[12,]    0    1    0    0    1    1    0    1    0     0
[13,]    0    1    1    0    1    1    0    1    0     0
[14,]    0    1    1    0    1    1    0    1    0     0
[15,]    1    1    1    0    1    1    0    1    0     0

Body:
As @G. Grothendieck commented, you can try cummax and cummin, i.e.

f1 <- function(x){
  if(sum(x) == 1){
    return(cummax(x))
  }else{
    return(rev(cummin(rev(x)))* -1)
  }
}

#apply as usual
apply(v.mtx, 2, f1)


来源: stackexchange

问:
python selenium screenshot captcha image
i want to take screenshot and crop only the captcha image, im write this code : http://pastebin.com/Hqau6kRD :

```<code>elem = driver.find_element_by_css_selector("#imagecpt")
loc  = elem.location
size = elem.size
left  = loc['x']
top   = loc['y']
width = size['width']
height = size['height']
box = (int(left), int(top), int(left+width), int(top+height))
screenshot = driver.get_screenshot_as_png()
img = Image.open(StringIO.StringIO(screenshot))
area = img.crop(box)
area.save('screenshot.png', 'PNG')
</code>```

the image saved is complete black, where im wrong ?

答:
Yeah. For Python3 it will be like:</p>

```<code>...
from io import BytesIO
...
screenshot = driver.get_screenshot_as_base64()
img = Image.open(BytesIO(base64.b64decode(screenshot))
...
</code>```

ContentLicense: CC BY-SA 3.0

Body:
i want to take screenshot and crop only the captcha image, im write this code : http://pastebin.com/Hqau6kRD :

elem = driver.find_element_by_css_selector("#imagecpt")
loc  = elem.location
size = elem.size
left  = loc['x']
top   = loc['y']
width = size['width']
height = size['height']
box = (int(left), int(top), int(left+width), int(top+height))
screenshot = driver.get_screenshot_as_png()
img = Image.open(StringIO.StringIO(screenshot))
area = img.crop(box)
area.save('screenshot.png', 'PNG')

the image saved is complete black, where im wrong ?

Body:
Yeah. For Python3 it will be like:

...
from io import BytesIO
...
screenshot = driver.get_screenshot_as_base64()
img = Image.open(BytesIO(base64.b64decode(screenshot))
...


问:
Javascript/Angular2 How can I toggle button based on the form field values
I have a form with mandatory fields as -
1. First Name
2. Last Name
3. Phone
4. State
5. City
6. Date of Birth
 I have a button which should toggle to complete/Incomplete based on the form inputs.The button should toggle to  'complete' only when all the fields have proper values.If I remove any of the value again,the button should toggle to Incomplete.

In my ts file-

```<code>formCompleteOrIncomplete(person,index) {
   if (person.dateOfBirth !== "" && person.phone!== "" &&
      (person.firstName !== undefined || person.firstName !== "") && (person.lastName !== undefined || person.lastName !== "") && (person.state !== undefined || person.state !== "") && (person.city !== undefined || person.city !== "" )) {
      person.status = true;

    }
    else {
      person.status = false;
    }
}
</code>```

In my html file-

```<code><div class="tag">
   <div class="success" *ngIf="person.status">Complete</div>
   <div class="failed" *ngIf="!person.status">Incomplete</div>
</div>
</code>```

form fields-

```<code>   <md-input required [(ngModel)]="person.firstName" (ngModelChange) = "formCompleteOrIncomplete(person, index)" aria-placeholder="First Name" placeholder="First Name" name="firstName" #firstName="ngModel"></md-input>
</code>```

On page load the button shows 'Incomplete' as none of the field values are entered and when I enter all the fields, button is getting toggled to 'Complete' but when I try to empty any of the field again, it does not get toggled to 'Incomplete' again.

Also, when i do not include a check for 'undefined' and include only "" check, on page load the button shows 'complete'.NOt sure why is this happening.

Can someone tell me where I am going wrong?

答:
You don't need the formCompleteorIncomplete function or ngModel, ngModelChange etc....

You should use angular2's ReactiveForms. ReactiveForms are the preferred approach to working with forms.

like so:

```<code>ngOnInit() {
    this.form= this.formBuilder.group({
      firstName: ['', Validators.required ],// <--- set any validators here
      lastName: ['', Validators.required ],
      ...//and so on...
      })
    });
</code>```

Next, add a formControlName:

```<code><md-input required formControlName="firstName" aria-placeholder="First Name" placeholder="First Name" name="firstName"></md-input>
</code>```

finally, you can toggle buttons with form.valid like so:
(form.valid changes depending on whether the form is valid (based on the validators you set above).

```<code><div class="tag">
   <div class="success" *ngIf="form.valid">Complete</div>
   <div class="failed" *ngIf="!form.valid">Incomplete</div>
</div>
</code>```

Check this site out for an example.

Body:
I have a form with mandatory fields as -
1. First Name
2. Last Name
3. Phone
4. State
5. City
6. Date of Birth
 I have a button which should toggle to complete/Incomplete based on the form inputs.The button should toggle to  'complete' only when all the fields have proper values.If I remove any of the value again,the button should toggle to Incomplete.

In my ts file-

formCompleteOrIncomplete(person,index) {
   if (person.dateOfBirth !== "" && person.phone!== "" &&
      (person.firstName !== undefined || person.firstName !== "") && (person.lastName !== undefined || person.lastName !== "") && (person.state !== undefined || person.state !== "") && (person.city !== undefined || person.city !== "" )) {
      person.status = true;

    }
    else {
      person.status = false;
    }
}

In my html file-

Complete

Incomplete

form fields-

   <md-input required [(ngModel)]="person.firstName" (ngModelChange) = "formCompleteOrIncomplete(person, index)" aria-placeholder="First Name" placeholder="First Name" name="firstName" #firstName="ngModel"></md-input>

On page load the button shows 'Incomplete' as none of the field values are entered and when I enter all the fields, button is getting toggled to 'Complete' but when I try to empty any of the field again, it does not get toggled to 'Incomplete' again.

Also, when i do not include a check for 'undefined' and include only "" check, on page load the button shows 'complete'.NOt sure why is this happening.

Can someone tell me where I am going wrong?

Body:
You don't need the formCompleteorIncomplete function or ngModel, ngModelChange etc....

You should use angular2's ReactiveForms. ReactiveForms are the preferred approach to working with forms.

like so:

ngOnInit() {
    this.form= this.formBuilder.group({
      firstName: ['', Validators.required ],// <--- set any validators here
      lastName: ['', Validators.required ],
      ...//and so on...
      })
    });

Next, add a formControlName:

<md-input required formControlName="firstName" aria-placeholder="First Name" placeholder="First Name" name="firstName"></md-input>

finally, you can toggle buttons with form.valid like so:
(form.valid changes depending on whether the form is valid (based on the validators you set above).

<div class="tag">
   <div class="success" *ngIf="form.valid">Complete</div>
   <div class="failed" *ngIf="!form.valid">Incomplete</div>
</div>

Check this site out for an example.


问:
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/WORLD
I'm trying out Gradle and JDBC for the first time. I have the following gradle.build file:

```<code>apply plugin: 'java-library'
apply plugin: 'java'

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    compile 'mysql:mysql-connector-java:5.1.36'
    testImplementation 'junit:junit:4.12'
}
</code>```

In my HelloMySQL.java file, I'm trying to establish a connection to the MySQL database WORLD(Verified the URL and port). I have the following code:

```<code>package Hello;
import java.sql.*;

public class HelloMySQL {
    public static void main(String[] args) {
        Connection conn = null;
        try{
            System.out.println("Trying to connect...");
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/WORLD", "root", "root");
            System.out.println("Creating statement...");
                Statement stmt = conn.createStatement();
                String sql;
                sql = "SELECT * FROM City LIMIT 10";
                ResultSet rs = stmt.executeQuery(sql);
                while(rs.next()){
                  int id = rs.getInt("id");
                  String name = rs.getString("name");
                  String countryCode = rs.getString("CountryCode");
                  System.out.println(id + " " + name + "\t " + countryCode);
                }

        } catch(SQLException e){
            System.out.println(e.toString());
        }

    }
}
</code>```

I've also tried adding this line before the DriverManager.getConnection:

```<code>Class.forName('com.mysql.jdbc.Driver');
</code>```

but it throws a java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Am I doing something wrong with the gradle build file?

EDIT: I have not added the jar for MySQL connector to the project. Gradle will download it for me, right?

答:
I found the problem. Not exactly a problem but still posting it for people who might struggle with Eclipse.

After you make changes to the gradle.build file, Cleaning the project won't do. You'll need to refresh the gradle project as well.

Right click in the build.gradle file -> Gradle -> Refresh Gradle Project

Body:
I'm trying out Gradle and JDBC for the first time. I have the following gradle.build file:

apply plugin: 'java-library'
apply plugin: 'java'

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    compile 'mysql:mysql-connector-java:5.1.36'
    testImplementation 'junit:junit:4.12'
}

In my HelloMySQL.java file, I'm trying to establish a connection to the MySQL database WORLD(Verified the URL and port). I have the following code:

package Hello;
import java.sql.*;

public class HelloMySQL {
    public static void main(String[] args) {
        Connection conn = null;
        try{
            System.out.println("Trying to connect...");
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/WORLD", "root", "root");
            System.out.println("Creating statement...");
                Statement stmt = conn.createStatement();
                String sql;
                sql = "SELECT * FROM City LIMIT 10";
                ResultSet rs = stmt.executeQuery(sql);
                while(rs.next()){
                  int id = rs.getInt("id");
                  String name = rs.getString("name");
                  String countryCode = rs.getString("CountryCode");
                  System.out.println(id + " " + name + "\t " + countryCode);
                }

        } catch(SQLException e){
            System.out.println(e.toString());
        }

    }
}

I've also tried adding this line before the DriverManager.getConnection:

Class.forName('com.mysql.jdbc.Driver');

but it throws a java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Am I doing something wrong with the gradle build file?

EDIT: I have not added the jar for MySQL connector to the project. Gradle will download it for me, right?


问:
How can I rotate xticklabels in matplotlib so that the spacing between each xticklabel is equal?
How can I rotate xticklabels in matplotlib  so that the spacing between each xticklabel is equal?

For example  with this code:

```<code>import matplotlib.pyplot as plt
import numpy as np

# Data + parameters
fontsize = 20
t = np.arange(0.0, 6.0, 1)
xticklabels = ['Full', 'token emb', 'char emb', 'char LSTM',
               'token LSTM', 'feed forward','ANN']

# Plotting
fig = plt.figure(1)
ax = fig.add_subplot(111)
plt.plot(t, t)
plt.xticks(range(0, len(t) + 1))
ax.tick_params(axis='both', which='major', labelsize=fontsize)
ax.set_xticklabels(xticklabels, rotation = 45)
fig.savefig('test_rotation.png', dpi=300, format='png', bbox_inches='tight')
</code>```

I obtain:

The spacing between each xticklabel is unequal. For example, the spacing between 'Full' and 'token emb' is much larger than the spacing between  'feed forward' and 'ANN'.

I use Matplotlib 2.0.0 and Python 3.5 64-bit on Windows 7 SP1 x64 Ultimate.

答:
The labels are centered at the tickmark position. Their bounding boxes are unequal in width and might even overlap, which makes them look unequally spaced.

Since you'd always want the ticklabels to link to their tickmarks, changing the spacing is not really an option.

However you might want to align them such the the upper right corner is the reference for their positioning below the tick.

Use the horizontalalignment or  ha argument for that and set it to "right":

```<code>ax.set_xticklabels(xticklabels, rotation = 45, ha="right")
</code>```

This results in the following plot:

An alternative can be to keep the ticklabels horizontally centered, but also center them vertically. This leads to an equal spacing but required to further adjust their vertical position with respect to the axis.

```<code>ax.set_xticklabels(xticklabels, rotation = 45, va="center", position=(0,-0.28))
</code>```

The above can be used if the ticks are specified manually like in the question (e.g. via plt.xticks or via ax.set_xticks) or if a categorical plot is used.

If instead the labels are shown automatically, one should not use set_xticklabels. This will in general let the labels and tick positions become out of sync, because set_xticklabels sets the formatter of the axes to a FixedFormatter, while the locator stays the automatic AutoLocator, or any other automatic locator.

In those cases either use plt.setp to set the rotation and alignment of existing labels,

```<code>plt.setp(ax.get_xticklabels(), ha="right", rotation=45)
</code>```

or loop over them to set the respective properties,

```<code>for label in ax.get_xticklabels():
    label.set_ha("right")
    label.set_rotation(45)
</code>```

An example would be

```<code>import numpy as np; np.random.seed(42)
import matplotlib.pyplot as plt

t = np.arange("2018-01-01", "2018-03-01", dtype="datetime64[D]")
x = np.cumsum(np.random.randn(len(t)))

fig, ax = plt.subplots()
ax.plot(t, x)

for label in ax.get_xticklabels():
    label.set_ha("right")
    label.set_rotation(45)

plt.tight_layout()
plt.show()
</code>```

Body:
How can I rotate xticklabels in matplotlib  so that the spacing between each xticklabel is equal?

For example  with this code:

import matplotlib.pyplot as plt
import numpy as np

# Data + parameters
fontsize = 20
t = np.arange(0.0, 6.0, 1)
xticklabels = ['Full', 'token emb', 'char emb', 'char LSTM',
               'token LSTM', 'feed forward','ANN']

# Plotting
fig = plt.figure(1)
ax = fig.add_subplot(111)
plt.plot(t, t)
plt.xticks(range(0, len(t) + 1))
ax.tick_params(axis='both', which='major', labelsize=fontsize)
ax.set_xticklabels(xticklabels, rotation = 45)
fig.savefig('test_rotation.png', dpi=300, format='png', bbox_inches='tight')

I obtain:

The spacing between each xticklabel is unequal. For example, the spacing between 'Full' and 'token emb' is much larger than the spacing between  'feed forward' and 'ANN'.

I use Matplotlib 2.0.0 and Python 3.5 64-bit on Windows 7 SP1 x64 Ultimate.

Body:
The labels are centered at the tickmark position. Their bounding boxes are unequal in width and might even overlap, which makes them look unequally spaced.

Since you'd always want the ticklabels to link to their tickmarks, changing the spacing is not really an option.

However you might want to align them such the the upper right corner is the reference for their positioning below the tick.

Use the horizontalalignment or  ha argument for that and set it to "right":

ax.set_xticklabels(xticklabels, rotation = 45, ha="right")

This results in the following plot:

An alternative can be to keep the ticklabels horizontally centered, but also center them vertically. This leads to an equal spacing but required to further adjust their vertical position with respect to the axis.

ax.set_xticklabels(xticklabels, rotation = 45, va="center", position=(0,-0.28))

The above can be used if the ticks are specified manually like in the question (e.g. via plt.xticks or via ax.set_xticks) or if a categorical plot is used.

If instead the labels are shown automatically, one should not use set_xticklabels. This will in general let the labels and tick positions become out of sync, because set_xticklabels sets the formatter of the axes to a FixedFormatter, while the locator stays the automatic AutoLocator, or any other automatic locator.

In those cases either use plt.setp to set the rotation and alignment of existing labels,

plt.setp(ax.get_xticklabels(), ha="right", rotation=45)

or loop over them to set the respective properties,

for label in ax.get_xticklabels():
    label.set_ha("right")
    label.set_rotation(45)

An example would be

import numpy as np; np.random.seed(42)
import matplotlib.pyplot as plt

t = np.arange("2018-01-01", "2018-03-01", dtype="datetime64[D]")
x = np.cumsum(np.random.randn(len(t)))

fig, ax = plt.subplots()
ax.plot(t, x)

for label in ax.get_xticklabels():
    label.set_ha("right")
    label.set_rotation(45)

plt.tight_layout()
plt.show()

ContentLicense: CC BY-SA 4.0


问:
How to implement spark.ui.filter
I have a spark cluster set up on 2 CentOS machines. I want to secure the web UI of my cluster (master node). I have made a BasicAuthenticationFilter servlet. I am unable to understand:

how should I use spark.ui.filter to secure my web UI.

Where should I place the servlet/jar file.

Kindly help.

答:
I also needed to handle this security problem to prevent unauthorized access to spark standalone UI. At last I fixed it after surfing on the web, the procedure is :

code and compile a java filter using standard basic authentication protocol, I refered to this [blog]: http://lambda.fortytools.com/post/26977061125/servlet-filter-for-http-basic-auth

packaged above filter class as a jar file, put it in $spark_home/jars/

add config lines in $spark_home/conf/spark-default.conf as :

spark.ui.filters        xxx.BasicAuthFilter # the full class name

spark.test.BasicAuthFilter.params       user=foo,password=cool,realm=some

the username and password need to provide to access the spark UI, “realm” is insignificant whatever you typed

restart all slave and master process and test to find it works

Title: How to implement spark.ui.filter


问:
Disable and enable link using PHP when admin click button
I have a problem with my website project using PHP. How can I disable link (ex : register.php and login.php) when admin click button for disable link in admin panel, and enable that again when it clicked for the second time..

Anyone can help ? thanks

答:
If you need to deny access to those pages,then disabling the link is not enough,since the user can directly type the URL on the browser and access them.

I am assuming you are using raw PHP.

You need to check access status first at the beginning of register.php as below:

```<code><?php
function accessIsAllowed() {
    $allowed = false;
    ......
    // Check admin status from database
    .....
    return $allowed;
}

if (!accessIsAllowed) {
    header('Location':'Your preferred URL'); //Redirect to your preferred URL eg access denied page
}
....
?>
</code>```

And on the view:

```<code><html>
.....
<a href="register.php"  <?php echo $allowed?'':'disabled';?>></a>
......
</html>
</code>```

To disable the link based on admin preference

Body:
If you need to deny access to those pages,then disabling the link is not enough,since the user can directly type the URL on the browser and access them.

I am assuming you are using raw PHP.

You need to check access status first at the beginning of register.php as below:

<?php
function accessIsAllowed() {
    $allowed = false;
    ......
    // Check admin status from database
    .....
    return $allowed;
}

if (!accessIsAllowed) {
    header('Location':'Your preferred URL'); //Redirect to your preferred URL eg access denied page
}
....
?>

And on the view:

<html>
.....
<a href="register.php"  <?php echo $allowed?'':'disabled';?>></a>
......
</html>

To disable the link based on admin preference


问:
How To Only Selectively Read Numbers and/or Words From a .txt File?
I have a simple .txt file ("theFile.txt") with the following format where the left column are the lineNumber and the right column are the word:

```<code>5     today
2     It's
1     "
4     sunny
3     a
6     "
</code>```

For this txt file, I'm making two separate methods to each get only the number and only the string, plus another method to scan the file and put each lineNumber and word in a double-linked list DLL:

```<code>  String fileName = "theFile.txt";

  public int getNumberOnly() {
       int lineNumber;

       //code to only get the lineNumber but NOT the words
       //This is as far as I got and I need help on this part

       return lineNumber;
  }

  public String getWordsOnly() {
       String words;

       //code to only get the words but NOT the lineNumber
       //This is as far as I got and I need help on this part

       return words;
  }

  public void readAndPrintWholeFile(String fileName){

          String fileContents = new String();
          File file = new File("theFile.txt");
          Scanner scanner = new Scanner(new FileInputStream(fileName));
          DLL<T> list = new DLL<T>();

         //Print each lineNumber and corresponding words for example
         // 5   Today
         // 2   It's

         while (scanner.hasNextLine())
         {
              fileContents = scanner.nextLine();
              System.out.println(list.getNumbersOnly() + " " +  list.getWordOnly());
              //prints the lineNumber then space then the word
         }
  }

  //I already have all DLL accessors and mutators such as get & set next/previous nodes here, etc.
</code>```

I'm stuck on how to code the method bodies for both getNumbersOnly() and getWordOnly()

I've tried my best to get to this point.  Thanks for your help.

答:
You need to pass "fileContents" as the parameter to the functions.</p>

```<code>public int getNumberOnly(String fileContents) {
   int lineNumber;
   //Get position of space
   int spacePos = fileContents.indexOf(" ");
   //Get substring from start till first space is encountered. Also trim off any leading or trailing spaces. Convert string to int via parseInt
   lineNumber = parseInt(fileContents.subString(0,spacePos).trim());
   return lineNumber;
}

public String getWordsOnly(String fileContents) {
   String words;
   int spacePos = fileContents.indexOf(" ");
   //Get substring from first space till the end
   words = fileContents.subString(spacePos).trim();
   return words;
}
</code>```

Body:
I have a simple .txt file ("theFile.txt") with the following format where the left column are the lineNumber and the right column are the word:

5     today
2     It's
1     "
4     sunny
3     a
6     "

For this txt file, I'm making two separate methods to each get only the number and only the string, plus another method to scan the file and put each lineNumber and word in a double-linked list DLL:

  String fileName = "theFile.txt";

  public int getNumberOnly() {
       int lineNumber;

       //code to only get the lineNumber but NOT the words
       //This is as far as I got and I need help on this part

       return lineNumber;
  }

  public String getWordsOnly() {
       String words;

       //code to only get the words but NOT the lineNumber
       //This is as far as I got and I need help on this part

       return words;
  }

  public void readAndPrintWholeFile(String fileName){

          String fileContents = new String();
          File file = new File("theFile.txt");
          Scanner scanner = new Scanner(new FileInputStream(fileName));
          DLL<T> list = new DLL<T>();

         //Print each lineNumber and corresponding words for example
         // 5   Today
         // 2   It's

         while (scanner.hasNextLine())
         {
              fileContents = scanner.nextLine();
              System.out.println(list.getNumbersOnly() + " " +  list.getWordOnly());
              //prints the lineNumber then space then the word
         }
  }

  //I already have all DLL accessors and mutators such as get & set next/previous nodes here, etc.

I'm stuck on how to code the method bodies for both getNumbersOnly() and getWordOnly()

I've tried my best to get to this point.  Thanks for your help.

Body:
You need to pass "fileContents" as the parameter to the functions.

public int getNumberOnly(String fileContents) {
   int lineNumber;
   //Get position of space
   int spacePos = fileContents.indexOf(" ");
   //Get substring from start till first space is encountered. Also trim off any leading or trailing spaces. Convert string to int via parseInt
   lineNumber = parseInt(fileContents.subString(0,spacePos).trim());
   return lineNumber;
}

public String getWordsOnly(String fileContents) {
   String words;
   int spacePos = fileContents.indexOf(" ");
   //Get substring from first space till the end
   words = fileContents.subString(spacePos).trim();
   return words;
}


问:
Appending layers with previous in keras? - Conv2D' object has no attribute 'is_placeholder'
I seem to have some problem appending layers in keras.

Example:

```<code>import keras
from keras.layers.merge import Concatenate
from keras.models import Model
from keras.layers import Input, Dense
from keras.layers import Dropout
from keras.layers.core import Dense, Activation, Lambda, Reshape,Flatten
from keras.layers import Conv2D, MaxPooling2D, Reshape, ZeroPadding2D

input_img = Input(shape=(3, 6, 3))

conv2d_1_1 = Conv2D(filters = 32, kernel_size = (3,3) , padding = "same" , activation = 'relu' , name = "conv2d_1_1" )(input_img)
conv2d_2_1 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_1_1)
conv2d_3_1 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_2_1)
conv2d_4_1 = Conv2D(filters = 32, kernel_size = (1,1) , padding = "same" , activation = 'relu' )(conv2d_3_1)
conv2d_4_1_flatten = Flatten()(conv2d_4_1)

conv2d_1_2 = Conv2D(filters = 32, kernel_size = (3,3) , padding = "same" , activation = 'relu' , name = "conv2d_1_2")(input_img)
conv2d_2_2 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_1_2)
conv2d_3_2 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_2_2)
conv2d_4_2 = Conv2D(filters = 32, kernel_size = (1,1) , padding = "same" , activation = 'relu' )(conv2d_3_2)
conv2d_4_2_flatten = Flatten()(conv2d_4_2)

merge = keras.layers.concatenate([conv2d_4_1_flatten, conv2d_4_2_flatten])

dense1 = Dense(100, activation = 'relu')(merge)
dense2 = Dense(50,activation = 'relu')(dense1)
dense3 = Dense(1 ,activation = 'softmax')(dense2)

model = Model(inputs = [conv2d_1_1 , conv2d_1_2] , outputs = dense3)
model.compile(loss="crossentropy", optimizer="adam")

print model.summary()
</code>```

Why am I not able to append my layers like this?
The input is an image which i've manually separated in to shaped of (3,6,3)..

答:
Your input isnt correct, you say it yourself, the input is your image. Change the way you create the model :

```<code>model = Model(inputs = input_img , outputs = dense3)
</code>```

This should work.

Body:
I seem to have some problem appending layers in keras.

Example:

import keras
from keras.layers.merge import Concatenate
from keras.models import Model
from keras.layers import Input, Dense
from keras.layers import Dropout
from keras.layers.core import Dense, Activation, Lambda, Reshape,Flatten
from keras.layers import Conv2D, MaxPooling2D, Reshape, ZeroPadding2D

input_img = Input(shape=(3, 6, 3))

conv2d_1_1 = Conv2D(filters = 32, kernel_size = (3,3) , padding = "same" , activation = 'relu' , name = "conv2d_1_1" )(input_img)
conv2d_2_1 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_1_1)
conv2d_3_1 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_2_1)
conv2d_4_1 = Conv2D(filters = 32, kernel_size = (1,1) , padding = "same" , activation = 'relu' )(conv2d_3_1)
conv2d_4_1_flatten = Flatten()(conv2d_4_1)

conv2d_1_2 = Conv2D(filters = 32, kernel_size = (3,3) , padding = "same" , activation = 'relu' , name = "conv2d_1_2")(input_img)
conv2d_2_2 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_1_2)
conv2d_3_2 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_2_2)
conv2d_4_2 = Conv2D(filters = 32, kernel_size = (1,1) , padding = "same" , activation = 'relu' )(conv2d_3_2)
conv2d_4_2_flatten = Flatten()(conv2d_4_2)

merge = keras.layers.concatenate([conv2d_4_1_flatten, conv2d_4_2_flatten])

dense1 = Dense(100, activation = 'relu')(merge)
dense2 = Dense(50,activation = 'relu')(dense1)
dense3 = Dense(1 ,activation = 'softmax')(dense2)

model = Model(inputs = [conv2d_1_1 , conv2d_1_2] , outputs = dense3)
model.compile(loss="crossentropy", optimizer="adam")

print model.summary()

Why am I not able to append my layers like this?
The input is an image which i've manually separated in to shaped of (3,6,3)..

Body:
Your input isnt correct, you say it yourself, the input is your image. Change the way you create the model :

model = Model(inputs = input_img , outputs = dense3)

This should work.


问:
How can I protect a logging object from the garbage collector in a multiprocessing process?
I create a couple of worker processes using Python's Multiprocessing module 2.6.
In each worker I use the standard logging module (with log rotation and file per worker)
to keep an eye on the worker. I've noticed that after a couple of hours that no more
events are written to the log. The process doesn't appear to crash and still responds
to commands via my queue. Using lsof I can see that the log file is no longer open.
I suspect the log object may be killed by the garbage collector, if so is there a way
that I can mark it to protect it?</p>

答:
```<code>http://docs.python.org/reference/datamodel.html#object.__del__
</code>```

According to this documentation the del() method is called on object destruction and you can at this point create a reference to the object to prevent it from being collected.  I am not sure how to do this, hopefully this gives you some food for thought.

ContentLicense: CC BY-SA 2.5

Body:
http://docs.python.org/reference/datamodel.html#object.__del__

According to this documentation the del() method is called on object destruction and you can at this point create a reference to the object to prevent it from being collected.  I am not sure how to do this, hopefully this gives you some food for thought.


问:
All divs has background blue.When I click on any div , background color has to change to red for only that div clicked & not others
But when you click on any one of div, the other divs remains blue and the clicked div has to changed to red only.How we implement using jquery ?

.blue {
    background:blue;
    width:100px;
    height:100px;
    display:inline-block;
    float:left;
    margin-right:20px;
}
```

<pre class="lang-html prettyprint-override"><code><!doctype html>
<html lang="en">
<body>
  <div id="test1" class="blue"></div>
  <div id="test2" class="blue"></div>
  <div id="test3" class="blue"></div>
</body>
</html>
</code>```

答:
You can use either-

```<code>$('div').click(function(){
 $('.blue').css("background", "blue");
 $(this).css("background","red");
</code>```

});

Or -

```<code>$('.blue').click(function(){
$('.blue').css("background", "blue");
$(this).css("background","red");
</code>```

});

It will change the color of the div on which you have clicked.

Body:
But when you click on any one of div, the other divs remains blue and the clicked div has to changed to red only.How we implement using jquery ?

.blue {
    background:blue;
    width:100px;
    height:100px;
    display:inline-block;
    float:left;
    margin-right:20px;
}

<!doctype html>

Body:
You can use either-

$('div').click(function(){
 $('.blue').css("background", "blue");
 $(this).css("background","red");

});

Or -

$('.blue').click(function(){
$('.blue').css("background", "blue");
$(this).css("background","red");

});

It will change the color of the div on which you have clicked.


问:
jasmine mockDate always one month off
I'm trying to use jasmine's mockDate() to write a time-relative unit test:

```<code>it("cookie_expiration() is 30 days out", function () {
    var baseTime = new Date(2016, 10, 1, 0, 0, 0, 0);
    jasmine.clock().mockDate(baseTime);
    console.info( new Date() );
    ...
});
</code>```

I think this is exactly what they show in the documentation but what I see in the console is: Tue Nov 01 2016 00:00:00 GMT-0700 (PDT)

```<code>"devDependencies": {
  "jasmine": "^2.5.3",
  "karma": "^1.5.0",
  "karma-chrome-launcher": "^2.0.0",
  "karma-jasmine": "^1.1.0",
  "karma-junit-reporter": "^1.2.0",
  "karma-phantomjs-launcher": "^1.0.4"
}
</code>```

答:
According to Date | MDN,

note that the month is 0-based

So, it's not an issue with jasmine's mockDate. It's the native Date.

Here's the snippet showing it's November :)

var baseTime = new Date(2016, 10, 1, 0, 0, 0, 0);
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

console.log("BaseTime month is " + monthNames[baseTime.getMonth()]);```

Title: jasmine mockDate always one month off

Body:
I'm trying to use jasmine's mockDate() to write a time-relative unit test:

it("cookie_expiration() is 30 days out", function () {
    var baseTime = new Date(2016, 10, 1, 0, 0, 0, 0);
    jasmine.clock().mockDate(baseTime);
    console.info( new Date() );
    ...
});

I think this is exactly what they show in the documentation but what I see in the console is: Tue Nov 01 2016 00:00:00 GMT-0700 (PDT)

"devDependencies": {
  "jasmine": "^2.5.3",
  "karma": "^1.5.0",
  "karma-chrome-launcher": "^2.0.0",
  "karma-jasmine": "^1.1.0",
  "karma-junit-reporter": "^1.2.0",
  "karma-phantomjs-launcher": "^1.0.4"
}


问:
Bootstrap table inside other table | Fix the height of table
I have little problem in my web page. I use bootstrap 4 and in table box I set  inside other table as in the picture below. How to make the height of table inside the same as the hieght of the box (td)?

html:

```<code><table class="table table-bordered">
   <tbody>
      <tr>
         <td>REVERT</td>
         <td>
            <table class="table" style="height: 100%">
               <tbody>
                  <tr>
                     <td>Name</td>
                     <td>LONG TEXT</td>
                  </tr>
               </tbody>
            </table>
         </td>
      </tr>
   </tbody>
</table>
</code>```

Browser:

答:
Because the table have CSS attribute margin-bottom: 20px, you need to add an override CSS to remove this attribute:

```<code><table class="table table-bordered">
   <tbody>
      <tr>
         <td>REVERT</td>
         <td>
            <table class="table table-no-margin" style="height: 100%">
               <tbody>
                  <tr>
                     <td>Name</td>
                     <td>LONG TEXT</td>
                  </tr>
               </tbody>
            </table>
         </td>
      </tr>
   </tbody>
</table>
<style>
    .table-no-margin { margin: 0 }
</style>
</code>```

Body:
I have little problem in my web page. I use bootstrap 4 and in table box I set  inside other table as in the picture below. How to make the height of table inside the same as the hieght of the box (td)?

html:

         REVERT

                     Name
                     LONG TEXT

Browser:

Body:
Because the table have CSS attribute margin-bottom: 20px, you need to add an override CSS to remove this attribute:

<table class="table table-bordered">
   <tbody>
      <tr>
         <td>REVERT</td>
         <td>
            <table class="table table-no-margin" style="height: 100%">
               <tbody>
                  <tr>
                     <td>Name</td>
                     <td>LONG TEXT</td>
                  </tr>
               </tbody>
            </table>
         </td>
      </tr>
   </tbody>
</table>
<style>
    .table-no-margin { margin: 0 }
</style>


问:
String formatting problem Java
im trying to format this string into a fixed column style but cant get it to work, heres my code, whats up?

```<code>System.out.format("%32s%10n%32s%10n%32s%10n", "Voter: " + e.voteNo + "Candidate: " + vote + "Booth: " + boothId);
</code>```

All variables are integers,

I want the output to be like

```
Voter: 1    Candidate: 0     Booth: 1
```

Thanks

答:
Please stop trying to program by accident. Your code looks like the glued-together parts of 3 different approaches to solving the issue. Try to read the documentation on the topic (JavaDoc is your friend!) and apply what you learned instead.

```<code>String result = String.format("Voter: %-10d Candidate: %-10d Booth: %-10d", e.voteNo, vote, boothId);
System.out.println(result);
</code>```

For more information on String.format check its JavaDoc.

Edit: apparently I didn't get the memo that there's actually a PrintStream.format, so you can actually write it like this:

```<code>System.out.format("Voter: %-10d Candidate: %-10d Booth: %-10d", e.voteNo, vote, boothId);
</code>```

Title: String formatting problem Java

Body:
im trying to format this string into a fixed column style but cant get it to work, heres my code, whats up?

System.out.format("%32s%10n%32s%10n%32s%10n", "Voter: " + e.voteNo + "Candidate: " + vote + "Booth: " + boothId);

All variables are integers,

I want the output to be like

Voter: 1    Candidate: 0     Booth: 1

Thanks

Body:
Please stop trying to program by accident. Your code looks like the glued-together parts of 3 different approaches to solving the issue. Try to read the documentation on the topic (JavaDoc is your friend!) and apply what you learned instead.

String result = String.format("Voter: %-10d Candidate: %-10d Booth: %-10d", e.voteNo, vote, boothId);
System.out.println(result);

For more information on String.format check its JavaDoc.

Edit: apparently I didn't get the memo that there's actually a PrintStream.format, so you can actually write it like this:

System.out.format("Voter: %-10d Candidate: %-10d Booth: %-10d", e.voteNo, vote, boothId);


问:
WebStorm unable to create Node.js Express App
I am getting the following error while trying to create a Node.js Express App:

Error creating Node.js Express App. Cannot find C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator5627\node_modules\express-generator\bin\express

I tried creating a new Node.js express app in Windows and Linux as well, but I am getting the exact same error every time in both the operating systems.
This is the log file of WebStorm running in Windows:

```<code>2017-04-01 02:45:45,619 [      0]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - IDE: WebStorm (build #WS-163.12024.17, 31 Jan 2017 19:45)
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - OS: Windows 10 (10.0, x86)
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - JRE: 1.8.0_112-release-408-b6 (JetBrains s.r.o)
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - JVM: 25.112-b6 (OpenJDK Server VM)
2017-04-01 02:45:45,666 [     47]   INFO -        #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx512m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djb.vmOptionsFile=C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\bin\webstorm.exe.vmoptions -Xbootclasspath/a:C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\lib\boot.jar -Didea.platform.prefix=WebStorm -Didea.paths.selector=WebStorm2016.3 -XX:ErrorFile=C:\Users\Trunapushpa\java_error_in_webstorm_%p.log -XX:HeapDumpPath=C:\Users\Trunapushpa\java_error_in_webstorm.hprof
2017-04-01 02:45:45,667 [     48]   INFO -        #com.intellij.idea.Main - ext: C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\jre\jre\lib\ext: [access-bridge-32.jar, access-bridge.jar, cldrdata.jar, dnsns.jar, jaccess.jar, jfxrt.jar, localedata.jar, meta-index, nashorn.jar, sunec.jar, sunjce_provider.jar, sunmscapi.jar, sunpkcs11.jar, zipfs.jar]
2017-04-01 02:45:45,667 [     48]   INFO -        #com.intellij.idea.Main - JNU charset: Cp1252
2017-04-01 02:45:45,732 [    113]   INFO -        #com.intellij.idea.Main - JNA library (32-bit) loaded in 65 ms
2017-04-01 02:45:45,735 [    116]   INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2017-04-01 02:45:45,736 [    117]   INFO -        #com.intellij.idea.Main - Using "FocusKiller" library to prevent focus stealing.
2017-04-01 02:45:45,746 [    127]   INFO -     #com.intellij.util.ui.JBUI - UI scale factor: 1.0
2017-04-01 02:45:51,478 [   5859]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor js-nashorn-support.xml
2017-04-01 02:45:51,618 [   5999]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor uml-properties-support.xml
2017-04-01 02:45:51,619 [   6000]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor uml-java-support.xml
2017-04-01 02:45:52,075 [   6456]   INFO - llij.ide.plugins.PluginManager - 55 plugins initialized in 886 ms
2017-04-01 02:45:52,092 [   6473]   INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: ASP (0.1), AngularJS (163.12024.17), CSS Support (163.12024.17), CVS Integration (11), CoffeeScript (2.0), Cucumber.js (0.1), Dart (163.12024.17), Docker integration (2.4.1), EJS (163.12024.17), EditorConfig (163.12024.17), File Watchers (163.12024.17), Gherkin (999.999), Git Integration (8.1), GitHub (163.12024.17), HAML (163.12024.17), HTML Tools (2.0), Handlebars/Mustache (163.12024.17), IDEA CORE (163.12024.17), IntelliLang (8.0), Java Server Pages (JSP) Integration (1.0), JavaScript Debugger (1.0), JavaScript Intention Power Pack (0.9.4), JavaScript Support (1.0), Karma (163.12024.17), LESS support (163.12024.17), LiveEdit (163.12024.17), Meteor (163.12024.17), Node.js Remote Interpreter (163.12024.17), NodeJS (163.12024.17), Perforce Integration (2.0), PhoneGap/Cordova Plugin (163.12024.17), Polymer & Web Components (999.999), Pug (ex-Jade) (163.12024.17), QuirksMode (163.12024.17), REST Client (163.12024.17), Refactor-X (2.01), Remote Hosts Access (0.1), SASS support (163.12024.17), SSH Remote Run (0.1), Settings Repository (163.12024.17), Spy-js (163.12024.17), Stylus support (999.999), Subversion Integration (1.1), Task Management (1.0), Terminal (0.1), TextMate bundles support (163.12024.17), Time Tracking (1.0), UML Support (1.0), Vagrant (0.6.VERSION), W3C Validators (2.0), XPathView + XSLT Support (4), XSLT-Debugger (1.4), YAML (163.12024.17), Yeoman (163.12024.17), hg4idea (10.0)
2017-04-01 02:45:52,770 [   7151]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=474
2017-04-01 02:45:52,800 [   7181]   INFO - pl.local.NativeFileWatcherImpl - Starting file watcher: C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\bin\fsnotifier.exe
2017-04-01 02:45:52,815 [   7196]   INFO - pl.local.NativeFileWatcherImpl - Native file watcher is operational.
2017-04-01 02:45:52,927 [   7308]   INFO - pi.util.registry.RegistryState - Registry values changed by user:
2017-04-01 02:45:52,927 [   7308]   INFO - pi.util.registry.RegistryState -   dumb.aware.run.configurations = true
2017-04-01 02:45:53,884 [   8265]   INFO - rains.ide.BuiltInServerManager - built-in server started, port 63342
2017-04-01 02:45:53,905 [   8286]   INFO - gs.impl.UpdateCheckerComponent - channel: release
2017-04-01 02:45:54,078 [   8459]   INFO - il.indexing.FileBasedIndexImpl - Index exts enumerated:65
2017-04-01 02:45:54,085 [   8466]   INFO - il.indexing.FileBasedIndexImpl - Index scheduled:7
2017-04-01 02:45:54,109 [   8490]   INFO - tellij.psi.stubs.StubIndexImpl - All stub exts enumerated:16
2017-04-01 02:45:54,109 [   8490]   INFO - tellij.psi.stubs.StubIndexImpl - stub exts update scheduled:0
2017-04-01 02:45:54,152 [   8533]   INFO - j.ide.script.IdeStartupScripts - 0 startup script(s) found
2017-04-01 02:45:54,273 [   8654]   INFO - plication.impl.ApplicationImpl - 80 application components initialized in 3088ms
2017-04-01 02:45:54,282 [   8663]   INFO - .intellij.idea.IdeaApplication - App initialization took 9647 ms
2017-04-01 02:45:55,494 [   9875]   INFO - pl$FileIndexDataInitialization - Initialization done:1407
2017-04-01 02:45:55,791 [  10172]   INFO - exImpl$StubIndexInitialization - Initialization done:297
2017-04-01 02:45:56,472 [  10853]   INFO - .openapi.application.Preloader - Finished preloading com.intellij.openapi.actionSystem.impl.ActionPreloader@191e350
2017-04-01 02:45:57,381 [  11762]   INFO - .openapi.application.Preloader - Finished preloading com.intellij.ide.ui.search.SearchableOptionPreloader@13fba
2017-04-01 02:45:57,443 [  11824]   INFO - ellij.project.impl.ProjectImpl - 104 project components initialized in 2111 ms
2017-04-01 02:45:57,519 [  11900]   INFO - le.impl.ModuleManagerComponent - 1 module(s) loaded in 65 ms
2017-04-01 02:45:57,610 [  11991]   INFO - .openapi.application.Preloader - Finished preloading com.intellij.codeInsight.completion.CompletionPreloader@10c5456
2017-04-01 02:45:58,072 [  12453]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 109ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:45:58,279 [  12660]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 205ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:45:58,448 [  12829]   INFO - tartup.impl.StartupManagerImpl - C:/Users/Trunapushpa/WebstormProjects/untitled1/.idea case-sensitivity: expected=false actual=false
2017-04-01 02:45:58,582 [  12963]   INFO - tor.impl.FileEditorManagerImpl - Project opening took 3660 ms
2017-04-01 02:52:54,045 [ 428426]   INFO - ellij.project.impl.ProjectImpl - 15 project components initialized in 17 ms
2017-04-01 02:52:54,046 [ 428427]   INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms
2017-04-01 02:53:03,054 [ 437435]   INFO - ellij.project.impl.ProjectImpl - 104 project components initialized in 33 ms
2017-04-01 02:53:03,055 [ 437436]   INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms
2017-04-01 02:53:03,077 [ 437458]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy
2017-04-01 02:53:03,077 [ 437458]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy in original object too
2017-04-01 02:53:03,328 [ 437709]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy
2017-04-01 02:53:03,328 [ 437709]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy in original object too
2017-04-01 02:53:03,420 [ 437801]   INFO - Tools.base.JsbtStartupActivity - Detecting buildfiles for com.intellij.lang.javascript.buildTools.grunt.GruntfileManager
2017-04-01 02:53:03,420 [ 437801]   INFO - Tools.base.JsbtStartupActivity - Detecting buildfiles for com.intellij.lang.javascript.buildTools.gulp.GulpfileManager
2017-04-01 02:53:03,421 [ 437802]   INFO - Tools.base.JsbtStartupActivity - Detecting buildfiles for com.intellij.lang.javascript.buildTools.npm.PackageJsonFileManager
2017-04-01 02:53:03,423 [ 437804]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 7ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:53:03,429 [ 437810]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 6ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:53:03,449 [ 437830]   INFO - xpress.ExpressProjectGenerator - Running '"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install express-generator@4.15.0' in C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2
2017-04-01 02:53:06,268 [ 440649]   INFO - xpress.ExpressProjectGenerator - stdout: C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2
`-- express-generator@4.15.0
  +-- commander@2.9.0
  | `-- graceful-readlink@1.0.1
  +-- ejs@2.5.6
  +-- mkdirp@0.5.1
  | `-- minimist@0.0.8
  `-- sorted-object@2.0.1
2017-04-01 02:53:06,268 [ 440649]   INFO - xpress.ExpressProjectGenerator - stderr: npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2\package.json'
npm WARN intellij-express-generator2 No description
npm WARN intellij-express-generator2 No repository field.
npm WARN intellij-express-generator2 No README data
npm WARN intellij-express-generator2 No license field.
2017-04-01 02:53:06,270 [ 440651]   WARN - xpress.ExpressProjectGenerator - Cannot find C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2\node_modules\express-generator\bin\express
com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator$GeneratorException: Cannot find C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2\node_modules\express-generator\bin\express
    at com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator.generateExpressApp(ExpressProjectGenerator.java:205)
    at com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator.generateProject(ExpressProjectGenerator.java:86)
    at com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator.generateProject(ExpressProjectGenerator.java:53)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep.a(AbstractNewProjectStep.java:218)
    at com.intellij.platform.PlatformProjectOpenProcessor.doOpenProject(PlatformProjectOpenProcessor.java:234)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep.doGenerateProject(AbstractNewProjectStep.java:222)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep$AbstractCallback.consume(AbstractNewProjectStep.java:162)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep$AbstractCallback.consume(AbstractNewProjectStep.java:155)
    at com.intellij.ide.util.projectWizard.ProjectSettingsStepBase$1.a(ProjectSettingsStepBase.java:131)
    at com.intellij.openapi.project.DumbPermissionServiceImpl.allowStartingDumbModeInside(DumbPermissionServiceImpl.java:37)
    at com.intellij.openapi.project.DumbService.allowStartingDumbModeInside(DumbService.java:294)
    at com.intellij.ide.util.projectWizard.ProjectSettingsStepBase$1.actionPerformed(ProjectSettingsStepBase.java:130)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swin
</code>```

答:
The issue is caused by recent changes in express-generator structure: express.js has been renamed to express-cli.js

To Fix

1.npm install -g express-generator

express project_name

cd project_name, npm install

in webstorm, File | open, choose project_name folder

Body:
I am getting the following error while trying to create a Node.js Express App:

Error creating Node.js Express App. Cannot find C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator5627\node_modules\express-generator\bin\express

I tried creating a new Node.js express app in Windows and Linux as well, but I am getting the exact same error every time in both the operating systems.
This is the log file of WebStorm running in Windows:

2017-04-01 02:45:45,619 [      0]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - IDE: WebStorm (build #WS-163.12024.17, 31 Jan 2017 19:45)
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - OS: Windows 10 (10.0, x86)
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - JRE: 1.8.0_112-release-408-b6 (JetBrains s.r.o)
2017-04-01 02:45:45,664 [     45]   INFO -        #com.intellij.idea.Main - JVM: 25.112-b6 (OpenJDK Server VM)
2017-04-01 02:45:45,666 [     47]   INFO -        #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx512m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djb.vmOptionsFile=C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\bin\webstorm.exe.vmoptions -Xbootclasspath/a:C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\lib\boot.jar -Didea.platform.prefix=WebStorm -Didea.paths.selector=WebStorm2016.3 -XX:ErrorFile=C:\Users\Trunapushpa\java_error_in_webstorm_%p.log -XX:HeapDumpPath=C:\Users\Trunapushpa\java_error_in_webstorm.hprof
2017-04-01 02:45:45,667 [     48]   INFO -        #com.intellij.idea.Main - ext: C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\jre\jre\lib\ext: [access-bridge-32.jar, access-bridge.jar, cldrdata.jar, dnsns.jar, jaccess.jar, jfxrt.jar, localedata.jar, meta-index, nashorn.jar, sunec.jar, sunjce_provider.jar, sunmscapi.jar, sunpkcs11.jar, zipfs.jar]
2017-04-01 02:45:45,667 [     48]   INFO -        #com.intellij.idea.Main - JNU charset: Cp1252
2017-04-01 02:45:45,732 [    113]   INFO -        #com.intellij.idea.Main - JNA library (32-bit) loaded in 65 ms
2017-04-01 02:45:45,735 [    116]   INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2017-04-01 02:45:45,736 [    117]   INFO -        #com.intellij.idea.Main - Using "FocusKiller" library to prevent focus stealing.
2017-04-01 02:45:45,746 [    127]   INFO -     #com.intellij.util.ui.JBUI - UI scale factor: 1.0
2017-04-01 02:45:51,478 [   5859]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor js-nashorn-support.xml
2017-04-01 02:45:51,618 [   5999]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor uml-properties-support.xml
2017-04-01 02:45:51,619 [   6000]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor uml-java-support.xml
2017-04-01 02:45:52,075 [   6456]   INFO - llij.ide.plugins.PluginManager - 55 plugins initialized in 886 ms
2017-04-01 02:45:52,092 [   6473]   INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: ASP (0.1), AngularJS (163.12024.17), CSS Support (163.12024.17), CVS Integration (11), CoffeeScript (2.0), Cucumber.js (0.1), Dart (163.12024.17), Docker integration (2.4.1), EJS (163.12024.17), EditorConfig (163.12024.17), File Watchers (163.12024.17), Gherkin (999.999), Git Integration (8.1), GitHub (163.12024.17), HAML (163.12024.17), HTML Tools (2.0), Handlebars/Mustache (163.12024.17), IDEA CORE (163.12024.17), IntelliLang (8.0), Java Server Pages (JSP) Integration (1.0), JavaScript Debugger (1.0), JavaScript Intention Power Pack (0.9.4), JavaScript Support (1.0), Karma (163.12024.17), LESS support (163.12024.17), LiveEdit (163.12024.17), Meteor (163.12024.17), Node.js Remote Interpreter (163.12024.17), NodeJS (163.12024.17), Perforce Integration (2.0), PhoneGap/Cordova Plugin (163.12024.17), Polymer & Web Components (999.999), Pug (ex-Jade) (163.12024.17), QuirksMode (163.12024.17), REST Client (163.12024.17), Refactor-X (2.01), Remote Hosts Access (0.1), SASS support (163.12024.17), SSH Remote Run (0.1), Settings Repository (163.12024.17), Spy-js (163.12024.17), Stylus support (999.999), Subversion Integration (1.1), Task Management (1.0), Terminal (0.1), TextMate bundles support (163.12024.17), Time Tracking (1.0), UML Support (1.0), Vagrant (0.6.VERSION), W3C Validators (2.0), XPathView + XSLT Support (4), XSLT-Debugger (1.4), YAML (163.12024.17), Yeoman (163.12024.17), hg4idea (10.0)
2017-04-01 02:45:52,770 [   7151]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=474
2017-04-01 02:45:52,800 [   7181]   INFO - pl.local.NativeFileWatcherImpl - Starting file watcher: C:\Program Files (x86)\JetBrains\WebStorm 2016.3.3\bin\fsnotifier.exe
2017-04-01 02:45:52,815 [   7196]   INFO - pl.local.NativeFileWatcherImpl - Native file watcher is operational.
2017-04-01 02:45:52,927 [   7308]   INFO - pi.util.registry.RegistryState - Registry values changed by user:
2017-04-01 02:45:52,927 [   7308]   INFO - pi.util.registry.RegistryState -   dumb.aware.run.configurations = true
2017-04-01 02:45:53,884 [   8265]   INFO - rains.ide.BuiltInServerManager - built-in server started, port 63342
2017-04-01 02:45:53,905 [   8286]   INFO - gs.impl.UpdateCheckerComponent - channel: release
2017-04-01 02:45:54,078 [   8459]   INFO - il.indexing.FileBasedIndexImpl - Index exts enumerated:65
2017-04-01 02:45:54,085 [   8466]   INFO - il.indexing.FileBasedIndexImpl - Index scheduled:7
2017-04-01 02:45:54,109 [   8490]   INFO - tellij.psi.stubs.StubIndexImpl - All stub exts enumerated:16
2017-04-01 02:45:54,109 [   8490]   INFO - tellij.psi.stubs.StubIndexImpl - stub exts update scheduled:0
2017-04-01 02:45:54,152 [   8533]   INFO - j.ide.script.IdeStartupScripts - 0 startup script(s) found
2017-04-01 02:45:54,273 [   8654]   INFO - plication.impl.ApplicationImpl - 80 application components initialized in 3088ms
2017-04-01 02:45:54,282 [   8663]   INFO - .intellij.idea.IdeaApplication - App initialization took 9647 ms
2017-04-01 02:45:55,494 [   9875]   INFO - pl$FileIndexDataInitialization - Initialization done:1407
2017-04-01 02:45:55,791 [  10172]   INFO - exImpl$StubIndexInitialization - Initialization done:297
2017-04-01 02:45:56,472 [  10853]   INFO - .openapi.application.Preloader - Finished preloading com.intellij.openapi.actionSystem.impl.ActionPreloader@191e350
2017-04-01 02:45:57,381 [  11762]   INFO - .openapi.application.Preloader - Finished preloading com.intellij.ide.ui.search.SearchableOptionPreloader@13fba
2017-04-01 02:45:57,443 [  11824]   INFO - ellij.project.impl.ProjectImpl - 104 project components initialized in 2111 ms
2017-04-01 02:45:57,519 [  11900]   INFO - le.impl.ModuleManagerComponent - 1 module(s) loaded in 65 ms
2017-04-01 02:45:57,610 [  11991]   INFO - .openapi.application.Preloader - Finished preloading com.intellij.codeInsight.completion.CompletionPreloader@10c5456
2017-04-01 02:45:58,072 [  12453]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 109ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:45:58,279 [  12660]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 205ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:45:58,448 [  12829]   INFO - tartup.impl.StartupManagerImpl - C:/Users/Trunapushpa/WebstormProjects/untitled1/.idea case-sensitivity: expected=false actual=false
2017-04-01 02:45:58,582 [  12963]   INFO - tor.impl.FileEditorManagerImpl - Project opening took 3660 ms
2017-04-01 02:52:54,045 [ 428426]   INFO - ellij.project.impl.ProjectImpl - 15 project components initialized in 17 ms
2017-04-01 02:52:54,046 [ 428427]   INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms
2017-04-01 02:53:03,054 [ 437435]   INFO - ellij.project.impl.ProjectImpl - 104 project components initialized in 33 ms
2017-04-01 02:53:03,055 [ 437436]   INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms
2017-04-01 02:53:03,077 [ 437458]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy
2017-04-01 02:53:03,077 [ 437458]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy in original object too
2017-04-01 02:53:03,328 [ 437709]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy
2017-04-01 02:53:03,328 [ 437709]   INFO - i.vcs.changes.ChangeListWorker - default list not found when copy in original object too
2017-04-01 02:53:03,420 [ 437801]   INFO - Tools.base.JsbtStartupActivity - Detecting buildfiles for com.intellij.lang.javascript.buildTools.grunt.GruntfileManager
2017-04-01 02:53:03,420 [ 437801]   INFO - Tools.base.JsbtStartupActivity - Detecting buildfiles for com.intellij.lang.javascript.buildTools.gulp.GulpfileManager
2017-04-01 02:53:03,421 [ 437802]   INFO - Tools.base.JsbtStartupActivity - Detecting buildfiles for com.intellij.lang.javascript.buildTools.npm.PackageJsonFileManager
2017-04-01 02:53:03,423 [ 437804]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 7ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:53:03,429 [ 437810]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 6ms; general responsiveness: ok; EDT responsiveness: ok
2017-04-01 02:53:03,449 [ 437830]   INFO - xpress.ExpressProjectGenerator - Running '"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install express-generator@4.15.0' in C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2
2017-04-01 02:53:06,268 [ 440649]   INFO - xpress.ExpressProjectGenerator - stdout: C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2
`-- express-generator@4.15.0
  +-- commander@2.9.0
  | `-- graceful-readlink@1.0.1
  +-- ejs@2.5.6
  +-- mkdirp@0.5.1
  | `-- minimist@0.0.8
  `-- sorted-object@2.0.1
2017-04-01 02:53:06,268 [ 440649]   INFO - xpress.ExpressProjectGenerator - stderr: npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2\package.json'
npm WARN intellij-express-generator2 No description
npm WARN intellij-express-generator2 No repository field.
npm WARN intellij-express-generator2 No README data
npm WARN intellij-express-generator2 No license field.
2017-04-01 02:53:06,270 [ 440651]   WARN - xpress.ExpressProjectGenerator - Cannot find C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2\node_modules\express-generator\bin\express
com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator$GeneratorException: Cannot find C:\Users\Trunapushpa\AppData\Local\Temp\intellij-express-generator2\node_modules\express-generator\bin\express
    at com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator.generateExpressApp(ExpressProjectGenerator.java:205)
    at com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator.generateProject(ExpressProjectGenerator.java:86)
    at com.jetbrains.nodejs.boilerplate.express.ExpressProjectGenerator.generateProject(ExpressProjectGenerator.java:53)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep.a(AbstractNewProjectStep.java:218)
    at com.intellij.platform.PlatformProjectOpenProcessor.doOpenProject(PlatformProjectOpenProcessor.java:234)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep.doGenerateProject(AbstractNewProjectStep.java:222)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep$AbstractCallback.consume(AbstractNewProjectStep.java:162)
    at com.intellij.ide.util.projectWizard.AbstractNewProjectStep$AbstractCallback.consume(AbstractNewProjectStep.java:155)
    at com.intellij.ide.util.projectWizard.ProjectSettingsStepBase$1.a(ProjectSettingsStepBase.java:131)
    at com.intellij.openapi.project.DumbPermissionServiceImpl.allowStartingDumbModeInside(DumbPermissionServiceImpl.java:37)
    at com.intellij.openapi.project.DumbService.allowStartingDumbModeInside(DumbService.java:294)
    at com.intellij.ide.util.projectWizard.ProjectSettingsStepBase$1.actionPerformed(ProjectSettingsStepBase.java:130)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swin


问:
Sending user to a new page after submission
After submitting a new Episode entity I need my user to be sent back to the dashboard - ie /dashboard

I have tried

```<code>return /dashboard
</code>```

but that simply sent the template to the browser without any data.

My controller looks like this:

```<code>public class formController {

private EpisodeRepository episodeRepository;

@Autowired
public void setEpisodeRepository(EpisodeRepository episodeRepository) {
    this.episodeRepository = episodeRepository;
}

@GetMapping("/newEpisode")
public String episodeForm(Model model) {
    model.addAttribute("episode", new Episode());
    return "episode";
}

@PostMapping("/newEpisode")
public String episodeSubmit(@ModelAttribute Episode episode) {
    episodeRepository.save(episode);
    return "dashboard";
}

@GetMapping("/dashboard")
public String dashboard(Model model) {
    List<Episode>listEpisodes = new ArrayList<>();
    episodeRepository.findAll().forEach((episode) -> {
        listEpisodes.add(episode);
            });
    System.out.println(listEpisodes.size());
    model.addAttribute("episodes", listEpisodes);
    return "dashboard";
}

@GetMapping("/event/{eventno}")
public String findEvent(@PathVariable String eventno, Model model) {
    Episode episode = new Episode();
    episode = episodeRepository.findByeventno(eventno);
    System.out.println("Printing the values held in episode for one get: " +eventno);
    model.addAttribute("episode", episode);
    return "episode";
    }
}
</code>```

And the relevant part of the html

```<code><form id="form" class="form-horizontal" method="post" action="#" th:action="@{/newEpisode}" th:object="${episode}">
</code>```

答:
And the answer is:</p>

```<code>    @PostMapping("newEpisode")
public String episodeSubmit(@ModelAttribute Episode episode) {
    episodeRepository.save(episode);
    return "redirect:/dashboard";
}
</code>```

Body:
After submitting a new Episode entity I need my user to be sent back to the dashboard - ie /dashboard

I have tried

return /dashboard

but that simply sent the template to the browser without any data.

My controller looks like this:

public class formController {

private EpisodeRepository episodeRepository;

@Autowired
public void setEpisodeRepository(EpisodeRepository episodeRepository) {
    this.episodeRepository = episodeRepository;
}

@GetMapping("/newEpisode")
public String episodeForm(Model model) {
    model.addAttribute("episode", new Episode());
    return "episode";
}

@PostMapping("/newEpisode")
public String episodeSubmit(@ModelAttribute Episode episode) {
    episodeRepository.save(episode);
    return "dashboard";
}

@GetMapping("/dashboard")
public String dashboard(Model model) {
    List<Episode>listEpisodes = new ArrayList<>();
    episodeRepository.findAll().forEach((episode) -> {
        listEpisodes.add(episode);
            });
    System.out.println(listEpisodes.size());
    model.addAttribute("episodes", listEpisodes);
    return "dashboard";
}

@GetMapping("/event/{eventno}")
public String findEvent(@PathVariable String eventno, Model model) {
    Episode episode = new Episode();
    episode = episodeRepository.findByeventno(eventno);
    System.out.println("Printing the values held in episode for one get: " +eventno);
    model.addAttribute("episode", episode);
    return "episode";
    }
}

And the relevant part of the html

<form id="form" class="form-horizontal" method="post" action="#" th:action="@{/newEpisode}" th:object="${episode}">

Body:
And the answer is:

    @PostMapping("newEpisode")
public String episodeSubmit(@ModelAttribute Episode episode) {
    episodeRepository.save(episode);
    return "redirect:/dashboard";
}


问:
implement sound in Qt Creator
I start to work with Qt Creator and I would develop a base program that when I push a button, a song start.
I have already managed the button.
May you recommend me the main command that I could use when I include QSound?

答:
To run a music you can:

Create a _player = new QMediaPlayer(this);

Get the file to read QUrl file = QUrl::fromLocalFile(QFileDialog::getOpenFileName(this, tr("Open Music"), "", tr("")));

Set the file to read in the media player _player->setMedia(file);

Set the default volume _player->setVolume(50);

Start the music _player->play();

In your case, the only thing you should change is to don't start the music directly and write a slot for your button. When you are in the slot, call _player->play();

Title: implement sound in Qt Creator


问:
How to set focus to right of text in EditText for android?
In my application when users click or touch on the Edit Text view the focus is sometimes set to the beginning. For example if the existing text is "Hi". Users wants to click on it and change it to "H1 How are you?" by adding the text "How are you?". But since the focus is in the beginning, it becomes "How are you?Hi". So I always want to set to focus to the right most of the text when selected. How do I do this. Please let me know with some sample if possible. Thank you for your time and help. </p>

答:
```<code>   public void ontextchangelistner(){

     if(s.toString().startsWith("0")) {
        if (s.length() == 2) {
            if (s.toString().contains("00")) {

                editText.setText(s.toString().substring(1));
                int pos = editText.getText().length();
                editText.setSelection(pos);
            }
        }
   }
</code>```

If you enter first time zero in edit text, it shows; but in second time pressing zero, this zero is not shown.
I hope it will help you.

Body:
   public void ontextchangelistner(){

     if(s.toString().startsWith("0")) {
        if (s.length() == 2) {
            if (s.toString().contains("00")) {

                editText.setText(s.toString().substring(1));
                int pos = editText.getText().length();
                editText.setSelection(pos);
            }
        }
   }

If you enter first time zero in edit text, it shows; but in second time pressing zero, this zero is not shown.
I hope it will help you.


问:
Web API 2 documentation with Swagger and FluentValidation
We are developing web api using web api 2 and fluent validation. Everything is working fine.

However, we realize the rules we define in fluent validation is not getting respect by the swagger (Swashbuckle).

For example

```<code>Class Customer {
    public string Name {get;set;}
}
</code>```

If I define the name as required field in the fluent validator, the property is marked as optional in the api. I know we can make that work by using .net annotation attribute. But we don't want to separate the validation logic (some of the logic are not easy to do in .net annotation.

Any comment on that will be appreciated.

答:
You can include your Fluent Validation rules to Swagger documentation by adding a custom SchemaFilter to your Swagger configuration.

Add the below code to the SwaggerConfig.cs file:

c.SchemaFilter<FluentValidationRules>();
```

<p>And inherit <code>ISchemaFilter</code> using the code below:</p>

<pre class="lang-cs prettyprint-override"><code>public class FluentValidationRules : ISchemaFilter
{
    public void Apply(Schema schema, SchemaRegistry schemaRegistry, Type type)
    {
        var validator = new Customer(); //Your fluent validator class

        schema.required = new List<string>();

        var validatorDescriptor = validator.CreateDescriptor();

        foreach (var key in schema.properties.Keys)
        {
            foreach (var validatorType in validatorDescriptor.GetValidatorsForMember(key))
            {
                if (validatorType is NotEmptyValidator)
                {
                    schema.required.Add(key);
                }
            }
        }
    }
}
</code>```

Body:
We are developing web api using web api 2 and fluent validation. Everything is working fine.

However, we realize the rules we define in fluent validation is not getting respect by the swagger (Swashbuckle).

For example

Class Customer {
    public string Name {get;set;}
}

If I define the name as required field in the fluent validator, the property is marked as optional in the api. I know we can make that work by using .net annotation attribute. But we don't want to separate the validation logic (some of the logic are not easy to do in .net annotation.

Any comment on that will be appreciated.

Body:
You can include your Fluent Validation rules to Swagger documentation by adding a custom SchemaFilter to your Swagger configuration.

Add the below code to the SwaggerConfig.cs file:

c.SchemaFilter<FluentValidationRules>();

And inherit ISchemaFilter using the code below:

public class FluentValidationRules : ISchemaFilter
{
    public void Apply(Schema schema, SchemaRegistry schemaRegistry, Type type)
    {
        var validator = new Customer(); //Your fluent validator class

        schema.required = new List<string>();

        var validatorDescriptor = validator.CreateDescriptor();

        foreach (var key in schema.properties.Keys)
        {
            foreach (var validatorType in validatorDescriptor.GetValidatorsForMember(key))
            {
                if (validatorType is NotEmptyValidator)
                {
                    schema.required.Add(key);
                }
            }
        }
    }
}


问:
How to create plugins in swift
I found article describing how to create plugin using Swift and Cocoa. It uses NSBundle to load plugin, but that, as far as I know, is not available in pure swift (no Cocoa). Is there way how to achieve same result without using Cocoa?

More info:

In case it's relevant, here is what I want to achieve. I create app in swift that runs on linux server. User can connect to it using their browser. I want to be able to have other people write "plugins" that will implement functionality itself (what user can see and do once they connect), from printing out hello world, through chat programs to games without having to worry about low level stuff provided by my app. Some sort of dll, that my server application loads and runs.

答:
What you will want to do is create a folder your program will look in.  Let's say it's called 'plugins'.  It should make a list of names from the files in there, and then iterate through using them, passing parameters to the files and getting the output and making use of that in some way.

Activating a program and getting output:

```<code>func runCommand(cmd : String, args : String...) -> (output: [String], error: [String], exitCode: Int32) {

    var output : [String] = []
    var error : [String] = []

    let task = Process()
    task.launchPath = cmd
    task.arguments = args

    let outpipe = Pipe()
    task.standardOutput = outpipe
    let errpipe = Pipe()
    task.standardError = errpipe

    task.launch()

    let outdata = outpipe.fileHandleForReading.readDataToEndOfFile()
    if var string = String(data: outdata, encoding: .utf8) {
        string = string.trimmingCharacters(in: .newlines)
        output = string.components(separatedBy: "\n")
    }

    let errdata = errpipe.fileHandleForReading.readDataToEndOfFile()
    if var string = String(data: errdata, encoding: .utf8) {
        string = string.trimmingCharacters(in: .newlines)
        error = string.components(separatedBy: "\n")
    }

    task.waitUntilExit()
    let status = task.terminationStatus

    return (output, error, status)
}
</code>```

`

Here is how a swift plugin would accept arguments:

```<code>    for i in 1..C_ARGC {
    let index = Int(i);

    let arg = String.fromCString(C_ARGV[index])
       switch arg {
        case 1:
            println("1");

        case 2:
            println("2")

        default:
            println("3)
       }
    }
</code>```

So once you have the program and plugin communicating you just have to add handling in your program based on the output so the plugins output can do something meaningful.  Without cocoa libraries this seems the way to go, though if you use C there are a couple of other options available there as well.  Hope this helps.

Title: How to create plugins in swift

Body:
What you will want to do is create a folder your program will look in.  Let's say it's called 'plugins'.  It should make a list of names from the files in there, and then iterate through using them, passing parameters to the files and getting the output and making use of that in some way.

Activating a program and getting output:

func runCommand(cmd : String, args : String...) -> (output: [String], error: [String], exitCode: Int32) {

    var output : [String] = []
    var error : [String] = []

    let task = Process()
    task.launchPath = cmd
    task.arguments = args

    let outpipe = Pipe()
    task.standardOutput = outpipe
    let errpipe = Pipe()
    task.standardError = errpipe

    task.launch()

    let outdata = outpipe.fileHandleForReading.readDataToEndOfFile()
    if var string = String(data: outdata, encoding: .utf8) {
        string = string.trimmingCharacters(in: .newlines)
        output = string.components(separatedBy: "\n")
    }

    let errdata = errpipe.fileHandleForReading.readDataToEndOfFile()
    if var string = String(data: errdata, encoding: .utf8) {
        string = string.trimmingCharacters(in: .newlines)
        error = string.components(separatedBy: "\n")
    }

    task.waitUntilExit()
    let status = task.terminationStatus

    return (output, error, status)
}

`

Here is how a swift plugin would accept arguments:

    for i in 1..C_ARGC {
    let index = Int(i);

    let arg = String.fromCString(C_ARGV[index])
       switch arg {
        case 1:
            println("1");

        case 2:
            println("2")

        default:
            println("3)
       }
    }

So once you have the program and plugin communicating you just have to add handling in your program based on the output so the plugins output can do something meaningful.  Without cocoa libraries this seems the way to go, though if you use C there are a couple of other options available there as well.  Hope this helps.


问:
How can i disable the tooltip from the TreeView control?
I didn't add any tooltips to the control. Not in designer not in the code.
But on some items in the TreeView when i put the mouse on the item i see like a tooltip window message of the item name.

Can't figure out why there is a tooltip on some items.

The only event i have register on the TreeView control in the designer is AfterSelect.

```<code>private void tvFolders_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
    //Populate folders and files when a folder is selected
    this.Cursor = Cursors.WaitCursor;

    //get current selected drive or folder
    TreeNode nodeCurrent = e.Node;

    //clear all sub-folders
    nodeCurrent.Nodes.Clear();

    if (nodeCurrent.SelectedImageIndex == 0)
    {
        //Selected My Computer - repopulate drive list
        PopulateDriveList();
    }
    else
    {
        //populate sub-folders and folder files
        PopulateDirectory(nodeCurrent, nodeCurrent.Nodes);
    }
    this.Cursor = Cursors.Default;
}
</code>```

In the designer

```<code>this.tvFolders.Dock = System.Windows.Forms.DockStyle.Left;
this.tvFolders.ImageIndex = 0;
this.tvFolders.ImageList = this.m_imageListTreeView;
this.tvFolders.Location = new System.Drawing.Point(0, 0);
this.tvFolders.Name = "tvFolders";
this.tvFolders.SelectedImageIndex = 0;
this.tvFolders.Size = new System.Drawing.Size(168, 357);
this.tvFolders.TabIndex = 2;
this.tvFolders.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvFolders_AfterSelect);
//
// m_imageListTreeView
//
this.m_imageListTreeView.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_imageListTreeView.ImageStream")));
this.m_imageListTreeView.TransparentColor = System.Drawing.Color.Transparent;
this.m_imageListTreeView.Images.SetKeyName(0, "");
this.m_imageListTreeView.Images.SetKeyName(1, "");
this.m_imageListTreeView.Images.SetKeyName(2, "");
this.m_imageListTreeView.Images.SetKeyName(3, "");
this.m_imageListTreeView.Images.SetKeyName(4, "");
this.m_imageListTreeView.Images.SetKeyName(5, "");
this.m_imageListTreeView.Images.SetKeyName(6, "");
this.m_imageListTreeView.Images.SetKeyName(7, "");
this.m_imageListTreeView.Images.SetKeyName(8, "");
</code>```

I do want to make that when i move the mouse over an item in the TreeView(tvFolders) it will show a tooltip message.

Why it's showing on some items tooltips messages and i didn't add any ?

How to make that when i move the mouse over an item in the TreeView it will show a tooltip message with the item name ?

答:
To disable the automatic tooltip, you need to add a new class file to your project with an override code as follows.

```<code>using System.Windows.Forms;

public class MyTreeView : TreeView {
  protected override CreateParams CreateParams {
    get {
      CreateParams parms = base.CreateParams;
      parms.Style |= 0x80;  // Turn on TVS_NOTOOLTIPS
      return parms;
    }
  }
}
</code>```

Then you need to build it. After that you will have a new control, a "MyTreeView" control in the toolbox to use.

You need to simply change the declaration in your designer class to use the custom TreeView:

```<code>this.tvFolders = new MyTreeView();
</code>```

To answer your questions:

The treeview control by default automatically adds a tooltip for long names that do not fit within the boundaries of the control.

To force the tooltip to show on each item, you can simply use the Node.ToolTipText property.

Source: this on MSDN

Body:
I didn't add any tooltips to the control. Not in designer not in the code.
But on some items in the TreeView when i put the mouse on the item i see like a tooltip window message of the item name.

Can't figure out why there is a tooltip on some items.

The only event i have register on the TreeView control in the designer is AfterSelect.

private void tvFolders_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
    //Populate folders and files when a folder is selected
    this.Cursor = Cursors.WaitCursor;

    //get current selected drive or folder
    TreeNode nodeCurrent = e.Node;

    //clear all sub-folders
    nodeCurrent.Nodes.Clear();

    if (nodeCurrent.SelectedImageIndex == 0)
    {
        //Selected My Computer - repopulate drive list
        PopulateDriveList();
    }
    else
    {
        //populate sub-folders and folder files
        PopulateDirectory(nodeCurrent, nodeCurrent.Nodes);
    }
    this.Cursor = Cursors.Default;
}

In the designer

this.tvFolders.Dock = System.Windows.Forms.DockStyle.Left;
this.tvFolders.ImageIndex = 0;
this.tvFolders.ImageList = this.m_imageListTreeView;
this.tvFolders.Location = new System.Drawing.Point(0, 0);
this.tvFolders.Name = "tvFolders";
this.tvFolders.SelectedImageIndex = 0;
this.tvFolders.Size = new System.Drawing.Size(168, 357);
this.tvFolders.TabIndex = 2;
this.tvFolders.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvFolders_AfterSelect);
//
// m_imageListTreeView
//
this.m_imageListTreeView.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_imageListTreeView.ImageStream")));
this.m_imageListTreeView.TransparentColor = System.Drawing.Color.Transparent;
this.m_imageListTreeView.Images.SetKeyName(0, "");
this.m_imageListTreeView.Images.SetKeyName(1, "");
this.m_imageListTreeView.Images.SetKeyName(2, "");
this.m_imageListTreeView.Images.SetKeyName(3, "");
this.m_imageListTreeView.Images.SetKeyName(4, "");
this.m_imageListTreeView.Images.SetKeyName(5, "");
this.m_imageListTreeView.Images.SetKeyName(6, "");
this.m_imageListTreeView.Images.SetKeyName(7, "");
this.m_imageListTreeView.Images.SetKeyName(8, "");

I do want to make that when i move the mouse over an item in the TreeView(tvFolders) it will show a tooltip message.

Why it's showing on some items tooltips messages and i didn't add any ?

How to make that when i move the mouse over an item in the TreeView it will show a tooltip message with the item name ?

Body:
To disable the automatic tooltip, you need to add a new class file to your project with an override code as follows.

using System.Windows.Forms;

public class MyTreeView : TreeView {
  protected override CreateParams CreateParams {
    get {
      CreateParams parms = base.CreateParams;
      parms.Style |= 0x80;  // Turn on TVS_NOTOOLTIPS
      return parms;
    }
  }
}

Then you need to build it. After that you will have a new control, a "MyTreeView" control in the toolbox to use.

You need to simply change the declaration in your designer class to use the custom TreeView:

this.tvFolders = new MyTreeView();

To answer your questions:

The treeview control by default automatically adds a tooltip for long names that do not fit within the boundaries of the control.

To force the tooltip to show on each item, you can simply use the Node.ToolTipText property.

Source: this on MSDN


问:
How to use vector of vector for reading a graph?
```<code>#include <iostream>
#include <vector>
using namespace std;
void addEdge( vector<vector<int> > adj, int, int);
void print_graph(vector<vector<int> > adj);

int main()
{

    vector<vector<int> > adj(4);
    addEdge(adj,1,2);     // edge from node 1 to node 2
    addEdge(adj,1,3);
    addEdge(adj,1,4);
    addEdge(adj,2,3);
    addEdge(adj,3,4);
    print_graph(adj);
    return 0;
}

void addEdge(vector<vector<int> > adj, int u , int v)
{
    adj[u].push_back(v);

}

void print_graph( vector<vector<int> > adj)
{
    for( int i = 0; i < adj.size() ; i++ )
    {
        for( int j = 0 ; j < adj[i].size(); j++ )
        {
            cout<< i+1 << " , " << cout<< adj[i][j]<<endl;
        }
    }
}
</code>```

I have written the code for reading the graph and printing it.

Prior to this for reading graph I used to use

```<code>vector<int>adj[5];
</code>```

But I have been told that , use

```<code>`vector<vector<int> > adj`  or `list<list<int> > adj`
</code>```

I tried but now I am getting No output.    ( update)

Can anyone help me in using vector of vector ?? Please help for list of list also.

答:
When you create the vector adj, you have an empty vector. In your function addEdge, you access the entry at index u in adj. But remember, that is an empty vector. This is where your crash comes from.

I assume your function addEdge is supposed to add an entry to this adjacency matrix you are creating. Before that, you need to create space for that matrix. Meaning, you need to make space in your adj vector for the vectors it will contain, and you also need to make space in those vectors where you can put the edge information.

Once you have your vectors set up though, your print function will still print all 0's because your function addEdge makes a copy of the vector you are passing, then writes to that copy. The original adj vector will be unchanged. Be sure to pass the vector by pointer if you want to modify the original.

Body:
#include <iostream>
#include <vector>
using namespace std;
void addEdge( vector<vector<int> > adj, int, int);
void print_graph(vector<vector<int> > adj);

int main()
{

    vector<vector<int> > adj(4);
    addEdge(adj,1,2);     // edge from node 1 to node 2
    addEdge(adj,1,3);
    addEdge(adj,1,4);
    addEdge(adj,2,3);
    addEdge(adj,3,4);
    print_graph(adj);
    return 0;
}

void addEdge(vector<vector<int> > adj, int u , int v)
{
    adj[u].push_back(v);

}

void print_graph( vector<vector<int> > adj)
{
    for( int i = 0; i < adj.size() ; i++ )
    {
        for( int j = 0 ; j < adj[i].size(); j++ )
        {
            cout<< i+1 << " , " << cout<< adj[i][j]<<endl;
        }
    }
}

I have written the code for reading the graph and printing it.

Prior to this for reading graph I used to use

vector<int>adj[5];

But I have been told that , use

`vector<vector<int> > adj`  or `list<list<int> > adj`

I tried but now I am getting No output.    ( update)

Can anyone help me in using vector of vector ?? Please help for list of list also.


问:
How to connect 2 mySql databases having different Ip's and credentials with Spring boot application
I am using application.properties file as</p>

```<code>spring.datasource.url=jdbc:mysql://IP:3306/dbname
spring.datasource.username=name
spring.datasource.password=pass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.dialect=org.hibernate.dialect.MYSQLDialect
</code>```

答:
```<code>######primary#############
datasource.primary.url=jdbc:sqlserver://xx.xx.xx.xx:1433;DatabaseName=PlayNowLog
datasource.primary.username=sa
datasource.primary.password=xxxxxx
datasource.primary.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

######secondary#############
datasource.secondary.url=jdbc:sqlserver://xx.xx.xx.xx:1433;DatabaseName=PlayNow_New
datasource.secondary.username=sa
datasource.secondary.password=xxxxxx
datasource.secondary.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

@Configuration
public class GlobalDataConfiguration {
    @Bean(name="primaryDataSource")
    @Primary
    @ConfigurationProperties(prefix="datasource.primary")
    public DataSource primaryDataSource() {
        System.out.println("-------------------- primaryDataSource init ---------------------");
        return DataSourceBuilder.create().build();
    }

    @Bean(name="secondaryDataSource")
    @ConfigurationProperties(prefix="datasource.secondary")
    public DataSource secondaryDataSource() {
        System.out.println("-------------------- secondaryDataSource init ---------------------");
        return DataSourceBuilder.create().build();
    }
}

@Component
public class UserDaoImpl<T extends com.sonychina.backend.entity.statistic.SysUser> extends MyBatisBaseDao<SysUser> implements UserDao {

    @Autowired
    public UserDaoImpl(@Qualifier("secondaryDataSource") DataSource dataSource) {
        super(dataSource);
    }
}
</code>```

Body:
I am using application.properties file as

spring.datasource.url=jdbc:mysql://IP:3306/dbname
spring.datasource.username=name
spring.datasource.password=pass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.dialect=org.hibernate.dialect.MYSQLDialect