问:
Cant find desired archetype when creating new Maven project
I am trying to create a new Maven project in the terminal, using the following command:

```<code>mvn archetype:generate -DgroupId=com.my.domain -DartifactId=myproject -DarchetypeArtifactId=wildfly-javaee7-webapp-archetype -DinteractiveMode=false
</code>```

So I am trying to use the Wildfly archetype wildfly-javaee7-webapp-archetype.

I am getting the following error...

```<code>[INFO] Generating project in Batch mode
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/wildfly-javaee7-webapp-archetype/1.0/wildfly-javaee7-webapp-archetype-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.860 s
[INFO] Finished at: 2016-03-31T14:35:27+02:00
[INFO] Final Memory: 16M/188M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.apache.maven.archetypes:wildfly-javaee7-webapp-archetype:1.0) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
</code>```

... which means, that Maven is trying to download the archetype at https://repo.maven.apache.org which is not correct, because the archetype is provided by http://mvnrepository.com/artifact/org.wildfly.archetype.

How can I change the source or how can I add additional sources? Or am I missing something different?

答: If anybody else is having problems following the accepted answer try to decrement the version to -DarchetypeVersion=8.1.0.Final

Body:
I am trying to create a new Maven project in the terminal, using the following command:

mvn archetype:generate -DgroupId=com.my.domain -DartifactId=myproject -DarchetypeArtifactId=wildfly-javaee7-webapp-archetype -DinteractiveMode=false

So I am trying to use the Wildfly archetype wildfly-javaee7-webapp-archetype.

I am getting the following error...

[INFO] Generating project in Batch mode
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/wildfly-javaee7-webapp-archetype/1.0/wildfly-javaee7-webapp-archetype-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.860 s
[INFO] Finished at: 2016-03-31T14:35:27+02:00
[INFO] Final Memory: 16M/188M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.apache.maven.archetypes:wildfly-javaee7-webapp-archetype:1.0) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

... which means, that Maven is trying to download the archetype at https://repo.maven.apache.org which is not correct, because the archetype is provided by http://mvnrepository.com/artifact/org.wildfly.archetype.

How can I change the source or how can I add additional sources? Or am I missing something different?


来源: stackexchange

问:
yo jhipster:docker-compose is not able to discover gateway and microservices on prod setup
I started a week before with jhipster and it is definitely up to the mark and provide great developer experience.

Initial project was created on my local laptop and following this link
I am able to do it successfully, but when I am trying the same command and steps on my production setup, it is not able to discover the gateway and services. I found "microservicePath" in gateway (file .yo-rc.json) and updated it. Still yo jhipster:docker-compose is not able to discover service and gateway.

ls in parent directory:
docker-compose  gateway  microservice

yo jhipster:docker-compose from docker-compose dir:

? Enter the root directory where your applications are located (../)

>> No microservice or gateway found in /home/ubuntu/

Please tell if something else also needed to be updated on prod box.

-
Thank you.

答:
The docker-compose subgen discover JHipster apps by looking for .Yo-rc.json files in all sub-directories of the path that is provided (relative or absolute).
If you have the following folder layout :

gateway

microservice

docker

And running yo jhipster: docker-compose in the docker folder.
You should enter "../" which is the default (so you can also directly hit enter) and then you will have the option to select both apps using "space".

ContentLicense: CC BY-SA 3.0


问:
Using __set with arrays solved, but why?
Having done a bit of research, I eventually came across the answer to a question I was soon to ask here anyways; How do you work with arrays via the __get and __set magic methods in PHP? Whenever I was trying to set a value using something like $object->foo['bar'] = 42; it seemed to silently discard it.

Anyways, the answer is simple; The __get method simply needs to return by reference. And after tossing an ampersand in front of it, sure enough it works.

My question actually, is why? I can't seem to understand why this is working. How does __get returning by reference affect __set working with multidimensional arrays?

Edit: By the way, running PHP 5.3.1

答:
In this particular case, __set is not actually getting called. If you break down what it happening, it should make a bit more sense:

```<code>$tmp = $object->__get('foo');
$tmp['bar'] = 42
</code>```

If __get did not return a reference, then instead of assigning 42 to the 'bar' index of the original object, you're be assigning to the 'bar' index of a copy of the original object.

ContentLicense: CC BY-SA 2.5

Body:
In this particular case, __set is not actually getting called. If you break down what it happening, it should make a bit more sense:

$tmp = $object->__get('foo');
$tmp['bar'] = 42

If __get did not return a reference, then instead of assigning 42 to the 'bar' index of the original object, you're be assigning to the 'bar' index of a copy of the original object.


问:
Capturing an hlist's ToList evidence as an implicit class parameter
I'm trying to use shapeless's hlist to construct introspectable URL templates, but I'm having trouble with traversing my HList. The following doesn't compile:

```<code>import shapeless.{::, HList, HNil}
import shapeless.LUBConstraint._
import shapeless.ops.hlist.ToTraversable._

import scala.util.Try
import shapeless.ops.hlist._

object Path {
  def /(s: String) = Path(PathLiteral(s) :: HNil)

  def param[T](name: String) = PathParameter(name)
}

sealed trait PathSegment[+T]
case class PathLiteral(value: String) extends PathSegment[String]
case class PathParameter[+T](name: String) extends PathSegment[T]

case class Path[L <: HList : <<:[PathSegment[_]]#λ](segments: L)
                                                   (implicit ev: ToList[L, PathSegment[_]])
{
  def /(literal: String) = Path(PathLiteral(literal) :: segments)

  def /[T](param: PathParameter[T]) = Path(param :: segments)

  override def toString: String = s"Path(${segments.toList.reverse})"
}

object Test extends App {

  import Path.param
  val myPath = Path / "v1" / "pets" / param[String]("name") / "pictures"
  println(myPath)

}
</code>```

It seems to me like the ToTraversable._ import covers the HNil case and the case of having the tail of an HList and a new head with the same Least Upper Bound. Obviously I'm either missing an import or misunderstanding everything.

I'm not sure if caching the evidence in the class as an implicit parameter is kosher; I'm doing it because

I don't want hlist details to leak into the external API

I need it for a nice toString

答:
The reason this doesn't work is the implicit which can prove:

ToList[PathLiteral :: L, PathSegment[_]] given

ToList[L, PathSegment[L]]

L <: HList

is this implicit def's type signature from hlists.scala:

```<code>implicit def hlistToTraversable[H1, H2, T <: HList, LubT, Lub0, M[_]]
  (implicit
    tttvs  : Aux[H2 :: T, M, LubT],
    u      : Lub[H1, LubT, Lub0],
    cbf    : CanBuildFrom[M[Lub0], Lub0, M[Lub0]]) : Aux[H1 :: H2 :: T, M, Lub0]
</code>```

actually needs to know the type of the head of the list as well as the new item (H1 and H2), so it can't be constructed from what's available inside my class.

Some workarounds:

build List manually alongside the HList

```<code>case class Path[L <: HList](segments: L, segmentsList: List[PathSegment[_]]) {
  def /(literal: String) = Path(PathLiteral(literal) :: segments, PathLiteral(literal) :: segmentsList)
  def /[T](param: PathParameter[T]) = Path(param :: segments, param :: segmentsList)
  override def toString: String = s"Path(${segmentsList.reverse})"
}
</code>```

push implicit parameters out to Path's methods

```<code>def printPath[L <: HList](path: Path[L])
                         (implicit ev: ToList[L, PathSegment[_]]) =
path.segments.toList.reverse.collect {
  case PathLiteral(value) => URLEncoder.encode(value, "UTF-8")
  case PathParameter(name) => s"<$name>"
}.mkString("/")

printPath(Path / "v1" / "pets"  / param[String]("name") / "pictures")
// v1/pets/<name>/pictures
</code>```

Body:
I'm trying to use shapeless's hlist to construct introspectable URL templates, but I'm having trouble with traversing my HList. The following doesn't compile:

import shapeless.{::, HList, HNil}
import shapeless.LUBConstraint._
import shapeless.ops.hlist.ToTraversable._

import scala.util.Try
import shapeless.ops.hlist._

object Path {
  def /(s: String) = Path(PathLiteral(s) :: HNil)

  def param[T](name: String) = PathParameter(name)
}

sealed trait PathSegment[+T]
case class PathLiteral(value: String) extends PathSegment[String]
case class PathParameter[+T](name: String) extends PathSegment[T]

