问:
Security role to user/group mapping: Error ADMA0014E: No virtual host specified
When trying to save via OK Button, I'm getting this error and WebSphere is not saving it. How can I fix that?

EDIT: This is the error message I'm trying to resolve with the configuration in WebSphere:

```<code>[6/20/16 10:46:34:524 CEST] 00000034 WebCollaborat A   SECJ0129E: Authorization failed for user TUZRS01:customRealm while invoking GET on null:/TestProject/, Authorization failed, Not granted any of the required roles: User
</code>```

答:
@DYangu's link to IBM pointed me in the right direction. When installing via wsadmin, it appears that the ibm-web-bnd.xml file is created automatically. If trying to install the application from eclipse/RAD, however, the file is not created.

What I did to resolve was create the above named file in my web application project (war) under WEB-INF folder:

```<code><?xml version="1.0" encoding="UTF-8"?>
<web-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://websphere.ibm.com/xml/ns/javaee"
        xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd" version="1.0">
    <virtual-host name="default_host"/>
</web-bnd>
</code>```

After doing this, I was able to successfully map the security role to the module.

Body:
When trying to save via OK Button, I'm getting this error and WebSphere is not saving it. How can I fix that?

EDIT: This is the error message I'm trying to resolve with the configuration in WebSphere:

[6/20/16 10:46:34:524 CEST] 00000034 WebCollaborat A   SECJ0129E: Authorization failed for user TUZRS01:customRealm while invoking GET on null:/TestProject/, Authorization failed, Not granted any of the required roles: User

Body:
@DYangu's link to IBM pointed me in the right direction. When installing via wsadmin, it appears that the ibm-web-bnd.xml file is created automatically. If trying to install the application from eclipse/RAD, however, the file is not created.

What I did to resolve was create the above named file in my web application project (war) under WEB-INF folder:

<?xml version="1.0" encoding="UTF-8"?>
<web-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://websphere.ibm.com/xml/ns/javaee"
        xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd" version="1.0">
    <virtual-host name="default_host"/>
</web-bnd>

After doing this, I was able to successfully map the security role to the module.


来源: stackexchange

问:
When would getters and setters with mutex be thread safe?
Consider the following class:

```<code>class testThreads
{
private:
    int var; // variable to be modified
    std::mutex mtx; // mutex
public:
    void set_var(int arg) // setter
    {
        std::lock_guard<std::mutex> lk(mtx);
        var = arg;
    }

    int get_var() // getter
    {
        std::lock_guard<std::mutex> lk(mtx);
        return var;
    }

    void hundred_adder()
    {
        for(int i = 0; i < 100; i++)
        {
            int got = get_var();
            set_var(got + 1);
            sleep(0.1);
        }
     }
};
</code>```

When I create two threads in main(), each with a thread function of hundred_adder modifying the same variable var, the end result of the var is always different i.e. not 200 but some other number.

Conceptually speaking, why is this use of mutex with getter and setter functions not thread-safe? Do the lock-guards fail to prevent the race-condition to var? And what would be an alternative solution?

答:
```<code>  int got = get_var();
  set_var(got + 1);
</code>```

Your get_var() and set_var() themselves are thread safe. But this combined sequence of get_var() followed by set_var() is not. There is no mutex that protects this entire sequence.

You have multiple concurrent threads executing this. You have multiple threads calling get_var(). After the first one finishes it and unlocks the mutex, another thread can lock the mutex immediately and obtain the same value for got that the first thread did. There's absolutely nothing that prevents multiple threads from locking and obtaining the same got, concurrently.

Then both threads will call set_var(), updating the mutex-protected int to the same value.

That's just one possibility that can happen here. You could easily have multiple threads acquiring the mutex sequentially and thus incrementing var by several values, only to be followed by some other, stalled thread, that called get_var() several seconds ago, and only now getting around to calling set_var(), thus resetting var to a much smaller value.

ContentLicense: CC BY-SA 3.0

Body:
Consider the following class:

class testThreads
{
private:
    int var; // variable to be modified
    std::mutex mtx; // mutex
public:
    void set_var(int arg) // setter
    {
        std::lock_guard<std::mutex> lk(mtx);
        var = arg;
    }

    int get_var() // getter
    {
        std::lock_guard<std::mutex> lk(mtx);
        return var;
    }

    void hundred_adder()
    {
        for(int i = 0; i < 100; i++)
        {
            int got = get_var();
            set_var(got + 1);
            sleep(0.1);
        }
     }
};

When I create two threads in main(), each with a thread function of hundred_adder modifying the same variable var, the end result of the var is always different i.e. not 200 but some other number.

Conceptually speaking, why is this use of mutex with getter and setter functions not thread-safe? Do the lock-guards fail to prevent the race-condition to var? And what would be an alternative solution?

Body:
  int got = get_var();
  set_var(got + 1);

Your get_var() and set_var() themselves are thread safe. But this combined sequence of get_var() followed by set_var() is not. There is no mutex that protects this entire sequence.

You have multiple concurrent threads executing this. You have multiple threads calling get_var(). After the first one finishes it and unlocks the mutex, another thread can lock the mutex immediately and obtain the same value for got that the first thread did. There's absolutely nothing that prevents multiple threads from locking and obtaining the same got, concurrently.

Then both threads will call set_var(), updating the mutex-protected int to the same value.

That's just one possibility that can happen here. You could easily have multiple threads acquiring the mutex sequentially and thus incrementing var by several values, only to be followed by some other, stalled thread, that called get_var() several seconds ago, and only now getting around to calling set_var(), thus resetting var to a much smaller value.


问:
Flow and function definitions
I'm trying to define a function signature in flow. I would expect the following code to throw an error but I'm not getting any error for this ?

```<code>// function that applied a function to an array - just for numbers
const arrayMath = (func: () => number, arr: Array<number>):Array<Number> => arr.map(func);

// would expect this function to work OK with arrayMath
const square = (num: number): number => num * num;

// would expect this function to fail with arrayMath
const concatX = (str: string): string => `${str}X`;

// flow is not giving me an error here..
arrayMath(concatX, [1, 2, 3]);
</code>```

答:
It appears that flow does find errors with the code you posted.

https://flow.org/try/#0PTAEAEDMBsHsHcBQiSkgVwHYGMAuBLWTUXACwENdRyAHG6fAUwBNq0s9DjdZrjyATgPIBPUAFpQAK3QBnKpFgDQmdAFsARowGzE2IvOpDRAWUqlQAXlAAKDDgBctgJRWAfCvVaBAGiMCnAEFjEQAeVU1tN2cHYOEwgDkvKPd-ADo1WjsOZwBuZFR4WHRoVkYADxpGPBJSfFl2HAIiEl4igQBrUAB5AGlQeHwyf1NzPQMqWQBHdEFGK1sIpwjvGM9I5UsPCNAAKnX8lDAikrLK6qoyesbOFp40cnxoAaGLQXizMnHMQ30cSgAGgsbPIAqBQfhMABzNYQ6GpAAGABIAN6ggC+AIRh1QMAQoGumFgVCh+AAbpCoaA1PNyMRtAIlKBSNpGGk0oh3qMyDY-thAX4ANoARj8ACY-ABmAC6eSAA

Title: Flow and function definitions

Body:
I'm trying to define a function signature in flow. I would expect the following code to throw an error but I'm not getting any error for this ?

// function that applied a function to an array - just for numbers
const arrayMath = (func: () => number, arr: Array<number>):Array<Number> => arr.map(func);

// would expect this function to work OK with arrayMath
const square = (num: number): number => num * num;

// would expect this function to fail with arrayMath
const concatX = (str: string): string => `${str}X`;

// flow is not giving me an error here..
arrayMath(concatX, [1, 2, 3]);


问:
best practice json?
when using spring rest server side generate json, it will looks like below

```<code>{"userInfo":{"id":123,"userFullName":"full name"}}    with nested 'userInfo'
</code>```

should json generate this way is consider best practice or should just generate like below

{"id":88,"userFullName":"dfXXXXXXXXXX"}    without nested 'userinfo'

the reason i asking is, if i use the prior technique, on my client, i would need to Extract the user info as JSONObject then only can get json data . which way is better?

答: From a maintenance point of view, I would choose the first option, since you might need extra information latter. Apart from that, there's not much difference.</p>

ContentLicense: CC BY-SA 2.5

Title: best practice json?

Body:
when using spring rest server side generate json, it will looks like below

{"userInfo":{"id":123,"userFullName":"full name"}}    with nested 'userInfo'

should json generate this way is consider best practice or should just generate like below

{"id":88,"userFullName":"dfXXXXXXXXXX"}    without nested 'userinfo'

the reason i asking is, if i use the prior technique, on my client, i would need to Extract the user info as JSONObject then only can get json data . which way is better?


问:
Where all to use volatile keyword in C
I know volatile keyword prevents compiler from optimizing a variable and read it from memory whenever it is read. Apart from memory mapped registers, what are all the situations where we need to use volatile? Given a conforming compiler, do I have to declare test_var as volatile in both scenarios?

