问:
How to get exact phrase match using BleveSearch?
I am searching for synonyms for a particular phrase from a dataset. I have 2 JSON files in which data is stored consisting of synonyms for yes and no  . If I query for "not interested" it gives both yes and no phrases/synonyms as result, the expected result is just no phrases/synonyms.

en-gen-yes.json

```<code>{
"tag":"en-gen-yes",
"phrases": [
    "yes",
    "yeah",
    "sure",
    "suits me",
    "interested"
]
</code>```

}

en-gen-no.json

```<code>{
"tag":"en-gen-no",
"phrases": [
    "no",
    "nope",
    "not sure",
    "does not suits me",
    "not interested"
]
</code>```

}

query code

```<code>query := bleve.NewMatchPhraseQuery("not interested")
    req := bleve.NewSearchRequest(query)
    req.Fields = []string{"phrases"}
    searchResults, err := paraphraseIndex.Search(req)
    if err != nil {
        log.Fatal(err)
    }
    if searchResults.Hits.Len() == 0 {
        fmt.Println("No matches found")
    } else {
        for i := 0; i < searchResults.Hits.Len(); {
            hit := searchResults.Hits[i]
            fmt.Printf("%s\n", hit.Fields["phrases"])
            i = i + 1
        }
    }
</code>```

The result comes as

[no nope not sure does not suits me not interested]
  [yes yeah sure suits me interested]

Expected Result is only

[no nope not sure does not suits me not interested]

答:
The reason that it matches both is that the MatchPhraseQuery you are using will analyze the search terms.  You didn't show the IndexMapping here so I can't be sure, but I'll assume you're using the "standard" analyzer.  This analyzer removes English stop words, and the English stop word list is defined here:

https://github.com/blevesearch/bleve/blob/master/analysis/lang/en/stop_words_en.go#L281

So, this means that when you do a MatchPhraseQuery for "not interested" you end up just searching for "interested".  And that term happens to also be in your "yes" list of synonyms.

It is worth noting that there is a variant called PhraseQuery (without Match) that does exact matching.  And while that wouldn't remove the word "not" at search time, it still wouldn't find the match.  And the reason is that the word "not" has been removed at index time as well, so and exact match of "not interested" would not find any matches (neither yes or no).

The solution is configure a custom analyzer which either doesn't remove any stop words, or that uses a custom stop word list that doesn't contain the word "not".  If you do this, and use it for both indexing and searching, the query you're using should start to work correctly.

Body:
I am searching for synonyms for a particular phrase from a dataset. I have 2 JSON files in which data is stored consisting of synonyms for yes and no  . If I query for "not interested" it gives both yes and no phrases/synonyms as result, the expected result is just no phrases/synonyms.

en-gen-yes.json

{
"tag":"en-gen-yes",
"phrases": [
    "yes",
    "yeah",
    "sure",
    "suits me",
    "interested"
]

}

en-gen-no.json

{
"tag":"en-gen-no",
"phrases": [
    "no",
    "nope",
    "not sure",
    "does not suits me",
    "not interested"
]

}

query code

query := bleve.NewMatchPhraseQuery("not interested")
    req := bleve.NewSearchRequest(query)
    req.Fields = []string{"phrases"}
    searchResults, err := paraphraseIndex.Search(req)
    if err != nil {
        log.Fatal(err)
    }
    if searchResults.Hits.Len() == 0 {
        fmt.Println("No matches found")
    } else {
        for i := 0; i < searchResults.Hits.Len(); {
            hit := searchResults.Hits[i]
            fmt.Printf("%s\n", hit.Fields["phrases"])
            i = i + 1
        }
    }

The result comes as

[no nope not sure does not suits me not interested]
  [yes yeah sure suits me interested]

Expected Result is only

[no nope not sure does not suits me not interested]


来源: stackexchange

问:
How can I use my own data set in sklearn - Python3
I'm new in machine learning and sklearn.
So, I have the following question:

I'm trying to do a linear regression, but I want to use my own data from some .txt file.
I have some data with a table with 3 columns.

Then, I would like to know how can I change this following code, that is an example from http://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html

Then I changed a bit the code in the example before and I invented some data, is that a correct way to do it? Like use some X and Y like this way. And then I would also to know how in the equation: x_train = x [:2], the [:2] has some influence on my procedure. I didn't really get this part.

```<code>from sklearn import linear_model
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, r2_score

#X has to be numpy array not list.

x=([0],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10])
y=[5,3,8,3,4,5,5,7,8,9,10]

x_train = x [:2]
x_test = x [2:]

y_train = y[:2]
y_test = y[2:]

regr = linear_model.LinearRegression()
regr.fit (x_train,y_train)

y_pred = regr.predict(x_test)

#coefficient
print('Coefficients: \n', regr.coef_)

#the mean square error
print("Mean squared error: %.2f" % mean_squared_error(y_test, y_pred))
print('Variance score: %.2f' % r2_score(y_test, y_pred))

plt.scatter(x_test, y_test,  color='black')
plt.plot(x_test, y_pred, color='blue', linewidth=3)
plt.axis([0, 20, 0, 20])
plt.show()
</code>```

Thanks a lot!

EDIT 1

With the help I received in this webpage, I tried to make some code, to produce a fit of my own data, but I'm not able to get the correct fit, so if someone has time to help me a bit more or tell me if I'm doing something wrong.

The code I'm using with the pics I'm getting

```<code>import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn import linear_model
from sklearn.metrics import mean_squared_error, r2_score
import matplotlib.pyplot as plt

data = pd.read_csv('data.txt')
#x = data[['col1','col2']]
x = data[['col1']]
y = data['col3']

#convert to array to fit the model
x=np.asarray(x)
y=np.asarray(y)

# define the KFolds
kf = KFold(n_splits=2)

#define the model
regr = linear_model.LinearRegression()

# use cross validation and return the r2 score for each Fold
#if you want to return other scores than r2, just change the scoring in cross_val_score
scores = cross_val_score(regr, x, y, cv= kf, scoring= 'r2')

print(scores)

for train_index, test_index in kf.split(x):
  print("TRAIN:", train_index, "TEST:", test_index)
  X_train, X_test = x[train_index], x[test_index]
  y_train, y_test = y[train_index], y[test_index]

plt.scatter (X_test, y_test)
plt.show()
</code>```

I'm here putting a picture of what looks like my data and what I get from TRAIN AND TEST

Then I did some fit procedure, but I'm not sure if it's correct:

```<code>regr.fit (X_train, y_train)
y_pred = regr.predict(X_test)
print(y_pred)
plt.scatter(X_test, y_test,  color='black')
plt.plot(X_test, y_pred, color='blue', linewidth=3)
plt.show()
</code>```

And I get a completely strange fit.

I don't understand why I get it, if when i did this using MINUIT, my fit worked. So, if someone has some hints to help me.

Why apparently the program is not using my data from "y" to do TRAIN or TEST samples?

My data can be taked here: https://www.dropbox.com/sh/nbbsc0fqznkwxvt/AAD-u6lM4orJOGrgIyz0o8B9a?dl=0

For me the only important is col1 and col3, the col2 should be ignored. Then I want make a fit in this data and extract the value of my fit. I know it's a line that fits this data.

Thank you!

答:
As pointed out :

Showing someone else's code is not good practice on Stack Overflow. Please read this about how to ask questions.

You should provide an example of your data (or dummy data if you can't disclose your real data).

Anyway, turn you text file in a CSV, that is, a text file with this structure :

```<code>col1name;col2name;col3name
1;0;2
4;6;8
0;1;3
</code>```

Then, put your dataset in a pandas.DataFrame, use all columns but the last one as your X dataset, and the last one as your Y.

```<code>import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression

file_path = "path/to/your/file.csv"

data = pd.read_csv(filepath_or_buffer = file_path, sep = ";")

X_train, X_test, y_train, y_test = train_test_split(data.loc[:, data.columns != "name_of_your_last_column"], data.loc[:, data.columns == "name_of_your_last_column"], test_size = 0.25)

classifier = LinearRegression()
classifier.fit(X_train, y_train)

print("Train set score :", classifier.score(X_train, y_train)
print("Test set score :", classifier.score(X_test, y_test))
</code>```

Please note that this is a minimal example, you should be using a cross validation procedure to avoid overfitting, and a grid search procedure to avoid underfitting.

ContentLicense: CC BY-SA 3.0

Body:
I'm new in machine learning and sklearn.
So, I have the following question:

I'm trying to do a linear regression, but I want to use my own data from some .txt file.
I have some data with a table with 3 columns.

Then, I would like to know how can I change this following code, that is an example from http://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html

Then I changed a bit the code in the example before and I invented some data, is that a correct way to do it? Like use some X and Y like this way. And then I would also to know how in the equation: x_train = x [:2], the [:2] has some influence on my procedure. I didn't really get this part.

from sklearn import linear_model
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, r2_score

#X has to be numpy array not list.

x=([0],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10])
y=[5,3,8,3,4,5,5,7,8,9,10]

x_train = x [:2]
x_test = x [2:]

y_train = y[:2]
y_test = y[2:]

regr = linear_model.LinearRegression()
regr.fit (x_train,y_train)

y_pred = regr.predict(x_test)

#coefficient
print('Coefficients: \n', regr.coef_)

#the mean square error
print("Mean squared error: %.2f" % mean_squared_error(y_test, y_pred))
print('Variance score: %.2f' % r2_score(y_test, y_pred))

plt.scatter(x_test, y_test,  color='black')
plt.plot(x_test, y_pred, color='blue', linewidth=3)
plt.axis([0, 20, 0, 20])
plt.show()

Thanks a lot!

EDIT 1

With the help I received in this webpage, I tried to make some code, to produce a fit of my own data, but I'm not able to get the correct fit, so if someone has time to help me a bit more or tell me if I'm doing something wrong.

The code I'm using with the pics I'm getting

import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn import linear_model
from sklearn.metrics import mean_squared_error, r2_score
import matplotlib.pyplot as plt

data = pd.read_csv('data.txt')
#x = data[['col1','col2']]
x = data[['col1']]
y = data['col3']

#convert to array to fit the model
x=np.asarray(x)
y=np.asarray(y)

# define the KFolds
kf = KFold(n_splits=2)

#define the model
regr = linear_model.LinearRegression()

# use cross validation and return the r2 score for each Fold
#if you want to return other scores than r2, just change the scoring in cross_val_score
scores = cross_val_score(regr, x, y, cv= kf, scoring= 'r2')

print(scores)

for train_index, test_index in kf.split(x):
  print("TRAIN:", train_index, "TEST:", test_index)
  X_train, X_test = x[train_index], x[test_index]
  y_train, y_test = y[train_index], y[test_index]

plt.scatter (X_test, y_test)
plt.show()