case class Path[L <: HList : <<:[PathSegment[_]]#λ](segments: L)
                                                   (implicit ev: ToList[L, PathSegment[_]])
{
  def /(literal: String) = Path(PathLiteral(literal) :: segments)

  def /[T](param: PathParameter[T]) = Path(param :: segments)

  override def toString: String = s"Path(${segments.toList.reverse})"
}

object Test extends App {

  import Path.param
  val myPath = Path / "v1" / "pets" / param[String]("name") / "pictures"
  println(myPath)

}

It seems to me like the ToTraversable._ import covers the HNil case and the case of having the tail of an HList and a new head with the same Least Upper Bound. Obviously I'm either missing an import or misunderstanding everything.

I'm not sure if caching the evidence in the class as an implicit parameter is kosher; I'm doing it because

I don't want hlist details to leak into the external API

I need it for a nice toString

Body:
The reason this doesn't work is the implicit which can prove:

ToList[PathLiteral :: L, PathSegment[_]] given

ToList[L, PathSegment[L]]

L <: HList

is this implicit def's type signature from hlists.scala:

implicit def hlistToTraversable[H1, H2, T <: HList, LubT, Lub0, M[_]]
  (implicit
    tttvs  : Aux[H2 :: T, M, LubT],
    u      : Lub[H1, LubT, Lub0],
    cbf    : CanBuildFrom[M[Lub0], Lub0, M[Lub0]]) : Aux[H1 :: H2 :: T, M, Lub0]

actually needs to know the type of the head of the list as well as the new item (H1 and H2), so it can't be constructed from what's available inside my class.

Some workarounds:

build List manually alongside the HList

case class Path[L <: HList](segments: L, segmentsList: List[PathSegment[_]]) {
  def /(literal: String) = Path(PathLiteral(literal) :: segments, PathLiteral(literal) :: segmentsList)
  def /[T](param: PathParameter[T]) = Path(param :: segments, param :: segmentsList)
  override def toString: String = s"Path(${segmentsList.reverse})"
}

push implicit parameters out to Path's methods

def printPath[L <: HList](path: Path[L])
                         (implicit ev: ToList[L, PathSegment[_]]) =
path.segments.toList.reverse.collect {
  case PathLiteral(value) => URLEncoder.encode(value, "UTF-8")
  case PathParameter(name) => s"<$name>"
}.mkString("/")

printPath(Path / "v1" / "pets"  / param[String]("name") / "pictures")
// v1/pets/<name>/pictures


问:
Neo4J - How to do post processing UNION (pagination)
I'm writing a cypher query to load data from my Neo4J DB, this is my data model

So basically what I want is a query to return a Journal with all of its properties and everything related to it, Ive tried doing the simple query but it is not performant at all and my ec2 instance where the DB is hosted runs out of memory quickly
    MATCH p=(j:Journal)-[*0..]-(n) RETURN p

I managed to write a query using UNIONS

```<code>`MATCH p=(j:Journal)<-[:BELONGS_TO]-(at:ArticleType) RETURN p
UNION
MATCH p=(j:Journal)<-[:OWNS]-(jo:JournalOwner) RETURN p
UNION

MATCH p=(j:Journal)<-[:BELONGS_TO]-(s:Section) RETURN p
UNION

MATCH p=(j:Journal)-[:ACCEPTS]->(fc:FileCategory) RETURN p
UNION
MATCH p=(j:Journal)-[:CHARGED_BY]->(a:APC) RETURN p
UNION
MATCH p=(j:Journal)-[:ACCEPTS]->(sft:SupportedFileType) RETURN p
UNION
MATCH p=(j:Journal)<-[:BELONGS_TO|:CHILD_OF*..]-(c:Classification) RETURN p
</code>```

SKIP 0 LIMIT 100`

The query works fine and its performance is not bad at all, the only problem I'm finding is in the limit, I've been googling around and I've seen that post-processing queries with UNIONS is not yet supported.

The referenced github issue is not yet resolved, so post processing of UNION is not yet possible github link

Logically the first thing I tried when I came across this issue was to put the pagination on each individual query, but this had some weird behaviour that didn't make much sense to myself.

So I tried to write the query without using UNIONS, I came up with this

```<code>`MATCH (j:Journal)
WITH j LIMIT 10
MATCH pa=(j)<-[:BELONGS_TO]-(a:ArticleType)
MATCH po=(j)<-[:OWNS]-(o:JournalOwner)
MATCH ps=(j)<-[:BELONGS_TO]-(s:Section)
MATCH pf=(j)-[:ACCEPTS]->(f:FileCategory)
MATCH pc=(j)-[:CHARGED_BY]->(apc:APC)
MATCH pt=(j)-[:ACCEPTS]->(sft:SupportedFileType)
MATCH pl=(j)<-[:BELONGS_TO|:CHILD_OF*..]-(c:Classification)
RETURN pa, po, ps, pf, pc, pt, pl`
</code>```

This query however breaks my DB, I feel like I'm missing something essential for writing CQL queries...

I've also looked into COLLECT and UNWIND in this neo blog post but couldn't really make sense of it.

How can I paginate my query without removing the unions? Or is there any other way of writing the query so that pagination can be applied at the Journal level and the performance isn't affected?

--- EDIT ---

Here is the execution plan for my second query

答:
You really don't need UNION for this, because when you approach this using UNION, you're getting all the related nodes for every :Journal node, and only AFTER you've made all those expansions from every :Journal node do you limit your result set. That is a ton of work that will only be excluded due to your LIMIT.

Your second query looks like the more correct approach, matching on :Journal nodes with a LIMIT, and only then matching on the related nodes to prepare the data for return.

You said that the second query breaks your DB. Can you run a PROFILE on the query (or an EXPLAIN, if the query never finishes execution), expand all elements of the plan, and add it to your description?

Also, if you leave out the final MATCH to :Classification, does the query behave correctly?

It would also help to know if you really need the paths returned, or if it's enough to just return the connected nodes.

EDIT

If you want each :Journal and all its connected data on a single row, you need to either be using COLLECT() after each match, or using pattern comprehension so the result is already in a collection.

This will also cut down on unnecessary queries. Your initial match (after the limit) generated 31k rows, so all subsequent matches executed 31k times. If you collect() or use pattern comprehension, you'll keep the cardinality down to your initial 10, and prevent redundant matches.

Something like this, if you only want collected paths returned:

```<code>MATCH (j:Journal)
WITH j LIMIT 10
WITH j,
[pa=(j)<-[:BELONGS_TO]-(a:ArticleType) | pa] as pa,
[po=(j)<-[:OWNS]-(o:JournalOwner) | po] as po,
[ps=(j)<-[:BELONGS_TO]-(s:Section) | ps] as ps,
[pf=(j)-[:ACCEPTS]->(f:FileCategory) | pf] as pf,
[pc=(j)-[:CHARGED_BY]->(apc:APC) | pc] as pc,
[pt=(j)-[:ACCEPTS]->(sft:SupportedFileType) | pt] as pt,
[pl=(j)<-[:BELONGS_TO|:CHILD_OF*..]-(c:Classification) | pl] as pl
RETURN pa, po, ps, pf, pc, pt, pl
</code>```

Body:
I'm writing a cypher query to load data from my Neo4J DB, this is my data model

So basically what I want is a query to return a Journal with all of its properties and everything related to it, Ive tried doing the simple query but it is not performant at all and my ec2 instance where the DB is hosted runs out of memory quickly
    MATCH p=(j:Journal)-[*0..]-(n) RETURN p

I managed to write a query using UNIONS

`MATCH p=(j:Journal)<-[:BELONGS_TO]-(at:ArticleType) RETURN p
UNION
MATCH p=(j:Journal)<-[:OWNS]-(jo:JournalOwner) RETURN p
UNION

MATCH p=(j:Journal)<-[:BELONGS_TO]-(s:Section) RETURN p
UNION

MATCH p=(j:Journal)-[:ACCEPTS]->(fc:FileCategory) RETURN p
UNION
MATCH p=(j:Journal)-[:CHARGED_BY]->(a:APC) RETURN p
UNION
MATCH p=(j:Journal)-[:ACCEPTS]->(sft:SupportedFileType) RETURN p
UNION
MATCH p=(j:Journal)<-[:BELONGS_TO|:CHILD_OF*..]-(c:Classification) RETURN p

SKIP 0 LIMIT 100`

The query works fine and its performance is not bad at all, the only problem I'm finding is in the limit, I've been googling around and I've seen that post-processing queries with UNIONS is not yet supported.

The referenced github issue is not yet resolved, so post processing of UNION is not yet possible github link

Logically the first thing I tried when I came across this issue was to put the pagination on each individual query, but this had some weird behaviour that didn't make much sense to myself.

So I tried to write the query without using UNIONS, I came up with this

`MATCH (j:Journal)
WITH j LIMIT 10
MATCH pa=(j)<-[:BELONGS_TO]-(a:ArticleType)
MATCH po=(j)<-[:OWNS]-(o:JournalOwner)
MATCH ps=(j)<-[:BELONGS_TO]-(s:Section)
MATCH pf=(j)-[:ACCEPTS]->(f:FileCategory)
MATCH pc=(j)-[:CHARGED_BY]->(apc:APC)
MATCH pt=(j)-[:ACCEPTS]->(sft:SupportedFileType)
MATCH pl=(j)<-[:BELONGS_TO|:CHILD_OF*..]-(c:Classification)
RETURN pa, po, ps, pf, pc, pt, pl`

This query however breaks my DB, I feel like I'm missing something essential for writing CQL queries...

I've also looked into COLLECT and UNWIND in this neo blog post but couldn't really make sense of it.

How can I paginate my query without removing the unions? Or is there any other way of writing the query so that pagination can be applied at the Journal level and the performance isn't affected?

--- EDIT ---

Here is the execution plan for my second query

Body:
You really don't need UNION for this, because when you approach this using UNION, you're getting all the related nodes for every :Journal node, and only AFTER you've made all those expansions from every :Journal node do you limit your result set. That is a ton of work that will only be excluded due to your LIMIT.

Your second query looks like the more correct approach, matching on :Journal nodes with a LIMIT, and only then matching on the related nodes to prepare the data for return.

You said that the second query breaks your DB. Can you run a PROFILE on the query (or an EXPLAIN, if the query never finishes execution), expand all elements of the plan, and add it to your description?

Also, if you leave out the final MATCH to :Classification, does the query behave correctly?

It would also help to know if you really need the paths returned, or if it's enough to just return the connected nodes.

EDIT

If you want each :Journal and all its connected data on a single row, you need to either be using COLLECT() after each match, or using pattern comprehension so the result is already in a collection.

This will also cut down on unnecessary queries. Your initial match (after the limit) generated 31k rows, so all subsequent matches executed 31k times. If you collect() or use pattern comprehension, you'll keep the cardinality down to your initial 10, and prevent redundant matches.

Something like this, if you only want collected paths returned:

MATCH (j:Journal)
WITH j LIMIT 10
WITH j,
[pa=(j)<-[:BELONGS_TO]-(a:ArticleType) | pa] as pa,
[po=(j)<-[:OWNS]-(o:JournalOwner) | po] as po,
[ps=(j)<-[:BELONGS_TO]-(s:Section) | ps] as ps,
[pf=(j)-[:ACCEPTS]->(f:FileCategory) | pf] as pf,
[pc=(j)-[:CHARGED_BY]->(apc:APC) | pc] as pc,
[pt=(j)-[:ACCEPTS]->(sft:SupportedFileType) | pt] as pt,
[pl=(j)<-[:BELONGS_TO|:CHILD_OF*..]-(c:Classification) | pl] as pl
RETURN pa, po, ps, pf, pc, pt, pl


问:
Javascript use variable to call another variable
I'm making something in React Native and there's a module where I have a variable called jorge

```<code>const jorge = "This is some output";
console.log(jorge);            //output: 'This is some output'
</code>```

I've passed props item to this module (I'm using the react-native-router-flux module, which also has a value of jorge:

```<code><Scene
    key="sceneTwo"
    component={componentItem}
    title={content.title}
    item="jorge"
 />
</code>```

I'd like to be able to do this:

```<code>console.log(this.props.item);  //output: 'This is some output'
</code>```

Whereas in reality, I get this:

```<code>console.log(this.props.item);  //output: 'jorge'
</code>```

I'm not sure what this technique is called hence the extremely vague title, but if anyone can suggest how I'd tackle this I'd be very grateful!

答:
Assuming that variable jorje is within the scope of the of the usage of eval, this should work:

```<code> console.log(eval(this.props.item))
</code>```

Here is a sample use of eval with an abbreviated object containing your values:

```<code>const jorje = "This is some output";

var scene = {key:'sceneTwo', item:'jorje'};

console.log( scene.item ); // outputs jorje

console.log( eval( scene.item ));  //outputs This is some output
</code>```

Body:
I'm making something in React Native and there's a module where I have a variable called jorge

const jorge = "This is some output";
console.log(jorge);            //output: 'This is some output'

I've passed props item to this module (I'm using the react-native-router-flux module, which also has a value of jorge:

<Scene
    key="sceneTwo"
    component={componentItem}
    title={content.title}
    item="jorge"
 />

I'd like to be able to do this:

console.log(this.props.item);  //output: 'This is some output'

Whereas in reality, I get this:

console.log(this.props.item);  //output: 'jorge'

I'm not sure what this technique is called hence the extremely vague title, but if anyone can suggest how I'd tackle this I'd be very grateful!

Body:
Assuming that variable jorje is within the scope of the of the usage of eval, this should work:

 console.log(eval(this.props.item))

Here is a sample use of eval with an abbreviated object containing your values:

const jorje = "This is some output";

var scene = {key:'sceneTwo', item:'jorje'};

console.log( scene.item ); // outputs jorje

console.log( eval( scene.item ));  //outputs This is some output


问:
Excel concatenate with IF statement
What I am trying to do is concatenate two cells, then check that concatenated value against a column of values, and put an X in a cell if such a value exists.  The following equation is what I'm using:

```<code>{=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C:$C, "x", "")}
</code>```

Column A is the name of the software and Column B the version number (A="Microsoft .NET Framework 4.5.1", B="4.5.50938", for example). I know that this concatenated value exists on the MasterList worksheet so I don't understand why I'm not getting the answer I expect.

Gurus, what's my flaw here?

答:
This is not a valid array formula. The LHS is a single cell while the RHS is an array. What it actually does is compare the concatenation to all cells of columns C in MasterList.

You either need to make it a valid array formula or a normal formula. I recommend the second solution.

For the first solution, it should be:

```<code>{=IF(CONCATENATE(A:A, " ",B:B ) ='MasterList'!$C:$C, "x", "")}
</code>```

However, this will be very slow because it will compute and concatenate two full columns, and moreover you will have to select your whole range where you want to calculate it (a full columns) then press Ctrl+Shift+Enter.

You can make it a simple formula in on cell then copy/paste along your column. Formula for C2:

```<code>=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C2, "x", "")
</code>```

Title: Excel concatenate with IF statement

Body:
What I am trying to do is concatenate two cells, then check that concatenated value against a column of values, and put an X in a cell if such a value exists.  The following equation is what I'm using:

{=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C:$C, "x", "")}