1.

In file1.c

```<code>int test_var=100;

void func1()
{
    test_var++;
}
</code>```

In file2.c

```<code>extern int test_var;

void func2()
{
    if(test_var==100)
    {
      ....
    }
}
</code>```

2.

In file1.c

```<code>int test_var=100;

void func1()
{

}
</code>```

In file2.c

```<code>extern int test_var;

void func2()
{
    if(test_var==100)
    {
      ....
    }
}
</code>```

答:
In C microcontroller applications using interrupts, the volatile keyword is essential in making sure that a value set in an interrupt is saved properly in the interrupt and later has the correct value in the main processing loop.  Failure to use volatile is perhaps the single biggest reason that timer-based interrupts or ADC (analog-digital conversion) based interrupts for example will have a corrupted value when flow of control resumes after the processor state is returned post-interrupt.  A canonical template from Atmel and GCC:

```<code>volatile uint8_t flag = 0;

ISR(TIMER_whatever_interrupt)
{
    flag = 1;
}

while(1) // main loop
{
    if (flag == 1)
    {
        <do something>
        flag = 0;
    }
}
</code>```

Without the volatile it's guaranteed to not work as expected.

Title: Where all to use volatile keyword in C

Body:
I know volatile keyword prevents compiler from optimizing a variable and read it from memory whenever it is read. Apart from memory mapped registers, what are all the situations where we need to use volatile? Given a conforming compiler, do I have to declare test_var as volatile in both scenarios?

1.

In file1.c

int test_var=100;

void func1()
{
    test_var++;
}

In file2.c

extern int test_var;

void func2()
{
    if(test_var==100)
    {
      ....
    }
}

2.

In file1.c

int test_var=100;

void func1()
{

}

In file2.c

extern int test_var;

void func2()
{
    if(test_var==100)
    {
      ....
    }
}

Body:
In C microcontroller applications using interrupts, the volatile keyword is essential in making sure that a value set in an interrupt is saved properly in the interrupt and later has the correct value in the main processing loop.  Failure to use volatile is perhaps the single biggest reason that timer-based interrupts or ADC (analog-digital conversion) based interrupts for example will have a corrupted value when flow of control resumes after the processor state is returned post-interrupt.  A canonical template from Atmel and GCC:

volatile uint8_t flag = 0;

ISR(TIMER_whatever_interrupt)
{
    flag = 1;
}

while(1) // main loop
{
    if (flag == 1)
    {
        <do something>
        flag = 0;
    }
}

Without the volatile it's guaranteed to not work as expected.


问:
Why does int(maxint) give a long, but int(int(maxint)) give an int? Is this a NumPy bug?
Pretty self-explanatory (I'm on Windows):

```<code>>>> import sys, numpy
>>> a = numpy.int_(sys.maxint)
>>> int(a).__class__
<type 'long'>
>>> int(int(a)).__class__
<type 'int'>
</code>```

Why does calling int once give me a long, whereas calling it twice gives me an int?

Is this a bug or a feature?

答:
As proposed in the (now-deleted) other answer, this does seem to be a bug due to an incorrect use of < instead of <=, but it's not coming from the code cited in the other answer. That code is part of the printing logic, which isn't involved here.

I believe the code that handles int calls on NumPy scalars is generated from a template in numpy/core/src/umath/scalarmath.c.src, the relevant part for signed integer dtypes being

```<code>    if(LONG_MIN < x && x < LONG_MAX)
        return PyInt_FromLong(x);
#endif
    return @func@(x);
</code>```

For integers strictly between LONG_MIN and LONG_MAX, this code produces an int. For an integer with value LONG_MAX, it falls back on the return @func@(x); case, where @func@ is substituted by an appropriate function from the PyLongFrom* family by the template engine.

Thus, calling int on a NumPy int with value LONG_MAX produces a long, but since the result is representable as an int, calling int on the result again produces an int.

Body:
Pretty self-explanatory (I'm on Windows):

>>> import sys, numpy
>>> a = numpy.int_(sys.maxint)
>>> int(a).__class__
<type 'long'>
>>> int(int(a)).__class__
<type 'int'>

Why does calling int once give me a long, whereas calling it twice gives me an int?

Is this a bug or a feature?

Body:
As proposed in the (now-deleted) other answer, this does seem to be a bug due to an incorrect use of < instead of <=, but it's not coming from the code cited in the other answer. That code is part of the printing logic, which isn't involved here.

I believe the code that handles int calls on NumPy scalars is generated from a template in numpy/core/src/umath/scalarmath.c.src, the relevant part for signed integer dtypes being

    if(LONG_MIN < x && x < LONG_MAX)
        return PyInt_FromLong(x);
#endif
    return @func@(x);

For integers strictly between LONG_MIN and LONG_MAX, this code produces an int. For an integer with value LONG_MAX, it falls back on the return @func@(x); case, where @func@ is substituted by an appropriate function from the PyLongFrom* family by the template engine.

Thus, calling int on a NumPy int with value LONG_MAX produces a long, but since the result is representable as an int, calling int on the result again produces an int.


问:
How to set tabBarIcon from the state in navigationOptions (react-navigation)
I want to do something just like this. i have image in my state but its showing me undefined error.I am using tabNavigator from react-navigation.</p>

```<code>static navigationOptions = {
   tabBarIcon:  <Image source={{uri: this.state.userImage}} style={{width:30, height: 30}}/>
}
</code>```

答:
Firstly you need to define a function that returns your react native component, not the component itself.

```<code>static navigationOptions = {
   tabBarIcon: () => (<Image source={{uri: this.state.userImage}} style={{width:30, height: 30}}/>)
}
</code>```

The error you're seeing is probably because you're trying to reference an instance of the component in a static method (this.state.userImage)

Body:
I want to do something just like this. i have image in my state but its showing me undefined error.I am using tabNavigator from react-navigation.

static navigationOptions = {
   tabBarIcon:  <Image source={{uri: this.state.userImage}} style={{width:30, height: 30}}/>
}

Body:
Firstly you need to define a function that returns your react native component, not the component itself.

static navigationOptions = {
   tabBarIcon: () => (<Image source={{uri: this.state.userImage}} style={{width:30, height: 30}}/>)
}

The error you're seeing is probably because you're trying to reference an instance of the component in a static method (this.state.userImage)


问:
IIS - 401.3 - Unauthorized
I am trying to get started with using IIS. I created a new site on IIS Manager, mapped it to a folder on my file system and added index.html to the folder. I have set the port to 85 for this site. When I try to access http://localhost:85/index.html, I get the following error message:

401.3 - unathorized - You do not have permission to view this directory or page because of the access control list (ACL)
  configuration or encryption settings for this resource on the Web
  server.

I gave read access to everybody on the folder and tried again. I could then access the page.

I then compared the properties of my folder with that of wwwroot. I found that wwwroot had read access on IIS_IUSRS...When I did the same on my folder and tried again, I got the above error again.
I checkedthat anonymous access is enabled by default, but I still get this error.

Why does this happen? What is the correct way to resolve the problem?

答:
TL;DR;

In most cases, granting access to the following account(s) (one|both) will be enough:

IIS AppPool\DefaultAppPool

IUSR

with Access Rights:

Read & Execute

List folder contents

Read

That's it!

Read on for a more detailed explanation...

Open IIS and select your application.

On the right side click on Authentication.

Select "Anonymous authentication"
here.

The following dialog pops up.

Grant access to the web application folder's ACL depending what is selected in the pic above:

Specific user: grant access for both IUSR (in my case) + IIS AppPool\DefaultAppPool

Application pool identity: grant access for IIS AppPool\DefaultAppPool only

IIS AppPool\DefaultAppPool account is the default AppPool account for new IIS web applications, if you have set a custom account, use the custom one.

Give the following permissions to the account(s):

Read & Execute

List folder contents

Read

Title: IIS - 401.3 - Unauthorized

ContentLicense: CC BY-SA 4.0


问:
What does ModeShape offer that JackRabbit doesn't?
I just familiarized myself with Apache JackRabbit. I've done a little multi-user repository for document management.

If anybody used both of them, could you please answer these questions ?

Is ModeShape somehow linked to JBoss ? I don't have much experience with JBoss AS or any other JBoss tools. I see a support for tomcat, but a lot of JBossy stuff

Documentation says that future releases should have UI integration, is it far future ? What kind of UI integration would it be ? Is there something that uses ModeShape as it is in case of Hippo CMS with JackRabbit ? It's a shame that Gatein doesn't use it.

How does JackRabbit compare to ModeShape in regard to fulltext search, indexing and the overall processing of text content ?

How about CMIS support ? I see an unresolved issue MODE-650. Jackrabbit is supported by OpenCMIS (Apache chmistry), even for secondary types in near future.

What about support/utils libraries, for developer convenience when working with Nodes

I'm interested in any other comparison comments, thank you

答:
The comparison above is outdated; Now you need to compare modeshare with jackrabbit oak.
http://jackrabbit.apache.org/oak/

Jackrabbit Oak is an effort to implement a scalable and performant
  hierarchical content repository for use as the foundation of modern
  world-class web sites and other demanding content applications.


问:
I Can't Edit my files in Android Studio
For some unknown reason, I can't edit files in Android Studio. This include both java and xml files and other files ,

I can't edit nothing - cut files , or delete , write , nothing worked..
Files are not locked as Read-Only. I checked.
Restarting Android Studio did not resolve my problem.
Please Help me ! Thanks

答:
This Can happen when you loose the focus of your Code View. you can keep focus by having a click on Scroll bar (right side) in the Android Studio.

This problem was in Android Studio version 1.2.2, So haven't experienced recently.
please Update Android Studio.

Title: I Can't Edit my files in Android Studio


问:
How to set a placeholder for a Image control (while it downloads)?
I have an app that show a list of images. The image source is set to a http URL, and the images are downloaded and display automatically.

However, while the app is taking time to download, the image control shows nothing. The user experience is not good this way.

How may I display a loading placeholder image, or a loading gauge, for each of the image control?

答: You could set the image source to your placeholder then when ImageOpened fires, change it to the remote url and let that run it's course.</p>


问:
How to display data from sql server with java [android studio]
I wish to display some data from my SQL server into my application.

Let me explain throw an example what have i done until now, and please tell me how should i go on with my work:

(1) I have a database named: 'DB1'
(2) In my database i have table named 'users':

```<code>Id, Name, LastName
1   Dave  Stone
2   Rose  Mary
3   Gray  Lone
</code>```

(3) I created 3 php files: 1/ config.php (sets up my database log in information like password...)
2/ DBConnection.php : `

```<code>// Connecting to database
public function connect() {
    require_once 'Config.php';

    // Connecting to mysql database
    $this->conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);

    // return database handler
    return $this->conn;
}
}

