问:
Why `gradle` is executing `ant.replaceregexp` in every subproject?
I have a java gradle project with this structure:

```<code>EarApp
|
\---> WarA/trunk
|     |
|     |- build.gradle
|     ...<src and config>
|
\---> WarB/trunk
|     |
|     |- build.gradle
|     ...<src and config>
|
\---> WarC/trunk
|     |
|     |- build.gradle
|     ...<src and config>
|
|- build.gradle
|- settings.gradle
</code>```

My settings.gradle is:

```<code>include "WarA"
include "WarB"
include "WarC"

project(":WarA").projectDir          = file("WarA/trunk")
project(":WarB").projectDir          = file("WarB/trunk")
project(":WarC").projectDir          = file("WarC/trunk")
</code>```

Every build.gradle in subprojects contains:

```<code>import org.tmatesoft.svn.core.wc.*
def getSvnRevision(){
    ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
    SVNClientManager clientManager = SVNClientManager.newInstance(options);
    SVNStatusClient statusClient = clientManager.getStatusClient();
    SVNStatus status = statusClient.doStatus(projectDir, false);
    SVNRevision revision = status.getRevision();
    return revision.getNumber();
}

def replaceTokens() {
    ant.replaceregexp(
      file:  "./src/main/resources/messages/text.properties",
        match:   "application.revision=(.*)",
        replace: "application.revision=rev_" + getSvnRevision(),
        byline:  "true"
    )
}

war {
  replaceTokens() // Update rev number
  baseName = nome

  from('config') {
    include 'ibm-web-ext.xml'
    into 'WEB-INF'

    manifest {
      attributes("Application-Name": baseName,
                 "Implementation-Version": versione + 'rev_' + getSvnRevision())
    }
  }
}
</code>```

When executing gradle -p WarA/trunk war or gradle WarA:war the WarA.war is built correctly but I'm expecting that only the ./src/main/resources/messages/text.properties of WarA is being updated by ant.

Instead I get that every subproject get the ./src/main/resources/messages/text.properties file updated.

What am I missing?

答:
Moving replaceTokens() inside a doFirst{} will do the trick.

```<code>war {
  doFirst{
    replaceTokens() // Update rev number
  }
  baseName = nome

  from('config') {
    include 'ibm-web-ext.xml'
    into 'WEB-INF'

    manifest {
      attributes("Application-Name": baseName,
                 "Implementation-Version": versione + 'rev_' + getSvnRevision())
    }
  }
}
</code>```

Reference here: https://discuss.gradle.org/t/what-difference-between-configuration-setting-and-dofirst-dolast/23406

Body:
I have a java gradle project with this structure:

EarApp
|
\---> WarA/trunk
|     |
|     |- build.gradle
|     ...<src and config>
|
\---> WarB/trunk
|     |
|     |- build.gradle
|     ...<src and config>
|
\---> WarC/trunk
|     |
|     |- build.gradle
|     ...<src and config>
|
|- build.gradle
|- settings.gradle

My settings.gradle is:

include "WarA"
include "WarB"
include "WarC"

project(":WarA").projectDir          = file("WarA/trunk")
project(":WarB").projectDir          = file("WarB/trunk")
project(":WarC").projectDir          = file("WarC/trunk")

Every build.gradle in subprojects contains:

import org.tmatesoft.svn.core.wc.*
def getSvnRevision(){
    ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
    SVNClientManager clientManager = SVNClientManager.newInstance(options);
    SVNStatusClient statusClient = clientManager.getStatusClient();
    SVNStatus status = statusClient.doStatus(projectDir, false);
    SVNRevision revision = status.getRevision();
    return revision.getNumber();
}

def replaceTokens() {
    ant.replaceregexp(
      file:  "./src/main/resources/messages/text.properties",
        match:   "application.revision=(.*)",
        replace: "application.revision=rev_" + getSvnRevision(),
        byline:  "true"
    )
}

war {
  replaceTokens() // Update rev number
  baseName = nome

  from('config') {
    include 'ibm-web-ext.xml'
    into 'WEB-INF'

    manifest {
      attributes("Application-Name": baseName,
                 "Implementation-Version": versione + 'rev_' + getSvnRevision())
    }
  }
}

When executing gradle -p WarA/trunk war or gradle WarA:war the WarA.war is built correctly but I'm expecting that only the ./src/main/resources/messages/text.properties of WarA is being updated by ant.

Instead I get that every subproject get the ./src/main/resources/messages/text.properties file updated.

What am I missing?

Body:
Moving replaceTokens() inside a doFirst{} will do the trick.

war {
  doFirst{
    replaceTokens() // Update rev number
  }
  baseName = nome

  from('config') {
    include 'ibm-web-ext.xml'
    into 'WEB-INF'

    manifest {
      attributes("Application-Name": baseName,
                 "Implementation-Version": versione + 'rev_' + getSvnRevision())
    }
  }
}

Reference here: https://discuss.gradle.org/t/what-difference-between-configuration-setting-and-dofirst-dolast/23406


来源: stackexchange

问:
How to override Allauth login template in app in Django?
I tried overriding Django Allauth login templates in my app, but it didn't work.
APP_DIRS in settings.py is also True.

Login template location:

```<code>ProjectName\main\templates\main\account\login.html
</code>```

Any idea how to fix this, without creating a templates folder on project level?

答:
Try to move account dir up 1 level, and create templates dir at project level, not main app level. like this:

```<code>ProjectName\templates\account\login.html
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I tried overriding Django Allauth login templates in my app, but it didn't work.
APP_DIRS in settings.py is also True.

Login template location:

ProjectName\main\templates\main\account\login.html

Any idea how to fix this, without creating a templates folder on project level?

Body:
Try to move account dir up 1 level, and create templates dir at project level, not main app level. like this:

ProjectName\templates\account\login.html


问:
I want to cache a frame, and then render another scene on the basis of this frame, how to do it?
I want to cache a frame, and then render another scene on the basis of this frame, how to do it?

I set two scenes, one is the physical scene, one for the cursor scene, because the physical scene may not change.

Now I use 2 canvases, one on top, and use a transparent background to solve the problem.

```<code>    let canvas = document.createElement("canvas");

    canvas.style.position = "absolute"
    canvas.style.zIndex = "100px";

    canvas.style.pointerEvents = "none";

    canvas.style.width = "100%";
    canvas.style.height = "100%";

    canvas.style.left = "0px";
    canvas.style.top = "0px";

    el.appendChild(canvas);

    render = new THREE.WebGLRenderer({ canvas: canvas, clearColor: 0, alpha: true })
</code>```

答:
If I'm understanding you correctly, you want to render one scene, and then render a second scene on top of the first. This is actually pretty easy to do, although you can just as easily cause undesired results by performing the wrong actions.

First, tell your renderer not to auto-clear its buffers:

```<code>renderer = new THREE.WebGLRenderer({ canvas: canvas, alpha: true });
renderer.autoClear = false;
</code>```

Next, you need to manually clear the buffers before rendering the first scene. If you don't clear here, then the previous image will remain on the canvas.

```<code>renderer.clear();
renderer.render(scene1, camera1);
</code>```

With the first scene rendered, you need to ensure your second scene will render on top of the first. Calling renderer.clear(); would cause it to erase the first scene. Instead, you only want to clear the depth buffer. This removes any depth information the renderer had previously, and will cause it to draw all new pixels on top of the old ones.

```<code>renderer.clearDepth();
renderer.render(scene2, camera2);
</code>```

Failing to clear the depth buffer would mean the renderer would remember where all the scene1 objects are (spatially), and it would render the scene2 objects as if they occupied the same space as scene1.

At this point, you should see the second scene rendered on top of the first, and they're both drawn to the same canvas.

If you have any questions, or would like me to expand on any of the steps above, please leave a comment below.

three.js r88

UPDATE

This seems like a hacky way to do it, so if anyone has better ideas, please chime in. What I've done in the code below is make rendering the background to be optional, and using the first rendered scene as the background behind the canvas. In the case of my example, I'm allowing the background to render once every ~1s. The red cube can still be manipulated at the full framerate allowed by requestAnimationFrame.

A couple things to note:

If you want to capture an image of your full render, it MUST be captured after a render where renderWithBackground === true. In all other cases, the canvas will actually only contain the contents of scene2.

Also, the first frame renders with a black background, and I'm not sure why. I don't have any more time at the moment to continue debugging it.

var renderer, scene1, scene2, camera1, camera2, controls, bgCube, fgCube;

var renderWithBackground = true;

var WIDTH = window.innerWidth,
  HEIGHT = window.innerHeight,
  FOV = 35,
  NEAR = 1,
  FAR = 1000;

function populateScenes() {
  var cubeGeo1 = new THREE.BoxBufferGeometry(15, 15, 15),
    cubeMat1 = new THREE.MeshPhongMaterial({
      color: "green"
    });
  bgCube = new THREE.Mesh(cubeGeo1, cubeMat1);
  scene1.add(bgCube);

  var cubeGeo2 = new THREE.BoxBufferGeometry(5, 5, 5),
    cubeMat2 = new THREE.MeshPhongMaterial({
      color: "red"
    });
  fgCube = new THREE.Mesh(cubeGeo2, cubeMat2);
  scene2.add(fgCube);
}

function init() {
  document.body.style.backgroundColor = "slateGray";

  renderer = new THREE.WebGLRenderer({
    antialias: true,
    alpha: true
  });
  renderer.autoClear = false;

  document.body.appendChild(renderer.domElement);
  document.body.style.overflow = "hidden";
  document.body.style.margin = "0";
  document.body.style.padding = "0";

  scene1 = new THREE.Scene();
  scene2 = new THREE.Scene();

  camera1 = new THREE.PerspectiveCamera(FOV, WIDTH / HEIGHT, NEAR, FAR);
  camera1.position.z = 50;
  scene1.add(camera1);

  camera2 = camera1.clone();
  scene2.add(camera2);

  controls = new THREE.TrackballControls(camera2, renderer.domElement);
  controls.dynamicDampingFactor = 0.5;
  controls.rotateSpeed = 3;

  var light = new THREE.PointLight(0xffffff, 1, Infinity);
  camera1.add(light);
  camera2.add(light.clone());

  setInterval(function() {
    renderWithBackground = true;
  }, 1000);

  resize();
  window.onresize = resize;

  populateScenes();

  animate();
}

function resize() {
  WIDTH = window.innerWidth;
  HEIGHT = window.innerHeight;
  if (renderer && camera1 && camera2 && controls) {
    renderer.setSize(WIDTH, HEIGHT);
    camera1.aspect = WIDTH / HEIGHT;
    camera1.updateProjectionMatrix();
    camera2.aspect = WIDTH / HEIGHT;
    camera2.updateProjectionMatrix();
    controls.handleResize();
  }
}

function render() {
  renderer.clear();
  if (renderWithBackground) {
    renderWithBackground = false;
    renderer.render(scene1, camera1);
    document.body.style.backgroundImage = "url('" + renderer.domElement.toDataURL() + "')";
    renderer.clearDepth();
  }
  renderer.render(scene2, camera2);
}

function animate() {
  bgCube.rotation.x += 0.001;
  bgCube.rotation.y += 0.002;
  bgCube.rotation.z += 0.003;
  requestAnimationFrame(animate);
  render();
  controls.update();
}

function threeReady() {
  init();
}

(function() {
  function addScript(url, callback) {
    callback = callback || function() {};
    var script = document.createElement("script");
    script.addEventListener("load", callback);
    script.setAttribute("src", url);
    document.head.appendChild(script);
  }

  addScript("https://threejs.org/build/three.js", function() {
    addScript("https://threejs.org/examples/js/controls/TrackballControls.js", function() {
      addScript("https://threejs.org/examples/js/libs/stats.min.js", function() {
        threeReady();
      })
    })
  })
})();```