I'm here putting a picture of what looks like my data and what I get from TRAIN AND TEST

Then I did some fit procedure, but I'm not sure if it's correct:

regr.fit (X_train, y_train)
y_pred = regr.predict(X_test)
print(y_pred)
plt.scatter(X_test, y_test,  color='black')
plt.plot(X_test, y_pred, color='blue', linewidth=3)
plt.show()

And I get a completely strange fit.

I don't understand why I get it, if when i did this using MINUIT, my fit worked. So, if someone has some hints to help me.

Why apparently the program is not using my data from "y" to do TRAIN or TEST samples?

My data can be taked here: https://www.dropbox.com/sh/nbbsc0fqznkwxvt/AAD-u6lM4orJOGrgIyz0o8B9a?dl=0

For me the only important is col1 and col3, the col2 should be ignored. Then I want make a fit in this data and extract the value of my fit. I know it's a line that fits this data.

Thank you!

Body:
As pointed out :

Showing someone else's code is not good practice on Stack Overflow. Please read this about how to ask questions.

You should provide an example of your data (or dummy data if you can't disclose your real data).

Anyway, turn you text file in a CSV, that is, a text file with this structure :

col1name;col2name;col3name
1;0;2
4;6;8
0;1;3

Then, put your dataset in a pandas.DataFrame, use all columns but the last one as your X dataset, and the last one as your Y.

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression

file_path = "path/to/your/file.csv"

data = pd.read_csv(filepath_or_buffer = file_path, sep = ";")

X_train, X_test, y_train, y_test = train_test_split(data.loc[:, data.columns != "name_of_your_last_column"], data.loc[:, data.columns == "name_of_your_last_column"], test_size = 0.25)

classifier = LinearRegression()
classifier.fit(X_train, y_train)

print("Train set score :", classifier.score(X_train, y_train)
print("Test set score :", classifier.score(X_test, y_test))

Please note that this is a minimal example, you should be using a cross validation procedure to avoid overfitting, and a grid search procedure to avoid underfitting.


问:
How to convert a datetime from sqlserver to java.util.Date
I am getting a row from a table with sql server database (with Asp net core as web api) using retrofit library in android and as far as I understood I must consider an string equivalent to datetime and then convert it to java.util.Date. An example of retrieved date time is 2018-10-29T19:56:59. Is there anyway to convert datetime to java.util.Date directly?
the code is shown below.

```<code>public class Food {
    @SerializedName("Id")
    private long Id;

    @SerializedName("Name")
    private String Name;

    @SerializedName("Content")
    private String Content;

    @SerializedName("IsActive")
    private boolean IsActive;

    @SerializedName("DoesExist")
    private boolean DoesExist;

    @SerializedName("Cost")
    private int Cost;

    @SerializedName("OffPercentage")
    private int OffPercentage;

    @SerializedName("OffTimeout")
    private Date OffTimeout;
...
}
</code>```

答:
Change your private Date OffTimeout to String, something like this :

```<code>@SerializedName("OffTimeout")
private String OffTimeout;
</code>```

And use this method to parse your date.

```<code>public static Date fromStringToDate(String stringDate, String pattern){
        SimpleDateFormat format = new SimpleDateFormat(pattern);
        try {
            Date date = format.parse(stringDate);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
</code>```

Use:

```<code> Date mydate = fromStringToDate(yourOffTimeOut, "yyyy-MM-dd'T'HH:mm:ss");
</code>```

Body:
I am getting a row from a table with sql server database (with Asp net core as web api) using retrofit library in android and as far as I understood I must consider an string equivalent to datetime and then convert it to java.util.Date. An example of retrieved date time is 2018-10-29T19:56:59. Is there anyway to convert datetime to java.util.Date directly?
the code is shown below.

public class Food {
    @SerializedName("Id")
    private long Id;

    @SerializedName("Name")
    private String Name;

    @SerializedName("Content")
    private String Content;

    @SerializedName("IsActive")
    private boolean IsActive;

    @SerializedName("DoesExist")
    private boolean DoesExist;

    @SerializedName("Cost")
    private int Cost;

    @SerializedName("OffPercentage")
    private int OffPercentage;

    @SerializedName("OffTimeout")
    private Date OffTimeout;
...
}

Body:
Change your private Date OffTimeout to String, something like this :

@SerializedName("OffTimeout")
private String OffTimeout;

And use this method to parse your date.

public static Date fromStringToDate(String stringDate, String pattern){
        SimpleDateFormat format = new SimpleDateFormat(pattern);
        try {
            Date date = format.parse(stringDate);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

Use:

 Date mydate = fromStringToDate(yourOffTimeOut, "yyyy-MM-dd'T'HH:mm:ss");


问:
Queue data structure implementation
I am currently trying to implement a queue data structure in C. The context is as follows:

A Doctors surgery needs a computer program to provide self-service to patients. Patients use this console to check in on arrivalto the surgery. They can also use the console to enquire about their position in the waiting list, or tofind out how many doctors are currently available at the surgery.The program is also used by doctors to check out (discharge) patients when they have finishedexamining them. Doctors use the program as well to check in and out of their rooms.The program must maintain a waiting list (queue) of all checked in patients, and as soon as one of thedoctors is free, the program must call on the next patient in the queue by displaying a message.

I need to implement the following queue functions:

```<code>void enqueue (int n) // append n to the queue
int dequeue () // remove the first item in the queue, and return its value
int first() // get the first item without removing it
int last () // get the last item without removing it
void clear () // clear (initialize) the queue
bool IsEmpty () // returns true if the queue is empty
bool IsFull () // returns true if the queue is full
void print () // print the entire queue
int position (int n) // returns the position of n in the queue, or -1 if n
is not in the queue
void remove (int n) // remove n from the queue
</code>```

The position function is something I'm struggling with a little bit:

```<code>int position(int n) {
  system("clear");
  int pos = 1;
  for (int i = front; i <= rear; i++) { // a for loop to run for each
                                        // element in the queue
    if (queue[i % MAX] == n)  // checks to see whether the integer inputted
                              // by the user is currently in the queue array

  printf("Number %d is in the queue\n", num); //

  return;
    }
  }
</code>```

I want the program to print out the position of n in the queue. I'm also not sure how to go about implementing a function to remove a specific element from the queue. Also I have yet to attempt the remove function, so will post again when I've done what I can to implement it.

I got the code to print the position in the queue, thanks to coderredoc! But because I want it to show the number 1, instead of 0 if something is first in the queue, I have used the following:

```<code>    void position(int n) {
      system("clear");
      int pos = 1;
      for (int i = front; i <= rear; i++) {

        if (queue[i % MAX] == n)
        printf("You are in the queue!\n");
        printf("Position in queue is %d \n",(i % MAX) +1);
            }
         }
</code>```

but it loops and prints out more than once with increment positions in the queue. I know this is something to do with my for loop but not sure how to prevent it.

EDIT: The above function has been fixed now. Thank you.

Now to try and implement a function to remove an element defined by the user from the queue.

答:
There are some errors in the code:-

1.

```<code>int position(int n) {
  system("clear");
  int pos = 1;
  for (int i = front; i <= rear; i++) { // a for loop to run for each
                                        // element in the queue
    if (queue[i % MAX] == n)  // checks to see whether the integer inputted
                              // by the user is currently in the queue array

  printf("Number %d is in the queue\n", num); //

  return 0; <----------PROBLEM
    }
  }
</code>```

Once the if is executed. Element not matched. And it returns.

2.

Also you use num but that is not changed when an element is found. Or atleast you should print the element  found.

3.

Also under case 6:

scanf("%d, &id"); should be scanf("%d", &id);.

4.

Also in the position() function you don't print the right message.

printf("Number %d is in the queue\n", num); will be

printf("Number %d is in the queue\n", n);

5.

You are not using the returned value of position(). In case you don't need to return anything it should have a return type void.

How the code will be?

The funtion position() would be something like this

```<code>void position(int n) {
    system("clear");
    for (int i = front; i <= rear; i++)
    {

        if (queue[i % MAX] == n){
            printf("You are in the queue!\n");
            printf("Position in queue is %d \n",(i%MAX+1)-front);
            return;
        }
    }
}
</code>```

Logical Error

Also in case more than 5 numbers entered, it drops elements silently without giving any message. Change that.

Also the logic of the queue implementation is wrong. After you delete all the 5 elements it still shows both the message queue is full and queue is empty.

The algorithm you apply is still wrong. Check any book for that.

To help you a bit the queue full condition is

(rear+1)%MAX == front.

The queue empty condition is

front == -1 && rear == -1.  ( These holds for OP's implementation where front= -1 and rear = -1 initially).

Pseudocode for insert() would be:

```<code>1. if queue is full - show message.
2.    if queue is empty set front and rear to 0. [Denoting there is some element in queue]
3.    else rear = rear % MAX
4. put the element in the array at position rear.
</code>```

Pseudocode for delete() would be:

```<code>1. if queue is empty - show message.
2. else if front == rear then rear = front = -1
3. else front = (front + 1)%MAX.
</code>```

Title: Queue data structure implementation

Body:
I am currently trying to implement a queue data structure in C. The context is as follows:

A Doctors surgery needs a computer program to provide self-service to patients. Patients use this console to check in on arrivalto the surgery. They can also use the console to enquire about their position in the waiting list, or tofind out how many doctors are currently available at the surgery.The program is also used by doctors to check out (discharge) patients when they have finishedexamining them. Doctors use the program as well to check in and out of their rooms.The program must maintain a waiting list (queue) of all checked in patients, and as soon as one of thedoctors is free, the program must call on the next patient in the queue by displaying a message.

I need to implement the following queue functions:

void enqueue (int n) // append n to the queue
int dequeue () // remove the first item in the queue, and return its value
int first() // get the first item without removing it
int last () // get the last item without removing it
void clear () // clear (initialize) the queue
bool IsEmpty () // returns true if the queue is empty
bool IsFull () // returns true if the queue is full
void print () // print the entire queue
int position (int n) // returns the position of n in the queue, or -1 if n
is not in the queue
void remove (int n) // remove n from the queue

The position function is something I'm struggling with a little bit:

int position(int n) {
  system("clear");
  int pos = 1;
  for (int i = front; i <= rear; i++) { // a for loop to run for each
                                        // element in the queue
    if (queue[i % MAX] == n)  // checks to see whether the integer inputted
                              // by the user is currently in the queue array

  printf("Number %d is in the queue\n", num); //

  return;
    }
  }

I want the program to print out the position of n in the queue. I'm also not sure how to go about implementing a function to remove a specific element from the queue. Also I have yet to attempt the remove function, so will post again when I've done what I can to implement it.

I got the code to print the position in the queue, thanks to coderredoc! But because I want it to show the number 1, instead of 0 if something is first in the queue, I have used the following:

    void position(int n) {
      system("clear");
      int pos = 1;
      for (int i = front; i <= rear; i++) {

        if (queue[i % MAX] == n)
        printf("You are in the queue!\n");
        printf("Position in queue is %d \n",(i % MAX) +1);
            }
         }

but it loops and prints out more than once with increment positions in the queue. I know this is something to do with my for loop but not sure how to prevent it.

EDIT: The above function has been fixed now. Thank you.

Now to try and implement a function to remove an element defined by the user from the queue.

Body:
There are some errors in the code:-

1.

int position(int n) {
  system("clear");
  int pos = 1;
  for (int i = front; i <= rear; i++) { // a for loop to run for each
                                        // element in the queue
    if (queue[i % MAX] == n)  // checks to see whether the integer inputted
                              // by the user is currently in the queue array

  printf("Number %d is in the queue\n", num); //

  return 0; <----------PROBLEM
    }
  }

Once the if is executed. Element not matched. And it returns.

2.

Also you use num but that is not changed when an element is found. Or atleast you should print the element  found.

3.

Also under case 6:

scanf("%d, &id"); should be scanf("%d", &id);.

4.

Also in the position() function you don't print the right message.

printf("Number %d is in the queue\n", num); will be

printf("Number %d is in the queue\n", n);

5.

You are not using the returned value of position(). In case you don't need to return anything it should have a return type void.

How the code will be?

The funtion position() would be something like this

void position(int n) {
    system("clear");
    for (int i = front; i <= rear; i++)
    {

        if (queue[i % MAX] == n){
            printf("You are in the queue!\n");
            printf("Position in queue is %d \n",(i%MAX+1)-front);
            return;
        }
    }
}

Logical Error

Also in case more than 5 numbers entered, it drops elements silently without giving any message. Change that.

Also the logic of the queue implementation is wrong. After you delete all the 5 elements it still shows both the message queue is full and queue is empty.

The algorithm you apply is still wrong. Check any book for that.

To help you a bit the queue full condition is

(rear+1)%MAX == front.

The queue empty condition is

front == -1 && rear == -1.  ( These holds for OP's implementation where front= -1 and rear = -1 initially).

Pseudocode for insert() would be:

1. if queue is full - show message.
2.    if queue is empty set front and rear to 0. [Denoting there is some element in queue]
3.    else rear = rear % MAX
4. put the element in the array at position rear.

Pseudocode for delete() would be:

1. if queue is empty - show message.
2. else if front == rear then rear = front = -1
3. else front = (front + 1)%MAX.


问:
Disable matplotlib widget in PyQt
I have a pyQt application with several embedded matplotlib widgets (https://github.com/chipmuenk/pyFDA).

The automatic updating of plots can be turned off for each plotting widget to speed up the application (especially 3D plots can take quite long).

Unfortunately, I haven't managed to disable (grey out) the canvas completely yet. What I'd like is to do something like

```<code>class MplWidget(QWidget):
    """
    Construct a subwidget with Matplotlib canvas and NavigationToolbar
    """

    def __init__(self, parent):
        super(MplWidget, self).__init__(parent)
        # Create the mpl figure and construct the canvas with the figure
        self.fig = Figure()
        self.pltCanv = FigureCanvas(self.fig)
#-------------------------------------------------

self.mplwidget = MplWidget(self)
self.mplwidget.pltCanv.setEnabled(False) # <- this doesn't work
</code>```

to make it clear that there is nothing to interact with in this widget. Is there an easy workaround?

答:
Grey out figure.

You may grey out the figure by placing a grey, semitransparent patch on top of it. To this end, you may create a Rectangle, set its zorder very high and give it the figure transform. To add it to a an axes, you may use ax.add_patch; however in order to add it to a figure with a 3D axes, this will not work and you would need to add it via fig.patches.extend. (See this answer)

```<code>import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([1,3,2],[1,2,3],[2,3,2])

rect=plt.Rectangle((0,0),1,1, transform=fig.transFigure,
                   clip_on=False, zorder=100, alpha=0.5, color="grey")
fig.patches.extend([rect])

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

Disconnecting all events

You may disconnect all events from the canvas. This will prevent any user interaction, but is also not reversible; so if you need those events back at a later stage the solution would be more complicated.

```<code>import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([1,3,2],[1,2,3],[2,3,2])

for evt, callback in fig.canvas.callbacks.callbacks.items():
    for cid, _ in callback.items():
        fig.canvas.mpl_disconnect(cid)
plt.show()
</code>```

Title: Disable matplotlib widget in PyQt

Body:
I have a pyQt application with several embedded matplotlib widgets (https://github.com/chipmuenk/pyFDA).

The automatic updating of plots can be turned off for each plotting widget to speed up the application (especially 3D plots can take quite long).

Unfortunately, I haven't managed to disable (grey out) the canvas completely yet. What I'd like is to do something like

class MplWidget(QWidget):
    """
    Construct a subwidget with Matplotlib canvas and NavigationToolbar
    """

    def __init__(self, parent):
        super(MplWidget, self).__init__(parent)
        # Create the mpl figure and construct the canvas with the figure
        self.fig = Figure()
        self.pltCanv = FigureCanvas(self.fig)
#-------------------------------------------------

self.mplwidget = MplWidget(self)
self.mplwidget.pltCanv.setEnabled(False) # <- this doesn't work

to make it clear that there is nothing to interact with in this widget. Is there an easy workaround?

Body:
Grey out figure.

You may grey out the figure by placing a grey, semitransparent patch on top of it. To this end, you may create a Rectangle, set its zorder very high and give it the figure transform. To add it to a an axes, you may use ax.add_patch; however in order to add it to a figure with a 3D axes, this will not work and you would need to add it via fig.patches.extend. (See this answer)

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([1,3,2],[1,2,3],[2,3,2])

rect=plt.Rectangle((0,0),1,1, transform=fig.transFigure,
                   clip_on=False, zorder=100, alpha=0.5, color="grey")
fig.patches.extend([rect])

plt.show()

Disconnecting all events

You may disconnect all events from the canvas. This will prevent any user interaction, but is also not reversible; so if you need those events back at a later stage the solution would be more complicated.

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([1,3,2],[1,2,3],[2,3,2])

for evt, callback in fig.canvas.callbacks.callbacks.items():
    for cid, _ in callback.items():
        fig.canvas.mpl_disconnect(cid)
plt.show()


问:
Generate Java Classes with XSD Restrictions built in
Working on a large integration project where we are also doing validation on some of the data which we are integrating back and forth.

We are using the CXF-XJC-plugin to generate java classes from XSD and WSDL files.
It would be very keen to have restrictions added as part of the generated classes, rather than having plain POJO classes.

An example would be:

```<code><xsd:element name="someString" minOccurs="0">
   <xsd:simpleType>
      <xsd:restriction base="xsd:string">
         <xsd:maxLength value="12"/>
      </xsd:restriction>
   </xsd:simpleType>
</xsd:element>
</code>```

Currently create as:

```<code>String someString;
</code>```

Basic setter and getter and the fancy fluent api, but nowhere is any restriction logic about the 12 characters

Anyone would know how to generate with restrictions built in?

答:
You can specify a separate bindings file, which contains the enableFailFastCheck attribute:

<?xml version="1.0" encoding="UTF-8"?>
<globalBindings xmlns="http://java.sun.com/xml/ns/jaxb" enableFailFastCheck="true"/>
```

Body:
Working on a large integration project where we are also doing validation on some of the data which we are integrating back and forth.

We are using the CXF-XJC-plugin to generate java classes from XSD and WSDL files.
It would be very keen to have restrictions added as part of the generated classes, rather than having plain POJO classes.

An example would be:

<xsd:element name="someString" minOccurs="0">
   <xsd:simpleType>
      <xsd:restriction base="xsd:string">
         <xsd:maxLength value="12"/>
      </xsd:restriction>
   </xsd:simpleType>
</xsd:element>

Currently create as:

String someString;

Basic setter and getter and the fancy fluent api, but nowhere is any restriction logic about the 12 characters

Anyone would know how to generate with restrictions built in?


问:
Dropbox redirect_uri for a windows application
I am using the REST-Library Demos to learn how to get & put files to a Dropbox App. I need to set up a redirect_uri but I can't  figure out what to provide.

The App setup page says this 'You must provide a proper URI with an authority or path component' and the hint is 'https:// (http allowed for localhost)';

What do I need to provide?

答:
OK, I finally figured what I was doing wrong.

The demo code was adding "LURL := LURL + '&redirect_uri=' + URIEncode('{ANY HTTPS-SITE YOU OWN OR YOU TRUST}');" I changed it to "LURL := LURL + '&redirect_uri=' + URIEncode('http://localhost:8765');" Now the redirect_uri = the app redirect_URI.


问:
Need a Javascript regex expression to match a language param in URL
I'm not familiar with regex and I haven't found any proper solution for my case.
My website utilizes such URLs:

```<code>(http(s)://www.)website.com/en/someURL
(http(s)://www.)website.com/anotherURL
(http(s)://www.)website.com/de/anotherURL
</code>```

If website.com/someURL, website.com/ or website.com is accessed the default language will be loaded.

I need a regex which will allow only these certain language codes, case sensitivity is not important:

```<code>(http(s)://www.)website.com/en
(http(s)://www.)website.com/en/
(http(s)://www.)website.com/
(http(s)://www.)website.com
(http(s)://www.)website.com/de
(http(s)://www.)website.com/de/
</code>```

答:
This regex will work:

```<code>^((https?)?\:\/\/www\.)?website\.com(\/((de|en)\/?)?)?$
</code>```

If you want to make some unit tests on [https://regex101.com/][1] you should erase the ^ and $ for beginning and end, otherwise you will see a positive result only if you use only one line.

For testing you could use this (if you want you can add some lines):

```<code>https://www.website.com/en
http://www.website.com/en/
https://www.website.com/
https://www.website.com
https://www.website.com/de
https://www.website.com/de/
</code>```

Body:
I'm not familiar with regex and I haven't found any proper solution for my case.
My website utilizes such URLs:

(http(s)://www.)website.com/en/someURL
(http(s)://www.)website.com/anotherURL
(http(s)://www.)website.com/de/anotherURL

If website.com/someURL, website.com/ or website.com is accessed the default language will be loaded.

I need a regex which will allow only these certain language codes, case sensitivity is not important:

(http(s)://www.)website.com/en
(http(s)://www.)website.com/en/
(http(s)://www.)website.com/
(http(s)://www.)website.com
(http(s)://www.)website.com/de
(http(s)://www.)website.com/de/

Body:
This regex will work:

^((https?)?\:\/\/www\.)?website\.com(\/((de|en)\/?)?)?$

If you want to make some unit tests on [https://regex101.com/][1] you should erase the ^ and $ for beginning and end, otherwise you will see a positive result only if you use only one line.

For testing you could use this (if you want you can add some lines):

https://www.website.com/en
http://www.website.com/en/
https://www.website.com/
https://www.website.com
https://www.website.com/de
https://www.website.com/de/


问:
Not able to set new value for an AngularJS custom directive isolated scope property
I'm creating a very simple custom directive and trying to pass a simple string variable from the parent scope to the custom directive isolated scope by using the '<' symbol. Then, I try to assign a new value to the variable in my custom directive controller and display the new value in the template but it's still displaying the old value.

Here is my parent controller:

```<code>    (function(){
      angular.module("app").controller("ctrl", ctrl);

      function ctrl(){
        ctrl = this;
        ctrl.fullname = "Paul G.";
      }
    })()
</code>```

Here is my custom directive:

```<code>    (function () {
      'use strict';
      angular.module('app').directive('dir', dir);
      function dir() {
        return {
          scope:{
            name:'<',
          },
          bindToController: true,
          template: `<h1>I'm a directive</h1>
                    <h1>Name: {{vm.name}}</h1>`
          ,
          controller: function($scope){
            this.name = "Tony J";
          },
          controllerAs:'vm'
      };
     }
   })();
</code>```

Here is my Html:

```<code>    <!DOCTYPE html>
        <html ng-app="app">

        <head>
         <meta charset="utf-8" />
         <script
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script data-require="angular.js@1.5.x" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.min.js" data-semver="1.5.11"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-resource/1.6.4/angular-resource.js"></script>
    <script src="app.js"></script>
    <script src="ctrl.js"></script>
    <script src="directive.js"></script>
  </head>

  <body ng-controller="ctrl as $ctrl">
    <p>Hello {{$ctrl.fullname}}!</p>
    <dir name="$ctrl.fullname"></dir>
    </div>
  </body>

</html>
</code>```

The output is below:

However, I expected it see Name: Tony J in the output.

答:
First a word of caution

Inputs should be using < and @ bindings. The < symbol denotes one-way bindings which are available since 1.5. The difference to = is that the bound properties in the component scope are not watched, which means if you assign a new value to the property in the component scope, it will not update the parent scope. Note however, that both parent and component scope reference the same object, so if you are changing object properties or array elements in the component, the parent will still reflect that change. The general rule should therefore be to never change an object or array property in the component scope. @ bindings can be used when the input is a string, especially when the value of the binding doesn't change.

— AngularJS Developer Guide - Component-based Application Architecture

Now what you can do is change the value of the variable after the directive has initialized(you can study the AngularJS Component life cycle here) something like this.

```<code>controller: function($scope) {
    ctrl = this;
  ctrl.$onInit = function() {
    ctrl.name = "some name"
  }
},
</code>```

here is a working fiddle I developed from your given example.

Body:
I'm creating a very simple custom directive and trying to pass a simple string variable from the parent scope to the custom directive isolated scope by using the '<' symbol. Then, I try to assign a new value to the variable in my custom directive controller and display the new value in the template but it's still displaying the old value.

Here is my parent controller:

    (function(){
      angular.module("app").controller("ctrl", ctrl);

      function ctrl(){
        ctrl = this;
        ctrl.fullname = "Paul G.";
      }
    })()

Here is my custom directive:

    (function () {
      'use strict';
      angular.module('app').directive('dir', dir);
      function dir() {
        return {
          scope:{
            name:'<',
          },
          bindToController: true,
          template: `
I'm a directive

Name: {{vm.name}}
`
          ,
          controller: function($scope){
            this.name = "Tony J";
          },
          controllerAs:'vm'
      };
     }
   })();

Here is my Html:

    <!DOCTYPE html>

         <meta charset="utf-8" />

Hello {{$ctrl.fullname}}!

    <dir name="$ctrl.fullname"></dir>

The output is below:

However, I expected it see Name: Tony J in the output.

Body:
First a word of caution

Inputs should be using < and @ bindings. The < symbol denotes one-way bindings which are available since 1.5. The difference to = is that the bound properties in the component scope are not watched, which means if you assign a new value to the property in the component scope, it will not update the parent scope. Note however, that both parent and component scope reference the same object, so if you are changing object properties or array elements in the component, the parent will still reflect that change. The general rule should therefore be to never change an object or array property in the component scope. @ bindings can be used when the input is a string, especially when the value of the binding doesn't change.

— AngularJS Developer Guide - Component-based Application Architecture

Now what you can do is change the value of the variable after the directive has initialized(you can study the AngularJS Component life cycle here) something like this.

controller: function($scope) {
    ctrl = this;
  ctrl.$onInit = function() {
    ctrl.name = "some name"
  }
},

here is a working fiddle I developed from your given example.


问:
Android react native recyclerview
I am attempting to migrate a native android project over to react native to make it cross platform. I am currently using recyclerview and a bit confused about what the closest React Native library is.</p>

答:
The RecyclerView of React-Native is FlatList.
Is very easy to use. You have all info here: https://facebook.github.io/react-native/docs/flatlist.html
Greetings!</p>

Title: Android react native recyclerview


问:
How does a program receive a signal?
Theoretical question: Let's say that I open up Skype and my friend calls me. How does Skype know that someone's calling me? Was it checking for calls (signals) every second?

Skype: Is someone calling?

Server: No.

Skype: Is someone calling?

Server: No.

Skype: Is someone calling?

Server: Yes.

Skype: Alright, hook us up.

Surely there must be a better way.

答:
I don't know how Skype is actually implemented. Hopefully, that was not the intent of the question. Here is a super high-level description of how this might work.

One way it might work is this:

You are running a server

The server is listening on a socket

While listening, the server is blocked (doing nothing)

When info arrive for your socket, the OS signals your server

Once signaled, the server accepts the info and responds appropriately

This may or may not be a realistic depiction of what is going on in your particular case. Another possibility is this:

You are running a client

There is a remote server running

You establish a session with the remote server and start listening

While listening, the client is blocked (doing nothing)

The server is listening on a socket

While listening, the server is blocked (doing nothing)

When packets arrive for your Skype client, the remote OS signals the server

Once signaled, the server starts a new thread to handle your request

It figures out the packets it got were associated with your session, and sends them

When these info arrive at your local OS, it signals your client

Once signaled, the client accepts the info and responds appropriately

Pictures of each method:

```<code>    SKYPE     __________________   ????????
(local server)                  (remote client)

    SKYPE     _________     SERVER    ________   ???????
(local client)         (remote server)        (remote client)
</code>```

In both cases, polling is not required provided the operating systems involved support multiprogramming (multiple processes overlapping execution, not necessarily truly in parallel), in which case these processes can block on I/O until signaled by the OS.

Fundamentally, though, multiprogramming with blocking on I/O is a lot like polling in the sense that the process scheduler is polling every time it makes a decision about which process gets the next time quantum.

Title: How does a program receive a signal?

Body:
I don't know how Skype is actually implemented. Hopefully, that was not the intent of the question. Here is a super high-level description of how this might work.

One way it might work is this:

You are running a server

The server is listening on a socket

While listening, the server is blocked (doing nothing)

When info arrive for your socket, the OS signals your server

Once signaled, the server accepts the info and responds appropriately

This may or may not be a realistic depiction of what is going on in your particular case. Another possibility is this:

You are running a client

There is a remote server running

You establish a session with the remote server and start listening

While listening, the client is blocked (doing nothing)

The server is listening on a socket

While listening, the server is blocked (doing nothing)

When packets arrive for your Skype client, the remote OS signals the server

Once signaled, the server starts a new thread to handle your request

It figures out the packets it got were associated with your session, and sends them

When these info arrive at your local OS, it signals your client

Once signaled, the client accepts the info and responds appropriately

Pictures of each method:

    SKYPE     __________________   ????????
(local server)                  (remote client)

    SKYPE     _________     SERVER    ________   ???????
(local client)         (remote server)        (remote client)

In both cases, polling is not required provided the operating systems involved support multiprogramming (multiple processes overlapping execution, not necessarily truly in parallel), in which case these processes can block on I/O until signaled by the OS.

Fundamentally, though, multiprogramming with blocking on I/O is a lot like polling in the sense that the process scheduler is polling every time it makes a decision about which process gets the next time quantum.


问:
Rails app not loading with Passenger + Nginx
I have a Rails app I am trying to deploy to production. I have Passenger setup with Nginx, and looking at the Nginx logs, passenger is starting but when I try to browse to my app the error logs fills up with the following:

```<code>App 67160 stdout:
App 67160 stdout:
[ E 2017-11-17 11:06:39.5087 67125/Th age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /var/www/vuln_frontend: An error occurred while starting up the preloader.
  Error ID: bd9a976b
  Error details saved to: /tmp/passenger-error-okz7mL.html
  Message from application: cannot load such file -- bundler/setup (LoadError)
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

[ E 2017-11-17 11:06:39.5121 67125/T9 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 2-1] Cannot checkout session because a spawning error occurred. The identifier of the error is bd9a976b. Please see earlier logs for details about the error.
</code>```

I have checked in /tmp/ but there is no /tmp/passenger-error-okz7mL.html
 file and my system Ruby is 2.4.2, the same as my app is using and the same as the RVM version.

I can't see where the issue lies, my gems are all up to date in the app and system.

I can load the Passenger error page but nothing else.

I have enabled riendly error pages and got the below output:

Details:

```<code>cannot load such file -- bundler/setup (LoadError)
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

System information:

Application root
    /var/www/vuln_frontend
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)
    production
Ruby interpreter command

    /usr/bin/ruby

User and groups

    uid=99(nobody) gid=99(nobody) groups=99(nobody)

Environment variables

    PASSENGER_USE_FEEDBACK_FD = true
    SERVER_SOFTWARE = nginx/1.12.1 Phusion_Passenger/5.1.11
    PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.XXXXMTSagL
    USER = nobody
    LOGNAME = nobody
    SHELL = /sbin/nologin
    HOME = /
    PWD = /var/www/vuln_frontend
    IN_PASSENGER = 1
    PYTHONUNBUFFERED = 1
    NODE_PATH = /usr/share/passenger/node
    RAILS_ENV = production
    RACK_ENV = production
    WSGI_ENV = production
    NODE_ENV = production
    PASSENGER_APP_ENV = production

Ulimits

    Unknown

System metrics

    ------------- General -------------
    Kernel version    : 3.10.0-693.5.2.el7.x86_64
    Uptime            : 1d 21h 16m 17s
    Load averages     : 0.00%, 0.01%, 0.05%
    Fork rate         : unknown

    ------------- CPU -------------
    Number of CPUs    :    2
    Average CPU usage :   0%  --   0% user,   0% nice,   0% system, 100% idle
      CPU 1           :   0%  --   0% user,   0% nice,   0% system, 100% idle
      CPU 2           :   0%  --   0% user,   0% nice,   0% system, 100% idle
    I/O pressure      :   0%
      CPU 1           :   0%
      CPU 2           :   0%
    Interference from other VMs:   0%
      CPU 1                    :   0%
      CPU 2                    :   0%

    ------------- Memory -------------
    RAM total         :   1823 MB
    RAM used          :    543 MB (30%)
    RAM free          :   1279 MB
    Swap total        :   2047 MB
    Swap used         :      0 MB (0%)
    Swap free         :   2047 MB
    Swap in           : unknown
    Swap out          : unknown

General Ruby interpreter information

    RUBY_VERSION = 2.0.0
    RUBY_PLATFORM = x86_64-linux
    RUBY_ENGINE = ruby
    RubyGems version = 2.0.14.1
    RubyGems paths = ["/.gem/ruby", "/usr/share/gems", "/usr/local/share/gems"]

Ruby configuration (RbConfig::CONFIG)

    DESTDIR =
    MAJOR = 2
    MINOR = 0
    TEENY = 0
    PATCHLEVEL = 648
    INSTALL = /usr/bin/install -c
    EXEEXT =
    prefix = /usr
    ruby_install_name = ruby
    RUBY_INSTALL_NAME = ruby
    RUBY_SO_NAME = ruby
    exec = exec
    ruby_pc = ruby.pc
    PACKAGE = ruby
    BUILTIN_TRANSSRCS =  newline.c
    USE_RUBYGEMS = YES
    MANTYPE = doc
    NROFF = /usr/bin/nroff
    OPTIONAL_PRELUDES = ./abrt_prelude.rb
    vendorarchhdrdir = /usr/include/vendor_ruby/x86_64-linux
    sitearchhdrdir = /usr/include/site_ruby/x86_64-linux
    rubyarchhdrdir = /usr/include
    vendorhdrdir = /usr/include/vendor_ruby
    sitehdrdir = /usr/include/site_ruby
    rubyhdrdir = /usr/include
    UNIVERSAL_INTS =
    UNIVERSAL_ARCHNAMES =
    configure_args =  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-rubylibprefix=/usr/share/ruby' '--with-rubyarchprefix=/usr/lib64/ruby' '--with-sitedir=/usr/local/share/ruby/site_ruby' '--with-sitearchdir=/usr/local/lib64/ruby/site_ruby' '--with-vendordir=/usr/share/ruby/vendor_ruby' '--with-vendorarchdir=/usr/lib64/ruby/vendor_ruby' '--with-rubyhdrdir=/usr/include' '--with-rubyarchhdrdir=/usr/include' '--with-sitearchhdrdir=/usr/include/site_ruby/x86_64-linux' '--with-vendorarchhdrdir=/usr/include/vendor_ruby/x86_64-linux' '--with-rubygemsdir=/usr/share/rubygems' '--with-ruby-pc=ruby.pc' '--disable-rpath' '--enable-shared' '--with-ruby-version=' '--enable-multiarch' '--with-prelude=./abrt_prelude.rb' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic'
    rubygemsdir = /usr/share/rubygems
    vendorarchdir = /usr/lib64/ruby/vendor_ruby
    vendorlibdir = /usr/share/ruby/vendor_ruby/
    vendordir = /usr/share/ruby/vendor_ruby
    sitearchdir = /usr/local/lib64/ruby/site_ruby
    sitelibdir = /usr/local/share/ruby/site_ruby/
    sitedir = /usr/local/share/ruby/site_ruby
    rubyarchdir = /usr/lib64/ruby/
    rubylibdir = /usr/share/ruby/
    ruby_version =
    sitearch = x86_64-linux
    arch = x86_64-linux
    sitearchincludedir = /usr/include/x86_64-linux
    archincludedir = /usr/include/x86_64-linux
    sitearchlibdir = /usr/lib64/x86_64-linux
    archlibdir = /usr/lib64/x86_64-linux
    RI_BASE_NAME = ri
    ridir = /usr/share/ri
    rubysitearchprefix = /usr/lib64/x86_64-linux/ruby
    rubyarchprefix = /usr/lib64/ruby
    rubylibprefix = /usr/share/ruby
    MAKEFILES = Makefile
    PLATFORM_DIR =
    THREAD_MODEL = pthread
    SYMBOL_PREFIX =
    EXPORT_PREFIX =
    COMMON_HEADERS =
    COMMON_MACROS =
    COMMON_LIBS =
    MAINLIBS =
    ENABLE_SHARED = yes
    DLDLIBS =  -lc
    SOLIBS = -lpthread -lrt -ldl -lcrypt -lm
    LIBRUBYARG_SHARED = -lruby
    LIBRUBYARG_STATIC = -lruby-static
    LIBRUBYARG = -lruby
    LIBRUBY = libruby.so.2.0.0
    LIBRUBY_ALIASES = libruby.so.2.0 libruby.so
    LIBRUBY_SO = libruby.so.2.0.0
    LIBRUBY_A = libruby-static.a
    RUBYW_INSTALL_NAME =
    rubyw_install_name =
    LIBRUBY_DLDFLAGS = -Wl,-soname,libruby.so.2.0
    LIBRUBY_LDSHARED = gcc -shared
    EXTDLDFLAGS =
    EXTLDFLAGS =
    strict_warnflags = -ansi -std=iso9899:199409
    warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
    debugflags = -ggdb3
    optflags = -O3 -fno-fast-math
    cxxflags =  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
    cflags =  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
    cppflags =
    NULLCMD = :
    DLNOBJ = dln.o
    INSTALLDOC = all
    CAPITARGET = nodoc
    RDOCTARGET = rdoc
    DTRACE_GLOMMED_OBJ = ruby-glommed.o
    DTRACE_OBJ = probes.o
    DTRACE_EXT = d
    EXECUTABLE_EXTS =
    ARCHFILE =
    LIBRUBY_RELATIVE = no
    EXTOUT = .ext
    RUNRUBY_COMMAND = $(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=.ext $(RUNRUBYOPT)
    PREP = miniruby
    BTESTRUBY = $(MINIRUBY)
    CROSS_COMPILING = no
    TEST_RUNNABLE = yes
    setup = Setup
    EXTSTATIC =
    STRIP = strip -S -x
    TRY_LINK =
    LIBPATHENV = LD_LIBRARY_PATH
    RPATHFLAG =
    LIBPATHFLAG =  -L%s
    LINK_SO =
    LIBEXT = a
    DLEXT2 =
    DLEXT = so
    LDSHAREDXX = g++ -shared
    LDSHARED = gcc -shared
    CCDLFLAGS = -fPIC
    STATIC =
    ARCH_FLAG = -m64
    DLDFLAGS =
    ALLOCA =
    codesign =
    POSTLINK = :
    WERRORFLAG = -Werror
    CHDIR = cd -P
    RMALL = rm -fr
    RMDIRS = rmdir --ignore-fail-on-non-empty -p
    RMDIR = rmdir --ignore-fail-on-non-empty
    CP = cp
    RM = rm -f
    PKG_CONFIG = pkg-config
    PYTHON =
    DOXYGEN =
    DOT =
    DTRACE = dtrace
    MAKEDIRS = /usr/bin/mkdir -p
    MKDIR_P = /usr/bin/mkdir -p
    INSTALL_DATA = /usr/bin/install -c -m 644
    INSTALL_SCRIPT = /usr/bin/install -c
    INSTALL_PROGRAM = /usr/bin/install -c
    SET_MAKE =
    LN_S = ln -s
    NM = nm
    DLLWRAP =
    WINDRES =
    OBJCOPY = :
    OBJDUMP = objdump
    ASFLAGS =
    AS = as
    AR = ar
    RANLIB = ranlib
    try_header =
    COUTFLAG = -o
    OUTFLAG = -o
    CPPOUTFILE = -o conftest.i
    GNU_LD = yes
    LD = ld
    GCC = yes
    EGREP = /usr/bin/grep -E
    GREP = /usr/bin/grep
    CPP = gcc -E
    CXXFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic
    CXX = g++
    OBJEXT = o
    CPPFLAGS =
    LDFLAGS = -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic
    CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC
    CC = gcc
    NACL_SDK_VARIANT =
    NACL_SDK_ROOT =
    NACL_TOOLCHAIN =
    target_os = linux
    target_vendor = redhat
    target_cpu = x86_64
    target = x86_64-redhat-linux-gnu
    host_os = linux-gnu
    host_vendor = redhat
    host_cpu = x86_64
    host = x86_64-redhat-linux-gnu
    RUBY_VERSION_NAME = ruby-
    RUBYW_BASE_NAME = rubyw
    RUBY_BASE_NAME = ruby
    build_os = linux-gnu
    build_vendor = redhat
    build_cpu = x86_64
    build = x86_64-redhat-linux-gnu
    RUBY_RELEASE_DATE = 2015-12-16
    RUBY_PROGRAM_VERSION = 2.0.0
    target_alias =
    host_alias = x86_64-redhat-linux-gnu
    build_alias = x86_64-redhat-linux-gnu
    LIBS = -lpthread -lrt -ldl -lcrypt -lm
    ECHO_T =
    ECHO_N = -n
    ECHO_C =
    DEFS =
    mandir = /usr/share/man
    localedir = /usr/share/locale
    libdir = /usr/lib64
    psdir = /usr/share/doc/ruby
    pdfdir = /usr/share/doc/ruby
    dvidir = /usr/share/doc/ruby
    htmldir = /usr/share/doc/ruby
    infodir = /usr/share/info
    docdir = /usr/share/doc/ruby
    oldincludedir = /usr/include
    includedir = /usr/include
    localstatedir = /var
    sharedstatedir = /var/lib
    sysconfdir = /etc
    datadir = /usr/share
    datarootdir = /usr/share
    libexecdir = /usr/libexec
    sbindir = /usr/sbin
    bindir = /usr/bin
    exec_prefix = /usr
    PACKAGE_URL =
    PACKAGE_BUGREPORT =
    PACKAGE_STRING =
    PACKAGE_VERSION =
    PACKAGE_TARNAME =
    PACKAGE_NAME =
    PATH_SEPARATOR = :
    SHELL = /bin/sh
    archdir = /usr/lib64/ruby/
    topdir = /usr/lib64/ruby

Ruby load path ($LOAD_PATH)

    /usr/local/share/ruby/site_ruby
    /usr/local/lib64/ruby/site_ruby
    /usr/share/ruby/vendor_ruby
    /usr/lib64/ruby/vendor_ruby
    /usr/share/rubygems
    /usr/share/ruby
    /usr/lib64/ruby/

Ruby loaded libraries ($LOADED_FEATURES)

    enumerator.so
    /usr/lib64/ruby/enc/encdb.so
    /usr/lib64/ruby/enc/trans/transdb.so
    /usr/lib64/ruby/rbconfig.rb
    /usr/share/rubygems/rubygems/compatibility.rb
    /usr/share/rubygems/rubygems/defaults.rb
    /usr/share/rubygems/rubygems/deprecate.rb
    /usr/share/rubygems/rubygems/errors.rb
    /usr/share/rubygems/rubygems/version.rb
    /usr/share/rubygems/rubygems/requirement.rb
    /usr/share/rubygems/rubygems/platform.rb
    /usr/share/rubygems/rubygems/specification.rb
    /usr/share/rubygems/rubygems/exceptions.rb
    /usr/share/rubygems/rubygems/defaults/operating_system.rb
    /usr/share/rubygems/rubygems/core_ext/kernel_gem.rb
    /usr/share/ruby/thread.rb
    /usr/share/ruby/monitor.rb
    /usr/share/rubygems/rubygems/core_ext/kernel_require.rb
    /usr/share/rubygems/rubygems.rb
    /usr/share/rubygems/rubygems/path_support.rb
    /usr/share/rubygems/rubygems/dependency.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/constants.rb
    /usr/lib64/ruby/etc.so
    /usr/share/ruby/fileutils.rb
    /usr/share/ruby/tmpdir.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/tmpio.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/platform_info.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/platform_info/operating_system.rb
    /usr/lib64/ruby/vendor_ruby/passenger_native_support.so
    /usr/share/ruby/vendor_ruby/phusion_passenger/native_support.rb
    /usr/lib64/ruby/socket.so
    /usr/share/ruby/socket.rb
    /usr/lib64/ruby/pathname.so
    /usr/share/ruby/pathname.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/ruby_core_enhancements.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/ruby_core_io_enhancements.rb
    /usr/share/ruby/base64.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/public_api.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/debug_logging.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/platform_info/ruby.rb
    /usr/share/ruby/shellwords.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/shellwords.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb
    /usr/lib64/ruby/fcntl.so
    /usr/share/ruby/vendor_ruby/phusion_passenger/message_channel.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/message_client.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/native_support_utils.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/unseekable_socket.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler.rb
    /usr/lib64/ruby/stringio.so
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/tee_input.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb
</code>```

答:
Passenger is using /usr/bin/ruby and you want it to use an RVM Ruby. You need to tell Passenger which Ruby command it should use to run your app, because there are multiple Ruby interpreters on your system. Please run passenger-config about ruby-command to find out which Ruby interpreter you are using. For example:

```<code>passenger-config about ruby-command
passenger-config was invoked through the following Ruby interpreter:
  Command: /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby
  Version: ruby 2.3.3p85 (2015-02-26 revision 49769) [x86_64-linux]
  ...
</code>```

Please take note of the path after "Command" (in this example, /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby). You need to set the passenger_ruby config option to this path.

https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#determine_ruby_command

Body:
I have a Rails app I am trying to deploy to production. I have Passenger setup with Nginx, and looking at the Nginx logs, passenger is starting but when I try to browse to my app the error logs fills up with the following:

App 67160 stdout:
App 67160 stdout:
[ E 2017-11-17 11:06:39.5087 67125/Th age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /var/www/vuln_frontend: An error occurred while starting up the preloader.
  Error ID: bd9a976b
  Error details saved to: /tmp/passenger-error-okz7mL.html
  Message from application: cannot load such file -- bundler/setup (LoadError)
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `'

[ E 2017-11-17 11:06:39.5121 67125/T9 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 2-1] Cannot checkout session because a spawning error occurred. The identifier of the error is bd9a976b. Please see earlier logs for details about the error.

I have checked in /tmp/ but there is no /tmp/passenger-error-okz7mL.html
 file and my system Ruby is 2.4.2, the same as my app is using and the same as the RVM version.

I can't see where the issue lies, my gems are all up to date in the app and system.

I can load the Passenger error page but nothing else.

I have enabled riendly error pages and got the below output:

Details:

cannot load such file -- bundler/setup (LoadError)
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `'

System information:

Application root
    /var/www/vuln_frontend
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)
    production
Ruby interpreter command

    /usr/bin/ruby

User and groups

    uid=99(nobody) gid=99(nobody) groups=99(nobody)

Environment variables

    PASSENGER_USE_FEEDBACK_FD = true
    SERVER_SOFTWARE = nginx/1.12.1 Phusion_Passenger/5.1.11
    PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.XXXXMTSagL
    USER = nobody
    LOGNAME = nobody
    SHELL = /sbin/nologin
    HOME = /
    PWD = /var/www/vuln_frontend
    IN_PASSENGER = 1
    PYTHONUNBUFFERED = 1
    NODE_PATH = /usr/share/passenger/node
    RAILS_ENV = production
    RACK_ENV = production
    WSGI_ENV = production
    NODE_ENV = production
    PASSENGER_APP_ENV = production

Ulimits

    Unknown

System metrics

    ------------- General -------------
    Kernel version    : 3.10.0-693.5.2.el7.x86_64
    Uptime            : 1d 21h 16m 17s
    Load averages     : 0.00%, 0.01%, 0.05%
    Fork rate         : unknown

    ------------- CPU -------------
    Number of CPUs    :    2
    Average CPU usage :   0%  --   0% user,   0% nice,   0% system, 100% idle
      CPU 1           :   0%  --   0% user,   0% nice,   0% system, 100% idle
      CPU 2           :   0%  --   0% user,   0% nice,   0% system, 100% idle
    I/O pressure      :   0%
      CPU 1           :   0%
      CPU 2           :   0%
    Interference from other VMs:   0%
      CPU 1                    :   0%
      CPU 2                    :   0%

    ------------- Memory -------------
    RAM total         :   1823 MB
    RAM used          :    543 MB (30%)
    RAM free          :   1279 MB
    Swap total        :   2047 MB
    Swap used         :      0 MB (0%)
    Swap free         :   2047 MB
    Swap in           : unknown
    Swap out          : unknown

General Ruby interpreter information

    RUBY_VERSION = 2.0.0
    RUBY_PLATFORM = x86_64-linux
    RUBY_ENGINE = ruby
    RubyGems version = 2.0.14.1
    RubyGems paths = ["/.gem/ruby", "/usr/share/gems", "/usr/local/share/gems"]

Ruby configuration (RbConfig::CONFIG)

    DESTDIR =
    MAJOR = 2
    MINOR = 0
    TEENY = 0
    PATCHLEVEL = 648
    INSTALL = /usr/bin/install -c
    EXEEXT =
    prefix = /usr
    ruby_install_name = ruby
    RUBY_INSTALL_NAME = ruby
    RUBY_SO_NAME = ruby
    exec = exec
    ruby_pc = ruby.pc
    PACKAGE = ruby
    BUILTIN_TRANSSRCS =  newline.c
    USE_RUBYGEMS = YES
    MANTYPE = doc
    NROFF = /usr/bin/nroff
    OPTIONAL_PRELUDES = ./abrt_prelude.rb
    vendorarchhdrdir = /usr/include/vendor_ruby/x86_64-linux
    sitearchhdrdir = /usr/include/site_ruby/x86_64-linux
    rubyarchhdrdir = /usr/include
    vendorhdrdir = /usr/include/vendor_ruby
    sitehdrdir = /usr/include/site_ruby
    rubyhdrdir = /usr/include
    UNIVERSAL_INTS =
    UNIVERSAL_ARCHNAMES =
    configure_args =  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-rubylibprefix=/usr/share/ruby' '--with-rubyarchprefix=/usr/lib64/ruby' '--with-sitedir=/usr/local/share/ruby/site_ruby' '--with-sitearchdir=/usr/local/lib64/ruby/site_ruby' '--with-vendordir=/usr/share/ruby/vendor_ruby' '--with-vendorarchdir=/usr/lib64/ruby/vendor_ruby' '--with-rubyhdrdir=/usr/include' '--with-rubyarchhdrdir=/usr/include' '--with-sitearchhdrdir=/usr/include/site_ruby/x86_64-linux' '--with-vendorarchhdrdir=/usr/include/vendor_ruby/x86_64-linux' '--with-rubygemsdir=/usr/share/rubygems' '--with-ruby-pc=ruby.pc' '--disable-rpath' '--enable-shared' '--with-ruby-version=' '--enable-multiarch' '--with-prelude=./abrt_prelude.rb' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic'
    rubygemsdir = /usr/share/rubygems
    vendorarchdir = /usr/lib64/ruby/vendor_ruby
    vendorlibdir = /usr/share/ruby/vendor_ruby/
    vendordir = /usr/share/ruby/vendor_ruby
    sitearchdir = /usr/local/lib64/ruby/site_ruby
    sitelibdir = /usr/local/share/ruby/site_ruby/
    sitedir = /usr/local/share/ruby/site_ruby
    rubyarchdir = /usr/lib64/ruby/
    rubylibdir = /usr/share/ruby/
    ruby_version =
    sitearch = x86_64-linux
    arch = x86_64-linux
    sitearchincludedir = /usr/include/x86_64-linux
    archincludedir = /usr/include/x86_64-linux
    sitearchlibdir = /usr/lib64/x86_64-linux
    archlibdir = /usr/lib64/x86_64-linux
    RI_BASE_NAME = ri
    ridir = /usr/share/ri
    rubysitearchprefix = /usr/lib64/x86_64-linux/ruby
    rubyarchprefix = /usr/lib64/ruby
    rubylibprefix = /usr/share/ruby
    MAKEFILES = Makefile
    PLATFORM_DIR =
    THREAD_MODEL = pthread
    SYMBOL_PREFIX =
    EXPORT_PREFIX =
    COMMON_HEADERS =
    COMMON_MACROS =
    COMMON_LIBS =
    MAINLIBS =
    ENABLE_SHARED = yes
    DLDLIBS =  -lc
    SOLIBS = -lpthread -lrt -ldl -lcrypt -lm
    LIBRUBYARG_SHARED = -lruby
    LIBRUBYARG_STATIC = -lruby-static
    LIBRUBYARG = -lruby
    LIBRUBY = libruby.so.2.0.0
    LIBRUBY_ALIASES = libruby.so.2.0 libruby.so
    LIBRUBY_SO = libruby.so.2.0.0
    LIBRUBY_A = libruby-static.a
    RUBYW_INSTALL_NAME =
    rubyw_install_name =
    LIBRUBY_DLDFLAGS = -Wl,-soname,libruby.so.2.0
    LIBRUBY_LDSHARED = gcc -shared
    EXTDLDFLAGS =
    EXTLDFLAGS =
    strict_warnflags = -ansi -std=iso9899:199409
    warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
    debugflags = -ggdb3
    optflags = -O3 -fno-fast-math
    cxxflags =  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
    cflags =  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
    cppflags =
    NULLCMD = :
    DLNOBJ = dln.o
    INSTALLDOC = all
    CAPITARGET = nodoc
    RDOCTARGET = rdoc
    DTRACE_GLOMMED_OBJ = ruby-glommed.o
    DTRACE_OBJ = probes.o
    DTRACE_EXT = d
    EXECUTABLE_EXTS =
    ARCHFILE =
    LIBRUBY_RELATIVE = no
    EXTOUT = .ext
    RUNRUBY_COMMAND = $(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=.ext $(RUNRUBYOPT)
    PREP = miniruby
    BTESTRUBY = $(MINIRUBY)
    CROSS_COMPILING = no
    TEST_RUNNABLE = yes
    setup = Setup
    EXTSTATIC =
    STRIP = strip -S -x
    TRY_LINK =
    LIBPATHENV = LD_LIBRARY_PATH
    RPATHFLAG =
    LIBPATHFLAG =  -L%s
    LINK_SO =
    LIBEXT = a
    DLEXT2 =
    DLEXT = so
    LDSHAREDXX = g++ -shared
    LDSHARED = gcc -shared
    CCDLFLAGS = -fPIC
    STATIC =
    ARCH_FLAG = -m64
    DLDFLAGS =
    ALLOCA =
    codesign =
    POSTLINK = :
    WERRORFLAG = -Werror
    CHDIR = cd -P
    RMALL = rm -fr
    RMDIRS = rmdir --ignore-fail-on-non-empty -p
    RMDIR = rmdir --ignore-fail-on-non-empty
    CP = cp
    RM = rm -f
    PKG_CONFIG = pkg-config
    PYTHON =
    DOXYGEN =
    DOT =
    DTRACE = dtrace
    MAKEDIRS = /usr/bin/mkdir -p
    MKDIR_P = /usr/bin/mkdir -p
    INSTALL_DATA = /usr/bin/install -c -m 644
    INSTALL_SCRIPT = /usr/bin/install -c
    INSTALL_PROGRAM = /usr/bin/install -c
    SET_MAKE =
    LN_S = ln -s
    NM = nm
    DLLWRAP =
    WINDRES =
    OBJCOPY = :
    OBJDUMP = objdump
    ASFLAGS =
    AS = as
    AR = ar
    RANLIB = ranlib
    try_header =
    COUTFLAG = -o
    OUTFLAG = -o
    CPPOUTFILE = -o conftest.i
    GNU_LD = yes
    LD = ld
    GCC = yes
    EGREP = /usr/bin/grep -E
    GREP = /usr/bin/grep
    CPP = gcc -E
    CXXFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic
    CXX = g++
    OBJEXT = o
    CPPFLAGS =
    LDFLAGS = -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic
    CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC
    CC = gcc
    NACL_SDK_VARIANT =
    NACL_SDK_ROOT =
    NACL_TOOLCHAIN =
    target_os = linux
    target_vendor = redhat
    target_cpu = x86_64
    target = x86_64-redhat-linux-gnu
    host_os = linux-gnu
    host_vendor = redhat
    host_cpu = x86_64
    host = x86_64-redhat-linux-gnu
    RUBY_VERSION_NAME = ruby-
    RUBYW_BASE_NAME = rubyw
    RUBY_BASE_NAME = ruby
    build_os = linux-gnu
    build_vendor = redhat
    build_cpu = x86_64
    build = x86_64-redhat-linux-gnu
    RUBY_RELEASE_DATE = 2015-12-16
    RUBY_PROGRAM_VERSION = 2.0.0
    target_alias =
    host_alias = x86_64-redhat-linux-gnu
    build_alias = x86_64-redhat-linux-gnu
    LIBS = -lpthread -lrt -ldl -lcrypt -lm
    ECHO_T =
    ECHO_N = -n
    ECHO_C =
    DEFS =
    mandir = /usr/share/man
    localedir = /usr/share/locale
    libdir = /usr/lib64
    psdir = /usr/share/doc/ruby
    pdfdir = /usr/share/doc/ruby
    dvidir = /usr/share/doc/ruby
    htmldir = /usr/share/doc/ruby
    infodir = /usr/share/info
    docdir = /usr/share/doc/ruby
    oldincludedir = /usr/include
    includedir = /usr/include
    localstatedir = /var
    sharedstatedir = /var/lib
    sysconfdir = /etc
    datadir = /usr/share
    datarootdir = /usr/share
    libexecdir = /usr/libexec
    sbindir = /usr/sbin
    bindir = /usr/bin
    exec_prefix = /usr
    PACKAGE_URL =
    PACKAGE_BUGREPORT =
    PACKAGE_STRING =
    PACKAGE_VERSION =
    PACKAGE_TARNAME =
    PACKAGE_NAME =
    PATH_SEPARATOR = :
    SHELL = /bin/sh
    archdir = /usr/lib64/ruby/
    topdir = /usr/lib64/ruby

Ruby load path ($LOAD_PATH)

    /usr/local/share/ruby/site_ruby
    /usr/local/lib64/ruby/site_ruby
    /usr/share/ruby/vendor_ruby
    /usr/lib64/ruby/vendor_ruby
    /usr/share/rubygems
    /usr/share/ruby
    /usr/lib64/ruby/

Ruby loaded libraries ($LOADED_FEATURES)

    enumerator.so
    /usr/lib64/ruby/enc/encdb.so
    /usr/lib64/ruby/enc/trans/transdb.so
    /usr/lib64/ruby/rbconfig.rb
    /usr/share/rubygems/rubygems/compatibility.rb
    /usr/share/rubygems/rubygems/defaults.rb
    /usr/share/rubygems/rubygems/deprecate.rb
    /usr/share/rubygems/rubygems/errors.rb
    /usr/share/rubygems/rubygems/version.rb
    /usr/share/rubygems/rubygems/requirement.rb
    /usr/share/rubygems/rubygems/platform.rb
    /usr/share/rubygems/rubygems/specification.rb
    /usr/share/rubygems/rubygems/exceptions.rb
    /usr/share/rubygems/rubygems/defaults/operating_system.rb
    /usr/share/rubygems/rubygems/core_ext/kernel_gem.rb
    /usr/share/ruby/thread.rb
    /usr/share/ruby/monitor.rb
    /usr/share/rubygems/rubygems/core_ext/kernel_require.rb
    /usr/share/rubygems/rubygems.rb
    /usr/share/rubygems/rubygems/path_support.rb
    /usr/share/rubygems/rubygems/dependency.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/constants.rb
    /usr/lib64/ruby/etc.so
    /usr/share/ruby/fileutils.rb
    /usr/share/ruby/tmpdir.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/tmpio.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/platform_info.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/platform_info/operating_system.rb
    /usr/lib64/ruby/vendor_ruby/passenger_native_support.so
    /usr/share/ruby/vendor_ruby/phusion_passenger/native_support.rb
    /usr/lib64/ruby/socket.so
    /usr/share/ruby/socket.rb
    /usr/lib64/ruby/pathname.so
    /usr/share/ruby/pathname.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/ruby_core_enhancements.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/ruby_core_io_enhancements.rb
    /usr/share/ruby/base64.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/public_api.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/debug_logging.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/platform_info/ruby.rb
    /usr/share/ruby/shellwords.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/shellwords.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb
    /usr/lib64/ruby/fcntl.so
    /usr/share/ruby/vendor_ruby/phusion_passenger/message_channel.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/message_client.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/native_support_utils.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/unseekable_socket.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler.rb
    /usr/lib64/ruby/stringio.so
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils/tee_input.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb
    /usr/share/ruby/vendor_ruby/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb

Body:
Passenger is using /usr/bin/ruby and you want it to use an RVM Ruby. You need to tell Passenger which Ruby command it should use to run your app, because there are multiple Ruby interpreters on your system. Please run passenger-config about ruby-command to find out which Ruby interpreter you are using. For example:

passenger-config about ruby-command
passenger-config was invoked through the following Ruby interpreter:
  Command: /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby
  Version: ruby 2.3.3p85 (2015-02-26 revision 49769) [x86_64-linux]
  ...

Please take note of the path after "Command" (in this example, /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby). You need to set the passenger_ruby config option to this path.

https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#determine_ruby_command


问:
deleted tables when using left_joint with sparklyr
I'm working with some tables that I want to join, for that I use sparklyr (due to tables size) with left_joint of dplyr.
here is the code sample :

```<code>query.1 <- left_join(pa11, pa12, by = c("CODIGO_HAB_D","ID_EST","ID_ME","ID_PARTE_D","ID_PAR", "ID_REP")) %>% left_join(., pa13, by = c("ID_SINI" = "ID_SINI"))

query.1 <- left_join(query.1, a14, by = "ID_REP" )
query.1 <-left_join(query.1, a16, by = c("ID_MEJ" = "ID_ME"))
query.1 <-left_join(query.1, a17, by = c("ID_EST"  = "ID_ESTE"))
query.1 <-left_join(query.1, a18, by = "ID_PARTE_D" )
query.1 <-left_join(query.1, a19, by = "CODI" )
query.1 <-left_join(query.1, a110, by = c("ID_PROF.x" = "ID_PROF" ))
query.1 <-left_join(query.1, a111, by = c("ID_COM.x" = "ID_COM" ))
query.1 <-left_join(query.1, a113, by = c("ID_GRANDES.x" = "ID_GRANDES"))
</code>```

When I left_joint the 5 first tables, everything goes as expected. When I repeat this with more tables i get this error

```<code>Error in as.vector(x, "character") :
cannot coerce type 'environment' to vector of type 'character'
</code>```

then, when I try to take a look at the Spark table I get an error in Rstudio.

答:
I get these errors from time to time for some other reasons.

From my experience, increasing the Sparklyr memory and executor overheadmemory helps

```<code>    config <- spark_config()
    config$`sparklyr.shell.driver-memory` <- "8G"
    config$`sparklyr.shell.executor-memory` <- "8G"
    config$spark.yarn.executor.memoryOverhead <- "2g"
</code>```

Body:
I'm working with some tables that I want to join, for that I use sparklyr (due to tables size) with left_joint of dplyr.
here is the code sample :

query.1 <- left_join(pa11, pa12, by = c("CODIGO_HAB_D","ID_EST","ID_ME","ID_PARTE_D","ID_PAR", "ID_REP")) %>% left_join(., pa13, by = c("ID_SINI" = "ID_SINI"))

query.1 <- left_join(query.1, a14, by = "ID_REP" )
query.1 <-left_join(query.1, a16, by = c("ID_MEJ" = "ID_ME"))
query.1 <-left_join(query.1, a17, by = c("ID_EST"  = "ID_ESTE"))
query.1 <-left_join(query.1, a18, by = "ID_PARTE_D" )
query.1 <-left_join(query.1, a19, by = "CODI" )
query.1 <-left_join(query.1, a110, by = c("ID_PROF.x" = "ID_PROF" ))
query.1 <-left_join(query.1, a111, by = c("ID_COM.x" = "ID_COM" ))
query.1 <-left_join(query.1, a113, by = c("ID_GRANDES.x" = "ID_GRANDES"))

When I left_joint the 5 first tables, everything goes as expected. When I repeat this with more tables i get this error

Error in as.vector(x, "character") :
cannot coerce type 'environment' to vector of type 'character'

then, when I try to take a look at the Spark table I get an error in Rstudio.

Body:
I get these errors from time to time for some other reasons.

From my experience, increasing the Sparklyr memory and executor overheadmemory helps

    config <- spark_config()
    config$`sparklyr.shell.driver-memory` <- "8G"
    config$`sparklyr.shell.executor-memory` <- "8G"
    config$spark.yarn.executor.memoryOverhead <- "2g"


问:
Migration from Zend_Lucene to Solr
In our project (based on Zend Framework) we have to find a replacement for default Zend_Lucene. Now I'm trying to implement Solr with PHP Solr Client in it.
We have 2 tables, where we take the data: categories and offers.

In Zend_Lucene addition data to index go that way:

```<code>/*Code above we create new index and take data from mysql
And here are the old methods:
offer - is array with query results
*/

$to_index = "{$offer["name"]} {$offer["type"]} {$offer["description"]}";

 $doc = new Zend_Search_Lucene_Document();
 $doc->addField( Zend_Search_Lucene_Field::Text('text', $to_index, "utf-8") );
 $doc->addField( Zend_Search_Lucene_Field::Keyword('cat_id', $offer["cat_id"]) );
 $doc->addField( Zend_Search_Lucene_Field::Keyword('type', "offer") );
 $doc->addField( Zend_Search_Lucene_Field::Keyword('id', $offer["id"]) );
 $doc->addField( Zend_Search_Lucene_Field::UnIndexed('created', time()) );

$this->index->addDocument($doc);

/*End of old code*/
</code>```

The same methods we have for categories/

In Solr and PHP Solr Client, I've changed that code (using default example schema.xml):

```<code>$to_index = "{$category["name"]}";

$doc = new Apache_Solr_Document();
$doc->text = $to_index;
$doc->type = "category";
$doc->id = $category["id"];
$doc->created = time();

try {
     $this->solr->addDocuments($doc);
     $this->solr->commit();
     $this->solr->optimize();
}
catch ( Exception $e ) {
     echo $e->getMessage();
}
</code>```

But search in index gives me 0! I have a suspicion, that Solr doesn't make proper index. (But there are no bug messages or exeptions during index creation). Also I'd try to give Solr only text and id poles in methods. But result was the same!

What I'm doing wrong? Did I change the Zend_Lucene methods correctly?

答:
I would recommend you to use the "DataImportHandler" built in Solr, to import data from a DataBase to the Solr engine.

It will do the job for you, and you can configure "full-import" which will import all the database and "delta-import" which will just import the new data from the database. You can configure "delete" too, to remove deleted database data.

ContentLicense: CC BY-SA 2.5

Title: Migration from Zend_Lucene to Solr

Body:
In our project (based on Zend Framework) we have to find a replacement for default Zend_Lucene. Now I'm trying to implement Solr with PHP Solr Client in it.
We have 2 tables, where we take the data: categories and offers.

In Zend_Lucene addition data to index go that way:

/*Code above we create new index and take data from mysql
And here are the old methods:
offer - is array with query results
*/

$to_index = "{$offer["name"]} {$offer["type"]} {$offer["description"]}";

 $doc = new Zend_Search_Lucene_Document();
 $doc->addField( Zend_Search_Lucene_Field::Text('text', $to_index, "utf-8") );
 $doc->addField( Zend_Search_Lucene_Field::Keyword('cat_id', $offer["cat_id"]) );
 $doc->addField( Zend_Search_Lucene_Field::Keyword('type', "offer") );
 $doc->addField( Zend_Search_Lucene_Field::Keyword('id', $offer["id"]) );
 $doc->addField( Zend_Search_Lucene_Field::UnIndexed('created', time()) );

$this->index->addDocument($doc);

/*End of old code*/

The same methods we have for categories/

In Solr and PHP Solr Client, I've changed that code (using default example schema.xml):

$to_index = "{$category["name"]}";

$doc = new Apache_Solr_Document();
$doc->text = $to_index;
$doc->type = "category";
$doc->id = $category["id"];
$doc->created = time();

try {
     $this->solr->addDocuments($doc);
     $this->solr->commit();
     $this->solr->optimize();
}
catch ( Exception $e ) {
     echo $e->getMessage();
}

But search in index gives me 0! I have a suspicion, that Solr doesn't make proper index. (But there are no bug messages or exeptions during index creation). Also I'd try to give Solr only text and id poles in methods. But result was the same!

What I'm doing wrong? Did I change the Zend_Lucene methods correctly?


问:
how to combine an id div and a php id
I don't know the specifications of PHP and an ID DIV. Here's my question :

Can I put in the same time an ID DIV named #modal and an ID PHP RETURN ?

```<code>while ( $contents_print = mysqli_fetch_array( $req_print ) ) {
    echo'
        <div class="row print">
            <div class="col s12 m4">
              <div class="card">
                <div class="card-image">
                  <img data-tags="print" class="activator" src="../00_sources/images/upload/pic_min/' . $contents_print[ 'pic_min' ] . '" alt="' . $contents_print[ 'pic_min' ] . '">
                  <a href="#modal" class="btn-floating halfway-fab waves-effect waves-light primary-color-text modal-trigger"><i class="material-icons">add</i></a>
                </div>
                <div class="card-content">
                    <span class="card-title">'.$contents_print['nom_projet'].'</span>
                  <p>'.$contents_print['detail_projet'].'</p>
                </div>
              </div>
            </div>
         </div>';
}
</code>```

This is my jquery ajax code :

```<code>$(document).ready(function(){
$('.materialboxed').materialbox();
 });

$( document ).ready( function () {
    $.ajax( {
            url: 'core/libs/contents-services.php?action=getFilterContent&id=3',
            type: "get",
            dataType: "html",
            success: function ( reponse ) {
                $( '#modal' ).html( reponse );
            }
        } );

    // the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
    $( '.modal' ).modal();
} );
</code>```

In my ajax code : the line url: 'core/libs/contents-services.php?action=getFilterContent&id=3', I have to use the id from the php/mysql request

I would like to make a link like this :
url: 'core/libs/contents-services.php?action=getFilterContent&id='.$_GET['id'].',

I hope I'am clear

Thanks for your help

http://portfolio.rabahbook.fr to see my working's site

答:
```<code>$('.post .modal-action').click(function(e){
    e.preventDefault();
    var id_projet= $(this).data('id_projet');
    var $hidennDiv = $('#' +id_projet);
    // do your ajax and whatever you want to do with the hidden div
    $.ajax( {
        url: 'core/libs/contents-services.php?action=getFilterContent&id='+id_projet,
        type: "get",
        dataType: "html",
        success: function ( reponse ) {
            $( '#modal' ).html( reponse );
            id_projet = reponse.id_projet;
        }
    } );
    $( '.modal' ).modal();
});
</code>```

This works for me

```<code><a href="#modal" class="modal-action modal-trigger" data-id_projet="'.$contents_print[ 'id_projet' ].'"></a>
</code>```

Thanks all to taking time to anwser to me !

Title: how to combine an id div and a php id

Body:
I don't know the specifications of PHP and an ID DIV. Here's my question :

Can I put in the same time an ID DIV named #modal and an ID PHP RETURN ?

while ( $contents_print = mysqli_fetch_array( $req_print ) ) {
    echo'

                  add

                    '.$contents_print['nom_projet'].'

'.$contents_print['detail_projet'].'

';
}

This is my jquery ajax code :

$(document).ready(function(){
$('.materialboxed').materialbox();
 });

$( document ).ready( function () {
    $.ajax( {
            url: 'core/libs/contents-services.php?action=getFilterContent&id=3',
            type: "get",
            dataType: "html",
            success: function ( reponse ) {
                $( '#modal' ).html( reponse );
            }
        } );

    // the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
    $( '.modal' ).modal();
} );

In my ajax code : the line url: 'core/libs/contents-services.php?action=getFilterContent&id=3', I have to use the id from the php/mysql request

I would like to make a link like this :
url: 'core/libs/contents-services.php?action=getFilterContent&id='.$_GET['id'].',

I hope I'am clear

Thanks for your help

http://portfolio.rabahbook.fr to see my working's site

Body:
$('.post .modal-action').click(function(e){
    e.preventDefault();
    var id_projet= $(this).data('id_projet');
    var $hidennDiv = $('#' +id_projet);
    // do your ajax and whatever you want to do with the hidden div
    $.ajax( {
        url: 'core/libs/contents-services.php?action=getFilterContent&id='+id_projet,
        type: "get",
        dataType: "html",
        success: function ( reponse ) {
            $( '#modal' ).html( reponse );
            id_projet = reponse.id_projet;
        }
    } );
    $( '.modal' ).modal();
});

This works for me

<a href="#modal" class="modal-action modal-trigger" data-id_projet="'.$contents_print[ 'id_projet' ].'"></a>

Thanks all to taking time to anwser to me !


问:
android studio 3.0 stuck at "building gradle project info"
Today I was going to make a new project in Android Studio. The Android Studio on my computer is updated to 3.0. When I was creating a new project and finished the procedure of the settings, the AS stuck at "Building Gradle Project info".

I have met this situation several times in AS 2.3.3, and I solved them by modifying the gradle distributionUrl. But this time, it doesn't work.

I hope someone can give me a hand. Thanks anyway!

答:
Problem

AS 3.0 is trying to download a new version of gradle but it is taking too much time.

Solution

Make sure to close AS 3.0

Go to the folder: C:\Users\[username]\.gradle\wrapper\dists

Note the latest version of gradle present there (gradle-4.1-all in my case)

Go to http://downloads.gradle.org/distributions and download the zip archive for this exact version (gradle-4.1-all.zip in my case)

Copy the archive in this gradle sub-folder, something like : C:\Users\[username]\.gradle\wrapper\dists\gradle-4.1-all\c64ydeuardnfqctvr1gm30w53 ;
delete the file with .part extension in this folder, it is the one AS 3.0 was trying to download.

Unzip the downloaded archive in this folder.

Create a copy of the present .lck file (0 KB) with the .ok extension (gradle-4.1-all.zip.ok in my case). I noticed that there are .ok files in other gradle version folders but I do not know if this is necessary.

Run AS 3.0, it should be fine now.