Column A is the name of the software and Column B the version number (A="Microsoft .NET Framework 4.5.1", B="4.5.50938", for example). I know that this concatenated value exists on the MasterList worksheet so I don't understand why I'm not getting the answer I expect.

Gurus, what's my flaw here?

Body:
This is not a valid array formula. The LHS is a single cell while the RHS is an array. What it actually does is compare the concatenation to all cells of columns C in MasterList.

You either need to make it a valid array formula or a normal formula. I recommend the second solution.

For the first solution, it should be:

{=IF(CONCATENATE(A:A, " ",B:B ) ='MasterList'!$C:$C, "x", "")}

However, this will be very slow because it will compute and concatenate two full columns, and moreover you will have to select your whole range where you want to calculate it (a full columns) then press Ctrl+Shift+Enter.

You can make it a simple formula in on cell then copy/paste along your column. Formula for C2:

=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C2, "x", "")


问:
How to convert coordinates into a recognizable measurement for leaflet maps?
I am new to the mapping functions in R and related packages, so any help is welcomed. Here is what I am doing, I am using leaflet in a dashboard I created through shiny. I am trying to map the data I have but leaflet doesn't recognize it because the measurement of my lat and long data is in feet and not decimal degrees (ex: x = 33.867022, y = -112.1409750).

I know I have lat and long data in feet measurement (ex: x = 632086.70, y = 1043211.35) because I was easily able to map this in ArcMap by simply using the
"display xy" function. Then I was able to convert the measurement format by using the "calculate geometry" function to transform from feet to a decimal degrees measurement. I am trying to automate my maps and would prefer NOT to use ArcMap for this conversion as I would like to stay in one platform (R).

My potential options (I think) and therefore questions are as follows:

1. Convert my data into something leaflet can recognize. Would anyone know the code, steps and/or package I need to use to convert the measurement of my lat and long data from feet to decimal degrees?

2. Tell leaflet to read my data in a different measurement. Is there a way (code, package, etc) to tell leaflet to read my points in feet measurement rather than decimal degrees?

Or any other suggestions???

答:
Thank you for all the help provided... My co-worker figured it out, we used the code below. </p>

```<code>proj4string(d) <- CRS("+proj=tmerc +lat_0=31+lon_0=-111.9166666666667+k=0.9999 +x_0=213360 +y_0=0 +ellps=GRS80 +datum=NAD83+to_meter=0.3048006096012192+no_defs")
CRS.new <- CRS("+init=epsg:4326") # WGS 84
d.ch102650 <- spTransform(d, CRS.new)
</code>```

<p>@IvanSanchez the CRS comment was helpful.</p>

Body:
Thank you for all the help provided... My co-worker figured it out, we used the code below.

proj4string(d) <- CRS("+proj=tmerc +lat_0=31+lon_0=-111.9166666666667+k=0.9999 +x_0=213360 +y_0=0 +ellps=GRS80 +datum=NAD83+to_meter=0.3048006096012192+no_defs")
CRS.new <- CRS("+init=epsg:4326") # WGS 84
d.ch102650 <- spTransform(d, CRS.new)

@IvanSanchez the CRS comment was helpful.


问:
SQL Query not turning out correctly
I have two tables and a query where I want to output the text of the different ids.

Col1 and Col2 of Table A is a Foreign Key to the PK of Table B

```<code>Table A
PK  Col1  Col2
1    2      3

Table B
PK  Col1
 2   test
 3   test1
</code>```

Query:

```<code>    select 'This is a ' + B.Col1 + 'and this is' + B.Col1 from TableA r inner join TableB k on r.Col1 = k.PK
</code>```

inner join TableB t on r.Col2 = t.PK'

Result I want

```<code>This is a test and this is test1
</code>```

Results Im getting

```<code>This is a test and this is test
</code>```

答:
This should work

```<code>select
'This is a ' + k1.Col1 +
'and this is' + k2.Col1
from TableA r
inner join TableB k1 on r.Col1 = k1.PK
inner join TableB k2 on r.Col2 = k2.PK
</code>```

And btw, realise that when you use + to concat columns. That if one of the column is Null that the result string will be null.

Use CONCAT if you want to avoid that.

Title: SQL Query not turning out correctly

Body:
I have two tables and a query where I want to output the text of the different ids.

Col1 and Col2 of Table A is a Foreign Key to the PK of Table B

Table A
PK  Col1  Col2
1    2      3

Table B
PK  Col1
 2   test
 3   test1

Query:

    select 'This is a ' + B.Col1 + 'and this is' + B.Col1 from TableA r inner join TableB k on r.Col1 = k.PK

inner join TableB t on r.Col2 = t.PK'

Result I want

This is a test and this is test1

Results Im getting

This is a test and this is test

Body:
This should work

select
'This is a ' + k1.Col1 +
'and this is' + k2.Col1
from TableA r
inner join TableB k1 on r.Col1 = k1.PK
inner join TableB k2 on r.Col2 = k2.PK

And btw, realise that when you use + to concat columns. That if one of the column is Null that the result string will be null.

Use CONCAT if you want to avoid that.


问:
Multiple borrow in Rust
There is any common pattern to implement something like this in Rust?

The error is

cannot borrow `sprite` as mutable because it is also borrowed as immutable
```

<p>I understand the problem but have no idea how to implement something like this in Rust.</p>

```struct Sprite {
    position: i32,
}

impl Sprite {
    pub fn left(&mut self) {
        self.position += 1;
    }
}

struct Game<'g> {
    sprite: &'g Sprite,
}

impl<'g> Game<'g> {
    pub fn new(sprite: &Sprite) -> Game {
        Game { sprite: sprite }
    }
}

fn main() {
    let mut sprite = Sprite { position: 3 };

    let game = Game::new(&sprite);

    sprite.left();
}
```

The code is also available on the playground.

答:
Intuitively, Games should probably own their Sprites. Here is an updated version reflecting that design change. Also on the playground.

```<code>struct Sprite {
    position: i32,
}

impl Sprite {
    pub fn left(&mut self) {
        self.position += 1;
    }
}

struct Game {
    sprite: Sprite,
}

impl Game {
    pub fn new(sprite: Sprite) -> Game {
        Game {
            sprite: sprite
        }
    }
}