Body:
I want to cache a frame, and then render another scene on the basis of this frame, how to do it?

I set two scenes, one is the physical scene, one for the cursor scene, because the physical scene may not change.

Now I use 2 canvases, one on top, and use a transparent background to solve the problem.

    let canvas = document.createElement("canvas");

    canvas.style.position = "absolute"
    canvas.style.zIndex = "100px";

    canvas.style.pointerEvents = "none";

    canvas.style.width = "100%";
    canvas.style.height = "100%";

    canvas.style.left = "0px";
    canvas.style.top = "0px";

    el.appendChild(canvas);

    render = new THREE.WebGLRenderer({ canvas: canvas, clearColor: 0, alpha: true })

Body:
If I'm understanding you correctly, you want to render one scene, and then render a second scene on top of the first. This is actually pretty easy to do, although you can just as easily cause undesired results by performing the wrong actions.

First, tell your renderer not to auto-clear its buffers:

renderer = new THREE.WebGLRenderer({ canvas: canvas, alpha: true });
renderer.autoClear = false;

Next, you need to manually clear the buffers before rendering the first scene. If you don't clear here, then the previous image will remain on the canvas.

renderer.clear();
renderer.render(scene1, camera1);

With the first scene rendered, you need to ensure your second scene will render on top of the first. Calling renderer.clear(); would cause it to erase the first scene. Instead, you only want to clear the depth buffer. This removes any depth information the renderer had previously, and will cause it to draw all new pixels on top of the old ones.

renderer.clearDepth();
renderer.render(scene2, camera2);

Failing to clear the depth buffer would mean the renderer would remember where all the scene1 objects are (spatially), and it would render the scene2 objects as if they occupied the same space as scene1.

At this point, you should see the second scene rendered on top of the first, and they're both drawn to the same canvas.

If you have any questions, or would like me to expand on any of the steps above, please leave a comment below.

three.js r88

UPDATE

This seems like a hacky way to do it, so if anyone has better ideas, please chime in. What I've done in the code below is make rendering the background to be optional, and using the first rendered scene as the background behind the canvas. In the case of my example, I'm allowing the background to render once every ~1s. The red cube can still be manipulated at the full framerate allowed by requestAnimationFrame.

A couple things to note:

If you want to capture an image of your full render, it MUST be captured after a render where renderWithBackground === true. In all other cases, the canvas will actually only contain the contents of scene2.

Also, the first frame renders with a black background, and I'm not sure why. I don't have any more time at the moment to continue debugging it.

var renderer, scene1, scene2, camera1, camera2, controls, bgCube, fgCube;

var renderWithBackground = true;

var WIDTH = window.innerWidth,
  HEIGHT = window.innerHeight,
  FOV = 35,
  NEAR = 1,
  FAR = 1000;

function populateScenes() {
  var cubeGeo1 = new THREE.BoxBufferGeometry(15, 15, 15),
    cubeMat1 = new THREE.MeshPhongMaterial({
      color: "green"
    });
  bgCube = new THREE.Mesh(cubeGeo1, cubeMat1);
  scene1.add(bgCube);

  var cubeGeo2 = new THREE.BoxBufferGeometry(5, 5, 5),
    cubeMat2 = new THREE.MeshPhongMaterial({
      color: "red"
    });
  fgCube = new THREE.Mesh(cubeGeo2, cubeMat2);
  scene2.add(fgCube);
}

function init() {
  document.body.style.backgroundColor = "slateGray";

  renderer = new THREE.WebGLRenderer({
    antialias: true,
    alpha: true
  });
  renderer.autoClear = false;

  document.body.appendChild(renderer.domElement);
  document.body.style.overflow = "hidden";
  document.body.style.margin = "0";
  document.body.style.padding = "0";

  scene1 = new THREE.Scene();
  scene2 = new THREE.Scene();

  camera1 = new THREE.PerspectiveCamera(FOV, WIDTH / HEIGHT, NEAR, FAR);
  camera1.position.z = 50;
  scene1.add(camera1);

  camera2 = camera1.clone();
  scene2.add(camera2);

  controls = new THREE.TrackballControls(camera2, renderer.domElement);
  controls.dynamicDampingFactor = 0.5;
  controls.rotateSpeed = 3;

  var light = new THREE.PointLight(0xffffff, 1, Infinity);
  camera1.add(light);
  camera2.add(light.clone());

  setInterval(function() {
    renderWithBackground = true;
  }, 1000);

  resize();
  window.onresize = resize;

  populateScenes();

  animate();
}

function resize() {
  WIDTH = window.innerWidth;
  HEIGHT = window.innerHeight;
  if (renderer && camera1 && camera2 && controls) {
    renderer.setSize(WIDTH, HEIGHT);
    camera1.aspect = WIDTH / HEIGHT;
    camera1.updateProjectionMatrix();
    camera2.aspect = WIDTH / HEIGHT;
    camera2.updateProjectionMatrix();
    controls.handleResize();
  }
}

function render() {
  renderer.clear();
  if (renderWithBackground) {
    renderWithBackground = false;
    renderer.render(scene1, camera1);
    document.body.style.backgroundImage = "url('" + renderer.domElement.toDataURL() + "')";
    renderer.clearDepth();
  }
  renderer.render(scene2, camera2);
}

function animate() {
  bgCube.rotation.x += 0.001;
  bgCube.rotation.y += 0.002;
  bgCube.rotation.z += 0.003;
  requestAnimationFrame(animate);
  render();
  controls.update();
}

function threeReady() {
  init();
}

(function() {
  function addScript(url, callback) {
    callback = callback || function() {};
    var script = document.createElement("script");
    script.addEventListener("load", callback);
    script.setAttribute("src", url);
    document.head.appendChild(script);
  }

  addScript("https://threejs.org/build/three.js", function() {
    addScript("https://threejs.org/examples/js/controls/TrackballControls.js", function() {
      addScript("https://threejs.org/examples/js/libs/stats.min.js", function() {
        threeReady();
      })
    })
  })
})();


问:
Use cases of bootstrapping maven
I've seen some companies using maven bootstrap binary, instead of the one You get by the package manager.

What are the typical use cases of bootstrapping maven?

答:
It is useful when you want to use different Maven versions on different projects. Besides that it requires less setup on new environment, because the required version is encapsulated and under configuration control. Also, it can be the case of using a newer version that the one provided by the package manager.

maven-wrapper is a tool that simplifies this pattern.

Title: Use cases of bootstrapping maven


问:
How do I remove all events of a type from an element
I want to remove ALL click events from a certain DOM element. How? There is removeEventListener, but that requires the attached function.