?>
</code>```

3/ GetUsers.php which i dont know how should i write it - this would be the code which will echo whatever i want from the table.

(4) Inside my android studio project i have a MainActivity.java and i want to get all the LastNames of all the users in the database and do whatever with them... like print them into a text box it doesn't really matter (let's say i don't know how many users I have).

I need some one to help me get stages (3)3/ + (4) done / explained.

答:
I think what you mean is a good method to retrieve and set values from app to database, the best and most prominent way is using basic REST services that convert your db values to JSON then you load the json using your api key as authentication, it might sound really stressful but is in fact very easy and flexible to implement, the only way you can directly set and get db values on android is using sqlite (android local inbuilt db)

The best tutorial and major explanation for exactly what you want to achieve is here

http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/

Then this one for further works
http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/

It covers how you make a rest service yourself

Body:
I wish to display some data from my SQL server into my application.

Let me explain throw an example what have i done until now, and please tell me how should i go on with my work:

(1) I have a database named: 'DB1'
(2) In my database i have table named 'users':

Id, Name, LastName
1   Dave  Stone
2   Rose  Mary
3   Gray  Lone

(3) I created 3 php files: 1/ config.php (sets up my database log in information like password...)
2/ DBConnection.php : `

// Connecting to database
public function connect() {
    require_once 'Config.php';

    // Connecting to mysql database
    $this->conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);

    // return database handler
    return $this->conn;
}
}

?>

3/ GetUsers.php which i dont know how should i write it - this would be the code which will echo whatever i want from the table.

(4) Inside my android studio project i have a MainActivity.java and i want to get all the LastNames of all the users in the database and do whatever with them... like print them into a text box it doesn't really matter (let's say i don't know how many users I have).

I need some one to help me get stages (3)3/ + (4) done / explained.


问:
Periodic RDS Postgresql Replication Delays
I have been observing that my PostgreSQL read replica shows periodic delay for replication lags. The lag seems to build to up to 30-40 minutes and then automatically goes down to 0. There is a correlation with CPU Utilization but it's nowhere close to CPU limit.

Read traffic comes from a reporting software called DOMO. DOMO periodically copies a large chunk of data & full tables into its warehouse.

Here's AWS Cloudwatch graph. The red line shows Replication Lag in seconds. The blue line shows the CPU load.

Lag vs CPU

Lag vs Network Out

Lag vs Read IOPS

Lag vs Write IOPS

Cloud: Amazon RDS

Instance Size: db.m3.2xlarge

PostgresSQL version: 9.3

Postgres Settings:

Shared Buffers (Set by RDS) = 7.3 GB (956978 * 8KB)

Updates

Tried setting Shared Buffers to 1GB (didn't help)

Updates June, 5 2017

I created a branch new replica for my database and pointed the reporting software (DOMO) at it. Things in the new instance look stable for now. The old replica which has no read traffic now is stable as well. Beginning to suspect some type of AWS config issue or something to do what remaining artifacts in the database (vacuum?).

答:
RDS read replica lag metric isn't updated when there's nothing to replicate. If master database has no changes to replicate, then replica would only be updated on time-forced so called checkpoint - periodic sync of data from write ahead log to the tables.

This would cause the graph to look like above. To see the real graph data you'd have to generate some traffic on the master, for example update some special sequence every minute or even every second - depending how much resolution you need.

Also WAL-generation log of master and network utilization on replica graphs would be interesting - the alternative explanation would be that there are too much traffic (IO or network) for replica to handle and it can only catch-up when traffic stops.


问:
Copy a row column from one table to another in ON CONFLICT
Using Postgres 9.6, I am copying a row(selected columns) from one table to another. I am running:

```<code>INSERT INTO copy_on_write(id, images)
    SELECT id, images
    FROM listings
    WHERE id = 1 AND posted_by = foo
ON CONFLICT (id) DO UPDATE SET images = listings.images
</code>```

With the conflict because id already exists, I am getting missing FROM-clause entry for table "listings".

So, I tried:

```<code>INSERT INTO copy_on_write(id, images)
    SELECT id, images
    FROM listings
    WHERE id = 1 AND posted_by = foo
ON CONFLICT (id) DO UPDATE SET images = images FROM listings
</code>```

but then I get syntax error at or near "FROM"

How do I handle this ON CONFLICT (id) so it updates the images column if the row id already exists?

答:
Use excluded:

```<code>INSERT INTO copy_on_write(id, images)
SELECT id, images
FROM listings
WHERE id = 1 AND posted_by = 'foo'
ON CONFLICT (id) DO UPDATE SET images = excluded.images;
</code>```

From the documentation:

conflict_action

(...) The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the existing row using the table's name (or an alias), and to rows proposed for insertion using the special excluded table.

Body:
Using Postgres 9.6, I am copying a row(selected columns) from one table to another. I am running:

INSERT INTO copy_on_write(id, images)
    SELECT id, images
    FROM listings
    WHERE id = 1 AND posted_by = foo
ON CONFLICT (id) DO UPDATE SET images = listings.images

With the conflict because id already exists, I am getting missing FROM-clause entry for table "listings".

So, I tried:

INSERT INTO copy_on_write(id, images)
    SELECT id, images
    FROM listings
    WHERE id = 1 AND posted_by = foo
ON CONFLICT (id) DO UPDATE SET images = images FROM listings

but then I get syntax error at or near "FROM"

How do I handle this ON CONFLICT (id) so it updates the images column if the row id already exists?

Body:
Use excluded:

INSERT INTO copy_on_write(id, images)
SELECT id, images
FROM listings
WHERE id = 1 AND posted_by = 'foo'
ON CONFLICT (id) DO UPDATE SET images = excluded.images;

From the documentation:

conflict_action

(...) The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the existing row using the table's name (or an alias), and to rows proposed for insertion using the special excluded table.


问:
Your device does not support vt-x
I am beginning to learn android development and using Oracle VirtualBox Machine for setting up the environment to develop.

I have installed the Android Studio, but when I try to create a Virtual Device after clicking on the AVD Manager and selecting the Virtual Device, I get an error that says - Your CPU does not support vt-x

I have checked in the settings of the Oracle Virtual Box Machine and it is enabled there as shown below:

Also, my system supports the Virtualisation as identified below by Intel Utility:

Please help, I am stuck at this point and can't continue my learning.

答:
The short answer (today) is that VirtualBox does not support running AVD inside a VM. Of course, this is of course a serious failure from the VB producers/developers side, because this is what most sane Android developers would want to do.

So for the normal android developer this is a complicated (technical) issue that is very poorly documented and explained. Rightly the settings screenshot in OP make you believe that it should work. But scouring the VB forums, you will only find rude and misleading answers, asking users to RTFM chapter 10.4 which is supposed to describe what is possible. However, and unfortunately, this is written in incomprehensible technical jargon/terms.

But apparently VMWare does allow for better virtualization that is compatible with AS, as briefly mentioned here. But other posts, say that newer versions of AS doesn't support that either. So apparently we can't blame it all on the VM producers, but also on Google for stopping to support these technologies.

One may wonder why bother with any VM, if you can't run the most common tools on it. Which by far would be AS.

Title: Your device does not support vt-x


问:
Make javascript work on any link
I would like for an effect to happen (a certain
 to translate left) when clicking on any link of my page. I was wondering if there was a way to do this with javascript. The only thing I thought about was the function but to add the attribute onclick="myFunction" to all of my links would be so long..

Maybe there is a pre-made js function that works on any link?

I also thought about using CSS a:active but I don't think that would be the best idea.

Thanks for the replies! :)