fn main() {
    let sprite = Sprite{ position: 3 };

    let mut game = Game::new(sprite);

    game.sprite.left();
}
</code>```

Title: Multiple borrow in Rust

Body:
There is any common pattern to implement something like this in Rust?

The error is

cannot borrow `sprite` as mutable because it is also borrowed as immutable

I understand the problem but have no idea how to implement something like this in Rust.

struct Sprite {
    position: i32,
}

impl Sprite {
    pub fn left(&mut self) {
        self.position += 1;
    }
}

struct Game<'g> {
    sprite: &'g Sprite,
}

impl<'g> Game<'g> {
    pub fn new(sprite: &Sprite) -> Game {
        Game { sprite: sprite }
    }
}

fn main() {
    let mut sprite = Sprite { position: 3 };

    let game = Game::new(&sprite);

    sprite.left();
}

The code is also available on the playground.

Body:
Intuitively, Games should probably own their Sprites. Here is an updated version reflecting that design change. Also on the <a href="https://play.rust-lang.org/?code=struct%20Sprite%20%7B%0A%20%20%20%20position%3A%20i32%2C%0A%7D%0A%0Aimpl%20Sprite%20%7B%0A%20%20%20%20pub%20fn%20left(%26mut%20self)%20%7B%0A%20%20%20%20%20%20%20%20self.position%20%2B%3D%201%3B%0A%20%20%20%20%7D%0A%7D%0A%0Astruct%20Game%20%7B%0A%20%20%20%20sprite%3A%20Sprite%2C%0A%7D%0A%0Aimpl%20Game%20%7B%0A%20%20%20%20pub%20fn%20new(sprite%3A%20Sprite)%20-%3E%20Game%20%7B%0A%20%20%20%20%20%20%20%20Game%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20sprite%3A%20sprite%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0A%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20sprite%20%3D%20Sprite%7B%20position%3A%203%20%7D%3B%0A%20%20%20%20%0A%20%20%20%20let%20mut%20game%20%3D%20Game%3A%3Anew(sprite)%3B%0A%20%20%20%20%0A%20%20%20%20game.sprite.left()%3B%0A%7D%0A&version=stable&backtrace=0" rel="nofollow noreferrer">playground.

struct Sprite {
    position: i32,
}

impl Sprite {
    pub fn left(&mut self) {
        self.position += 1;
    }
}

struct Game {
    sprite: Sprite,
}

impl Game {
    pub fn new(sprite: Sprite) -> Game {
        Game {
            sprite: sprite
        }
    }
}

fn main() {
    let sprite = Sprite{ position: 3 };

    let mut game = Game::new(sprite);

    game.sprite.left();
}


问:
Hadoop commands from python script?
I have multiple hadoop commands to be run and these are going to be invoked from a python script. Currently, I tried the following way.

```<code>import os
import xml.etree.ElementTree as etree
import subprocess

filename = "sample.xml"
__currentlocation__ = os.getcwd()
__fullpath__ = os.path.join(__currentlocation__,filename)
tree = etree.parse(__fullpath__)
root = tree.getroot()
hivetable = root.find("hivetable").text
dburl = root.find("dburl").text
username = root.find("username").text
password = root.find("password").text
tablename = root.find("tablename").text
mappers = root.find("mappers").text
targetdir = root.find("targetdir").text
print hivetable
print dburl
print username
print password
print tablename
print mappers
print targetdir

p = subprocess.call(['hadoop','fs','-rmr',targetdir],stdout = subprocess.PIPE, stderr = subprocess.PIPE)
</code>```

But, the code is not working.It is neither throwing an error not deleting the directory.

答:
I suggest you slightly change your approach, or this is how I'm doing it. I make use of python  library import commands which then depends how you will use it (https://docs.python.org/2/library/commands.html).
Here is a lil demo:

```<code>import commands as com
print com.getoutput('hadoop fs -ls /')
</code>```

This gives you output like (depending on what you have in the HDFS dir )

```<code>/usr/local/Cellar/hadoop/2.7.3/libexec/etc/hadoop/hadoop-env.sh: line 25: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home: Is a directory
Found 2 items
drwxr-xr-x   - someone supergroup          0 2017-03-29 13:48 /hdfs_dir_1
drwxr-xr-x   - someone supergroup          0 2017-03-24 13:42 /hdfs_dir_2
</code>```

Note: the lib commands doesn't work with python 3 (to my knowledge), I'm using python 2.7.
Note: Be aware of the limitation of commands

If you will use subprocess which is the equivalent to commands for python 3 then you might consider to find a proper way to deal with your 'pipelines'. I find this discussion useful in that sense: (subprocess popen to run commands (HDFS/hadoop))

I hope this suggestion helps you!

Best

Title: Hadoop commands from python script?

Body:
I have multiple hadoop commands to be run and these are going to be invoked from a python script. Currently, I tried the following way.

import os
import xml.etree.ElementTree as etree
import subprocess

filename = "sample.xml"
__currentlocation__ = os.getcwd()
__fullpath__ = os.path.join(__currentlocation__,filename)
tree = etree.parse(__fullpath__)
root = tree.getroot()
hivetable = root.find("hivetable").text
dburl = root.find("dburl").text
username = root.find("username").text
password = root.find("password").text
tablename = root.find("tablename").text
mappers = root.find("mappers").text
targetdir = root.find("targetdir").text
print hivetable
print dburl
print username
print password
print tablename
print mappers
print targetdir

p = subprocess.call(['hadoop','fs','-rmr',targetdir],stdout = subprocess.PIPE, stderr = subprocess.PIPE)

But, the code is not working.It is neither throwing an error not deleting the directory.

Body:
I suggest you slightly change your approach, or this is how I'm doing it. I make use of python  library import commands which then depends how you will use it (https://docs.python.org/2/library/commands.html).
Here is a lil demo:

import commands as com
print com.getoutput('hadoop fs -ls /')

This gives you output like (depending on what you have in the HDFS dir )

/usr/local/Cellar/hadoop/2.7.3/libexec/etc/hadoop/hadoop-env.sh: line 25: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home: Is a directory
Found 2 items
drwxr-xr-x   - someone supergroup          0 2017-03-29 13:48 /hdfs_dir_1
drwxr-xr-x   - someone supergroup          0 2017-03-24 13:42 /hdfs_dir_2

Note: the lib commands doesn't work with python 3 (to my knowledge), I'm using python 2.7.
Note: Be aware of the limitation of commands

If you will use subprocess which is the equivalent to commands for python 3 then you might consider to find a proper way to deal with your 'pipelines'. I find this discussion useful in that sense: (subprocess popen to run commands (HDFS/hadoop))

I hope this suggestion helps you!

Best


问:
ReactJS ES6 syntax for handling events
I am fairly new to ReactJS, Redux and ES6, and I am trying to implement an event-handler where my chat body would hide or unhide as i click the header (kind of like what Facebook chat widget does). My problem is I cannot get the syntax correctly from a copied source. Here is my code:

```<code>import React, {Component} from 'react';
import chat from './styles.css';
import {connect} from 'react-redux';

class ChatWidget extends Component {

  handleClick(event) {
    console.log("test")
  }

  render() {
    return (
      <div className={chat.box}>

        <div className={chat.container}>

          <div onClick={onClick={this.handleClick.bind(this)}}
               className={chat.header}>
            <span className={chat.name}>Idol</span>
          </div>

          <div className={chat.body}>
            This is the Body of the chat
          </div>

          <div className={chat.chat}>
            <input type="text" placeholder="Ask anything..." />
          </div>
        </div>

      </div>
    );
  }
}

function mapStateToProps(state) {
  return {
    user: state.activeUser
  };
}

export default connect(mapStateToProps)(ChatWidget);
</code>```

Error:

```<code>> 16 |           <div onClick={onClick={this.handleClick.bind(this)}}
     |                                      ^
</code>```

答:
The recommended way of doing bindings is in the constructor because they will be created only once, not on every render().</p>

```<code>class Foo extends React.Component {
  constructor(props) {
    super(props);

    this.myFn = this.myFn.bind(this);
  }

  myFn() {
    // code goes here
  }

  render() {
    // code goes here also

    return <button onClick={this.myFn}>Look ma no .bind() here</button>;
  }
}
</code>```

Title: ReactJS ES6 syntax for handling events

Body:
I am fairly new to ReactJS, Redux and ES6, and I am trying to implement an event-handler where my chat body would hide or unhide as i click the header (kind of like what Facebook chat widget does). My problem is I cannot get the syntax correctly from a copied source. Here is my code:

import React, {Component} from 'react';
import chat from './styles.css';
import {connect} from 'react-redux';

class ChatWidget extends Component {

  handleClick(event) {
    console.log("test")
  }

  render() {
    return (

            Idol

            This is the Body of the chat

            <input type="text" placeholder="Ask anything..." />

    );
  }
}

function mapStateToProps(state) {
  return {
    user: state.activeUser
  };
}

export default connect(mapStateToProps)(ChatWidget);

Error:

> 16 |           <div onClick={onClick={this.handleClick.bind(this)}}
     |                                      ^

Body:
The recommended way of doing bindings is in the constructor because they will be created only once, not on every render().

class Foo extends React.Component {
  constructor(props) {
    super(props);

    this.myFn = this.myFn.bind(this);
  }

  myFn() {
    // code goes here
  }

  render() {
    // code goes here also

    return <button onClick={this.myFn}>Look ma no .bind() here</button>;
  }
}


问:
Intellij IDEA - import project into subversion -choose what to import
How to choose which folders and files from the project to import into Subversion? When I do CVS - Import into version control - Import into Subversion, it simply imports the whole chosen folder. What if I don't want to import .idea folder and project-name.iml file for example? Is there a way to choose what to import?

答:
To assign a version control system to the project root:

VCS -> Enable Version Control Integration
 or press Alt+Back Quote, and select Enable Version Control Integration....

In the Enable Version Control Integration dialog box that opens, select a version control system from the drop-down list that you want to associate with your project root.

From There your project will be associated with the version control system you want to use.  You can the right click on the directories you do want to include in VCS and navigate to the Version control system. And then Add to VCS.

For example: Subversion ->  Add to VCS
or Ctrl + ALT + A


问:
Subtract percentage of scrollTop from div's width on scroll with jquery
I'm attempting to adjust a div's width on scroll with jQuery, the idea is to have a div's width be reduced by a fraction of the scrolltop value, every time you scroll.

For example say I have a div with a width of 100px, if I scrolled down 20px from the top of the page, and the function declared to subtract 1/2 of the current scrolltop value, the div's width would become 90px.

答:
Hi here is the code which reduces the width by 10% of height scrolled https://jsfiddle.net/x3o439kt/

code :

```<code>$('#myDiv').on('scroll',function(e){
var w= $('#myDiv').scrollTop()*10/100;
$('#myDiv').width($('#myDiv').width()-w);
});
</code>```

You can replace 10 by any percentage you want.
if you want the scrolling to be done for the entire document, just replace #mydiv with document like so https://jsfiddle.net/x3o439kt/3/

Body:
Hi here is the code which reduces the width by 10% of height scrolled https://jsfiddle.net/x3o439kt/

code :

$('#myDiv').on('scroll',function(e){
var w= $('#myDiv').scrollTop()*10/100;
$('#myDiv').width($('#myDiv').width()-w);
});

You can replace 10 by any percentage you want.
if you want the scrolling to be done for the entire document, just replace #mydiv with document like so https://jsfiddle.net/x3o439kt/3/


问:
Material UI Chips - stop them changing color when active
If you notice Chip number 3 below has a slightly darker background color because I have clicked on it and it is active. However there is no need for it to change color on being clicked/active, because only the delete button has a function, so the chip going darker on click/active has no meaning.

How can I set the styling to stop this background color change when a user clicks the Chip?

I think the custom styling has to come from react. In the devtools, I selected to make the element ':active', however it dosen't change color, so I dont think it is actually ':active' from a CSS perspective. The styling is all coming from React and the Material UI library, so I think we have to apply the custom styling within the React Component for it to work.

答:
However there is no need for it to change color on being clicked/active, because only the delete button has a function

Please refer to the documentation:

"Note that since no onTouchTap property is defined, the Chip can be focused, but does not gain depth while clicked or touched."

http://www.material-ui.com/#/components/chip

The chip has focus color so that a user can tell when it is focused (whether through keyboard, mouse or touch). A focused chip receives the backspace keyboard input, so the user needs a visual cue as to which chip will be deleted.

Source: I wrote the Chip component.


问:
Struts html tags are not working
I just tried to include a textbox in jsp page with struts provided tags. But it's behaving every typical.

Working

Not Working

So, with out property 'value', its not working.
Please help me guys.

Note:
Using tomcat 6.0

bean, logics are working good and in html also most of them are working. radio, textarea, text are some which are causing issues.

JSP FILE

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://struts.apache.org/tags-bean"  prefix="bean"  %>

<%@ taglib uri="http://struts.apache.org/tags-html"  prefix="html"  %>

<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Registration Form</title>

```<code>type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 14