Is there a way to remove ALL attached events of one type (or just ALL, that's fine too)?

答:
If you want to remove all the event listeners how about assigning an empty function to the onclick event?</p>

```<code><YOUR_HTML_ELEMENT>.onclick=function(){};
</code>```

ContentLicense: CC BY-SA 4.0

Body:
If you want to remove all the event listeners how about assigning an empty function to the onclick event?

<YOUR_HTML_ELEMENT>.onclick=function(){};

ContentLicense: CC BY-SA 2.5


问:
Pandas box plot error on one datapoint
I'm working on a box-plot using pandas.

My DataFrame looks like this

```<code>Year                 2013      2014      2015      2016      2017
dfMin            1.091603  0.973346  1.040000  0.855209  1.079500
dfLowerQuartile  1.727191  1.684009  1.275601  1.136703  2.262654
dfUpperQuartile  2.225000  2.000000  1.857570  2.120644  2.435724
dfMax            2.687323  2.350000  2.105000  2.250000  2.566467
</code>```

My chart code looks like this

```<code>chartDF.boxplot(grid=False, figsize=(9,4))
</code>```

Leading to a plot looking like this

I am puzzled at the lower value in 2017 coming out as a point.

Does anyone know how to fix this issue?

答:
What happens with the following?

```<code>import pandas as pd
df = pd.DataFrame({"a": [1, 2, 2.1, 2.3]})
df.boxplot()
</code>```

It calcualtes out of these four values the quantiles, the value 1 is interpreted as an outlier. So: the actual indices you are using are ignored, pandas takes those values as data points.

So, actually, instead of setting min, max and quantiles yourself, you rather should pass the full data from a dataframe to a boxplot.

Title: Pandas box plot error on one datapoint

Body:
I'm working on a box-plot using pandas.

My DataFrame looks like this

Year                 2013      2014      2015      2016      2017
dfMin            1.091603  0.973346  1.040000  0.855209  1.079500
dfLowerQuartile  1.727191  1.684009  1.275601  1.136703  2.262654
dfUpperQuartile  2.225000  2.000000  1.857570  2.120644  2.435724
dfMax            2.687323  2.350000  2.105000  2.250000  2.566467

My chart code looks like this

chartDF.boxplot(grid=False, figsize=(9,4))

Leading to a plot looking like this

I am puzzled at the lower value in 2017 coming out as a point.

Does anyone know how to fix this issue?

Body:
What happens with the following?

import pandas as pd
df = pd.DataFrame({"a": [1, 2, 2.1, 2.3]})
df.boxplot()

It calcualtes out of these four values the quantiles, the value 1 is interpreted as an outlier. So: the actual indices you are using are ignored, pandas takes those values as data points.

So, actually, instead of setting min, max and quantiles yourself, you rather should pass the full data from a dataframe to a boxplot.


答:
It isn't issue. Basically boxplot show values around means. And if u have one point out of rectangle it means that point with that value is outlier.

More infromation about outliers: Outlier

Title: Pandas box plot error on one datapoint


问:
Artifactory Pro 5.4.6 - Groovy plugin not executing on a schedule
We have deployed a groovy script to the artifactory home plugin folders.
using the REST API we have loaded it successfully.

from the logs we can see that the load is successful.

2017-11-14 10:00:54,815 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.GroovyRunnerImpl:244) - Loading script from 'purgeLibrary.groovy'.

  2017-11-14 10:00:55,015 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.e.ExecutePluginImpl:187) - Groovy execution 'purgeLibrary' has been successfully registered.

  2017-11-14 10:00:55,023 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.j.JobsPluginImpl:92) - Groovy job 'purgeOutdatedArtifacts' has been successfully scheduled to run.

  2017-11-14 10:00:55,024 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.GroovyRunnerImpl:296) - Script 'purgeLibrary' loaded.

and using the REST API again, we have manually executed the script purgeLibrary (again verified though log messages).

Job purgeOutdatedArtifacts and execution purgeLibrary are both wrappers around the same internal method, but job has default parms.

However, this 'job' never actually executes - again we can tell because there is nothing in the logs.

The relevant 'hook points' below...

```<code>executions {
   purgeLibrary() { params ->
    def dryRun = params["dryRun"] ? params["dryRun"][0] as boolean : false
    libraryPurge(dryRun)
    }
 }
 jobs {
    // Finds ci/cd published Artifacts that have reached max daysToLive and purges them. Executes daily at 1am, server time.
    purgeOutdatedArtifacts(cron: "0 0 1 * * ?") {
        libraryPurge(true)  // default dryrun flag to true
    }
}
</code>```

Now: all of this works in our test server - also same version of Artifactory. So my assumption is there is a configuration difference on the production server that is missing / not set correctly.

Any idea why the 'job' does not actually execute?

Thanks!

答:
So it turns out the job is actually running, but doing so at a different start time that equates to the value that was originally in the script.

I am still researching why it has not updated start time when we reloaded the script.

I am not deleting the question, in case this adds value to someone else

Body:
We have deployed a groovy script to the artifactory home plugin folders.
using the REST API we have loaded it successfully.

from the logs we can see that the load is successful.

2017-11-14 10:00:54,815 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.GroovyRunnerImpl:244) - Loading script from 'purgeLibrary.groovy'.

  2017-11-14 10:00:55,015 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.e.ExecutePluginImpl:187) - Groovy execution 'purgeLibrary' has been successfully registered.

  2017-11-14 10:00:55,023 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.j.JobsPluginImpl:92) - Groovy job 'purgeOutdatedArtifacts' has been successfully scheduled to run.

  2017-11-14 10:00:55,024 [http-nio-8081-exec-74] [INFO ] (o.a.a.p.GroovyRunnerImpl:296) - Script 'purgeLibrary' loaded.

and using the REST API again, we have manually executed the script purgeLibrary (again verified though log messages).

Job purgeOutdatedArtifacts and execution purgeLibrary are both wrappers around the same internal method, but job has default parms.

However, this 'job' never actually executes - again we can tell because there is nothing in the logs.

The relevant 'hook points' below...

executions {
   purgeLibrary() { params ->
    def dryRun = params["dryRun"] ? params["dryRun"][0] as boolean : false
    libraryPurge(dryRun)
    }
 }
 jobs {
    // Finds ci/cd published Artifacts that have reached max daysToLive and purges them. Executes daily at 1am, server time.
    purgeOutdatedArtifacts(cron: "0 0 1 * * ?") {
        libraryPurge(true)  // default dryrun flag to true
    }
}

Now: all of this works in our test server - also same version of Artifactory. So my assumption is there is a configuration difference on the production server that is missing / not set correctly.

Any idea why the 'job' does not actually execute?

Thanks!


问:
Cordova StatusBar plugin fails randomly
I'm trying to run an iOS Cordova app using the StatusBar plugin (version 2.3.0).

My problem is that the plugin will be loaded randomly and also works just randomly.
Sometimes I get this error on Xcode:

```<code>[CDVTimer][statusbar] 5.837023ms
ERROR: Plugin 'StatusBar' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["StatusBar1191468497","StatusBar","_ready",[]]
</code>```

and sometimes it's just working fine.

My config.xml:

```<code><plugin name="cordova-plugin-statusbar" spec="2.3.0" />
<feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" />
    <param name="onload" value="true" />
    <param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#445E75" />
<preference name="StatusBarStyle" value="lightcontent" />
</code>```

I also tried removing the platform and adding it again, removing the ios.json... I always get the same result.

答:
The solution was to call the JavaScript methods of StatusBar.</p>

```<code>document.addEventListener("deviceready", function(){
    StatusBar.overlaysWebView(false);
    Statusbar.backgroundColorByHexString("#445E75");
    Statusbar.styleLightContent();
}, false);
</code>```

Title: Cordova StatusBar plugin fails randomly

Body:
I'm trying to run an iOS Cordova app using the StatusBar plugin (version 2.3.0).

My problem is that the plugin will be loaded randomly and also works just randomly.
Sometimes I get this error on Xcode:

[CDVTimer][statusbar] 5.837023ms
ERROR: Plugin 'StatusBar' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["StatusBar1191468497","StatusBar","_ready",[]]

and sometimes it's just working fine.

My config.xml:

<plugin name="cordova-plugin-statusbar" spec="2.3.0" />
<feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" />
    <param name="onload" value="true" />
    <param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#445E75" />
<preference name="StatusBarStyle" value="lightcontent" />

I also tried removing the platform and adding it again, removing the ios.json... I always get the same result.

Body:
The solution was to call the JavaScript methods of StatusBar.

document.addEventListener("deviceready", function(){
    StatusBar.overlaysWebView(false);
    Statusbar.backgroundColorByHexString("#445E75");
    Statusbar.styleLightContent();
}, false);


问:
I am trying a javascript onchange method but i cant get the value in text box
I am trying a javascript onchange method
when i select some option in (To->("destination")) it dsn't set any value on price text box</p>