答:
You can use jQuery to make things work like this:-

```<code>$('a').click(myfunction);
function myFunction() {
    //do click event stuff here :)
}
</code>```

If you need a pure JavaScript alternative, I'm not sure if this will work but here's something you can try:

```<code>var a = document.getElementsByTagName("p");
for(var i=0; i<p.length; i++){
 p[i].onclick = function(){
   myFunction();
 }
}
function myFunction() {
//do click event stuff here :)
}
</code>```

For a better understanding, you can refer to http://jsbin.com/onaci/
I'm sorry if I misunderstood you. If so, please correct me.
Thanks

Title: Make javascript work on any link

Body:
You can use jQuery to make things work like this:-

$('a').click(myfunction);
function myFunction() {
    //do click event stuff here :)
}

If you need a pure JavaScript alternative, I'm not sure if this will work but here's something you can try:

var a = document.getElementsByTagName("p");
for(var i=0; i<p.length; i++){
 p[i].onclick = function(){
   myFunction();
 }
}
function myFunction() {
//do click event stuff here :)
}

For a better understanding, you can refer to http://jsbin.com/onaci/
I'm sorry if I misunderstood you. If so, please correct me.
Thanks


问:
HTTP/2 client - associate response to request - can rely on stream id?
I'm trying to use netty to implement HTTP/2 client. In this example (line 93) they manually increment streamId and put it to the map. When response comes they look for HttpConversionUtil.ExtensionHeaderNames.STREAM_ID header parameter and thus associate the response with the request.

I don't like the idea of increasing streamId by myself. Can I somehow get the id netty's going to use to writeAndFlush the request?

Also, does it take much resources to create a new stream? Or is it just an identifier?

答:
I'm pretty sure, at this moment you can't get streamId generated and used by Netty. Also, I don't like the idea of increasing streamId by myself too, but looks like it's okay to do this with current API.

I've checked Netty sources and found next things:

HttpToHttp2ConnectionHandler is used for writing requests. It has private method getStreamId which is used in write method for getting value of currentStreamId. But we doesn't have any access to this variable.

getStreamId method uses another method called incrementAndGetNextStreamId. So, again, we can only increment and get new streamId value but can't get the current one.

Both of these classes marked with annotation @UnstableApi, so maybe this behavior will be change in the future.

Here's some related links:

A little bit updated HTTP 2 client example from Netty repository.

HTTP/2 Java Client Examples.

Why netty http2 server always use odd number for streamId.


问:
Searchkick, search only in specific ids
In rails app I have post model, and relative post_locations model. We use searchkick to find data. When user enter location searchkick search in location table to find that location, that how I know id of location. So what I need is to search posts only where post_location is with already known id.

Example:

User search for Chicago, in location table Chicago have id = 1. I need to search in PostLocation.where(location_id: 1).posts.search 'other search params'. Any idea how I can do it?

答:
Assuming you want to set an instance variable:

```<code>@post_location = PostLocation.search "*", where: { location_id: 1 }
</code>```

If you have multiple variables, pass them into the hash.

```<code>@post_location = PostLocation.search "*", where: { location_id: 1, state: 'NY' }
</code>```

Title: Searchkick, search only in specific ids

Body:
Assuming you want to set an instance variable:

@post_location = PostLocation.search "*", where: { location_id: 1 }

If you have multiple variables, pass them into the hash.

@post_location = PostLocation.search "*", where: { location_id: 1, state: 'NY' }


问:
How to get html tags from url?
How would you get all the HTML tags from a URL and print them?

答:
```<code>import urllib
print urllib.urlopen('http://www.example.com/blah').read()
</code>```

Title: How to get html tags from url?


问:
Is there an equivalent tool to Appium for windows Application (not mobile)?
I use to work with Appium for mobile automation, now i want to use the same logic of Appium but for windows desktop application.
Is there any automation tool similar to Appium but to test desktop windows application?
(Other than RIDE and AutoIt) i 'm using ride with Sikuli library but i find that Is not as good as Appium which offer a many locations strategies by name,by id, by xpath ... there is no good strategy to locate elements only by image using SikuliLibrary or mouse click position using AutoItLibrary so that if i change from Windows 7 to 10 image will not respond to our scripts ....

答:
Sikuli and Appium are two different types of application and test approaches. This is well beyond the scope of SO and I urge you to look elsewhere for that type of information.

Within the Robot Framework community a number of official/common libraries exist. These are well known and easily found. However, there are also a large group of libraries that are not found in the Python Repository but freely available on (example) GitHub. On top of this there are the plain Python modules that can be directly imported and whose methods are then usable as keywords. If your favorite application has a Python interface or module, then creating a Robot Framework Library is not difficult.

Given the specific topic of Windows Desktop Application testing with Robot Framework my first search result lead me to the Official Python Testing Tools Taxonomy Page for testing and it's GUI testing section. From this list the PyWinAuto project shows most promise as it supports windows and is open source. A Robot Framework Library robotframework-winbot exists, and still works but has not been updated in a while.

As you mentioned Appium, I've also taken a look there and although the Robot Framework Library keyword documentation doesn't seems to support Windows application, Appium itself has recently released some support for Windows Application UI Testing. This is based on the fairly new Microsoft Windows Application Driver. Python sypport is available, as there are Python examples in the Python Samples section, but no specific Robot Framework Library.

There may be other options, but I recommend you try these first and raise specific questions when you encounter issues.


问:
JNI method signatures with arguments of derived types
According to this link, in order to invoke Java methods from native (C++) code using JNI, the GetMethodID function is used to:

"return the method ID for an instance (nonstatic) method of a class or
  interface."

Consider, as an example, the following constructor of the File class:

```<code>public File(Uri uri)
</code>```

A JNI method signature for this constructor would be:

"Ljava/io/File;.(Landroid.net.Uri;)V"

But, since Uri is an abstract class, is it possible to retrieve the method ID for this constructor using a signature that contains types that are derived from Uri ?

*I am asking this, since I'm using an environment where the actual signature is being automatically created based on the runtime object type, but that seems to fail, but i am not sure if its a limitation of JNI or a bug in the signature creation code, or something else entirely.

答:
The signature of a method is determined by its own source code, not by what you want to call it with. If all you have is the actual argument list rather than the formal parmaeter types, you don't have enough information to generate it at runtime.

But I cannot understand why you would want or need to generate it at runtime in the first place, or why you would want or need to do this via JNI. Maybe you should be looking at java.beans.Statement and friends.

I'm using an environment where the actual signature is being automatically created based on the runtime object type

No you aren't, because it isn't possible. You have misunderstood, or you are attempting the impossible.

Body:
According to this link, in order to invoke Java methods from native (C++) code using JNI, the GetMethodID function is used to:

"return the method ID for an instance (nonstatic) method of a class or
  interface."

Consider, as an example, the following constructor of the File class:

public File(Uri uri)

A JNI method signature for this constructor would be:

"Ljava/io/File;.(Landroid.net.Uri;)V"

But, since Uri is an abstract class, is it possible to retrieve the method ID for this constructor using a signature that contains types that are derived from Uri ?

*I am asking this, since I'm using an environment where the actual signature is being automatically created based on the runtime object type, but that seems to fail, but i am not sure if its a limitation of JNI or a bug in the signature creation code, or something else entirely.


问:
Gitlab CI and PHPUnit Lumen - CI fails even though tests pass
For some reason, my Gitlab CI job that runs PHPUnit tests on a PHP Lumen application have just started failing- eventhough the tests are actually all passing.

Here is my YAML file:

```<code>    image: php:7.1.3

cache:
  paths:
  - vendor/

before_script:
- apt-get -qq update -y
- apt-get -qq install openssh-client -y
- apt-get -qq install git -y
- apt-get -qq install zip unzip
# setup the private key
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh -L 3306:127.0.0.1:3306 XXX@xxx.xxx.xxx.xxx -Nf
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install

stages:
  - test

phpunit:
  stage: test
  script:
  - vendor/bin/phpunit --configuration phpunit.xml || exit 1
</code>```

Here is the build log:

```<code>    [0KRunning with gitlab-ci-multi-runner 1.10.6 (2dadd48)[0;m
[0;m[0KUsing Docker executor with image php:7.1.3 ...
[0;m[0KPulling docker image php:7.1.3 ...
[0;mRunning on runner-2b6016b4-project-1032-concurrent-0 via xxx-iMac.local...
[32;1mFetching changes...[0;m
Removing composer.phar
Removing vendor/
HEAD is now at d08ea1a Restored CI yaml to how it was when it was passing, also changed some config attributes in phpunit xml file
From https://xxxxxxxxxx
   d08ea1a..bd0955d  development -> origin/development
[32;1mChecking out bd0955d0 as development...[0;m
[32;1mSkipping Git submodules setup[0;m
[32;1mChecking cache for phpunit/development...[0;m
[32;1mSuccessfully extracted cache[0;m
[32;1m$ apt-get -qq update -y[0;m
[32;1m$ apt-get -qq install openssh-client -y[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libxau6:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 12253 files and directories currently installed.)
Preparing to unpack .../libxau6_1%3a1.0.8-1_amd64.deb ...
Unpacking libxau6:amd64 (1:1.0.8-1) ...
Selecting previously unselected package libxdmcp6:amd64.
Preparing to unpack .../libxdmcp6_1%3a1.1.1-1+b1_amd64.deb ...
Unpacking libxdmcp6:amd64 (1:1.1.1-1+b1) ...
Selecting previously unselected package libxcb1:amd64.
Preparing to unpack .../libxcb1_1.10-3+b1_amd64.deb ...
Unpacking libxcb1:amd64 (1.10-3+b1) ...
Selecting previously unselected package libx11-data.
Preparing to unpack .../libx11-data_2%3a1.6.2-3_all.deb ...
Unpacking libx11-data (2:1.6.2-3) ...
Selecting previously unselected package libx11-6:amd64.
Preparing to unpack .../libx11-6_2%3a1.6.2-3_amd64.deb ...
Unpacking libx11-6:amd64 (2:1.6.2-3) ...
Selecting previously unselected package libxext6:amd64.
Preparing to unpack .../libxext6_2%3a1.3.3-1_amd64.deb ...
Unpacking libxext6:amd64 (2:1.3.3-1) ...
Selecting previously unselected package libxmuu1:amd64.
Preparing to unpack .../libxmuu1_2%3a1.1.2-1_amd64.deb ...
Unpacking libxmuu1:amd64 (2:1.1.2-1) ...
Selecting previously unselected package openssh-client.
Preparing to unpack .../openssh-client_1%3a6.7p1-5+deb8u3_amd64.deb ...
Unpacking openssh-client (1:6.7p1-5+deb8u3) ...
Selecting previously unselected package xauth.
Preparing to unpack .../xauth_1%3a1.0.9-1_amd64.deb ...
Unpacking xauth (1:1.0.9-1) ...
Setting up libxau6:amd64 (1:1.0.8-1) ...
Setting up libxdmcp6:amd64 (1:1.1.1-1+b1) ...
Setting up libxcb1:amd64 (1.10-3+b1) ...
Setting up libx11-data (2:1.6.2-3) ...
Setting up libx11-6:amd64 (2:1.6.2-3) ...
Setting up libxext6:amd64 (2:1.3.3-1) ...
Setting up libxmuu1:amd64 (2:1.1.2-1) ...
Setting up openssh-client (1:6.7p1-5+deb8u3) ...
Setting up xauth (1:1.0.9-1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
[32;1m$ apt-get -qq install git -y[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpopt0:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 12600 files and directories currently installed.)
Preparing to unpack .../libpopt0_1.16-10_amd64.deb ...
Unpacking libpopt0:amd64 (1.16-10) ...
Selecting previously unselected package libcurl3-gnutls:amd64.
Preparing to unpack .../libcurl3-gnutls_7.38.0-4+deb8u5_amd64.deb ...
Unpacking libcurl3-gnutls:amd64 (7.38.0-4+deb8u5) ...
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack .../libexpat1_2.1.0-6+deb8u3_amd64.deb ...
Unpacking libexpat1:amd64 (2.1.0-6+deb8u3) ...
Selecting previously unselected package less.
Preparing to unpack .../archives/less_458-3_amd64.deb ...
Unpacking less (458-3) ...
Selecting previously unselected package patch.
Preparing to unpack .../patch_2.7.5-1_amd64.deb ...
Unpacking patch (2.7.5-1) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.1.4-2.1+deb8u2_all.deb ...
Unpacking git-man (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.1.4-2.1+deb8u2_amd64.deb ...
Unpacking git (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package rsync.
Preparing to unpack .../rsync_3.1.1-3_amd64.deb ...
Unpacking rsync (3.1.1-3) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up libpopt0:amd64 (1.16-10) ...
Setting up libcurl3-gnutls:amd64 (7.38.0-4+deb8u5) ...
Setting up libexpat1:amd64 (2.1.0-6+deb8u3) ...
Setting up less (458-3) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Setting up patch (2.7.5-1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:2.1.4-2.1+deb8u2) ...
Setting up git (1:2.1.4-2.1+deb8u2) ...
Setting up rsync (3.1.1-3) ...
invoke-rc.d: policy-rc.d denied execution of restart.
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for systemd (215-17+deb8u6) ...
[32;1m$ apt-get -qq install zip unzip[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 13497 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-16+deb8u2_amd64.deb ...
Unpacking unzip (6.0-16+deb8u2) ...
Selecting previously unselected package zip.
Preparing to unpack .../archives/zip_3.0-8_amd64.deb ...
Unpacking zip (3.0-8) ...
Setting up unzip (6.0-16+deb8u2) ...
Setting up zip (3.0-8) ...
[32;1m$ eval $(ssh-agent -s)[0;m
Agent pid 377
[32;1m$ ssh-add <(echo "$SSH_PRIVATE_KEY")[0;m
Identity added: /dev/fd/63 (rsa w/o comment)
[32;1m$ mkdir -p ~/.ssh[0;m
[32;1m$ echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config[0;m
[32;1m$ ssh -L 3306:127.0.0.1:3306 xx@xxx.xxx.xxx.xxx -Nf[0;m
Warning: Permanently added '128.243.22.101' (ECDSA) to the list of known hosts.
[32;1m$ curl -sS https://getcomposer.org/installer | php[0;m
All settings correct for using Composer
Downloading...

Composer (version 1.4.1) successfully installed to: /builds/XXXXX/XXXX/composer.phar
Use it: php composer.phar

[32;1m$ php composer.phar install[0;m
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 3 installs, 38 updates, 1 removal
  - Removing symfony/yaml (v3.2.6)
  - Updating symfony/debug (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (55%)Downloading (60%)Downloading (75%)Downloading (80%)Downloading (100%)
  - Updating symfony/console (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating symfony/translation (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (100%)
  - Updating illuminate/contracts (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (15%)Downloading (25%)Downloading (40%)Downloading (50%)Downloading (60%)Downloading (75%)Downloading (90%)Downloading (100%)
  - Updating illuminate/support (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/console (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (20%)Downloading (40%)Downloading (95%)Downloading (100%)
  - Updating symfony/http-foundation (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating symfony/finder (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/filesystem (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (85%)Downloading (95%)Downloading (100%)
  - Updating illuminate/session (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (45%)Downloading (60%)Downloading (95%)Downloading (100%)
  - Updating symfony/event-dispatcher (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (100%)
  - Updating symfony/http-kernel (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/container (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (15%)Downloading (30%)Downloading (45%)Downloading (60%)Downloading (75%)Downloading (90%)Downloading (100%)
  - Updating illuminate/events (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/view (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (30%)Downloading (55%)Downloading (65%)Downloading (70%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating illuminate/translation (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (100%)
  - Updating illuminate/validation (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (40%)Downloading (60%)Downloading (65%)Downloading (95%)Downloading (100%)
  - Updating symfony/process (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (25%)Downloading (50%)Downloading (60%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (100%)
  - Updating illuminate/queue (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (100%)
  - Updating illuminate/pipeline (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (40%)Downloading (100%)
  - Updating illuminate/pagination (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (25%)Downloading (50%)Downloading (100%)
  - Updating illuminate/http (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (55%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating illuminate/hashing (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/encryption (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/database (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/config (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/cache (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (100%)
  - Updating illuminate/bus (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/broadcasting (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (55%)Downloading (85%)Downloading (100%)
  - Updating illuminate/auth (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (10%)Downloading (20%)Downloading (50%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating laravel/lumen-framework (v5.4.5 => v5.4.6): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (30%)Downloading (35%)Downloading (50%)Downloading (55%)Downloading (80%)Downloading (85%)Downloading (100%)
  - Updating sebastian/recursion-context (2.0.0 => 3.0.0): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (70%)Downloading (100%)
  - Installing sebastian/object-reflector (1.1.1): Downloading (connecting...)Downloading (0%)           Downloading (65%)Downloading (100%)
  - Updating sebastian/object-enumerator (2.0.1 => 3.0.2): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating sebastian/exporter (2.0.0 => 3.1.0): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating sebastian/comparator (1.2.4 => 2.0.0): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (45%)Downloading (55%)Downloading (80%)Downloading (95%)Downloading (100%)
  - Updating phpunit/phpunit-mock-objects (3.4.3 => 4.0.1): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (95%)Downloading (100%)
  - Updating phpunit/php-code-coverage (4.0.8 => 5.1.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Installing phar-io/version (1.0.1): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (55%)Downloading (100%)
  - Installing phar-io/manifest (1.0.1): Downloading (connecting...)Downloading (0%)           Downloading (10%)Downloading (20%)Downloading (30%)Downloading (45%)Downloading (60%)Downloading (70%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating phpunit/phpunit (5.7.18 => 6.1.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
Generating autoload files
[32;1m$ vendor/bin/phpunit --configuration phpunit.xml[0;m
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.

........................W......................................  63 / 224 ( 28%)
..................................................W............ 126 / 224 ( 56%)
WW............................................................. 189 / 224 ( 84%)
...............WW..................                             224 / 224 (100%)

Time: 24.6 seconds, Memory: 38.00MB

There were 6 warnings:

1) Warning
No tests found in class "XX".

2) Warning
No tests found in class "XX".

3) Warning
No tests found in class "XX".

4) Warning
No tests found in class "XX".

5) Warning
No tests found in class "XX".

6) Warning
No tests found in class "XX".

WARNINGS!
Tests: 224, Assertions: 218, Warnings: 6.
[31;1mERROR: Build failed: exit code 1
[0;m
</code>```