11: <title>Registration Form</title>
12: </head>
13: <body>
14: <html:text property="name"></html:text>
15: </body>
16: </html>

Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
    org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:864)
    org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:126)
    org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102)
    org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:80)
    org.apache.jsp.index_jsp._jspx_meth_html_005ftext_005f0(index_jsp.java:96)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.

--------------------------------------------------------------------------------

Apache Tomcat/6.0.18
</code>```

答: In case anyone else stumbles on this post looking for a solution to the obtuse javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope error message, I caused it by accidentally inserting one Struts  inside of another .  The error message Struts doesn't indicate this.  I figured it out by reviewing the HTML produced by my page.

Title: Struts html tags are not working

Body:
I just tried to include a textbox in jsp page with struts provided tags. But it's behaving every typical.

Working

Not Working

So, with out property 'value', its not working.
Please help me guys.

Note:
Using tomcat 6.0

bean, logics are working good and in html also most of them are working. radio, textarea, text are some which are causing issues.

JSP FILE

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://struts.apache.org/tags-bean"  prefix="bean"  %>

<%@ taglib uri="http://struts.apache.org/tags-html"  prefix="html"  %>

<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Registration Form</title>

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 14

11: <title>Registration Form</title>
12:
13:
14:
15:
16:

Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
    org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:864)
    org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:126)
    org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102)
    org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:80)
    org.apache.jsp.index_jsp._jspx_meth_html_005ftext_005f0(index_jsp.java:96)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.

--------------------------------------------------------------------------------

Apache Tomcat/6.0.18

Body: In case anyone else stumbles on this post looking for a solution to the obtuse javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope error message, I caused it by accidentally inserting one Struts <html:form> inside of another <html:form>.  The error message Struts doesn't indicate this.  I figured it out by reviewing the HTML produced by my page.


问:
Related to datastage. Adding user variable to parameter
I have an user variable (say for ex var_ts) that stores the timestamp using the user variable stage in the job sequence.

Now I want to use the variable value in other jobs in the same job sequence.

How do I add it as a parameter, because when I am adding it the variable name is coming and not the timestamp within.

答:
When you add it as a parameter the user variable name is used, but at runtime the value will be substituted.

For example in the job activity stage for MyTS it will add:

```<code>UserVariables_Activity_0.var_ts
</code>```

At runtime you will see:

```<code>CallRowGenToPeek1 -> (RowGenToPeek1): Job run requested
Mode (row/warn limits) = 0/0
Job Parameters --->
MyTS=00:00:00
DSJobController=CallRowGenToPeek1
</code>```

where the value of UserVariables_Activity_0.var_ts is 00:00:00.

Body:
When you add it as a parameter the user variable name is used, but at runtime the value will be substituted.

For example in the job activity stage for MyTS it will add:

UserVariables_Activity_0.var_ts

At runtime you will see:

CallRowGenToPeek1 -> (RowGenToPeek1): Job run requested
Mode (row/warn limits) = 0/0
Job Parameters --->
MyTS=00:00:00
DSJobController=CallRowGenToPeek1

where the value of UserVariables_Activity_0.var_ts is 00:00:00.


问:
Unexpected output from URLEncoder in Java
I am trying to encode a URL parameter.

For example when I am encoding

qOddENxeLxL+13drGKYUgA==\n

using URL Encoder tool

It gives the following output which works when I request API

qOddENxeLxL%2B13drGKYUgA%3D%3D%5Cn

But when I am encoding URL from my Java code (Android) using URLEncoder.encode("qOddENxeLxL+13drGKYUgA==\n", "UTF-8");

It gives me the following result

qOddENxeLxL%252B13drGKYUgA%253D%253D%250A

I tried using other Encoding schemes too but could not produce the same result.

答: The issue is that you are feeding \n to the URLEncoder tool, which doesn't understand it as an escape sequence and so gives you %5Cn, and to the Java compiler inside a string literal, which does understand it and so gives you 0x0A.


问:
Finding characters within a string in C
I'm writing an algorithm in C with netbeans to find asterisks in a string.

```<code>int main() {
    int M=0, i, j;
    scanf("%i",&M);
    int pos[M];
    char c[M];
    scanf("%s", c);

    i=0;
    j=1;

    while(c[i] != '\0'){
        if(c[i]=='*'){
            pos[j] = i;
            j++;
        }
        i++;
    }

    printf("Asterisks in positions: \n\n");

    for(j=1; j<=i; j++){
        printf("%i", pos[j]);
    }
    return 0;
}
</code>```

But it doesn't work, it prints a lot of numbers even if M is a small number.

答:
The information regarding how many asterisks you found is stored in the counter j.  This variable gets reset in the for loop:

```<code>for(j=1; j<=i; j++)
</code>```

Furthermore, this for loop goes all the way up to i, which is the length of the your input string.  Try reworking your loop as follows:

```<code>for(i=1; i<j; i++){
    printf("%i", pos[i]);
}
</code>```

Title: Finding characters within a string in C

Body:
I'm writing an algorithm in C with netbeans to find asterisks in a string.

int main() {
    int M=0, i, j;
    scanf("%i",&M);
    int pos[M];
    char c[M];
    scanf("%s", c);

    i=0;
    j=1;

    while(c[i] != '\0'){
        if(c[i]=='*'){
            pos[j] = i;
            j++;
        }
        i++;
    }

    printf("Asterisks in positions: \n\n");

    for(j=1; j<=i; j++){
        printf("%i", pos[j]);
    }
    return 0;
}

But it doesn't work, it prints a lot of numbers even if M is a small number.

Body:
The information regarding how many asterisks you found is stored in the counter j.  This variable gets reset in the for loop:

for(j=1; j<=i; j++)

Furthermore, this for loop goes all the way up to i, which is the length of the your input string.  Try reworking your loop as follows:

for(i=1; i<j; i++){
    printf("%i", pos[i]);
}


问:
Extjs proxy just post dirty fields to server, not all filelds
I have a model:

```<code>Ext.define('CrudTest.model.User', {
extend: 'Ext.data.Model',
idProperty: 'Id',
fields: [
     { name: 'Id', type: 'int' },
    { name: 'Name', type: 'string' },
    { name: 'PhoneNumber', type: 'int' },
    { name: 'Address', type: 'string' },
    { name: 'StateId', type: 'int', reference: 'State' },
],
validators: [
    { type: 'presence', field: 'Name', message: 'define name, please' },
    { type: 'length', field: 'PhoneNumber', max: 8, messsage: 'lower than 8 digit' },

],
proxy: {
    type: 'ajax',
    api: {
        create: 'home/new',
        read: 'home/users',
        update: 'home/Edit',
        destroy: 'home/Delete'
    },
},
</code>```

});

and a form that load data to form by  loadRecord() and my handler code for submit button is:

```<code>    var form = this.up('form').getForm();
      if (form.isValid()) {
              form.getRecord().save();
       }
</code>```

it make a post request through my proxy model good. but the body of request just have dirty(edited) fields. why i don't have other fields?

but in request body i have just dirty fields. why? i know updateRecord() uses getFieldValues([onlyDirty=false]), how can send all fields values?

I use extjs 5

答:
You can set crtical: true on the Model to any fields you always want written whether changed or not, e.g.</p>

```<code>{ name: 'title', type: 'string', critical: true }
</code>```

Body:
I have a model:

Ext.define('CrudTest.model.User', {
extend: 'Ext.data.Model',
idProperty: 'Id',
fields: [
     { name: 'Id', type: 'int' },
    { name: 'Name', type: 'string' },
    { name: 'PhoneNumber', type: 'int' },
    { name: 'Address', type: 'string' },
    { name: 'StateId', type: 'int', reference: 'State' },
],
validators: [
    { type: 'presence', field: 'Name', message: 'define name, please' },
    { type: 'length', field: 'PhoneNumber', max: 8, messsage: 'lower than 8 digit' },

],
proxy: {
    type: 'ajax',
    api: {
        create: 'home/new',
        read: 'home/users',
        update: 'home/Edit',
        destroy: 'home/Delete'
    },
},

});

and a form that load data to form by  loadRecord() and my handler code for submit button is:

    var form = this.up('form').getForm();
      if (form.isValid()) {
              form.getRecord().save();
       }

it make a post request through my proxy model good. but the body of request just have dirty(edited) fields. why i don't have other fields?

but in request body i have just dirty fields. why? i know updateRecord() uses getFieldValues([onlyDirty=false]), how can send all fields values?

I use extjs 5

Body:
You can set crtical: true on the Model to any fields you always want written whether changed or not, e.g.

{ name: 'title', type: 'string', critical: true }


答:
It seams that you select the entire column C on yout MasterListSheet. Don't you mean just one cell? Like:

```<code>=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C1, "x", "")
</code>```

or try to : =IF(CONCATENATE(A2, " ", B2) = MasterList.!$C1, "x", "") (on open Office)

Best thing is instead of you write the Sheet name, let Excel do it for you by editing the formula, remove the sheet name and then with a mouse click navigate to the desired area.

Title: Excel concatenate with IF statement

Body:
What I am trying to do is concatenate two cells, then check that concatenated value against a column of values, and put an X in a cell if such a value exists.  The following equation is what I'm using:

{=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C:$C, "x", "")}

Column A is the name of the software and Column B the version number (A="Microsoft .NET Framework 4.5.1", B="4.5.50938", for example). I know that this concatenated value exists on the MasterList worksheet so I don't understand why I'm not getting the answer I expect.

Gurus, what's my flaw here?

Body:
It seams that you select the entire column C on yout MasterListSheet. Don't you mean just one cell? Like:

=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C1, "x", "")

or try to : =IF(CONCATENATE(A2, " ", B2) = MasterList.!$C1, "x", "") (on open Office)

Best thing is instead of you write the Sheet name, let Excel do it for you by editing the formula, remove the sheet name and then with a mouse click navigate to the desired area.


问:
how to obtain execution time profile for a nodejs sails application
I have a nodejs back-end API application implemented using sails.
Is there some way for me to know how much time was spent in each of my app  functions, after I hit specific http routes in the app?
Thanks.

EDIT: I tried using
node --prof /pathToSails/sails lift but the resulting profile didn't mention any of my own functions.  Seems more like a profile of sails' own functions instead.

答:
I took a different direction at solving my problem, but in case someone is wondering, there is the options of using sails debug together with node-inspector.

This is briefly documented in the sails debug doc page, with more details on the node-inspector README file, on specifics about how to start and end the profiling.


问:
How can i send null value with a datetimepicker in vb.net
i need your help i want to send null to my database when the datetimepicker is disabled and send the date when its enable but i just dont get it how can i do it </p>

```<code>Function insertarPersona(ByVal Fecha_de_Precla As Date) As String
    Dim salida As String = "Se ha insertado correctamente"
    Try
        cmd = New SqlCommand("Insert into pruebasop(Fecha_de_Precla)values ('" & Fecha_de_Precla & "')", cn)
        cmd.ExecuteNonQuery()
</code>```

<p>and i want to insert the data depending if the  chekbox its enabled or not, sorry for my bad english </p>

答:
You use a parameter setting the value to DBNull.Value. Of course this will work only if your datatable field (Fecha_de_Precla) accepts a NULL value.

```<code>Function insertarPersona(ByVal Fecha_de_Precla As Date) As String
    Dim salida As String = "Se ha insertado correctamente"
    Try
        Dim cmdText = "Insert into pruebasop(Fecha_de_Precla)
                              values (@fecha)"
        cmd = New SqlCommand(cmdText, cn)
        if date_precla.Enabled = False then
           cmd.Parameters.Add("@fecha", SqlDbType.DateTime).Value = DBNull.Value
        else
           cmd.Parameters.Add("@fecha", SqlDbType.DateTime).Value = Fecha_de_Precla
        End If
        cmd.ExecuteNonQuery()
</code>```

It is important to use the correct DataType for the parameter. Check how you have defined the table field and use the correct SqlDbType.

Body:
i need your help i want to send null to my database when the datetimepicker is disabled and send the date when its enable but i just dont get it how can i do it

Function insertarPersona(ByVal Fecha_de_Precla As Date) As String
    Dim salida As String = "Se ha insertado correctamente"
    Try
        cmd = New SqlCommand("Insert into pruebasop(Fecha_de_Precla)values ('" & Fecha_de_Precla & "')", cn)
        cmd.ExecuteNonQuery()

and i want to insert the data depending if the  chekbox its enabled or not, sorry for my bad english

Body:
You use a parameter setting the value to DBNull.Value. Of course this will work only if your datatable field (Fecha_de_Precla) accepts a NULL value.

Function insertarPersona(ByVal Fecha_de_Precla As Date) As String
    Dim salida As String = "Se ha insertado correctamente"
    Try
        Dim cmdText = "Insert into pruebasop(Fecha_de_Precla)
                              values (@fecha)"
        cmd = New SqlCommand(cmdText, cn)
        if date_precla.Enabled = False then
           cmd.Parameters.Add("@fecha", SqlDbType.DateTime).Value = DBNull.Value
        else
           cmd.Parameters.Add("@fecha", SqlDbType.DateTime).Value = Fecha_de_Precla
        End If
        cmd.ExecuteNonQuery()

It is important to use the correct DataType for the parameter. Check how you have defined the table field and use the correct SqlDbType.


问:
Installing GitHub for Windows
I'm trying to install GitHub for Windows.  I tried installing it the normal way and got this error:

Application installation did not succeed.  Cannot locate application files on the server.  Contact the application vendor or your administrator for assistance.

Clicking on Details... gave me this:

```<code>PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.18034
    System.Deployment.dll       : 4.0.30319.17929 built by: FX45RTMREL
    clr.dll             : 4.0.30319.18034 built by: FX45RTMGDR
    dfdll.dll           : 4.0.30319.17929 built by: FX45RTMREL
    dfshim.dll          : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url          : http://github-windows.s3.amazonaws.com/GitHub.application
                        Server      : AmazonS3
    Application url         : http://github-windows.s3.amazonaws.com/Application%20Files/GitHub_1_0_47_0/GitHub.exe.manifest
                        Server      : AmazonS3

IDENTITIES
    Deployment Identity     : GitHub.application, Version=1.0.47.0, Culture=neutral, PublicKeyToken=317444273a93ac29, processorArchitecture=x86
    Application Identity        : GitHub.exe, Version=1.0.47.0, Culture=neutral, PublicKeyToken=317444273a93ac29, processorArchitecture=x86, type=win32

APPLICATION SUMMARY
    * Installable application.
    * Trust url parameter is set.
ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://github-windows.s3.amazonaws.com/GitHub.application resulted in exception. Following failure messages were detected:
        + Downloading http://github-windows.s3.amazonaws.com/Application Files/GitHub_1_0_47_0/msvcp100.dll.deploy did not succeed.
        + The remote server returned an error: (403) Forbidden.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [5/21/2013 8:19:19 AM] : Activation of http://github-windows.s3.amazonaws.com/GitHub.application has started.
    * [5/21/2013 8:19:19 AM] : Processing of deployment manifest has successfully completed.
    * [5/21/2013 8:19:19 AM] : Installation of the application has started.
    * [5/21/2013 8:19:20 AM] : Processing of application manifest has successfully completed.
    * [5/21/2013 8:19:24 AM] : Found compatible runtime version 4.0.30319.
    * [5/21/2013 8:19:24 AM] : Request of trust and detection of platform is complete.

ERROR DETAILS
    Following errors were detected during this operation.
    * [5/21/2013 8:19:25 AM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
        - Downloading http://github-windows.s3.amazonaws.com/Application Files/GitHub_1_0_47_0/msvcp100.dll.deploy did not succeed.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
            at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
            at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
            at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Net.WebException
        - The remote server returned an error: (403) Forbidden.
        - Source: System
        - Stack trace:
            at System.Net.HttpWebRequest.GetResponse()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.
</code>```

I followed the advice on this post and downloaded github-windows.s3.amazonaws.com/GitHub.application with the latest version of Chrome.  When I tried to run it, I got this error:

Application cannot be started.  Contact the application vendor.

With this detail:

```<code>PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.18034
    System.Deployment.dll       : 4.0.30319.17929 built by: FX45RTMREL
    clr.dll             : 4.0.30319.18034 built by: FX45RTMGDR
    dfdll.dll           : 4.0.30319.17929 built by: FX45RTMREL
    dfshim.dll          : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url          : file:///C:/Users/SESA277661/Downloads/GitHub.application

IDENTITIES
    Deployment Identity     : GitHub.application, Version=1.0.47.0, Culture=neutral, PublicKeyToken=317444273a93ac29, processorArchitecture=x86

APPLICATION SUMMARY
    * Installable application.
    * Trust url parameter is set.
ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\SESA277661\Downloads\GitHub.application resulted in exception. Following failure messages were detected:
        + Deployment and application do not have matching security zones.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [5/21/2013 8:29:33 AM] : Activation of C:\Users\SESA277661\Downloads\GitHub.application has started.
    * [5/21/2013 8:29:33 AM] : Processing of deployment manifest has successfully completed.
    * [5/21/2013 8:29:33 AM] : Installation of the application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [5/21/2013 8:29:33 AM] System.Deployment.Application.InvalidDeploymentException (Zone)
        - Deployment and application do not have matching security zones.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.
</code>```

From here I'm stuck.  Any advice would be much appreciated.

I'm on a work computer, so there may be some security settings blocking something, but I don't know about all that.

Thanks,
Chris

答:
Thanks to this post, I just used Internet Explorer and navigated to:

https://github-windows.s3.amazonaws.com/GitHub.application

And it completely installed Github for Windows (I have Windows 8.1).

Prior to this, with the installer I downloaded using Chrome I couldn't install Github for Windows (I used to get the above "did not succeed" error).

Title: Installing GitHub for Windows

Body:
I'm trying to install GitHub for Windows.  I tried installing it the normal way and got this error:

Application installation did not succeed.  Cannot locate application files on the server.  Contact the application vendor or your administrator for assistance.

Clicking on Details... gave me this:

PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.18034
    System.Deployment.dll       : 4.0.30319.17929 built by: FX45RTMREL
    clr.dll             : 4.0.30319.18034 built by: FX45RTMGDR
    dfdll.dll           : 4.0.30319.17929 built by: FX45RTMREL
    dfshim.dll          : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url          : http://github-windows.s3.amazonaws.com/GitHub.application
                        Server      : AmazonS3
    Application url         : http://github-windows.s3.amazonaws.com/Application%20Files/GitHub_1_0_47_0/GitHub.exe.manifest
                        Server      : AmazonS3

IDENTITIES
    Deployment Identity     : GitHub.application, Version=1.0.47.0, Culture=neutral, PublicKeyToken=317444273a93ac29, processorArchitecture=x86
    Application Identity        : GitHub.exe, Version=1.0.47.0, Culture=neutral, PublicKeyToken=317444273a93ac29, processorArchitecture=x86, type=win32

APPLICATION SUMMARY
    * Installable application.
    * Trust url parameter is set.
ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://github-windows.s3.amazonaws.com/GitHub.application resulted in exception. Following failure messages were detected:
        + Downloading http://github-windows.s3.amazonaws.com/Application Files/GitHub_1_0_47_0/msvcp100.dll.deploy did not succeed.
        + The remote server returned an error: (403) Forbidden.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [5/21/2013 8:19:19 AM] : Activation of http://github-windows.s3.amazonaws.com/GitHub.application has started.
    * [5/21/2013 8:19:19 AM] : Processing of deployment manifest has successfully completed.
    * [5/21/2013 8:19:19 AM] : Installation of the application has started.
    * [5/21/2013 8:19:20 AM] : Processing of application manifest has successfully completed.
    * [5/21/2013 8:19:24 AM] : Found compatible runtime version 4.0.30319.
    * [5/21/2013 8:19:24 AM] : Request of trust and detection of platform is complete.

ERROR DETAILS
    Following errors were detected during this operation.
    * [5/21/2013 8:19:25 AM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
        - Downloading http://github-windows.s3.amazonaws.com/Application Files/GitHub_1_0_47_0/msvcp100.dll.deploy did not succeed.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
            at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
            at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
            at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Net.WebException
        - The remote server returned an error: (403) Forbidden.
        - Source: System
        - Stack trace:
            at System.Net.HttpWebRequest.GetResponse()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

I followed the advice on this post and downloaded github-windows.s3.amazonaws.com/GitHub.application with the latest version of Chrome.  When I tried to run it, I got this error:

Application cannot be started.  Contact the application vendor.

With this detail:

PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.18034
    System.Deployment.dll       : 4.0.30319.17929 built by: FX45RTMREL
    clr.dll             : 4.0.30319.18034 built by: FX45RTMGDR
    dfdll.dll           : 4.0.30319.17929 built by: FX45RTMREL
    dfshim.dll          : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url          : file:///C:/Users/SESA277661/Downloads/GitHub.application

IDENTITIES
    Deployment Identity     : GitHub.application, Version=1.0.47.0, Culture=neutral, PublicKeyToken=317444273a93ac29, processorArchitecture=x86

APPLICATION SUMMARY
    * Installable application.
    * Trust url parameter is set.
ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\SESA277661\Downloads\GitHub.application resulted in exception. Following failure messages were detected:
        + Deployment and application do not have matching security zones.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [5/21/2013 8:29:33 AM] : Activation of C:\Users\SESA277661\Downloads\GitHub.application has started.
    * [5/21/2013 8:29:33 AM] : Processing of deployment manifest has successfully completed.
    * [5/21/2013 8:29:33 AM] : Installation of the application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [5/21/2013 8:29:33 AM] System.Deployment.Application.InvalidDeploymentException (Zone)
        - Deployment and application do not have matching security zones.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

From here I'm stuck.  Any advice would be much appreciated.

I'm on a work computer, so there may be some security settings blocking something, but I don't know about all that.

Thanks,
Chris


问:
Infinite Background Image(PNG) Animation Not Seamless
I have a background image that I would like to animate. Its a faint transparent PNG that is smoke. My question is how can you seamlessly animate the background image so you cant see the stop/start point of the animation and get rid of the "jump" that occurs every time the animation resets. An SVG would also not be good here. Is there a more preferred method I should use, or am I overlooking something. Can someone please help me. Thanks in advance.

HTML

```<code><div class="background" style="background-image:url('http://punchdrunk.staging.sfp.net/wp-content/themes/punchdrunk/assets/img/backgrounds/footer.jpg')">
<div class="overlay"  style="background-image:url('http://punchdrunk.staging.sfp.net/wp-content/themes/punchdrunk/assets/img/backgrounds/smoke.png')"></div>
</div>
</code>```

CSS

```<code>.background,.overlay{height:100%; width:100%; position:absolute; left:0; right:0; top:0; bottom:0;}
.overlay   { opacity:0; animation:smoke 5s infinite;}

@keyframes smoke
{
0%   {opacity:0}
100%   {opacity:1}
}
</code>```

Below is my codepen

http://codepen.io/Jesders88/pen/zZMZOG

答:
How do you expect it to look? You snap from 100% to 0% transparency..

Seems to me you would want to use something like this to fade back out again?

```<code>0%      {opacity:0;}
50%     {opacity:1;}
100%    {opacity:0;}
</code>```

Body:
I have a background image that I would like to animate. Its a faint transparent PNG that is smoke. My question is how can you seamlessly animate the background image so you cant see the stop/start point of the animation and get rid of the "jump" that occurs every time the animation resets. An SVG would also not be good here. Is there a more preferred method I should use, or am I overlooking something. Can someone please help me. Thanks in advance.

HTML

CSS

.background,.overlay{height:100%; width:100%; position:absolute; left:0; right:0; top:0; bottom:0;}
.overlay   { opacity:0; animation:smoke 5s infinite;}

@keyframes smoke
{
0%   {opacity:0}
100%   {opacity:1}
}

Below is my codepen

http://codepen.io/Jesders88/pen/zZMZOG

Body:
How do you expect it to look? You snap from 100% to 0% transparency..

Seems to me you would want to use something like this to fade back out again?

0%      {opacity:0;}
50%     {opacity:1;}
100%    {opacity:0;}


问:
What does git-rm mean by working tree and index?
The documentation for git-rm contains this short description:

git-rm - Remove files from the working tree and from the index

What exactly is meant by the working tree and the index, and which local or remote files will be removed?

答: It means removing from working tree: the working directory of your file system tree where you cloned this repository and from index in .git directory maintained by git. git rm will never remove the file from working directory alone otherwise it will leave index database in inconsistent state. To inform index database about removal of files using Unix based rm command, you're required to run git commit -a which essentially removes the index of deleted objects.


问:
How do I serve an angular 2 app from django's development server?
I have a project where I am using Angular2 to consume a rest API that I built with Django-Rest-Framework.  Currently I have to start up the django api using django development server e.g., 'python manage.py runserver' and then I have to start up the angular 2 server using either 'npm start' or through the cli, 'ng serve'.  Is there any way I can setup my django project to serve the angular2 project?  </p>

答:
I'm assuming that Django-Rest-Framework has an option somewhere for serving static assets, right?

If that's true, you can configure the angular cli to produce its build output into a folder that Django is able to serve. The output of ng build is a bunch of static assets (js, css and index.html) that can be served by any web server.  So, if you change the outDir option in .angular-cli.json to point to your static asset folder in your Django setup, you can get the benefit of only having to run a single folder.

There are two main downsides of this approach. The first is that you now have to actively remember to run ng build everytime you update your angular project and want to see the new changes - you lose the automatic update and reload that happens when using ng serve.  The second downside is that ng build is noticeably slower than ng serve updating after changes are made (because the former has to write to the file system whereas the latter just keeps files in memory).

There are ways around having remember to do the ng serve on every save of an Angular file, but that either requires making use of gulp or grunt or another task runner to monitor for file changes and run a command, or making use of whatever functionality Django has for automatic file watching and reloading and figuring out how to hook into that (i'm not familiar with Django, but Rails had the guard gem to help with those types of setups).

I hope that helps.

(Honestly, I did a similar setup with Rails and ended up removing it and just running the two servers side by side - it was less stress that way).


问:
Windows service always "Starting"
I've got an app which I've tested as working as a console application.
I've now converted this to a Windows service, installed it, run it, and it still does it job.

However, it always has a status of Starting.  There doesn't seem to be any logical flag to set on the ServiceBase.

I've setup the service with a bool isRunning flag, and the program runs within a
while (isRunning) {} block.

答:
It sounds as if you are not handing off the run in the startup phase.</p>

```<code>  static void Main()
  {
     ServiceBase[] ServicesToRun;
     ServicesToRun = new ServiceBase[] { new myservice() };
     AppDomain currentDomain = AppDomain.CurrentDomain;
     currentDomain.UnhandledException += UnknownExceptionHandler;
     Run(ServicesToRun);
  }
</code>```

Title: Windows service always "Starting"

Body:
It sounds as if you are not handing off the run in the startup phase.

  static void Main()
  {
     ServiceBase[] ServicesToRun;
     ServicesToRun = new ServiceBase[] { new myservice() };
     AppDomain currentDomain = AppDomain.CurrentDomain;
     currentDomain.UnhandledException += UnknownExceptionHandler;
     Run(ServicesToRun);
  }


问:
How to find out why the status of a spid is suspended? What resources the spid is waiting for?
I run EXEC sp_who2 78 and I get the following results:

How can I find why its status is suspended?

This process is a heavy INSERT based on an expensive query. A big SELECT that gets data from several tables and write some 3-4 millions rows to a different table.

There are no locks/ blocks.

The waittype it is linked to is CXPACKET. which I can understand because there are 9 78s as you can see on the picture below.

What concerns me and what I really would like to know is why the number 1 of the SPID 78 is suspended.

I understand that when the status of a SPID is suspended it means the process is waiting on a resource and it will resume when it gets its resource.

How can I find more details about this? what resource? why is it not available?

I use a lot the code below, and variations therefrom, but is there anything else I can do to find out why the SPID is suspended?

```<code>select *
from sys.dm_exec_requests r
join sys.dm_os_tasks t on r.session_id = t.session_id
where r.session_id = 78
</code>```

I already used sp_whoisactive. The result I get for this particular spid78 is as follow: (broken into 3 pics to fit screen)

答:
You can solve it with to ways:

Fix the cluster index.

Use temporal tables to get a part of the all table and work with it.

I have the same problem with a table with a 400,000,000 rows, and use a temporal tables to get a part of it and then i use my filters and inners because change the index was not a option.

Some example:

```<code>--
--this is need be cause DECLARE @TEMPORAL are not well for a lot of data.
CREATE TABLE #TEMPORAL
(
    ID BIGINT,
    ID2 BIGINT,
    DATA1 DECIMAL,
    DATA2 DECIMAL
);

WITH TABLE1 AS
(
    SELECT
        L.ID,
        L.ID2,
        L.DATA
    FROM LARGEDATA L
    WHERE L.ID = 1
), WITH TABLE2 AS
(
    SELECT
        L.ID,
        L.ID2,
        L.DATA
    FROM LARGEDATA L
    WHERE L.ID = 2
) INSERT INTO #TEMPORAL SELECT
    T1.ID,
    T2.ID,
    T1.DATA,
    T2.DATA
FROM TABLE1 T1
    INNER JOIN TABLE2 T2
        ON T2.ID2 = T2.ID2;
--
--this take a lot of resources proces and time and be come a status suspend, this why i need a temporal table.
SELECT
    *
FROM #TEMPORAL T
WHERE T.DATA1 < T.DATA2
--
--IMPORTANT DROP THE TABLE.
DROP TABLE #TEMPORAL
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I run EXEC sp_who2 78 and I get the following results:

How can I find why its status is suspended?

This process is a heavy INSERT based on an expensive query. A big SELECT that gets data from several tables and write some 3-4 millions rows to a different table.

There are no locks/ blocks.

The waittype it is linked to is CXPACKET. which I can understand because there are 9 78s as you can see on the picture below.

What concerns me and what I really would like to know is why the number 1 of the SPID 78 is suspended.

I understand that when the status of a SPID is suspended it means the process is waiting on a resource and it will resume when it gets its resource.

How can I find more details about this? what resource? why is it not available?

I use a lot the code below, and variations therefrom, but is there anything else I can do to find out why the SPID is suspended?

select *
from sys.dm_exec_requests r
join sys.dm_os_tasks t on r.session_id = t.session_id
where r.session_id = 78

I already used sp_whoisactive. The result I get for this particular spid78 is as follow: (broken into 3 pics to fit screen)

Body:
You can solve it with to ways:

Fix the cluster index.

Use temporal tables to get a part of the all table and work with it.

I have the same problem with a table with a 400,000,000 rows, and use a temporal tables to get a part of it and then i use my filters and inners because change the index was not a option.

Some example:

--
--this is need be cause DECLARE @TEMPORAL are not well for a lot of data.
CREATE TABLE #TEMPORAL
(
    ID BIGINT,
    ID2 BIGINT,
    DATA1 DECIMAL,
    DATA2 DECIMAL
);

WITH TABLE1 AS
(
    SELECT
        L.ID,
        L.ID2,
        L.DATA
    FROM LARGEDATA L
    WHERE L.ID = 1
), WITH TABLE2 AS
(
    SELECT
        L.ID,
        L.ID2,
        L.DATA
    FROM LARGEDATA L
    WHERE L.ID = 2
) INSERT INTO #TEMPORAL SELECT
    T1.ID,
    T2.ID,
    T1.DATA,
    T2.DATA
FROM TABLE1 T1
    INNER JOIN TABLE2 T2
        ON T2.ID2 = T2.ID2;
--
--this take a lot of resources proces and time and be come a status suspend, this why i need a temporal table.
SELECT
    *
FROM #TEMPORAL T
WHERE T.DATA1 < T.DATA2
--
--IMPORTANT DROP THE TABLE.
DROP TABLE #TEMPORAL


问:
jQuery Animate Not Working (Position has been set)
this has been driving me nuts. Putting a slider together and the image will slideDown, but when I change to animate, it stops working.

Position has been set to relative. Any ideas?

```<code> function carousel() {
    var x = document.getElementsByClassName("pf-grid-items");
    var t = document.getElementsByClassName("rotateText");
    var image = document.getElementsByClassName("img1");
    for (var i = 0; i < x.length; i++) {
      x[i].style.display = "none";
    }
    for (var j = 0; j < t.length; j++) {
      t[j].style.display = "none";
    }
    for (var d = 0; d < image.length; d++) {
      image[d].style.display = "none";
    }

    slideIndex++;

    if (slideIndex > x.length) {slideIndex = 1}
    var output = x[slideIndex-1]
    var imageSlide = image[slideIndex-1]
    if (slideIndex % 2 !==0){

    $(output).slideDown(1000).promise().done(function(){

      textCarousel(t)
      $(imageSlide).animate({left:"250px"});
        $(output).fadeOut(5000);
    })
  } else {
    $(output).fadeIn(1000).promise().done(function(){

      textCarousel(t)
        $(output).fadeOut(5000);
    })
  }
  setTimeout(carousel, 7000);
}
</code>```

CSS:

```<code>.img1 {
  position: relative;
  width: 50%;
  height: 100%;
  background: url('./flex/angular.png');
  background-position: left;
  background-repeat: no-repeat;
  background-size: contain;
}
</code>```

答:
Instead of using $.animate() and altering the left property, you can do that in CSS by assigning a class that applies translateX() (to move the element horizontally, doesn't require any unique positioning) and using transition to animate it. transitioning transform properties is much more performant than using jquery to animate the left property.

$('button').on('click',function() {
  $('div').addClass('move');
})```
<pre class="snippet-code-css lang-css prettyprint-override"><code>div {
  transition: transform 1s;
}
.move {
  transform: translateX(250px);
}</code>```

div

<button>click</button>```

Body:
this has been driving me nuts. Putting a slider together and the image will slideDown, but when I change to animate, it stops working.

Position has been set to relative. Any ideas?

 function carousel() {
    var x = document.getElementsByClassName("pf-grid-items");
    var t = document.getElementsByClassName("rotateText");
    var image = document.getElementsByClassName("img1");
    for (var i = 0; i < x.length; i++) {
      x[i].style.display = "none";
    }
    for (var j = 0; j < t.length; j++) {
      t[j].style.display = "none";
    }
    for (var d = 0; d < image.length; d++) {
      image[d].style.display = "none";
    }

    slideIndex++;

    if (slideIndex > x.length) {slideIndex = 1}
    var output = x[slideIndex-1]
    var imageSlide = image[slideIndex-1]
    if (slideIndex % 2 !==0){

    $(output).slideDown(1000).promise().done(function(){

      textCarousel(t)
      $(imageSlide).animate({left:"250px"});
        $(output).fadeOut(5000);
    })
  } else {
    $(output).fadeIn(1000).promise().done(function(){

      textCarousel(t)
        $(output).fadeOut(5000);
    })
  }
  setTimeout(carousel, 7000);
}

CSS:

.img1 {
  position: relative;
  width: 50%;
  height: 100%;
  background: url('./flex/angular.png');
  background-position: left;
  background-repeat: no-repeat;
  background-size: contain;
}

Body:
Instead of using $.animate() and altering the left property, you can do that in CSS by assigning a class that applies translateX() (to move the element horizontally, doesn't require any unique positioning) and using transition to animate it. transitioning transform properties is much more performant than using jquery to animate the left property.

$('button').on('click',function() {
  $('div').addClass('move');
})

div {
  transition: transform 1s;
}
.move {
  transform: translateX(250px);
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>div</div>
<button>click</button>


问:
How to use emacs with rtags
I'm trying to use rtags in Emacs because rtags is better than gtags
I tried to follow rtags site's tutorial in FreeBSD.

Now I can compile rtags and generate "compile_commands.json" for my c++ project with ninja -t commands...

When I try to navigate source with rtags in emacs... I realized that I can only navigate with .c extension but .cc extension is not worked...

I tried to change some cc files to c file for test and it works but I can't change all cc files cause it's not my own file.

答:
Maybe these links can help you:

EmacsWiki: BuildTags

EmacsWiki: EmacsTags

EmacsWiki: Tags File

Also see: man etags

Title: How to use emacs with rtags


问:
How much low-level stuff to expose in an API?
When designing the public API of a generic library, how much of the low-level stuff that's used internally should be exposed?  On the one hand, users should not depend too heavily on implementation details, and too many low-level functions/classes might clutter the API.  Therefore, the knee-jerk response might be "none".  On the other hand, some of the low-level functionality might be useful to people, and exposing more of it can prevent abstraction inversion (the re-implementing of low-level constructs on top of high-level constructs).

Furthermore, exposing more low-level details could provide performance shortcuts.  For example, let's say you have a function to find the median of an array.  The principle of least surprise says that you should duplicate the array so that users of your API don't have to care that its implementation involves the side effect of reordering elements.  Should you, in this case, note that median() costs a memory allocation and provide another function that bypasses the allocation, but will arbitrarily reorder the user's input?

What are some general guidelines for how much of this kind of detail to expose?

答:
Your API shouldn't allow callers to "break" anything by mucking up the state of the internals (e.g. reordering collections, etc.). To solve that problem, your exposed interfaces should be read only when necessary.

With respect to complexity, I lean far in the direction of simple, basic methods. I try very hard not to over-engineer anything with what I think will be needed down the road.

Write to today's requirements (maybe tomorrow's), but not beyond. You can always extend in the future. It's much harder to just drop things that you can't maintain anymore.

OwnerDisplayName: dsimcha

OwnerDisplayName: Michael Haren