```<code><html>
<head>
<style>
div.newdiv
{
width:980;
background:url("");

}
div
{
display:inline-block;
color:black;
background-color:skyblue;
border:2px solid white;
box-shadow:3px 3px 3px white;
font-weight: 500;
color: #434248;
text-shadow: 0 1px rgba(white, .5);
border-radius: 40px;
width:500;
text-align:center;
}
h3
{
color:white;

}
h1
{
color:white;
background-color:lime;
border:2px solid white;
box-shadow:3px 3px 3px white;
}
body
{
background-color:white;
}
</style>
</head>
<body bgcolor=#CCCCCC>
<script>
function price()
{
    var des = document.getElementById("destination").value;
    switch (des)
    {
       case '700': document.getElementById("price").value="700";
       break;

       case '350': document.getElementById("price").value="350";
       break;

       case '550': document.getElementById("price").value="550";
       break;

       case '450': document.getElementById("price").value="450";
       break;

       default:  document.getElementById("price").value="select
destination";
    }

}

</script>
<div class=newdiv>
<div>
<h1>Online Booking Form</h1>
<h3><u>To reserve seats please complete and submit the booking form</u></h3>
<form name="f1" method="post" action="jsdropdown.php">

FirstName:  <input type="text" name="fname" value="" placeholder=firstname>
<br><br>

LastName:<input type="text" name="lname" value="" placeholder=lastname><br>
<br>

Age: <input type="text" name="age" value="" placeholder=age><br><br>

E-mail: <input type="email" name="email" value=""
placeholder=example@gmail.com><br><br>

Phone Number:<select name="phno">
<option>+91</option>
<option>+12</option>
<option>+325</option>
<option>+487</option>
</select> - <input type="text" name="phno" value="" placeholder=phonenumber>
<br><br>

From:<input type="text" name="from" value="" placeholder=source><br><br>

To:<select id="destination" onchange="price()">
<option value="700">chennai</option>
<option value="350">ooty</option>
<option value="550">bangalore</option>
<option value="450">kerala</select>
<br><br>

Price:<input type="text" id="price" size="20" placeholder=price><br><br>

Bus Type:<select name="bustype">
<option>Ac</option>
<option>Non Ac</option></select><br><br>

Number Of Passengers:<input type="text" name="passenger" value=""
placeholder=passengers><br><br>

Total:<input type="text" name="total" value="" placeholder=total><br><br>

<input type="submit" align="center" name="book" value="BOOK YOUR TICKET">
</form></div></div>
</body>
</html>
</code>```

答:
destination is a selectbox. to get what you are testing against in your switch statement, you would need to get the value like this:

```<code>var destSelect = document.getElementById("destination");
var des = destSelect.options[destSelect.selectedIndex].value;
</code>```

the way you set the textbox value seems to work. try it out and let me know if it solved your problem!

Body:
I am trying a javascript onchange method
when i select some option in (To->("destination")) it dsn't set any value on price text box

Online Booking Form

To reserve seats please complete and submit the booking form

<form name="f1" method="post" action="jsdropdown.php">

FirstName:  <input type="text" name="fname" value="" placeholder=firstname>

LastName:<input type="text" name="lname" value="" placeholder=lastname>

Age: <input type="text" name="age" value="" placeholder=age>

E-mail: <input type="email" name="email" value=""
placeholder=example@gmail.com>

Phone Number:<select name="phno">
<option>+91</option>
<option>+12</option>
<option>+325</option>
<option>+487</option>
</select> - <input type="text" name="phno" value="" placeholder=phonenumber>

From:<input type="text" name="from" value="" placeholder=source>

To:<select id="destination" onchange="price()">
<option value="700">chennai</option>
<option value="350">ooty</option>
<option value="550">bangalore</option>
<option value="450">kerala</select>

Price:<input type="text" id="price" size="20" placeholder=price>

Bus Type:<select name="bustype">
<option>Ac</option>
<option>Non Ac</option></select>

Number Of Passengers:<input type="text" name="passenger" value=""
placeholder=passengers>

Total:<input type="text" name="total" value="" placeholder=total>

<input type="submit" align="center" name="book" value="BOOK YOUR TICKET">
</form>

Body:
destination is a selectbox. to get what you are testing against in your switch statement, you would need to get the value like this:

var destSelect = document.getElementById("destination");
var des = destSelect.options[destSelect.selectedIndex].value;

the way you set the textbox value seems to work. try it out and let me know if it solved your problem!


答: This is an outlier for 2017. If you are not interested in that observation you should simply delete it in the dataset knowing that it will change values for the respective statistical measures.</p>

Title: Pandas box plot error on one datapoint


问:
Selenium WebDriver: Wait for complex page with JavaScript to load
I have a web application to test with Selenium. There is a lot of JavaScript running on page load.

This JavaScript code is not so well written but I can't change anything.
So waiting for an element to appear in the DOM with findElement() method is not an option.

I want to create a generic function in Java to wait for a page to load, a possible solution would be:

run a JavaScript script form WebDriver and store the result of document.body.innerHTML in a string variable body.

compare the body variable to the previous version of body. if they are the same then set increment a counter notChangedCount otherwise set notChangedCount to zero.

wait for a litte time (50 ms for example).

if the page has not changed for some time (500 ms for example) so notChangedCount >= 10 then exit the loop otherwise loop to the first step.

Do you think it's a valid solution?

答:
Two conditions can be used to check if the page is loaded before finding any element on the page:

```<code>WebDriverWait wait = new WebDriverWait(driver, 50);
</code>```

Using below readyState will wait till page load

```<code>wait.until((ExpectedCondition<Boolean>) wd ->
   ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));
</code>```

Below JQuery will wait till data has not been loaded

```<code>  int count =0;
            if((Boolean) executor.executeScript("return window.jQuery != undefined")){
                while(!(Boolean) executor.executeScript("return jQuery.active == 0")){
                    Thread.sleep(4000);
                    if(count>4)
                        break;
                    count++;
                }
            }
</code>```

After these JavaScriptCode try to findOut webElement.

```<code>WebElement we = wait.until(ExpectedConditions.presenceOfElementLocated(by));
</code>```

Body:
Two conditions can be used to check if the page is loaded before finding any element on the page:

WebDriverWait wait = new WebDriverWait(driver, 50);

Using below readyState will wait till page load

wait.until((ExpectedCondition<Boolean>) wd ->
   ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));

Below JQuery will wait till data has not been loaded

  int count =0;
            if((Boolean) executor.executeScript("return window.jQuery != undefined")){
                while(!(Boolean) executor.executeScript("return jQuery.active == 0")){
                    Thread.sleep(4000);
                    if(count>4)
                        break;
                    count++;
                }
            }

After these JavaScriptCode try to findOut webElement.

WebElement we = wait.until(ExpectedConditions.presenceOfElementLocated(by));


问:
Concurrent download and processing of large files in python
I have a list of URLs for large files to download (e.g. compressed archives), which I want to process (e.g. decompress the archives).

Both download and processing take a long time and processing is heavy on disk IO, so I want to have just one of each to run at a time. Since the two tasks take about the same time and do not compete for the same resources, I want to download the next file(s) while the last is being processed.

This is a variation of the producer-consumer problem.

The situation is similar to reading and processing images or downloading loads of files, but my downloader calls are not (yet) picklable, so I have not been able to use multiprocessing, and both tasks take about the same time.

Here is a dummy example, where both download and processing are blocking:

```<code>import time
import posixpath

def download(urls):
    for url in urls:
        time.sleep(3)  # this is the download (more like 1000s)
        yield posixpath.basename(url)

def process(fname):
    time.sleep(2)  # this is the processing part (more like 600s)

urls = ['a', 'b', 'c']
for fname in download(urls):
    process(fname)
    print(fname)
</code>```

How could I make the two tasks concurrent? Can I use yield or yield from in a smart way, perhaps in combination with deque? Or must it be asyncio with Future?

答: A year later, we are actually using Python 3's asyncio and aiohttp.

Body:
I have a list of URLs for large files to download (e.g. compressed archives), which I want to process (e.g. decompress the archives).

Both download and processing take a long time and processing is heavy on disk IO, so I want to have just one of each to run at a time. Since the two tasks take about the same time and do not compete for the same resources, I want to download the next file(s) while the last is being processed.

This is a variation of the producer-consumer problem.

The situation is similar to reading and processing images or downloading loads of files, but my downloader calls are not (yet) picklable, so I have not been able to use multiprocessing, and both tasks take about the same time.

Here is a dummy example, where both download and processing are blocking:

import time
import posixpath

def download(urls):
    for url in urls:
        time.sleep(3)  # this is the download (more like 1000s)
        yield posixpath.basename(url)

def process(fname):
    time.sleep(2)  # this is the processing part (more like 600s)

urls = ['a', 'b', 'c']
for fname in download(urls):
    process(fname)
    print(fname)

How could I make the two tasks concurrent? Can I use yield or yield from in a smart way, perhaps in combination with deque? Or must it be asyncio with Future?


问:
LINQ Enumerable.All always return True if collection is empty
```<code>    class Program
    {
        static void Main()
        {
            var list = new List<Foo>();
            var a = list.All(l => l.BoolBar == true);//true
            var s = list.All(l => l.Bar.Contains("magicstring"));//true
        }
    }
    public class Foo
    {
        public bool BoolBar{ get; set; }
        public string Bar{ get; set; }
    }
</code>```

Based on this snippet I'm wondering why Linq framework creators chose to go with this solution for empty collections? Also, due Visual Studio and Linq are both MS products why intellisense does not warn if a user didn't check whether the collection is empty before performing .All? I think it can cause a lot of unexpected results.

答:
That's what the Documentation says.

true if every element of the source sequence passes the test in the
  specified predicate, or if the sequence is empty; otherwise, false.

Implementation:

```<code>public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
    if (source == null) throw Error.ArgumentNull("source");
    if (predicate == null) throw Error.ArgumentNull("predicate");
    foreach (TSource element in source) {
        if (!predicate(element)) return false;
    }
    return true;
}
</code>```

So it's obvious, if there is no item in the IEnumerable the foreach loop will be skipped and it directly returns true.