Like I say, these tests are actually passing and weren't failing the CI just a few days ago.

Can anyone advise?

Gitlab Version: GitLab Community Edition 8.17.0 77254ab
CI runner using Docker (latest version to date)

答:
```<code>script:
  - vendor/bin/phpunit --configuration phpunit.xml || exit 1
</code>```

you use exit 1 - an exit >0 is always threaded like an error.

use exit 0 or true

see http://man7.org/linux/man-pages/man3/exit.3.html

as long as you dont call phpunit with --fail-on-warning it shouldnt use an exit code >0

Body:
For some reason, my Gitlab CI job that runs PHPUnit tests on a PHP Lumen application have just started failing- eventhough the tests are actually all passing.

Here is my YAML file:

    image: php:7.1.3

cache:
  paths:
  - vendor/

before_script:
- apt-get -qq update -y
- apt-get -qq install openssh-client -y
- apt-get -qq install git -y
- apt-get -qq install zip unzip
# setup the private key
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh -L 3306:127.0.0.1:3306 XXX@xxx.xxx.xxx.xxx -Nf
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install

stages:
  - test

phpunit:
  stage: test
  script:
  - vendor/bin/phpunit --configuration phpunit.xml || exit 1

Here is the build log:

    [0KRunning with gitlab-ci-multi-runner 1.10.6 (2dadd48)[0;m
[0;m[0KUsing Docker executor with image php:7.1.3 ...
[0;m[0KPulling docker image php:7.1.3 ...
[0;mRunning on runner-2b6016b4-project-1032-concurrent-0 via xxx-iMac.local...
[32;1mFetching changes...[0;m
Removing composer.phar
Removing vendor/
HEAD is now at d08ea1a Restored CI yaml to how it was when it was passing, also changed some config attributes in phpunit xml file
From https://xxxxxxxxxx
   d08ea1a..bd0955d  development -> origin/development
[32;1mChecking out bd0955d0 as development...[0;m
[32;1mSkipping Git submodules setup[0;m
[32;1mChecking cache for phpunit/development...[0;m
[32;1mSuccessfully extracted cache[0;m
[32;1m$ apt-get -qq update -y[0;m
[32;1m$ apt-get -qq install openssh-client -y[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libxau6:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 12253 files and directories currently installed.)
Preparing to unpack .../libxau6_1%3a1.0.8-1_amd64.deb ...
Unpacking libxau6:amd64 (1:1.0.8-1) ...
Selecting previously unselected package libxdmcp6:amd64.
Preparing to unpack .../libxdmcp6_1%3a1.1.1-1+b1_amd64.deb ...
Unpacking libxdmcp6:amd64 (1:1.1.1-1+b1) ...
Selecting previously unselected package libxcb1:amd64.
Preparing to unpack .../libxcb1_1.10-3+b1_amd64.deb ...
Unpacking libxcb1:amd64 (1.10-3+b1) ...
Selecting previously unselected package libx11-data.
Preparing to unpack .../libx11-data_2%3a1.6.2-3_all.deb ...
Unpacking libx11-data (2:1.6.2-3) ...
Selecting previously unselected package libx11-6:amd64.
Preparing to unpack .../libx11-6_2%3a1.6.2-3_amd64.deb ...
Unpacking libx11-6:amd64 (2:1.6.2-3) ...
Selecting previously unselected package libxext6:amd64.
Preparing to unpack .../libxext6_2%3a1.3.3-1_amd64.deb ...
Unpacking libxext6:amd64 (2:1.3.3-1) ...
Selecting previously unselected package libxmuu1:amd64.
Preparing to unpack .../libxmuu1_2%3a1.1.2-1_amd64.deb ...
Unpacking libxmuu1:amd64 (2:1.1.2-1) ...
Selecting previously unselected package openssh-client.
Preparing to unpack .../openssh-client_1%3a6.7p1-5+deb8u3_amd64.deb ...
Unpacking openssh-client (1:6.7p1-5+deb8u3) ...
Selecting previously unselected package xauth.
Preparing to unpack .../xauth_1%3a1.0.9-1_amd64.deb ...
Unpacking xauth (1:1.0.9-1) ...
Setting up libxau6:amd64 (1:1.0.8-1) ...
Setting up libxdmcp6:amd64 (1:1.1.1-1+b1) ...
Setting up libxcb1:amd64 (1.10-3+b1) ...
Setting up libx11-data (2:1.6.2-3) ...
Setting up libx11-6:amd64 (2:1.6.2-3) ...
Setting up libxext6:amd64 (2:1.3.3-1) ...
Setting up libxmuu1:amd64 (2:1.1.2-1) ...
Setting up openssh-client (1:6.7p1-5+deb8u3) ...
Setting up xauth (1:1.0.9-1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
[32;1m$ apt-get -qq install git -y[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpopt0:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 12600 files and directories currently installed.)
Preparing to unpack .../libpopt0_1.16-10_amd64.deb ...
Unpacking libpopt0:amd64 (1.16-10) ...
Selecting previously unselected package libcurl3-gnutls:amd64.
Preparing to unpack .../libcurl3-gnutls_7.38.0-4+deb8u5_amd64.deb ...
Unpacking libcurl3-gnutls:amd64 (7.38.0-4+deb8u5) ...
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack .../libexpat1_2.1.0-6+deb8u3_amd64.deb ...
Unpacking libexpat1:amd64 (2.1.0-6+deb8u3) ...
Selecting previously unselected package less.
Preparing to unpack .../archives/less_458-3_amd64.deb ...
Unpacking less (458-3) ...
Selecting previously unselected package patch.
Preparing to unpack .../patch_2.7.5-1_amd64.deb ...
Unpacking patch (2.7.5-1) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.1.4-2.1+deb8u2_all.deb ...
Unpacking git-man (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.1.4-2.1+deb8u2_amd64.deb ...
Unpacking git (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package rsync.
Preparing to unpack .../rsync_3.1.1-3_amd64.deb ...
Unpacking rsync (3.1.1-3) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up libpopt0:amd64 (1.16-10) ...
Setting up libcurl3-gnutls:amd64 (7.38.0-4+deb8u5) ...
Setting up libexpat1:amd64 (2.1.0-6+deb8u3) ...
Setting up less (458-3) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Setting up patch (2.7.5-1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:2.1.4-2.1+deb8u2) ...
Setting up git (1:2.1.4-2.1+deb8u2) ...
Setting up rsync (3.1.1-3) ...
invoke-rc.d: policy-rc.d denied execution of restart.
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for systemd (215-17+deb8u6) ...
[32;1m$ apt-get -qq install zip unzip[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 13497 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-16+deb8u2_amd64.deb ...
Unpacking unzip (6.0-16+deb8u2) ...
Selecting previously unselected package zip.
Preparing to unpack .../archives/zip_3.0-8_amd64.deb ...
Unpacking zip (3.0-8) ...
Setting up unzip (6.0-16+deb8u2) ...
Setting up zip (3.0-8) ...
[32;1m$ eval $(ssh-agent -s)[0;m
Agent pid 377
[32;1m$ ssh-add <(echo "$SSH_PRIVATE_KEY")[0;m
Identity added: /dev/fd/63 (rsa w/o comment)
[32;1m$ mkdir -p ~/.ssh[0;m
[32;1m$ echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config[0;m
[32;1m$ ssh -L 3306:127.0.0.1:3306 xx@xxx.xxx.xxx.xxx -Nf[0;m
Warning: Permanently added '128.243.22.101' (ECDSA) to the list of known hosts.
[32;1m$ curl -sS https://getcomposer.org/installer | php[0;m
All settings correct for using Composer
Downloading...

Composer (version 1.4.1) successfully installed to: /builds/XXXXX/XXXX/composer.phar
Use it: php composer.phar

[32;1m$ php composer.phar install[0;m
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 3 installs, 38 updates, 1 removal
  - Removing symfony/yaml (v3.2.6)
  - Updating symfony/debug (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (55%)Downloading (60%)Downloading (75%)Downloading (80%)Downloading (100%)
  - Updating symfony/console (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating symfony/translation (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (100%)
  - Updating illuminate/contracts (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (15%)Downloading (25%)Downloading (40%)Downloading (50%)Downloading (60%)Downloading (75%)Downloading (90%)Downloading (100%)
  - Updating illuminate/support (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/console (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (20%)Downloading (40%)Downloading (95%)Downloading (100%)
  - Updating symfony/http-foundation (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating symfony/finder (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/filesystem (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (85%)Downloading (95%)Downloading (100%)
  - Updating illuminate/session (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (45%)Downloading (60%)Downloading (95%)Downloading (100%)
  - Updating symfony/event-dispatcher (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (100%)
  - Updating symfony/http-kernel (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/container (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (15%)Downloading (30%)Downloading (45%)Downloading (60%)Downloading (75%)Downloading (90%)Downloading (100%)
  - Updating illuminate/events (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/view (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (30%)Downloading (55%)Downloading (65%)Downloading (70%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating illuminate/translation (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (100%)
  - Updating illuminate/validation (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (40%)Downloading (60%)Downloading (65%)Downloading (95%)Downloading (100%)
  - Updating symfony/process (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (25%)Downloading (50%)Downloading (60%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (100%)
  - Updating illuminate/queue (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (100%)
  - Updating illuminate/pipeline (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (40%)Downloading (100%)
  - Updating illuminate/pagination (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (25%)Downloading (50%)Downloading (100%)
  - Updating illuminate/http (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (55%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating illuminate/hashing (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/encryption (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/database (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Updating illuminate/config (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/cache (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (100%)
  - Updating illuminate/bus (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating illuminate/broadcasting (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (55%)Downloading (85%)Downloading (100%)
  - Updating illuminate/auth (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (10%)Downloading (20%)Downloading (50%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating laravel/lumen-framework (v5.4.5 => v5.4.6): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (30%)Downloading (35%)Downloading (50%)Downloading (55%)Downloading (80%)Downloading (85%)Downloading (100%)
  - Updating sebastian/recursion-context (2.0.0 => 3.0.0): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (70%)Downloading (100%)
  - Installing sebastian/object-reflector (1.1.1): Downloading (connecting...)Downloading (0%)           Downloading (65%)Downloading (100%)
  - Updating sebastian/object-enumerator (2.0.1 => 3.0.2): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating sebastian/exporter (2.0.0 => 3.1.0): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Updating sebastian/comparator (1.2.4 => 2.0.0): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (45%)Downloading (55%)Downloading (80%)Downloading (95%)Downloading (100%)
  - Updating phpunit/phpunit-mock-objects (3.4.3 => 4.0.1): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (95%)Downloading (100%)
  - Updating phpunit/php-code-coverage (4.0.8 => 5.1.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Installing phar-io/version (1.0.1): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (55%)Downloading (100%)
  - Installing phar-io/manifest (1.0.1): Downloading (connecting...)Downloading (0%)           Downloading (10%)Downloading (20%)Downloading (30%)Downloading (45%)Downloading (60%)Downloading (70%)Downloading (85%)Downloading (90%)Downloading (100%)
  - Updating phpunit/phpunit (5.7.18 => 6.1.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
Generating autoload files
[32;1m$ vendor/bin/phpunit --configuration phpunit.xml[0;m
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.

........................W......................................  63 / 224 ( 28%)
..................................................W............ 126 / 224 ( 56%)
WW............................................................. 189 / 224 ( 84%)
...............WW..................                             224 / 224 (100%)

Time: 24.6 seconds, Memory: 38.00MB

There were 6 warnings:

1) Warning
No tests found in class "XX".

2) Warning
No tests found in class "XX".

3) Warning
No tests found in class "XX".

4) Warning
No tests found in class "XX".

5) Warning
No tests found in class "XX".

6) Warning
No tests found in class "XX".

WARNINGS!
Tests: 224, Assertions: 218, Warnings: 6.
[31;1mERROR: Build failed: exit code 1
[0;m

Like I say, these tests are actually passing and weren't failing the CI just a few days ago.

Can anyone advise?

Gitlab Version: GitLab Community Edition 8.17.0 77254ab
CI runner using Docker (latest version to date)

Body:
script:
  - vendor/bin/phpunit --configuration phpunit.xml || exit 1

you use exit 1 - an exit >0 is always threaded like an error.

use exit 0 or true

see http://man7.org/linux/man-pages/man3/exit.3.html

as long as you dont call phpunit with --fail-on-warning it shouldnt use an exit code >0


问:
SVG - animate/move dots along path
I'm looking for a way to move dots along existing path in order to get animation that looks like this:

I was thinking about working with dasharray but wasn't able to get this exact behavior.

Here is an example of something I tried, but as you can see it doesn't really work:

path.link {
  stroke-width: 3px;
  stroke-dasharray: 5 5;
  stroke: black;
}
path.link-anim {
  stroke-width: 3px;
  animation: link-anim 5s linear infinite;
}
path.red {
  stroke: red;
}
path.blue {
  stroke: blue;
}
path.green {
  stroke: green;
}
path.pink {
  stroke: pink;
}
@keyframes link-anim {
    0% {
        stroke-dashoffset: 0;
        stroke-dasharray: 5 5 100%;
    }
    100% {
        stroke-dashoffset: 100%;
        stroke-dasharray: 100% 5 5;
    }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><svg width="450" height="450">
  <g>
    <path class="link" d="M10,10L100,10"></path>
    <path class="link-anim red" d="M10,10L100,10"></path>
  </g>
  <g>
    <path class="link" d="M50,50L200,50"></path>
    <path class="link-anim blue" d="M50,50L200,50"></path>
  </g>
  <g>
    <path class="link" d="M75,75L75,200"></path>
    <path class="link-anim green" d="M75,75L75,200"></path>
  </g>
  <g>
    <path class="link" d="M85,85L450,450"></path>
    <path class="link-anim pink" d="M85,85L450,450"></path>
  </g>
</svg></code>```

Note - the angle of the line is not something I care about. I should have written this from the start. What I need is the 3 dots to move forward (and only those 3 dots).

答:
I added 2 more variants (sample 3, 4), using your original SVG and <animationTransform>.

Note 1, using <animationTransform> have less browser support

Note 2, since Chrome favor CSS/Web animations over SMIL, the future of SMIL might be somewhat unpredictable, so I would recommend to wait using it until its future is more secured.

Sample 1/2 benefit from rotating the element itself, which makes it much simpler when it comes to define each step, while with sample 3, one need to recalculate those for every angled used.

With sample 4 I made the 3 dots a solid line instead, using same color as the background, to show how that looks and its simpler code compared with sample 3.

Sample 1, using SVG

svg {
  background: black;
}
svg + svg {
  transform: rotate(45deg);
  transform-origin: left bottom;
}
line.nr2 {
  transform: translateX(-100%);
  animation: anim 2s steps(18) infinite;
}
@keyframes anim {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(500%); }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><svg width="320px" height="20px" viewBox="0 0 320 20">
    <line class="nr1" x1="10" x2="320" y1="10" y2="10" stroke="#f00" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
    <line class="nr2" x1="10" x2="73" y1="10" y2="10" stroke="#fff" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
</svg>

<svg width="320px" height="20px" viewBox="0 0 320 20">
    <line class="nr1" x1="10" x2="320" y1="10" y2="10" stroke="#f00" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
    <line class="nr2" x1="10" x2="73" y1="10" y2="10" stroke="#fff" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
</svg></code>```

Sample 2, using pseudo element

div {
  position: relative;
  width: 180px;
  height: 55px;
  background: black;
  overflow: hidden;
  font-size:16px;
}
div + div {
  transform: rotate(45deg);
  transform-origin: left bottom;
}

div::before {
  content: '• • • • • • • • • • • • • • • • • • •';
  position: absolute;
  color: red;
  left: 0;
  top: 20px;
}
div::after {
  content: '• • •';
  position: absolute;
  color: white;
  left: 2px;
  top: 20px;
  width: 40px;
  transform: translateX(-100%);
  animation: anim 2s steps(24) infinite;
}

@keyframes anim {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(190px); }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div></div>

<div></div></code>```

Sample 3, 4

path.link {
  stroke-width: 3px;
  stroke-dasharray: 5 5;
  stroke: black;
}
path.red {
  stroke: red;
}
path.white {
  stroke: white;
  stroke-dasharray: 0;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><svg width="150" height="150">
  <g>
    <path class="link" d="M3,3L150,150"></path>
  </g>
  <g>
    <path id="path2" class="link anim red" d="M-18,-18L3,3">
      <animateTransform
        attributeName="transform"
        type="translate"
        values="0 0;7 7;14 14;21 21;28 28;35 35;42 42;50 50;57 57;
                64 64;71 71;78 78;85 85;92 92;99 99;106 106;113 113;
                120 120;127 127;134 134;141 141;148 148;155 155"
        calcMode="discrete"
        begin="0s"
        dur="3s"
        repeatCount="indefinite"
      />
    </path>
  </g>
</svg>

<svg width="150" height="150">
  <g>
    <path class="link" d="M3,3L150,150"></path>
  </g>
  <g>
    <path id="path2" class="link anim white" d="M-18,-18L3,3">
      <animateTransform
        attributeName="transform"
        type="translate"
        from="0 0"
        to="250 250"
        begin="0s"
        dur="3s"
        repeatCount="indefinite"
      />
    </path>
  </g>
</svg></code>```

Title: SVG - animate/move dots along path

Body:
I'm looking for a way to move dots along existing path in order to get animation that looks like this:

I was thinking about working with dasharray but wasn't able to get this exact behavior.

Here is an example of something I tried, but as you can see it doesn't really work:

path.link {
  stroke-width: 3px;
  stroke-dasharray: 5 5;
  stroke: black;
}
path.link-anim {
  stroke-width: 3px;
  animation: link-anim 5s linear infinite;
}
path.red {
  stroke: red;
}
path.blue {
  stroke: blue;
}
path.green {
  stroke: green;
}
path.pink {
  stroke: pink;
}
@keyframes link-anim {
    0% {
        stroke-dashoffset: 0;
        stroke-dasharray: 5 5 100%;
    }
    100% {
        stroke-dashoffset: 100%;
        stroke-dasharray: 100% 5 5;
    }
}

<svg width="450" height="450">
  <g>
    <path class="link" d="M10,10L100,10"></path>
    <path class="link-anim red" d="M10,10L100,10"></path>
  </g>
  <g>
    <path class="link" d="M50,50L200,50"></path>
    <path class="link-anim blue" d="M50,50L200,50"></path>
  </g>
  <g>
    <path class="link" d="M75,75L75,200"></path>
    <path class="link-anim green" d="M75,75L75,200"></path>
  </g>
  <g>
    <path class="link" d="M85,85L450,450"></path>
    <path class="link-anim pink" d="M85,85L450,450"></path>
  </g>
</svg>

Note - the angle of the line is not something I care about. I should have written this from the start. What I need is the 3 dots to move forward (and only those 3 dots).

Body:
I added 2 more variants (sample 3, 4), using your original SVG and <animationTransform>.

Note 1, using <animationTransform> have less browser support

Note 2, since Chrome favor CSS/Web animations over SMIL, the future of SMIL might be somewhat unpredictable, so I would recommend to wait using it until its future is more secured.

Sample 1/2 benefit from rotating the element itself, which makes it much simpler when it comes to define each step, while with sample 3, one need to recalculate those for every angled used.

With sample 4 I made the 3 dots a solid line instead, using same color as the background, to show how that looks and its simpler code compared with sample 3.

Sample 1, using SVG

svg {
  background: black;
}
svg + svg {
  transform: rotate(45deg);
  transform-origin: left bottom;
}
line.nr2 {
  transform: translateX(-100%);
  animation: anim 2s steps(18) infinite;
}
@keyframes anim {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(500%); }
}

<svg width="320px" height="20px" viewBox="0 0 320 20">
    <line class="nr1" x1="10" x2="320" y1="10" y2="10" stroke="#f00" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
    <line class="nr2" x1="10" x2="73" y1="10" y2="10" stroke="#fff" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
</svg>

<svg width="320px" height="20px" viewBox="0 0 320 20">
    <line class="nr1" x1="10" x2="320" y1="10" y2="10" stroke="#f00" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
    <line class="nr2" x1="10" x2="73" y1="10" y2="10" stroke="#fff" stroke-width="10" stroke-linecap="round" stroke-dasharray="1, 20"/>
</svg>

Sample 2, using pseudo element

div {
  position: relative;
  width: 180px;
  height: 55px;
  background: black;
  overflow: hidden;
  font-size:16px;
}
div + div {
  transform: rotate(45deg);
  transform-origin: left bottom;
}

div::before {
  content: '• • • • • • • • • • • • • • • • • • •';
  position: absolute;
  color: red;
  left: 0;
  top: 20px;
}
div::after {
  content: '• • •';
  position: absolute;
  color: white;
  left: 2px;
  top: 20px;
  width: 40px;
  transform: translateX(-100%);
  animation: anim 2s steps(24) infinite;
}

@keyframes anim {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(190px); }
}

<div></div>

<div></div>

Sample 3, 4

path.link {
  stroke-width: 3px;
  stroke-dasharray: 5 5;
  stroke: black;
}
path.red {
  stroke: red;
}
path.white {
  stroke: white;
  stroke-dasharray: 0;
}

<svg width="150" height="150">
  <g>
    <path class="link" d="M3,3L150,150"></path>
  </g>
  <g>
    <path id="path2" class="link anim red" d="M-18,-18L3,3">
      <animateTransform
        attributeName="transform"
        type="translate"
        values="0 0;7 7;14 14;21 21;28 28;35 35;42 42;50 50;57 57;
                64 64;71 71;78 78;85 85;92 92;99 99;106 106;113 113;
                120 120;127 127;134 134;141 141;148 148;155 155"
        calcMode="discrete"
        begin="0s"
        dur="3s"
        repeatCount="indefinite"
      />
    </path>
  </g>
</svg>

<svg width="150" height="150">
  <g>
    <path class="link" d="M3,3L150,150"></path>
  </g>
  <g>
    <path id="path2" class="link anim white" d="M-18,-18L3,3">
      <animateTransform
        attributeName="transform"
        type="translate"
        from="0 0"
        to="250 250"
        begin="0s"
        dur="3s"
        repeatCount="indefinite"
      />
    </path>
  </g>
</svg>


问:
Nginx. If Empty URI. If Empty Domain. Location. Regex
I'm using the upstream module for balancing my site. For some reason i have to redirect some requests to a specified server.
So in short: i want to redirect domain.com to a specified server, domain.com/anything can be served by the upstream module. So if theres only the domain in the request and nothing else.

```<code>   location [here_something_i_dont_know]/ {
        proxy_pass           http://0.0.0.0:9000/;
        access_log      off;
    }
</code>```

Thanks for ur help!

答:
```   location = / {
        proxy_pass           http://0.0.0.0:9000/;
        access_log      off;
   }
   location / {
        proxy_pass           http://another_upstream;
        access_log      off;
   }
```

Body:
I'm using the upstream module for balancing my site. For some reason i have to redirect some requests to a specified server.
So in short: i want to redirect domain.com to a specified server, domain.com/anything can be served by the upstream module. So if theres only the domain in the request and nothing else.

   location [here_something_i_dont_know]/ {
        proxy_pass           http://0.0.0.0:9000/;
        access_log      off;
    }

Thanks for ur help!


问:
Precompile v8 script for use in multiple isolate
I have implemented a 'require'-like function using embedded v8 that loads a JavaScript file and executes it, but because my program has multiple threads, and as such each thread has its own isolate, I am having to load and compile the file separately in each thread that specifies the same source.   I am wanting to, if possible, somehow cache any compiled script so that if another thread (using another isolate) happens to want the same file, I can utilize some sort of precompiled format, and just give it the script to run, instead of having to separately compile it inside of each isolate that needs the same file.</p>

答:
I think ScriptCompiler can help you. With ScriptCompiler::CompileUnboundScript you can create and consume cached data for the script. I did not (yet) test it but the comment looks promising:</p>

```<code>/**
   * Compiles the specified script (context-independent).
   * Cached data as part of the source object can be optionally produced to be
   * consumed later to speed up compilation of identical source scripts.
   *
   * Note that when producing cached data, the source must point to NULL for
   * cached data. When consuming cached data, the cached data must have been
   * produced by the same version of V8.
   *
   * \param source Script source code.
   * \return Compiled script object (context independent; for running it must be
   *   bound to a context).
   */
</code>```

Body:
I think ScriptCompiler can help you. With ScriptCompiler::CompileUnboundScript you can create and consume cached data for the script. I did not (yet) test it but the comment looks promising:

/**
   * Compiles the specified script (context-independent).
   * Cached data as part of the source object can be optionally produced to be
   * consumed later to speed up compilation of identical source scripts.
   *
   * Note that when producing cached data, the source must point to NULL for
   * cached data. When consuming cached data, the cached data must have been
   * produced by the same version of V8.
   *
   * \param source Script source code.
   * \return Compiled script object (context independent; for running it must be
   *   bound to a context).
   */


问:
Is there a way to add data to the SQLite DB provided with Django with another python script?
Is there a way to run a python script that will add data to this SQLite DB then? I mean, a completely separate .py file that I will run in the shell, doing python thefile.py in an SSH connection?

Of course, this file will be on the same server as the whole Django project.

This way, I can easily access the data from the DB from my Django project, and display it the way I want in a pretty HTML/CSS web page.

Thanks

答: Is there a reason for not using django? you can add a command to the manage.py the way it's described here https://docs.djangoproject.com/en/1.11/howto/custom-management-commands/</p>