Body:
    class Program
    {
        static void Main()
        {
            var list = new List<Foo>();
            var a = list.All(l => l.BoolBar == true);//true
            var s = list.All(l => l.Bar.Contains("magicstring"));//true
        }
    }
    public class Foo
    {
        public bool BoolBar{ get; set; }
        public string Bar{ get; set; }
    }

Based on this snippet I'm wondering why Linq framework creators chose to go with this solution for empty collections? Also, due Visual Studio and Linq are both MS products why intellisense does not warn if a user didn't check whether the collection is empty before performing .All? I think it can cause a lot of unexpected results.

Body:
That's what the Documentation says.

true if every element of the source sequence passes the test in the
  specified predicate, or if the sequence is empty; otherwise, false.

Implementation:

public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
    if (source == null) throw Error.ArgumentNull("source");
    if (predicate == null) throw Error.ArgumentNull("predicate");
    foreach (TSource element in source) {
        if (!predicate(element)) return false;
    }
    return true;
}

So it's obvious, if there is no item in the IEnumerable the foreach loop will be skipped and it directly returns true.


问:
Docker containers as Jenkins Slave (build agents)
i have a jenkins master running inside a container ...
and i'm tyring to containerize my builds using Docker containers as Jenkins Slave (build agents), on a separete vm , to run my CI pipelines.
This Docker container (build agents) will be created when the CI pipeline runs;
 . once the build is complete the Docker container will be destroyed.
To achieve this:

i use docker plugin as following:

enter image description here

this my jenkinsfile code:

    node('docker') {
      stage('Checkout Code') {
          checkout scm  }
      stage('Build') {
        withMaven {
            sh 'mvn clean install' }
      }
    }```
</div>
</div>
</p>

<p>when i run my peline every thing is going right :</p>

<p>but the question is about the build results (.war)<br>
are this archives transferred to the master workspace or destroyed with the container ??
if the second case then how can i recuperate the build results to jenkins master to pursue CI process ??</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>[INFO] Installing /home/jenkins/workspace/Build_pipeline_team/target/Teams.war to /home/jenkins/.m2/repository/teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.war
[INFO] Installing /home/jenkins/workspace/Build_pipeline_team/pom.xml to /home/jenkins/.m2/repository/teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:12 min
[INFO] Finished at: 2017-11-15T03:40:13+00:00
[INFO] Final Memory: 21M/51M
[INFO] ------------------------------------------------------------------------
[jenkins-maven-event-spy] INFO generated /home/jenkins/workspace/Build_pipeline_team@tmp/withMaven673f8d6e/maven-spy-20171115-033800-6375412806014049683204.log
[Pipeline] }
[withMaven] artifactsPublisher - Archive artifact pom.xml under teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.pom
[withMaven] artifactsPublisher - Archive artifact target/Teams.war under teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.war
[withMaven] junitPublisher - Archive test results for Maven artifact teams:Teams:1.0-SNAPSHOT generated by maven-surefire-plugin:test (default-test): target/surefire-reports/*.xml</code>```

答:
When you encapsulate the stage inside a node, everything will run on that node. Thus the war will be destroyed with the container when the build finished.

You have several alternatives to keep the war.

The maven way is to deploy artifacts to a repository such as nexus.

Another Jenkins alternative is to stash the war on the slave once the build finishes and unstash it back on the master. This will effectively copy back the stashed files from the slave to the master node.

Body:
i have a jenkins master running inside a container ...
and i'm tyring to containerize my builds using Docker containers as Jenkins Slave (build agents), on a separete vm , to run my CI pipelines.
This Docker container (build agents) will be created when the CI pipeline runs;
 . once the build is complete the Docker container will be destroyed.
To achieve this:

i use docker plugin as following:

enter image description here

this my jenkinsfile code:

    node('docker') {
      stage('Checkout Code') {
          checkout scm  }
      stage('Build') {
        withMaven {
            sh 'mvn clean install' }
      }
    }

when i run my peline every thing is going right :

but the question is about the build results (.war)

are this archives transferred to the master workspace or destroyed with the container ??
if the second case then how can i recuperate the build results to jenkins master to pursue CI process ??

[INFO] Installing /home/jenkins/workspace/Build_pipeline_team/target/Teams.war to /home/jenkins/.m2/repository/teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.war
[INFO] Installing /home/jenkins/workspace/Build_pipeline_team/pom.xml to /home/jenkins/.m2/repository/teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:12 min
[INFO] Finished at: 2017-11-15T03:40:13+00:00
[INFO] Final Memory: 21M/51M
[INFO] ------------------------------------------------------------------------
[jenkins-maven-event-spy] INFO generated /home/jenkins/workspace/Build_pipeline_team@tmp/withMaven673f8d6e/maven-spy-20171115-033800-6375412806014049683204.log
[Pipeline] }
[withMaven] artifactsPublisher - Archive artifact pom.xml under teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.pom
[withMaven] artifactsPublisher - Archive artifact target/Teams.war under teams/Teams/1.0-SNAPSHOT/Teams-1.0-SNAPSHOT.war
[withMaven] junitPublisher - Archive test results for Maven artifact teams:Teams:1.0-SNAPSHOT generated by maven-surefire-plugin:test (default-test): target/surefire-reports/*.xml


问:
Is it possible to make this image in CSS?
I was working on something in photoshop. You can see the picture here:

The three triangles in the background refer to 3 different pages on my website. I was wondering if it was possible to put the images like this in CSS because I want them to work like links and put some simple zoom animation on it when you hover on it. I'm actually pretty noob and new to CSS in overall so this will be hard to make without doing a lot of research but I hope you guys can help me out and give me a way to start. Any help is appreciated, thanks a lot!

just to be clear, the 3 triangles should become 3 individual pictures. I'm forced to work with flexbox on school if that matters. Thanks again.

答:
So here is a rough draft of how I would create this in CSS. Basically I made three squares (.triangle to .triangle3), gave them a rotation (transform: rotate(45deg);) and added a gradient with a transparency (background-image: linear-gradient( to top left, red, transparent 50%);) to each of the squares. This creates the basic triangular shape, as the other halves of the squares are hidden if they are big enough to go over the viewport. I positioned the elements next to each other by using position: absolute;.

I did not use flexbox however, but I don't think flexbox would be the right thing to use in this case.

Another thing to point out: If you don't want the 45° angles you can also use transform:skew. It skews the element and gives you the possibility to create different angles. This is a good resource for this.

body {
  background: black;
  position: relative;
  width: 475px;
}

.triangle {
  height: 200px;
  width: 200px;
  transform: rotate(135deg);
  background-image: linear-gradient(rgba(0, 255, 0, 1), rgba(0, 255, 0, 0));
  position: absolute;
  left: 0;
  margin-top: 30%;
}

.triangle2 {
  height: 200px;
  width: 200px;
  transform: rotate(-135deg);
  background-image: linear-gradient(rgba(0, 0, 255, 1), rgba(0, 0, 255, 0));
  position: absolute;
  right: 0;
  margin-top: 30%;
}

.triangle3 {
  height: 200px;
  width: 200px;
  transform: rotate(45deg);
  background-image: linear-gradient( to top left, red, transparent 50%);
  position: absolute;
  right: 0;
  left: 0;
  margin: 0% auto;
}

.wrapper {
overflow: hidden;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="triangle"></div>
<div class="triangle2"></div>
<div class="triangle3"></div></code>```

Body:
So here is a rough draft of how I would create this in CSS. Basically I made three squares (.triangle to .triangle3), gave them a rotation (transform: rotate(45deg);) and added a gradient with a transparency (background-image: linear-gradient( to top left, red, transparent 50%);) to each of the squares. This creates the basic triangular shape, as the other halves of the squares are hidden if they are big enough to go over the viewport. I positioned the elements next to each other by using position: absolute;.

I did not use flexbox however, but I don't think flexbox would be the right thing to use in this case.

Another thing to point out: If you don't want the 45° angles you can also use transform:skew. It skews the element and gives you the possibility to create different angles. This is a good resource for this.

body {
  background: black;
  position: relative;
  width: 475px;
}

.triangle {
  height: 200px;
  width: 200px;
  transform: rotate(135deg);
  background-image: linear-gradient(rgba(0, 255, 0, 1), rgba(0, 255, 0, 0));
  position: absolute;
  left: 0;
  margin-top: 30%;
}

.triangle2 {
  height: 200px;
  width: 200px;
  transform: rotate(-135deg);
  background-image: linear-gradient(rgba(0, 0, 255, 1), rgba(0, 0, 255, 0));
  position: absolute;
  right: 0;
  margin-top: 30%;
}

.triangle3 {
  height: 200px;
  width: 200px;
  transform: rotate(45deg);
  background-image: linear-gradient( to top left, red, transparent 50%);
  position: absolute;
  right: 0;
  left: 0;
  margin: 0% auto;
}

.wrapper {
overflow: hidden;
}

<div class="triangle"></div>
<div class="triangle2"></div>
<div class="triangle3"></div>


问:
Add to home screen' Web App Install Banner not showing up in my web app and showing error
Below is the my manifest.json file

```<code>{
    "short_name": "ponds.brandfans.co",
    "name": "ponds.brandfans.co",
    "icons": [{
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "36x36",
        "type": "image/png",
        "density": "0.75"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "48x48",
        "type": "image/png",
        "density": "1.0"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "72x72",
        "type": "image/png",
        "density": "1.5"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "96x96",
        "type": "image/png",
        "density": "2.0"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "144x144",
        "type": "image/png",
        "density": "3.0"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "192x192",
        "type": "image/png",
        "density": "4.0"
    }],
    "start_url": "/",
    "display": "standalone",
    "gcm_sender_id": "482941778795",
    "background_color": "#2c3e50",
    "theme_color": "#2c3e50"
}
</code>```

I am getting an error: "Site cannot be installed: the page does not work offline"
Please let me know if I missed anything?

答:
As seen in Chris Love's blog and video, you must add this to your service worker javascript code:

```<code>self.addEventListener("fetch", function(event) {});
</code>```

(For me the service worker file (sw.js) only contains this line)

Body:
Below is the my manifest.json file

{
    "short_name": "ponds.brandfans.co",
    "name": "ponds.brandfans.co",
    "icons": [{
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "36x36",
        "type": "image/png",
        "density": "0.75"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "48x48",
        "type": "image/png",
        "density": "1.0"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "72x72",
        "type": "image/png",
        "density": "1.5"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "96x96",
        "type": "image/png",
        "density": "2.0"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "144x144",
        "type": "image/png",
        "density": "3.0"
    }, {
        "src": "/images/logo/favicons/36x36.png",
        "sizes": "192x192",
        "type": "image/png",
        "density": "4.0"
    }],
    "start_url": "/",
    "display": "standalone",
    "gcm_sender_id": "482941778795",
    "background_color": "#2c3e50",
    "theme_color": "#2c3e50"
}

I am getting an error: "Site cannot be installed: the page does not work offline"
Please let me know if I missed anything?

Body:
As seen in Chris Love's blog and video, you must add this to your service worker javascript code:

self.addEventListener("fetch", function(event) {});

(For me the service worker file (sw.js) only contains this line)


问:
transclude and Require on Angular4
I'm trying to convert this component of angularJs 1.6 to angular 4 and I can't find the solution for require and transclude:

Here AngularJs version:

```<code>const partnerTabComponent = {
  selector: 'ypUiPartnerTab',
  controller : PartnerTabController,
  template,
  transclude: true,
  require: {
    parent: '^ypUiPartnerTabs'
  },
  bindings: {
    label: '<'
  }
}
</code>```

And here Angular version:

```<code>@Component({
  selector: 'yp-ui-partner-tab',
  templateUrl: './partner-tab.component.html',
  styleUrls: ['./partner-tab.component.less']
})
export class PartnerTabComponent implements OnInit {

  @Input() label: any

  constructor() { }
}
</code>```

I want to add transclude element and require, in this Angular version.

It maybe very easy, but I can't find the solution right now.

答:
There is no require in angular, you can however inject the parent component into your child component. If the child component is not inside the parent, your application will throw an error:

```<code>@Component({...})
export class PartnerTabComponent implements OnInit {

  constructor(private readonly partnerTabs: PartnerTabsComponent) {}

}
</code>```

For the transclude bit, I believe you can use the ng-content tag:

If you have a parent component template like this:

```<code><yp-ui-partner-tab>
  <div>this is sparta!</div>
</yp-ui-partner-tab>
</code>```

You can render your 'sparta' inside your partner-tab at the position where you place your ng-content tag:

```<code>@Component({
  selector: 'yp-ui-partner-tab',
  template: `
      <div>What is this?</div>
      <ng-content></ng-content>
  `
})
export class PartnerTabComponent implements OnInit {

  constructor(private readonly partnerTabs: PartnerTabsComponent) {}

}
</code>```

Title: transclude and Require on Angular4

Body:
I'm trying to convert this component of angularJs 1.6 to angular 4 and I can't find the solution for require and transclude:

Here AngularJs version:

const partnerTabComponent = {
  selector: 'ypUiPartnerTab',
  controller : PartnerTabController,
  template,
  transclude: true,
  require: {
    parent: '^ypUiPartnerTabs'
  },
  bindings: {
    label: '<'
  }
}

And here Angular version:

@Component({
  selector: 'yp-ui-partner-tab',
  templateUrl: './partner-tab.component.html',
  styleUrls: ['./partner-tab.component.less']
})
export class PartnerTabComponent implements OnInit {

  @Input() label: any

  constructor() { }
}

I want to add transclude element and require, in this Angular version.

It maybe very easy, but I can't find the solution right now.

Body:
There is no require in angular, you can however inject the parent component into your child component. If the child component is not inside the parent, your application will throw an error:

@Component({...})
export class PartnerTabComponent implements OnInit {

  constructor(private readonly partnerTabs: PartnerTabsComponent) {}

}

For the transclude bit, I believe you can use the ng-content tag:

If you have a parent component template like this:

<yp-ui-partner-tab>
  <div>this is sparta!</div>
</yp-ui-partner-tab>

You can render your 'sparta' inside your partner-tab at the position where you place your ng-content tag:

@Component({
  selector: 'yp-ui-partner-tab',
  template: `
      <div>What is this?</div>
      <ng-content></ng-content>
  `
})
export class PartnerTabComponent implements OnInit {

  constructor(private readonly partnerTabs: PartnerTabsComponent) {}

}


问:
onchange form input grabs value and submits form
click to see the toggle input

I have a form input for item quantity, it's formatted to have toggles for increasing and decreasing the value

```<code><input name="quantity" type="text" class="form-control text-center" id="quantity" value="<?php echo $crow[ 'quantity' ];?>" />
</code>```

How could I use javascript to run a function on change or on click and grab it's value and submit a form?

Thanks for your help

I now have

```<code>function changeQuant(){
     var x = document.getElementById("quantity").value;
     document.getElementById('fquant').submit();
}
</code>```

and the form submits on change

```<code><form action="cartplusone.php" method="post" id="fquant" >
   <td class="input-qty"><input name="quantity" type="text" class="form-control text-center" id="quantity" onchange="changeQuant()" value="<?php echo $crow[ 'quantity' ];?>" /></td>
   <input name="newqval" type="hidden" id="newqval" value="">
</form>
</code>```

How do I now best get the var x value into the hidden form field?

答:
You can use onchange

In your input add this onchange="myFunction()"

Following is an example with input type number

 function myFunction(){
     var x = document.getElementById("quantity").value;
     console.log(x);
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input type="number" id="quantity" onchange="myFunction()"/></code>```

Body:
click to see the toggle input

I have a form input for item quantity, it's formatted to have toggles for increasing and decreasing the value

<input name="quantity" type="text" class="form-control text-center" id="quantity" value="<?php echo $crow[ 'quantity' ];?>" />

How could I use javascript to run a function on change or on click and grab it's value and submit a form?

Thanks for your help

I now have

function changeQuant(){
     var x = document.getElementById("quantity").value;
     document.getElementById('fquant').submit();
}

and the form submits on change

<form action="cartplusone.php" method="post" id="fquant" >
   <input name="quantity" type="text" class="form-control text-center" id="quantity" onchange="changeQuant()" value="<?php echo $crow[ 'quantity' ];?>" />
   <input name="newqval" type="hidden" id="newqval" value="">
</form>

How do I now best get the var x value into the hidden form field?

Body:
You can use onchange

In your input add this onchange="myFunction()"

Following is an example with input type number

 function myFunction(){
     var x = document.getElementById("quantity").value;
     console.log(x);
}

<input type="number" id="quantity" onchange="myFunction()"/>


问:
How to make a nested ordered list from array data
I have data like this:

```<code>var array = ["a", "b", "c", "d", "e"];
</code>```

I want this data converted like this:

```<code><ol>
 <li>a</li>
   <ol>
    <li>b</li>
     <ol>
      <li>c</li>
       <ol>
        <li>d</li>
       </ol>
     </ol>
  </ol>
</code>```

I will try this:

```<code>var makeNestedList = () => {
  $.each(array, function(i, el) {
    nested += '<ol>';
    nested += '<li>' + el + '</li>';
    makeNestedList();
    nested += '</ol>';
  });
};
</code>```

But why is the result empty?

答:
You can try following, your recursive is not correct.

```<code>var arr=[1,2,3];
var nested='';

 var nestIt=function(i){
    if(i==arr.length){
        return "";
    }
    nested += '<ol>';
    nested += '<li>' + arr[i]+ '</li>';
    nestIt(i+1)
    nested += '</ol>';

    return nested
}

nestIt(0);
nested;
</code>```

it will display result in console.

Body:
I have data like this:

var array = ["a", "b", "c", "d", "e"];

I want this data converted like this:

a

b

c

d

I will try this:

var makeNestedList = () => {
  $.each(array, function(i, el) {
    nested += '
';
    nested += '
' + el + '
';
    makeNestedList();
    nested += '
';
  });
};

But why is the result empty?

Body:
You can try following, your recursive is not correct.

var arr=[1,2,3];
var nested='';

 var nestIt=function(i){
    if(i==arr.length){
        return "";
    }
    nested += '<ol>';
    nested += '<li>' + arr[i]+ '</li>';
    nestIt(i+1)
    nested += '</ol>';

    return nested
}

nestIt(0);
nested;

it will display result in console.


问:
How can I make continuous animation attached to an svg inside a button on hover smooth?
I am working on a codewars link (a div). I would like the svg inside the div to rotate continuously on hover. The resulting hover effect is far from smooth, the svg jumps when the mouse rolls over it. The mouseout event is commented out because it makes it worth. What is the best way to optimize this? Codepen: https://codepen.io/forTheLoveOfCode/pen/MOvRNb

CSS:

```<code>#codewars-butn{
  position: absolute;
  top: 20%;
  left: 20%;
  background-color: #B21C15;
  border: 2px solid;
  border-radius: 10px;
}
body{
  background-color: #3F2740;
}
.codewars{
  display: inline-block;
  stroke:#000;
  stroke-dasharray: 1 5;
}
</code>```

HTML:

```<code><body>
  <div id="codewars-butn">
    <svg class="codewars" width="100" height="100">
      <defs>
          <path id="curve" d="M50 50 A 20 20 0 1 0 80 70" stroke-width="10" stroke-linecap="round" fill="none"/>
      </defs>
      <use href="#curve"/>
      <use href="#curve" transform="rotate(60, 50, 50)"/>
      <use href="#curve" transform="rotate(120, 50, 50)"/>
      <use href="#curve" transform="rotate(180, 50, 50)"/>
      <use href="#curve" transform="rotate(240, 50, 50)"/>
      <use href="#curve" transform="rotate(300, 50, 50)"/>

      <animateTransform attributeName="transform"
                              attributeType="XML"
                              type="rotate"
                              from="0 0 0"
                              to="360 0 0"
                              dur="5s"
                              begin="mouseover"
<!--                               end="mouseout" -->
                              repeatCount="indefinite"/>
    </svg>
  </div>
</body>
</code>```

答:
Here, I deleted svg transformation and made CSS only solution.

```<code>#codewars-butn:hover svg{
  animation-name: rotate;
  animation-duration: 1s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg) }
  to { transform: rotate(360deg) }
}
</code>```

https://codepen.io/mnikolaus/pen/VrzJLY

Body:
I am working on a codewars link (a div). I would like the svg inside the div to rotate continuously on hover. The resulting hover effect is far from smooth, the svg jumps when the mouse rolls over it. The mouseout event is commented out because it makes it worth. What is the best way to optimize this? Codepen: https://codepen.io/forTheLoveOfCode/pen/MOvRNb

CSS:

#codewars-butn{
  position: absolute;
  top: 20%;
  left: 20%;
  background-color: #B21C15;
  border: 2px solid;
  border-radius: 10px;
}
body{
  background-color: #3F2740;
}
.codewars{
  display: inline-block;
  stroke:#000;
  stroke-dasharray: 1 5;
}

HTML:

    <svg class="codewars" width="100" height="100">
      <defs>
          <path id="curve" d="M50 50 A 20 20 0 1 0 80 70" stroke-width="10" stroke-linecap="round" fill="none"/>
      </defs>
      <use href="#curve"/>
      <use href="#curve" transform="rotate(60, 50, 50)"/>
      <use href="#curve" transform="rotate(120, 50, 50)"/>
      <use href="#curve" transform="rotate(180, 50, 50)"/>
      <use href="#curve" transform="rotate(240, 50, 50)"/>
      <use href="#curve" transform="rotate(300, 50, 50)"/>

      <animateTransform attributeName="transform"
                              attributeType="XML"
                              type="rotate"
                              from="0 0 0"
                              to="360 0 0"
                              dur="5s"
                              begin="mouseover"

                              repeatCount="indefinite"/>
    </svg>

Body:
Here, I deleted svg transformation and made CSS only solution.

#codewars-butn:hover svg{
  animation-name: rotate;
  animation-duration: 1s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg) }
  to { transform: rotate(360deg) }
}

https://codepen.io/mnikolaus/pen/VrzJLY


问:
Update and set row where id is equal to an id in another table
I am trying to set 2 columns in a row, where the paymentid of that row is the same as the foreign key in another table to that row.

```<code>UPDATE
    SomeDB.dbo.[Payment]
SET
    TransactionId = {0},
    PaymentAccepted = 1
WHERE
</code>```

I have an OrderId, and that Order has a PaymentId foreign key to the Payment table.

答:
I think, this is what you're looking for, but without having concrete fields and table names, I can only give you a hint how it will work.</p>

```<code>Update
    SomeDB.dbo.[Payment]
SET
    TransactionId = {0},
    PaymentAccepted = 1
FROM
    SomeDB.dbo.[Payment]
INNER JOIN
    SomeDB.dbo.[OtherTable] on SomeDB.dbo.[Payment].paymentId = SomeDB.dbo.[OtherTable].foreignKey
WHERE
    ...
</code>```

Body:
I am trying to set 2 columns in a row, where the paymentid of that row is the same as the foreign key in another table to that row.

UPDATE
    SomeDB.dbo.[Payment]
SET
    TransactionId = {0},
    PaymentAccepted = 1
WHERE

I have an OrderId, and that Order has a PaymentId foreign key to the Payment table.

Body:
I think, this is what you're looking for, but without having concrete fields and table names, I can only give you a hint how it will work.

Update
    SomeDB.dbo.[Payment]
SET
    TransactionId = {0},
    PaymentAccepted = 1
FROM
    SomeDB.dbo.[Payment]
INNER JOIN
    SomeDB.dbo.[OtherTable] on SomeDB.dbo.[Payment].paymentId = SomeDB.dbo.[OtherTable].foreignKey
WHERE
    ...


问:
Registration-Spring Boot-MongoDb-Primary key Replacing new data
I am trying Registering a student in Mongodb, throuh spring boot application. In my been class i mentioned emailId is primary key, my intention is here when student trying to registered second time with that same emailId it shouldn't be store but when i am trying to give same email id for registering again, in mongodb instead of error, the data is going to update for that same emailId.

Here is my been class:

```<code>@Document(collection="StudentData")
public class StudentBean {

    private String studentName;
    @Id
    private String emailId;
    private String contactNumber;
    private String skillSet;
    private String address;
    private String password;
</code>```

Here is my controller class:

```<code>@CrossOrigin("*")
@RequestMapping(method=RequestMethod.POST)
// This Annotation takes care to map specific response to a method with fixed value attribute
public ResponseEntity<String> addUser(@RequestBody StudentBean userBean) throws UserAlreadyExistException{
    try {
        studentService.addUser(userBean);
    }catch(UserAlreadyExistException ue){
        throw new UserAlreadyExistException("User Already Exists");
    }

    return ResponseEntity.ok("User saved successfully");
    // ResponseEntity returns message along with HTTP Status.
}
</code>```

Here is my service class:

```<code>@Override
public StudentBean addUser(StudentBean userBean) throws UserAlreadyExistException{

        return studentRepository.save(userBean);
    }
</code>```

Actually i am new to mongodb,and i am expecting that primary key will work as like mysql. Please can any one help me what i need to add for achieving  to throw an error.

答:
studentRepository.save(userBean); saves the object overwriting any object that might exist with the same id.
You can use the repository insert method.

Body:
I am trying Registering a student in Mongodb, throuh spring boot application. In my been class i mentioned emailId is primary key, my intention is here when student trying to registered second time with that same emailId it shouldn't be store but when i am trying to give same email id for registering again, in mongodb instead of error, the data is going to update for that same emailId.

Here is my been class:

@Document(collection="StudentData")
public class StudentBean {

    private String studentName;
    @Id
    private String emailId;
    private String contactNumber;
    private String skillSet;
    private String address;
    private String password;

Here is my controller class:

@CrossOrigin("*")
@RequestMapping(method=RequestMethod.POST)
// This Annotation takes care to map specific response to a method with fixed value attribute
public ResponseEntity<String> addUser(@RequestBody StudentBean userBean) throws UserAlreadyExistException{
    try {
        studentService.addUser(userBean);
    }catch(UserAlreadyExistException ue){
        throw new UserAlreadyExistException("User Already Exists");
    }

    return ResponseEntity.ok("User saved successfully");
    // ResponseEntity returns message along with HTTP Status.
}

Here is my service class:

@Override
public StudentBean addUser(StudentBean userBean) throws UserAlreadyExistException{

        return studentRepository.save(userBean);
    }

Actually i am new to mongodb,and i am expecting that primary key will work as like mysql. Please can any one help me what i need to add for achieving  to throw an error.


答:
This is expected behavior. Your minimum value for 2017 is more than 1.5 IQR below the first quartile of the four provided data points, in which case the minimum is displayed as an outlier (a point).

From the docs for whis in boxplot (emphasis mine):

whis : float, sequence, or string (default = 1.5)

As a float, determines the reach of the whiskers to the beyond the first and third quartiles. In other words, where IQR is the interquartile range (Q3-Q1), the upper whisker will extend to last datum less than Q3 + whis*IQR). Similarly, the lower whisker will extend to the first datum greater than Q1 - whis*IQR. Beyond the whiskers, data are considered outliers and are plotted as individual points. Set this to an unreasonably high value to force the whiskers to show the min and max values. Alternatively, set this to an ascending sequence of percentile (e.g., [5, 95]) to set the whiskers at specific percentiles of the data. Finally, whis can be the string 'range' to force the whiskers to the min and max of the data.

So if you want the whiskers to extend all the way,

```<code>df.boxplot(grid=False, figsize=(9, 4), whis='range')
</code>```

Title: Pandas box plot error on one datapoint

Body:
I'm working on a box-plot using pandas.

My DataFrame looks like this

Year                 2013      2014      2015      2016      2017
dfMin            1.091603  0.973346  1.040000  0.855209  1.079500
dfLowerQuartile  1.727191  1.684009  1.275601  1.136703  2.262654
dfUpperQuartile  2.225000  2.000000  1.857570  2.120644  2.435724
dfMax            2.687323  2.350000  2.105000  2.250000  2.566467

My chart code looks like this

chartDF.boxplot(grid=False, figsize=(9,4))

Leading to a plot looking like this

I am puzzled at the lower value in 2017 coming out as a point.

Does anyone know how to fix this issue?

Body:
This is expected behavior. Your minimum value for 2017 is more than 1.5 IQR below the first quartile of the four provided data points, in which case the minimum is displayed as an outlier (a point).

From the docs for whis in boxplot (emphasis mine):

whis : float, sequence, or string (default = 1.5)

As a float, determines the reach of the whiskers to the beyond the first and third quartiles. In other words, where IQR is the interquartile range (Q3-Q1), the upper whisker will extend to last datum less than Q3 + whis*IQR). Similarly, the lower whisker will extend to the first datum greater than Q1 - whis*IQR. Beyond the whiskers, data are considered outliers and are plotted as individual points. Set this to an unreasonably high value to force the whiskers to show the min and max values. Alternatively, set this to an ascending sequence of percentile (e.g., [5, 95]) to set the whiskers at specific percentiles of the data. Finally, whis can be the string 'range' to force the whiskers to the min and max of the data.

So if you want the whiskers to extend all the way,

df.boxplot(grid=False, figsize=(9, 4), whis='range')


问:
Specifications of SQL CE?
i hope this is not a repeated question

does anyone have an idea about the specs of CE SQL for example max size, max concurrent users.
how is it different from SQL express

答:
try this

http://weblogs.asp.net/scottgu/archive/2011/01/11/vs-2010-sp1-and-sql-ce.aspx

SQL Server Compact Edition 4

Today we are also shipping SQL Server Compact Edition 4 (aka SQL CE 4).  SQL CE is a free, >embedded, database engine that enables easy database storage.

No Database Installation Required

SQL CE does not require you to run a setup or install a database server in order to use >it.  You can simply copy the SQL CE binaries into the \bin directory of your ASP.NET >application, and then your web application can use it as a database engine.  No setup or >extra security permissions are required for it to run. You do not need to have an >administrator account on the machine. Just copy your web application onto any server and >it will work. This is true even of medium-trust applications running in a web hosting >environment.

SQL CE runs in-memory within your ASP.NET application and will start-up when you first >access a SQL CE database, and will automatically shutdown when your application is >unloaded.  SQL CE databases are stored as files that live within the \App_Data folder of >your ASP.NET Applications.

Works with Existing Data APIs

SQL CE 4 works with existing .NET-based data APIs, and supports a SQL Server compatible >query syntax.  This means you can use existing data APIs like ADO.NET, as well as use >higher-level ORMs like Entity Framework and NHibernate with SQL CE.  This enables you to >use the same data programming skills and data APIs you know today.

Supports Development, Testing and Production Scenarios

SQL CE can be used for development scenarios, testing scenarios, and light production >usage scenarios.  With the SQL CE 4 release we’ve done the engineering work to ensure that >SQL CE won’t crash or deadlock when used in a multi-threaded server scenario (like >ASP.NET).  This is a big change from previous releases of SQL CE – which were designed for >client-only scenarios and which explicitly blocked running in web-server environments.  >Starting with SQL CE 4 you can use it in a web-server as well.

There are no license restrictions with SQL CE.  It is also totally free.

Tooling Support with VS 2010 SP1

Visual Studio 2010 SP1 adds support for SQL CE 4 and ASP.NET Projects.  Read my VS 2010 >SP1 and SQL CE 4 blog post to learn more about what it enables.

Title: Specifications of SQL CE?


问:
gitlab-ci: remote shell execution with variable expansion
Within a gitlab-ci job, I want to create a directory (on a remote server) with the job id and perform some actions more or less as follows:

```<code>- ssh user@server mkdir -p /user/$CI_JOB_ID
- ssh user@server <perform_some_action_that_creates_several_zip_files>
- LAST_MODIFIED_FILE=$(ssh user@server bash -c 'find /user/$CI_JOB_ID -iname "*.zip" | tail -n 1 | xargs readlink -f')
</code>```

The directory does get created and the action that creates several zips works out.

However, the last command that I use for getting the last modified/created .zip does not work, because $CI_JOB_ID does not seem to get expanded.

Any suggestions?

答:
This issue is due to your ssh call. The way you do it now, you are mixing contexts :

```<code>ssh user@server bash -c 'find /user/$CI_JOB_ID -iname "*.zip" | tail -n 1 | xargs readlink -f'
</code>```

bash -c 'my_commands' : you use simple quotes, so ssh will execute exactly the instruction my_commands. In your case, it will try to find the remote value for $CI_JOB_ID, instead of using the local one.

ssh user@server bash -c "my_commands" : withssh, the commands to execute on the remote shell are sent as a single string. Thus, if you were to run ssh with this quotation, it would try to run "bash -c find ... | tail ... | xargs ...". Here, only  find is run through bash -c.

In your case, simply writing directly the following statement should do the trick :

```<code>ssh user@server "find /user/$CI_JOB_ID -iname '*.zip' | tail -n 1 | xargs readlink -f"
</code>```

Otherwise, if you want to keep using the bash -c syntax, you'd have to escape the quotation so that it is propagated to the remote machine :

```<code>ssh user@server bash -c \"find /user/$CI_JOB_ID -iname '*.zip' | tail -n 1 | xargs readlink -f\"
</code>```

Body:
Within a gitlab-ci job, I want to create a directory (on a remote server) with the job id and perform some actions more or less as follows:

- ssh user@server mkdir -p /user/$CI_JOB_ID
- ssh user@server <perform_some_action_that_creates_several_zip_files>
- LAST_MODIFIED_FILE=$(ssh user@server bash -c 'find /user/$CI_JOB_ID -iname "*.zip" | tail -n 1 | xargs readlink -f')

The directory does get created and the action that creates several zips works out.

However, the last command that I use for getting the last modified/created .zip does not work, because $CI_JOB_ID does not seem to get expanded.

Any suggestions?

Body:
This issue is due to your ssh call. The way you do it now, you are mixing contexts :

ssh user@server bash -c 'find /user/$CI_JOB_ID -iname "*.zip" | tail -n 1 | xargs readlink -f'

bash -c 'my_commands' : you use simple quotes, so ssh will execute exactly the instruction my_commands. In your case, it will try to find the remote value for $CI_JOB_ID, instead of using the local one.

ssh user@server bash -c "my_commands" : withssh, the commands to execute on the remote shell are sent as a single string. Thus, if you were to run ssh with this quotation, it would try to run "bash -c find ... | tail ... | xargs ...". Here, only  find is run through bash -c.

In your case, simply writing directly the following statement should do the trick :

ssh user@server "find /user/$CI_JOB_ID -iname '*.zip' | tail -n 1 | xargs readlink -f"

Otherwise, if you want to keep using the bash -c syntax, you'd have to escape the quotation so that it is propagated to the remote machine :

ssh user@server bash -c \"find /user/$CI_JOB_ID -iname '*.zip' | tail -n 1 | xargs readlink -f\"


问:
How to run a single specflow scenario outline using nunit3 console tool
Using VS2015 the Test Explorer allows you to run a single scenario outline.

Now I need to do the same using NUnit3 console tool (I'm using NUnit as Unit Test Provider).

Currently I'm using the following command in order to run a test using console tool.

```<code>"C:\NUnit-3.0.1\bin\nunit3-console.exe" Path.Scripts.dll --test:Fully.Qualified.Name.TestAAAFeature.TestAAA --x86
</code>```

答:
I could run a single row of a specflow scenario outline example using the --testlist: option.

```<code># list.txt
TestC112169Feature.TestCase112169("1","atomic",null)

# cmd
"C:\NUnit-3.0.1\bin\nunit3-console.exe" Path.Scripts.dll --testlist:"c:\list.txt" --x86
</code>```

And that do the trick.

Body:
Using VS2015 the Test Explorer allows you to run a single scenario outline.

Now I need to do the same using NUnit3 console tool (I'm using NUnit as Unit Test Provider).

Currently I'm using the following command in order to run a test using console tool.

"C:\NUnit-3.0.1\bin\nunit3-console.exe" Path.Scripts.dll --test:Fully.Qualified.Name.TestAAAFeature.TestAAA --x86

Body:
I could run a single row of a specflow scenario outline example using the --testlist: option.

# list.txt
TestC112169Feature.TestCase112169("1","atomic",null)

# cmd
"C:\NUnit-3.0.1\bin\nunit3-console.exe" Path.Scripts.dll --testlist:"c:\list.txt" --x86

And that do the trick.


问:
Enable cross-site tracking in WKWebView
When compiling against the iOS 11 SDK, it seems as though the default cookie accept policy for WKWebView has changed, as though the user had enabled the equivalent "Prevent Cross-Site Tracking" option in Safari.

I need cross-site cookies to work within a WKWebView. Does anyone know of a way to enable this please?

答:
For enterprise app deployments (i.e. distribution outside the App Store), you can use the following private method on WKProcessPool:

self.webView.configuration.processPool.perform("_setCookieAcceptPolicy:", with: HTTPCookie.AcceptPolicy.always)

The corresponding WebKit source code can be found here:

https://github.com/WebKit/webkit/blob/c637754ee7dfca6142e441d2040026903fee0c1f/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm

Title: Enable cross-site tracking in WKWebView