问:
Spark streaming Job aborted due to stage failure when reading from kafka topic
I'm new in spark and kafka and I'm using spark streaming to process data coming from a kafka topic. For now, I just want to print the records in the console.
I have a mini cluster with spark on two nodes (scala version 2.12.2 and spark-2.1.1) and a node with kafka (version kafka_2.11-0.10.2.0).
However when I submit my code I get this error :

```<code>Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 4 times, most recent failure: Lost task 0.3 in stage 0.0 (TID 3, 1.3.64.64, executor 1): java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
    at org.apache.spark.streaming.kafka010.KafkaRDD$KafkaRDDIterator.<init>(KafkaRDD.scala:193)
    at org.apache.spark.streaming.kafka010.KafkaRDD.compute(KafkaRDD.scala:185)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
    at org.apache.spark.scheduler.Task.run(Task.scala:99)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:322)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
</code>```

Does it have something to do with the versions ? Or maybe my code is not correct !

Here is my code :

```<code>import java.util.UUID
import org.apache.kafka.clients.consumer.ConsumerRecord
import runtime.ScalaRunTime.stringOf
import org.apache.spark.SparkConf
import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.spark.streaming.kafka010._
import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent
import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe

object followProduction {

def main(args: Array[String]) = {

val sparkConf = new SparkConf().setMaster("spark://<real adress here : 10. ...>:7077").setAppName("followProcess")
val streamContext = new StreamingContext(sparkConf, Seconds(2))

streamContext.checkpoint("checkpoint")

val kafkaParams = Map[String, Object](
  "bootstrap.servers" -> "1.3.64.66:9094",
  "key.deserializer" -> classOf[StringDeserializer],
  "value.deserializer" -> classOf[StringDeserializer],
  "group.id" -> s"${UUID.randomUUID().toString}",
  "auto.offset.reset" -> "earliest",
  "enable.auto.commit" -> (false: java.lang.Boolean)
)

val topics = Array("test")
val stream = KafkaUtils.createDirectStream[String, String](
  streamContext,
  PreferConsistent,
  Subscribe[String, String](topics, kafkaParams)
)

stream.print()

//stream.map(record => (record.key, record.value)).count().print()

streamContext.start()
streamContext.awaitTermination()
}
}
</code>```

And here is my built :

```<code>name := "test"
version := "1.0"
scalaVersion := "2.12.2"

libraryDependencies += "org.apache.spark" % "spark-core_2.10" % "2.1.1" %"provided"
libraryDependencies += "org.apache.spark" % "spark-streaming_2.10" % "2.1.1" %"provided"
libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-10_2.10" % "2.0.0"

assemblyMergeStrategy in assembly := {
  case PathList("META-INF", xs @ _*) => MergeStrategy.discard
  case x => MergeStrategy.first
}
</code>```

Any help will be appreciated and thank you for your time.

答:
Spark 2.1.x is compiled against Scala 2.11, not 2.12.

Try:

```<code>scalaVersion := 2.11.11
</code>```

Any 2.11.x version should work.

Also, your Kafka streaming dependency is referring to Scala 2.10, when you need 2.11:

```<code>libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-10_2.11" % "2.1.1"
</code>```

Body:
I'm new in spark and kafka and I'm using spark streaming to process data coming from a kafka topic. For now, I just want to print the records in the console.
I have a mini cluster with spark on two nodes (scala version 2.12.2 and spark-2.1.1) and a node with kafka (version kafka_2.11-0.10.2.0).
However when I submit my code I get this error :

Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 4 times, most recent failure: Lost task 0.3 in stage 0.0 (TID 3, 1.3.64.64, executor 1): java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
    at org.apache.spark.streaming.kafka010.KafkaRDD$KafkaRDDIterator.<init>(KafkaRDD.scala:193)
    at org.apache.spark.streaming.kafka010.KafkaRDD.compute(KafkaRDD.scala:185)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
    at org.apache.spark.scheduler.Task.run(Task.scala:99)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:322)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Does it have something to do with the versions ? Or maybe my code is not correct !

Here is my code :

import java.util.UUID
import org.apache.kafka.clients.consumer.ConsumerRecord
import runtime.ScalaRunTime.stringOf
import org.apache.spark.SparkConf
import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.spark.streaming.kafka010._
import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent
import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe

object followProduction {

def main(args: Array[String]) = {

val sparkConf = new SparkConf().setMaster("spark://<real adress here : 10. ...>:7077").setAppName("followProcess")
val streamContext = new StreamingContext(sparkConf, Seconds(2))

streamContext.checkpoint("checkpoint")

val kafkaParams = Map[String, Object](
  "bootstrap.servers" -> "1.3.64.66:9094",
  "key.deserializer" -> classOf[StringDeserializer],
  "value.deserializer" -> classOf[StringDeserializer],
  "group.id" -> s"${UUID.randomUUID().toString}",
  "auto.offset.reset" -> "earliest",
  "enable.auto.commit" -> (false: java.lang.Boolean)
)

val topics = Array("test")
val stream = KafkaUtils.createDirectStream[String, String](
  streamContext,
  PreferConsistent,
  Subscribe[String, String](topics, kafkaParams)
)

stream.print()

//stream.map(record => (record.key, record.value)).count().print()

streamContext.start()
streamContext.awaitTermination()
}
}

And here is my built :

name := "test"
version := "1.0"
scalaVersion := "2.12.2"

libraryDependencies += "org.apache.spark" % "spark-core_2.10" % "2.1.1" %"provided"
libraryDependencies += "org.apache.spark" % "spark-streaming_2.10" % "2.1.1" %"provided"
libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-10_2.10" % "2.0.0"

assemblyMergeStrategy in assembly := {
  case PathList("META-INF", xs @ _*) => MergeStrategy.discard
  case x => MergeStrategy.first
}

Any help will be appreciated and thank you for your time.

Body:
Spark 2.1.x is compiled against Scala 2.11, not 2.12.

Try:

scalaVersion := 2.11.11

Any 2.11.x version should work.

Also, your Kafka streaming dependency is referring to Scala 2.10, when you need 2.11:

libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-10_2.11" % "2.1.1"


来源: stackexchange

问:
Issue with IE conditional comments and Google Analytics
I have a web-page that starts like so:

```<code><!DOCTYPE html>

<html>
<head>
    <!--[if lt IE 10]>
    <script>
        location.href = "http://www.getfirefox.com";
    </script>
    <![endif]-->
</code>```

That page gets ~500 pageviews/month and for the last 6 months I had no IE visitors according to Google Analytics. However, a few days ago I got a report of an IE6 visit. How did that happen?

Did the redirection code in the conditional comment fire to late?

Did Google Analytics code mistakingly identified a non-IE browser as IE6?

答:
He had javascript disabled.

Also, nice usability. You know they're not going to download firefox and then come back, right?

ContentLicense: CC BY-SA 2.5

Body:
I have a web-page that starts like so:

<!DOCTYPE html>

That page gets ~500 pageviews/month and for the last 6 months I had no IE visitors according to Google Analytics. However, a few days ago I got a report of an IE6 visit. How did that happen?

Did the redirection code in the conditional comment fire to late?

Did Google Analytics code mistakingly identified a non-IE browser as IE6?


问:
Should branch indexing for Multibranch Pipeline jobs be triggered automatically by webhooks?
I've set up a number of Multibranch Pipeline jobs in Jenkins (running 2.46.2 LTS, Branch API 2.0.8, GitHub Branch Source 2.0.5, and Pipeline Multibranch 2.14) and have just noted that branch indexing -- and thus any cleanup of old branches -- does not appear to be triggered by the webhook calls from GitHub. It only appears to be triggered if someone manually clicks the "Scan Repository Now" link, or if the job configuration in Jenkins is re-saved. I'm using the timestamp shown in the "Scan Repository Log" page as an indication of when the branch indexing occurs.

It seems that new branches or changes to existing ones are being detected correctly and built, so the webhooks from source control (GitHub) are working, but was surprised that this wasn't also triggering the branch indexing and thus the old branch cleanup. I just can't tell from the documentation whether this is correct and expected behavior or if something is incorrect in my setup.

I note that the help text for the "Periodically if not otherwise run" setting says:

Some kinds of folders are reindexed automatically and immediately upon receipt of an external event. For example, a multi-branch project will recheck its SCM repository for new or removed or modified branches when it receives an SCM change notification. (Push notification may be configured as per the SCM plugin used for each respective branch source.) Such notifications can occasionally be unreliable, however, or Jenkins might not even be running to receive them. In some cases no immediate notification is even possible, for example because Jenkins is behind a firewall and can only poll an external system.

This trigger allows for a periodic fallback, but when necessary. If no indexing has been performed in the specified interval, then an indexing will be scheduled. For example, in the case of a multi-branch project, if the source control system is not configured for push notification, set a short interval (most people will pick between 15 minutes and 1 hour). If the source control system is configured for push notification, set an interval that corresponds to the maximum acceptable delay in the event of a lost push notification as the last commit of the day. (Subsequent commits should trigger indexing anyway and result in the commit being picked up, so most people will pick between 4 hours and 1 day.)

This certainly implies that indexing of a Multibranch Pipeline job should be re-triggered by branch events (e.g., pushes from GitHub via webhook), but the timestamp on my indexing log seems to belie that.

So, is what I'm observing the intended behavior? If so, and I want a regular cleanup of old branches, do I need to select the "Periodically if not otherwise run" checkbox under "Scan repository triggers"? Or is there something wrong with my setup, which is preventing it from working as intended?

答:
According to the official documentation:

By default, Jenkins will not automatically re-index the repository for branch additions or deletions (unless using an Organization Folder), so it is often useful to configure a Multibranch Pipeline to periodically re-index in the configuration.

ContentLicense: CC BY-SA 3.0


问:
How to open modal jquery and get cell value from table?
I have a html table with data that draws dynamically with a JS function, and for each row I have a button that opens a modal bootstrap, how can I make that when the modal opens also capture the value of a column according to the Row selected when you press the button?

My modal html:

```<code>   <div id="myModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
         <!-- Modal content-->
         <div class="modal-content">
             <div class="modal-header">

             </div>
              <div class="modal-body">
                        info content
              </div>
               <div class="modal-footer">
                    <button type="button" class="btn btn-primary" data-dismiss="modal">Send</button>
               </div>
    </div>
</div>
</code>```

And mi js funcion:

```<code>successList: function(data) {

   var strHtml = '';
   for(var i = 0; i<data.array.length; i++) {

      strHtml += '<tr>';
      strHtml += '  <td>'+data.array[i].idUser+'</td>';
      strHtml += '  <td>'+data.array[i].age+'</td>';
      strHtml += '  <td>'+data.array[i].email+'</td>';
      strHtml += '  <td> <button type="button" id="btnOpenModal" class="btn btn-warning" data-toggle="modal" data-target="#myModal">Process</button> </td>';
      strHtml += '</tr>'
   }

  $("#tblUsers").append(strHtml);

}
</code>```

i want capture idUser

答: You can add event listener for click on button. And get data from event inside event listener. Use 'target' property of event object in order to get instance of button which was clicked.</p>

Body:
I have a html table with data that draws dynamically with a JS function, and for each row I have a button that opens a modal bootstrap, how can I make that when the modal opens also capture the value of a column according to the Row selected when you press the button?

My modal html:

                        info content

                    <button type="button" class="btn btn-primary" data-dismiss="modal">Send</button>

And mi js funcion:

successList: function(data) {

   var strHtml = '';
   for(var i = 0; i<data.array.length; i++) {

      strHtml += '
';
      strHtml += '  '+data.array[i].idUser+'	';
      strHtml += '  '+data.array[i].age+'	';
      strHtml += '  '+data.array[i].email+'	';
      strHtml += '   <button type="button" id="btnOpenModal" class="btn btn-warning" data-toggle="modal" data-target="#myModal">Process</button> 	';
      strHtml += '
'
   }

  $("#tblUsers").append(strHtml);

}

i want capture idUser


问:
Eclipse menu bar won't show - Ubuntu 16.04 - Eclipse Mars
I recently installed eclipse Mars with the installer.

However, the menu at the top won't show : I can't see File, Edit...

I'm using Ubuntu 16.04

Eclipse.ini

Screenshot of the problem at the top

Thanks in advance for you help

答:
It works for me with David M. Karr's suggestion.  To be more specific,

Go to Ubuntu 16.04 All Settings (mechanic gear icon), Click on Appearance...
All Settings"->"Appearance"->"Behavior" and change the "Show the menus for a window" setting:  Check both of the following:
1. In the window's title bar and 2. Always displayed.


问:
Longest word test from appacademy practice in ruby
I am trying to do this test and there are bunch of solutions online and here but  I first want to figure out why my solution is wrong even though it seems that it puts right results when I enter certain strings :

Here is what they are asking :

Write a method that takes in a string. Return the longest word in the
  string. You may assume that the string contains only letters and
  spaces.

You may use the String split method to aid you in your quest.

Here is my solution where I thought I could turn string into array, sort it from max length descending and then just print first element in that new string like this :

```<code>def longest_word(sentence)
  sentence = sentence.split

  sentence.sort_by! { |longest| -longest.length }

  return sentence[0]
end
</code>```

That doesn't seem to work obviously since their test gives me all false..here is the test :

```<code>puts("\nTests for #longest_word")
puts("===============================================")
    puts(
      'longest_word("short longest") == "longest": ' +
      (longest_word('short longest') == 'longest').to_s
    )
    puts(
      'longest_word("one") == "one": ' +
      (longest_word('one') == 'one').to_s
    )
    puts(
      'longest_word("abc def abcde") == "abcde": ' +
      (longest_word('abc def abcde') == 'abcde').to_s
    )
puts("===============================================")
</code>```

So the question is why? And can I just fix my code or the idea is all wrong and I need to do it completely different?

答:
I'd write it something like:</p>

```<code>str = "Write a method that takes in a string"
str.split.sort_by(&:length).last # => "string"
</code>```

Body:
I am trying to do this test and there are bunch of solutions online and here but  I first want to figure out why my solution is wrong even though it seems that it puts right results when I enter certain strings :

Here is what they are asking :

Write a method that takes in a string. Return the longest word in the
  string. You may assume that the string contains only letters and
  spaces.

You may use the String split method to aid you in your quest.

Here is my solution where I thought I could turn string into array, sort it from max length descending and then just print first element in that new string like this :

def longest_word(sentence)
  sentence = sentence.split

  sentence.sort_by! { |longest| -longest.length }

  return sentence[0]
end

That doesn't seem to work obviously since their test gives me all false..here is the test :

puts("\nTests for #longest_word")
puts("===============================================")
    puts(
      'longest_word("short longest") == "longest": ' +
      (longest_word('short longest') == 'longest').to_s
    )
    puts(
      'longest_word("one") == "one": ' +
      (longest_word('one') == 'one').to_s
    )
    puts(
      'longest_word("abc def abcde") == "abcde": ' +
      (longest_word('abc def abcde') == 'abcde').to_s
    )
puts("===============================================")

So the question is why? And can I just fix my code or the idea is all wrong and I need to do it completely different?

Body:
I'd write it something like:

str = "Write a method that takes in a string"
str.split.sort_by(&:length).last # => "string"


问:
How to target the 7th child only
Problem I have the following code that displays the navigation bar that is provided by Mura:

```<code>#$.dspPrimaryNav(
viewDepth=0
, id='navPrimary'
, class='nav navbar-nav nav-nowrap'
, displayHome='never'
, closeFolders=false
, showCurrentChildrenOnly=false
, liHasKidsClass='dropdown'
, liHasKidsAttributes=''
, liCurrentClass=''
, liCurrentAttributes=''
, liHasKidsNestedClass='dropdown-submenu'
, aHasKidsClass='dropdown-toggle'
, aHasKidsAttributes='role="button" data-toggle="dropdown" data-target="##"'
, aCurrentClass=''
, aCurrentAttributes=''
, ulNestedClass='dropdown-menu'
, ulNestedAttributes=''
, aNotCurrentClass=''
, siteid=$.event('siteid')
)#
</code>```

And the displays the following navigation bar:

As you can see above, the second row of the navigation bar is shifted to the right. I tried the following css to align the second row with the first row of the navigation bar:

```<code>#navPrimary ul:nth-child(3n+1){
    margin-left:-15px;
}
</code>```

However, it is not working. Any help would be appreciated.

答:
:nth-child(N) psuedo selector, where N = sequence of the child, can select the child node of an element. To select 7th child us N=7 in your selector. Solution to your problem been-

```<code>#navPrimary ul li:nth-child(7){
  // Your style rules here...
}
</code>```

Reference: CSS Tricks

Title: How to target the 7th child only

Body:
Problem I have the following code that displays the navigation bar that is provided by Mura:

#$.dspPrimaryNav(
viewDepth=0
, id='navPrimary'
, class='nav navbar-nav nav-nowrap'
, displayHome='never'
, closeFolders=false
, showCurrentChildrenOnly=false
, liHasKidsClass='dropdown'
, liHasKidsAttributes=''
, liCurrentClass=''
, liCurrentAttributes=''
, liHasKidsNestedClass='dropdown-submenu'
, aHasKidsClass='dropdown-toggle'
, aHasKidsAttributes='role="button" data-toggle="dropdown" data-target="##"'
, aCurrentClass=''
, aCurrentAttributes=''
, ulNestedClass='dropdown-menu'
, ulNestedAttributes=''
, aNotCurrentClass=''
, siteid=$.event('siteid')
)#

And the displays the following navigation bar:

As you can see above, the second row of the navigation bar is shifted to the right. I tried the following css to align the second row with the first row of the navigation bar:

#navPrimary ul:nth-child(3n+1){
    margin-left:-15px;
}

However, it is not working. Any help would be appreciated.

Body:
:nth-child(N) psuedo selector, where N = sequence of the child, can select the child node of an element. To select 7th child us N=7 in your selector. Solution to your problem been-

#navPrimary ul li:nth-child(7){
  // Your style rules here...
}

Reference: CSS Tricks

ContentLicense: CC BY-SA 4.0


问:
RxJava + Retrofit + polling
I have a Retrofit call and want to recall it every 30sec. To do that I use an Observable.interval(0, 30, TimeUnit.SECONDS)

```<code>Observable
    .interval(0, 30, TimeUnit.SECONDS)
    .flatMap(x -> RestApi.instance().getUsers())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(list -> {
                    // ...
               },
               error -> Timber.e(error, "can't load users"));
</code>```

My problem: If the api call fails, onError is called and the subscription unsubscribes and the polling isn't working anymore :-(

To catch the api error I added a retryWhen

```<code>Observable
    .interval(0, 30, TimeUnit.SECONDS)
    .flatMap(x -> RestApi.instance().getUsers()
                         .retryWhen(errors -> errors
                             .flatMap(error -> Observable.timer(15, TimeUnit.SECONDS))))
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(list -> {
                   // ...
               },
               error -> Timber.e(error, "can't load users"));
</code>```

This catches the error but I get multiple api calls over the time. Every 30sec I get a new poll signal which ends in a new api request. But if the api request fails it retries itself. So I have a new request plus all retries.

My question: How can I handle an api error without unsubscribing from the poll signal?

答:
You can use this code, in this code implement the numbers attempts and time delay between  request</p>

```<code>private static int COUNTER_START = 1;
private static final int ATTEMPTS = 6;
private static final int ORIGINAL_DELAY_IN_SECONDS = 2;

remoteData.getAllRides(idSearch)
            .repeatWhen(new Func1<Observable<? extends Void>, Observable<?>>() {
                        @Override
                        public Observable<?> call(Observable<? extends Void> observable) {
                            return observable.flatMap(new Func1<Void, Observable<?>>() {
                                @Override
                                public Observable<?> call(Void aVoid) {
                                    if(COUNTER_START > ATTEMPTS){
                                        throw new RuntimeException();
                                    }
                                    COUNTER_START++;
                                    return Observable.timer(ORIGINAL_DELAY_IN_SECONDS, TimeUnit.SECONDS);
                                }
                            });
                        }
                    })
            .takeUntil(new Func1<RideResponse, Boolean>() {
                @Override
                public Boolean call(RideResponse rideResponse) {
                    return rideResponse.getState().equals("finished");//this is the validation finish polling

                }
            }).filter(new Func1<RideResponse, Boolean>() {
                @Override
                public Boolean call(RideResponse rideResponse) {
                    return rideResponse.getState().equals("finished"); //this is the validation finish polling
                }
            }).map(rideResponse -> Log.e("",rideResponse.toString()))
        .doOnError(err -> Log.e("Polling", "Error retrieving messages: " + err));
</code>```

Title: RxJava + Retrofit + polling

Body:
I have a Retrofit call and want to recall it every 30sec. To do that I use an Observable.interval(0, 30, TimeUnit.SECONDS)

Observable
    .interval(0, 30, TimeUnit.SECONDS)
    .flatMap(x -> RestApi.instance().getUsers())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(list -> {
                    // ...
               },
               error -> Timber.e(error, "can't load users"));

My problem: If the api call fails, onError is called and the subscription unsubscribes and the polling isn't working anymore :-(

To catch the api error I added a retryWhen

Observable
    .interval(0, 30, TimeUnit.SECONDS)
    .flatMap(x -> RestApi.instance().getUsers()
                         .retryWhen(errors -> errors
                             .flatMap(error -> Observable.timer(15, TimeUnit.SECONDS))))
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(list -> {
                   // ...
               },
               error -> Timber.e(error, "can't load users"));

This catches the error but I get multiple api calls over the time. Every 30sec I get a new poll signal which ends in a new api request. But if the api request fails it retries itself. So I have a new request plus all retries.

My question: How can I handle an api error without unsubscribing from the poll signal?

Body:
You can use this code, in this code implement the numbers attempts and time delay between  request

private static int COUNTER_START = 1;
private static final int ATTEMPTS = 6;
private static final int ORIGINAL_DELAY_IN_SECONDS = 2;

remoteData.getAllRides(idSearch)
            .repeatWhen(new Func1<Observable<? extends Void>, Observable<?>>() {
                        @Override
                        public Observable<?> call(Observable<? extends Void> observable) {
                            return observable.flatMap(new Func1<Void, Observable<?>>() {
                                @Override
                                public Observable<?> call(Void aVoid) {
                                    if(COUNTER_START > ATTEMPTS){
                                        throw new RuntimeException();
                                    }
                                    COUNTER_START++;
                                    return Observable.timer(ORIGINAL_DELAY_IN_SECONDS, TimeUnit.SECONDS);
                                }
                            });
                        }
                    })
            .takeUntil(new Func1<RideResponse, Boolean>() {
                @Override
                public Boolean call(RideResponse rideResponse) {
                    return rideResponse.getState().equals("finished");//this is the validation finish polling

                }
            }).filter(new Func1<RideResponse, Boolean>() {
                @Override
                public Boolean call(RideResponse rideResponse) {
                    return rideResponse.getState().equals("finished"); //this is the validation finish polling
                }
            }).map(rideResponse -> Log.e("",rideResponse.toString()))
        .doOnError(err -> Log.e("Polling", "Error retrieving messages: " + err));


问:
Atomic conditional update in RethinkDB
RethinkDB gives us some atomicity guarantees under certain conditions. I'm trying to take advantage of it using a revision field to implement optimistic concurrency (c#). The idea is that if the data has been modified while the client was editing his own revision, the update should fail. New entries should be inserted.

```<code>var id = "some unique id";
var rev = "the old known revision";
var doc = new {id, Revision = Guid.NewGuid().ToString("N")};
var result = await R.Db("test").Table("table")
    .Get(id)
    .Replace(found =>
        R.Branch(
            found.Eq(null), doc,
            found["Revision"].Eq(rev), doc,
            found
        )
    ).RunResultAsync(connection);
</code>```

The above code seems to work for this purpose but I'm wondering if it indeed will eliminate the race conditions for tight concurrent access. In other words, is this update/insert or upsert atomic? Please guide me to some documentation if possible.

The documentation speaks of a check-and-set register (which may as well be CAS, the compare and swap) that I don't find as helpful to explain which operations are actually atomic and how can we guarantee it (for instance using integration tests).

I get the impression that if the following criteria are met:

write_acks: majority

durability: hard

read_mode: majority

And if the write does not involve secondary queries or other documents, then the write is atomic. There is too much faith in there to my liking, those ifs. I'd prefer if there was a flag or something that the operation MUST be atomic, otherwise nuke it. Well until then, can I believe my impression?
There's confusion on SO as well.

答:
Your sample query is atomic. It is atomic because it modifies a single document using Replace. If it modified multiple documents, the whole query would not be atomic, but the modifications to each document would be separate atomic operations.

There is a flag to Replace, nonAtomic, which defaults to true. Unless you pass the nonAtomic argument to Replace, the function passed to Replace will be performed atomically.

There is no whole-query atomic or nonAtomic flag.

RethinkDB will throw an error when you try to perform non-deterministic operations atomically:

Could not prove argument deterministic.  Maybe you want to use the non_atomic flag?

The documentation you linked to mentions that:

To read and modify a document in a single atomic operation, use the update or replace commands.

The check-and-set register is just an example of an operation that can be performed atomically. It also serves to illustrate the caveats of atomic operations: only the function passed to Replace or Update is atomic. The surrounding query isn't, for example Filter or GetAll.

RethinkDB operations are never atomic across multiple keys

Reading the discussion you linked to, the confusion seems to stem from an error in the documentation. It used to say

If the user runs a query that cannot be executed atomically, by default RethinkDB will throw an error.

But was corrected to say

If an update or replace query cannot be executed atomically, by default RethinkDB will throw an error

See also How does the atomicity model work?

Write atomicity is supported on a per-document basis – updates to a single JSON document are guaranteed to be atomic. RethinkDB is different from other NoSQL systems in that atomic document updates aren’t limited to a small subset of possible operations – any combination of operations that can be performed on a single document is guaranteed to update the document atomically.

Title: Atomic conditional update in RethinkDB

Body:
RethinkDB gives us some atomicity guarantees under certain conditions. I'm trying to take advantage of it using a revision field to implement optimistic concurrency (c#). The idea is that if the data has been modified while the client was editing his own revision, the update should fail. New entries should be inserted.

var id = "some unique id";
var rev = "the old known revision";
var doc = new {id, Revision = Guid.NewGuid().ToString("N")};
var result = await R.Db("test").Table("table")
    .Get(id)
    .Replace(found =>
        R.Branch(
            found.Eq(null), doc,
            found["Revision"].Eq(rev), doc,
            found
        )
    ).RunResultAsync(connection);

The above code seems to work for this purpose but I'm wondering if it indeed will eliminate the race conditions for tight concurrent access. In other words, is this update/insert or upsert atomic? Please guide me to some documentation if possible.

The documentation speaks of a check-and-set register (which may as well be CAS, the compare and swap) that I don't find as helpful to explain which operations are actually atomic and how can we guarantee it (for instance using integration tests).

I get the impression that if the following criteria are met:

write_acks: majority

durability: hard

read_mode: majority

And if the write does not involve secondary queries or other documents, then the write is atomic. There is too much faith in there to my liking, those ifs. I'd prefer if there was a flag or something that the operation MUST be atomic, otherwise nuke it. Well until then, can I believe my impression?
There's confusion on SO as well.


问:
jQuery Show-Hide DIV based on Checkbox Value
Using AJAX I populate a DIV with a bunch of checkboxes (each with it's own unique ID). The IDs are "projectID1", "projectID2", "projectID3" and so on... I have given all checkboxes a class of "pChk".

My end goal is to show the DIV containing the Submit Button if ANY of the checkboxes are checked. The only time the DIV containing the Submit Button show be hidden is if all checkboxes are unchecked.

However the code I have come up with below shows/hides the Submit Button DIV for each checkbox instance. In other words, if I have three checkboxes CHECKED and I UNCHECK one of them, the Submit Button DIV get hidden.

Your expert advice is more than welcome!

```<code>function checkUncheck() {
    $('.pChk').click(function() {
        if (this.checked) {
            $("#ProjectListButton").show();
        } else {
            $("#ProjectListButton").hide();
        }
    });
}
</code>```

答:
You might consider using the :checked selector, provided by jQuery.  Something like this:

```<code>$('.pChk').click(function() {
    if( $('.pChk:checked').length > 0 ) {
        $("#ProjectListButton").show();
    } else {
        $("#ProjectListButton").hide();
    }
});
</code>```

Body:
Using AJAX I populate a DIV with a bunch of checkboxes (each with it's own unique ID). The IDs are "projectID1", "projectID2", "projectID3" and so on... I have given all checkboxes a class of "pChk".

My end goal is to show the DIV containing the Submit Button if ANY of the checkboxes are checked. The only time the DIV containing the Submit Button show be hidden is if all checkboxes are unchecked.

However the code I have come up with below shows/hides the Submit Button DIV for each checkbox instance. In other words, if I have three checkboxes CHECKED and I UNCHECK one of them, the Submit Button DIV get hidden.

Your expert advice is more than welcome!

function checkUncheck() {
    $('.pChk').click(function() {
        if (this.checked) {
            $("#ProjectListButton").show();
        } else {
            $("#ProjectListButton").hide();
        }
    });
}

Body:
You might consider using the :checked selector, provided by jQuery.  Something like this:

$('.pChk').click(function() {
    if( $('.pChk:checked').length > 0 ) {
        $("#ProjectListButton").show();
    } else {
        $("#ProjectListButton").hide();
    }
});


问:
Use Bootstrap buttons to scroll to different areas
I've got 2 bootstrap buttons I need to be able to scroll down the page. One goes to one section, and the other goes to a section further down the page. What do I need to add to my <button> elements?

```<code><ul>
  <div class="row">
    <div class="col-md-4">
      <li><button class="btn btn-block" style="margin-top: 5px;">Section1</button></li>
    </div>
    <div class="col-md-4">
      <li><button class="btn btn-block" style="margin-top: 5px;">Section2</button></li>
    </div>
  </div>
</ul>
</code>```

I don't know Javascript at all, and I have minimal experience with jQuery.

答:
This can be done with html. First, change your <button> tags to  tags

With the  tags, you can specify the href attribute as a div (or any element) to scroll to. So say you have an element:

You could rewrite your code as:

```<code>    <ul>
    <div class="row">
      <div class="col-md-4">
    <li><a href="#scroll-target" class="btn btn-block" style="margin-top: 5px;">Section1</button> </li>
      </div>
      <div class="col-md-4">
    <li><a href="#scroll-target" class="btn btn-block" style="margin-top: 5px;">Section2</button> </li>
        </div<
    </ul>
</code>```

And clicking on the buttons should take you to the #scroll-target div.

Also, I'm fairly certain the bootstrap styles will work just as well on  tags as they do on <button> tags with the same classes ('btn', 'btn-sm', 'btn-primary', etc.).

Body:
I've got 2 bootstrap buttons I need to be able to scroll down the page. One goes to one section, and the other goes to a section further down the page. What do I need to add to my <button> elements?

<button class="btn btn-block" style="margin-top: 5px;">Section1</button>

<button class="btn btn-block" style="margin-top: 5px;">Section2</button>

I don't know Javascript at all, and I have minimal experience with jQuery.

Body:
This can be done with html. First, change your <button> tags to <a> tags

With the <a> tags, you can specify the href attribute as a div (or any element) to scroll to. So say you have an element:

<div id="scroll-target"></div>

You could rewrite your code as:

    <ul>
    <div class="row">
      <div class="col-md-4">
    <li><a href="#scroll-target" class="btn btn-block" style="margin-top: 5px;">Section1</button> </li>
      </div>
      <div class="col-md-4">
    <li><a href="#scroll-target" class="btn btn-block" style="margin-top: 5px;">Section2</button> </li>
        </div<
    </ul>

And clicking on the buttons should take you to the #scroll-target div.

Also, I'm fairly certain the bootstrap styles will work just as well on <a> tags as they do on <button> tags with the same classes ('btn', 'btn-sm', 'btn-primary', etc.).


问:
How can I add Google scopes later?
I have an Angular 4 app that uses Firebase UI (web) with Google auth.  For our company staff users, I need to ask for more permission scopes than non-staff users. I don't necessarily need those extra scopes right away, though.

I'm thinking that the login screen will have a "staff login" checkbox that toggles the config.  However, the new firebaseui.auth.AuthUI(firebase.auth()) call has already been made.

Is it bad if I call ui.start() a second time with a different config?

Or: is there something I should make sure I do to cleanly dispose of
the prior AuthUI before creating a new one?

Or: (ideally) is there a way to simply force a prompt later for additional scopes, only when needed?

答:
You can re-render the widget with:

ui.reset();
ui.start('#firebaseui-container', myNewConfig);

Title: How can I add Google scopes later?


问:
Which PHP version is currently running 5.2.15 or 5.3.4?

           i often read official PHP website website.

on 9 Dec,2010 headlines was   PHP 5.2.15 Released! and

on 10 Dec,2010 headlines was  PHP 5.3.4 Released!

i m really confused that what means of two different headlines??
i think version order are may b wrong or what is this??please explain PHP GURU

please tell me what should i said when interviewer ask which version of php we works currently??

ONE MORE THING

so which version we need to use for safeside, is that 5.3.x or 5.2.x???

答: I would also be a bit careful about claiming a different version of PHP than what you actually know how to use. if you say you're using PHP 5.3 the next question very well may be (What functions have been deprecated in 5.3?)</p>


问:
Deployment to Google App Engine Flexible is failing from Intellij
I have an Application on Spring Boot that I am want to deploy to my GAE Flexible project.

I am using Google Cloud Tool's latest version for deployment using the Google Cloud Plugin for Intellij. But the deployment is failing with the following exception:

```Deploying '[2017-05-23 19:22:53] Maven build: backend_flexible. Project: healthy-dragon-168416. Version: 1'...
Created temporary staging directory: C:\Users\Digvijay\AppData\Local\Temp\gae-staging-healthy-dragon-1684162
You are about to deploy the following services:
 - healthy-dragon-168416/default/1 (from [C:\Users\Digvijay\AppData\Local\Temp\gae-staging-healthy-dragon-1684162\app.yaml])
     Deploying to URL: [https://healthy-dragon-168416.appspot.com]

If this is your first deployment, this may take a while...
...done.

Beginning deployment of service [default]...
Building and pushing image for service [default]
Started cloud build [fb9c1b45-37bd-44db-8a2c-e3d21ddccd66].
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/fb9c1b45-37bd-44db-8a2c-e3d21ddccd66?project=healthy-dragon-168416
----------------------------- REMOTE BUILD OUTPUT ------------------------------
starting build "fb9c1b45-37bd-44db-8a2c-e3d21ddccd66"

FETCHSOURCE
Fetching storage object: gs://staging.healthy-dragon-168416.appspot.com/asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest#1495547617343338
Copying gs://staging.healthy-dragon-168416.appspot.com/asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest#1495547617343338...
/ [0 files][    0.0 B/ 14.7 MiB]
/ [0 files][264.0 KiB/ 14.7 MiB]
-
- [0 files][  4.1 MiB/ 14.7 MiB]
\
\ [1 files][ 14.7 MiB/ 14.7 MiB]

Operation completed over 1 objects/14.7 MiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  17.42MB

Step 1/2 : FROM gcr.io/google_appengine/jetty
latest: Pulling from google_appengine/jetty
Digest: sha256:5c3886bb6ad2c7800df4f4c5ea08b96b9696c93b1cbe680e411f0d684c997183
Status: Downloaded newer image for gcr.io/google_appengine/jetty:latest
 ---> 2903b2805f30
Step 2/2 : ADD target.war $JETTY_BASE/webapps/root.war
 ---> e8b1c947eb72
Removing intermediate container 596e22679487
Successfully built e8b1c947eb72
Successfully tagged asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest
PUSH
Pushing asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest
The push refers to a repository [asia.gcr.io/healthy-dragon-168416/appengine/default.1]
995181bdf30b: Preparing
e5f61ed28c2e: Preparing
5f62410a1ff2: Preparing
48fda9d28da8: Preparing
a387774c7e67: Preparing
6fff2d1f2112: Preparing
2f65f91183d8: Preparing
a1375b417df0: Preparing
f029db0c96f4: Preparing
5c269b80652e: Preparing
52e854e7e519: Preparing
741cffb17349: Preparing
f84d6cd2c591: Preparing
eb2705dec5a9: Preparing
d26cbf1738a5: Preparing
6fff2d1f2112: Waiting
2f65f91183d8: Waiting
a1375b417df0: Waiting
f029db0c96f4: Waiting
5c269b80652e: Waiting
52e854e7e519: Waiting
741cffb17349: Waiting
f84d6cd2c591: Waiting
eb2705dec5a9: Waiting
d26cbf1738a5: Waiting
a387774c7e67: Layer already exists
e5f61ed28c2e: Layer already exists
5f62410a1ff2: Layer already exists
48fda9d28da8: Layer already exists
2f65f91183d8: Layer already exists
a1375b417df0: Layer already exists
6fff2d1f2112: Layer already exists
f029db0c96f4: Layer already exists
5c269b80652e: Layer already exists
52e854e7e519: Layer already exists
741cffb17349: Layer already exists
f84d6cd2c591: Layer already exists
d26cbf1738a5: Layer already exists
eb2705dec5a9: Layer already exists
995181bdf30b: Pushed
latest: digest: sha256:041f18c29d722d7fc66b033375ce002fbac5e013498cd2e96c3d4154c9b7220d size: 3462
DONE
--------------------------------------------------------------------------------

Updating service [default]...
......................................................................................................................................................................................................................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
    at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:452)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
    at org.eclipse.jetty.server.Server.start(Server.java:452)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.Server.doStart(Server.java:419)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
Caused by:
javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
    at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:183)
    at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
    at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:63)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:329)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1480)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1442)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
    at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:452)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
    at org.eclipse.jetty.server.Server.start(Server.java:452)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.Server.doStart(Server.java:419)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
2017-05-23 13:56:02.822:INFO:oejs.AbstractConnector:main: Started ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2017-05-23 13:56:02.822:INFO:oejs.Server:main: Started @9704ms
org.eclipse.jetty.server.Server@3ffc5af1 - STARTED
 += qtp1818402158{STARTED,10<=10<=200,i=7,q=0} - STARTED
 |   +- 16 qtp1818402158-16 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 20 qtp1818402158-20-acceptor-0@589c2f1c-ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} RUNNABLE @ sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
 |   +- 18 qtp1818402158-18 RUNNABLE @ sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
 |   +- 11 qtp1818402158-11 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 12 qtp1818402158-12-lowPrioritySelector BLOCKED @ org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:244) prio=1
 |   +- 13 qtp1818402158-13 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 19 qtp1818402158-19 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 14 qtp1818402158-14 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 15 qtp1818402158-15 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 17 qtp1818402158-17 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- jobs
 += org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@17ed40e0 - STARTED
 += org.eclipse.jetty.server.handler.HandlerCollection@175c2241[org.eclipse.jetty.server.handler.ContextHandlerCollection@5bf0d49[o.e.j.w.WebAppContext@520a3426{/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war}], org.eclipse.jetty.server.handler.DefaultHandler@5b7a5baa] - STARTED
 |   += org.eclipse.jetty.server.handler.ContextHandlerCollection@5bf0d49[o.e.j.w.WebAppContext@520a3426{/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war}] - STARTED
 |   |   +~ o.e.j.w.WebAppContext@520a3426{/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war} - FAILED
 |   += org.eclipse.jetty.server.handler.DefaultHandler@5b7a5baa - STARTED
 +- [org.eclipse.jetty.webapp.WebInfConfiguration, org.eclipse.jetty.webapp.WebXmlConfiguration, org.eclipse.jetty.webapp.MetaInfConfiguration, org.eclipse.jetty.webapp.FragmentConfiguration, org.eclipse.jetty.plus.webapp.EnvConfiguration, org.eclipse.jetty.plus.webapp.PlusConfiguration, org.eclipse.jetty.annotations.AnnotationConfiguration, org.eclipse.jetty.webapp.JettyWebXmlConfiguration]
 += org.eclipse.jetty.deploy.DeploymentManager@776aec5c - STARTED
 |   +~ org.eclipse.jetty.deploy.providers.WebAppProvider@1d296da - STARTED
 += ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   +~ org.eclipse.jetty.server.Server@3ffc5af1 - STARTED
 |   +~ qtp1818402158{STARTED,10<=10<=200,i=7,q=0} - STARTED
 |   +~ org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@17ed40e0 - STARTED
 |   +- org.eclipse.jetty.io.ArrayByteBufferPool@7c7a06ec
 |   += HttpConnectionFactory@4de8b406[HTTP/1.1] - STARTED
 |   |   +- HttpConfiguration@75d4a5c2{32768/8192,8192/8192,https://:443,[ForwardedRequestCustomizer@557caf28]}
 |   += org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@408d971b - STARTED
 |   |   += org.eclipse.jetty.io.ManagedSelector@6c6cb480 id=0 keys=0 selected=0 id=0
 |   |       +- sun.nio.ch.EPollSelectorImpl@411e07b3 keys=0
 |   +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:8080]
 |   +- qtp1818402158-20-acceptor-0@589c2f1c-ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
 += org.eclipse.jetty.server.handler.ErrorHandler@292b08d6 - STARTED
 +- {file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701, file:///opt/jetty-home/lib/servlet-api-3.1.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701}
 +- {file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701, file:///opt/jetty-home/lib/servlet-api-3.1.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701}
 +- {file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar=[jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/c-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/scriptfree.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/fmt-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/sql-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/c-1_1.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/permittedTaglibs.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/x-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/fmt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/sql.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/x.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/c.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/fn.tld], file:///opt/jetty-home/lib/servlet-api-3.1.jar=[]}
 |
 +> startJarLoader@4bf558aa
     +- file:/var/lib/jetty/resources/
     +- file:/opt/jetty-home/lib/servlet-api-3.1.jar
     +- file:/opt/jetty-home/lib/jetty-schemas-3.1.jar
     +- file:/opt/jetty-home/lib/jetty-http-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-server-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-xml-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-util-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-io-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-jndi-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jndi/javax.mail.glassfish-1.4.1.v201005082020.jar
     +- file:/opt/jetty-home/lib/jndi/javax.transaction-api-1.2.jar
     +- file:/opt/jetty-home/lib/jetty-security-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-servlet-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-webapp-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-plus-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-annotations-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/annotations/asm-5.1.jar
     +- file:/opt/jetty-home/lib/annotations/asm-commons-5.1.jar
     +- file:/opt/jetty-home/lib/annotations/javax.annotation-api-1.2.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.eclipse.jdt.core.compiler.ecj-4.4.2.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.eclipse.jetty.apache-jsp-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.mortbay.jasper.apache-el-8.5.9.1.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.5.9.1.jar
     +- file:/opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar
     +- file:/opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-spec-1.2.5.jar
     +- file:/opt/jetty-home/lib/jetty-deploy-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/setuid/jetty-setuid-java-1.0.3.jar
     +- file:/var/lib/jetty/lib/gcp/jetty9-base-0.1.0-SNAPSHOT.jar
     +- sun.misc.Launcher$AppClassLoader@18b4aac2
2017-05-23 13:56:02.866:WARN:oejx.XmlConfiguration:main:
java.lang.IllegalStateException: No Available Context
    at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
Caused by: java.lang.IllegalStateException: No Available Context
    at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    ... 7 more
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
Caused by: java.lang.IllegalStateException: No Available Context
    at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    ... 7 more

Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
       java -jar $JETTY_HOME/start.jar --help  # for more information

Failed to deploy '[2017-05-23 19:22:53] Maven build: backend_flexible. Project: healthy-dragon-168416. Version: 1': Deployment failed with exit code: 1
Please make sure that you are using the latest version of the Google Cloud SDK.
Run ''gcloud components update'' to update the SDK. (See: https://cloud.google.com/sdk/gcloud/reference/components/update.)
```

And, here is the deployment window I am presented with just before deploying:

Does anyone have any idea why this might be happening?

答:
It looks like it failed while trying to change your new version to the default service.  (And deleting your old version in the process).

There are a few things you can do to see if it is a problem with your code, or if its simply barfing on promoting your version.

You could try to increment the version number to 2, so that it isn't overriding the previous version.

You could try to manually stop/delete the version yourself in web console or using gcloud.

Set the version number higher, and uncheck the "promote this version" box.

If it has nothing to do with the promotion of your service, my best guess is that you're missing something in pom.xml/gradle that has to do with:

javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
    at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:183)

And... I just realized it might be a problem with your app.yaml, specifically what you set as the runtime : ???.  If you set the runtime to "java" it should be using java8/jetty 9 runtime which runs servlet 3.1.

Body:
I have an Application on Spring Boot that I am want to deploy to my GAE Flexible project.

I am using Google Cloud Tool's latest version for deployment using the Google Cloud Plugin for Intellij. But the deployment is failing with the following exception:

Deploying '[2017-05-23 19:22:53] Maven build: backend_flexible. Project: healthy-dragon-168416. Version: 1'...
Created temporary staging directory: C:\Users\Digvijay\AppData\Local\Temp\gae-staging-healthy-dragon-1684162
You are about to deploy the following services:
 - healthy-dragon-168416/default/1 (from [C:\Users\Digvijay\AppData\Local\Temp\gae-staging-healthy-dragon-1684162\app.yaml])
     Deploying to URL: [https://healthy-dragon-168416.appspot.com]

If this is your first deployment, this may take a while...
...done.

Beginning deployment of service [default]...
Building and pushing image for service [default]
Started cloud build [fb9c1b45-37bd-44db-8a2c-e3d21ddccd66].
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/fb9c1b45-37bd-44db-8a2c-e3d21ddccd66?project=healthy-dragon-168416
----------------------------- REMOTE BUILD OUTPUT ------------------------------
starting build "fb9c1b45-37bd-44db-8a2c-e3d21ddccd66"

FETCHSOURCE
Fetching storage object: gs://staging.healthy-dragon-168416.appspot.com/asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest#1495547617343338
Copying gs://staging.healthy-dragon-168416.appspot.com/asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest#1495547617343338...
/ [0 files][    0.0 B/ 14.7 MiB]
/ [0 files][264.0 KiB/ 14.7 MiB]
-
- [0 files][  4.1 MiB/ 14.7 MiB]
\
\ [1 files][ 14.7 MiB/ 14.7 MiB]

Operation completed over 1 objects/14.7 MiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  17.42MB

Step 1/2 : FROM gcr.io/google_appengine/jetty
latest: Pulling from google_appengine/jetty
Digest: sha256:5c3886bb6ad2c7800df4f4c5ea08b96b9696c93b1cbe680e411f0d684c997183
Status: Downloaded newer image for gcr.io/google_appengine/jetty:latest
 ---> 2903b2805f30
Step 2/2 : ADD target.war $JETTY_BASE/webapps/root.war
 ---> e8b1c947eb72
Removing intermediate container 596e22679487
Successfully built e8b1c947eb72
Successfully tagged asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest
PUSH
Pushing asia.gcr.io/healthy-dragon-168416/appengine/default.1:latest
The push refers to a repository [asia.gcr.io/healthy-dragon-168416/appengine/default.1]
995181bdf30b: Preparing
e5f61ed28c2e: Preparing
5f62410a1ff2: Preparing
48fda9d28da8: Preparing
a387774c7e67: Preparing
6fff2d1f2112: Preparing
2f65f91183d8: Preparing
a1375b417df0: Preparing
f029db0c96f4: Preparing
5c269b80652e: Preparing
52e854e7e519: Preparing
741cffb17349: Preparing
f84d6cd2c591: Preparing
eb2705dec5a9: Preparing
d26cbf1738a5: Preparing
6fff2d1f2112: Waiting
2f65f91183d8: Waiting
a1375b417df0: Waiting
f029db0c96f4: Waiting
5c269b80652e: Waiting
52e854e7e519: Waiting
741cffb17349: Waiting
f84d6cd2c591: Waiting
eb2705dec5a9: Waiting
d26cbf1738a5: Waiting
a387774c7e67: Layer already exists
e5f61ed28c2e: Layer already exists
5f62410a1ff2: Layer already exists
48fda9d28da8: Layer already exists
2f65f91183d8: Layer already exists
a1375b417df0: Layer already exists
6fff2d1f2112: Layer already exists
f029db0c96f4: Layer already exists
5c269b80652e: Layer already exists
52e854e7e519: Layer already exists
741cffb17349: Layer already exists
f84d6cd2c591: Layer already exists
d26cbf1738a5: Layer already exists
eb2705dec5a9: Layer already exists
995181bdf30b: Pushed
latest: digest: sha256:041f18c29d722d7fc66b033375ce002fbac5e013498cd2e96c3d4154c9b7220d size: 3462
DONE
--------------------------------------------------------------------------------

Updating service [default]...
......................................................................................................................................................................................................................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
    at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:452)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
    at org.eclipse.jetty.server.Server.start(Server.java:452)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.Server.doStart(Server.java:419)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
Caused by:
javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
    at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:183)
    at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
    at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:63)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:329)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1480)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1442)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
    at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:452)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
    at org.eclipse.jetty.server.Server.start(Server.java:452)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.Server.doStart(Server.java:419)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
2017-05-23 13:56:02.822:INFO:oejs.AbstractConnector:main: Started ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2017-05-23 13:56:02.822:INFO:oejs.Server:main: Started @9704ms
org.eclipse.jetty.server.Server@3ffc5af1 - STARTED
 += qtp1818402158{STARTED,10<=10<=200,i=7,q=0} - STARTED
 |   +- 16 qtp1818402158-16 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 20 qtp1818402158-20-acceptor-0@589c2f1c-ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} RUNNABLE @ sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
 |   +- 18 qtp1818402158-18 RUNNABLE @ sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
 |   +- 11 qtp1818402158-11 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 12 qtp1818402158-12-lowPrioritySelector BLOCKED @ org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:244) prio=1
 |   +- 13 qtp1818402158-13 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 19 qtp1818402158-19 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 14 qtp1818402158-14 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 15 qtp1818402158-15 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- 17 qtp1818402158-17 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 |   +- jobs
 += org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@17ed40e0 - STARTED
 += org.eclipse.jetty.server.handler.HandlerCollection@175c2241[org.eclipse.jetty.server.handler.ContextHandlerCollection@5bf0d49[o.e.j.w.WebAppContext@520a3426{/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war}], org.eclipse.jetty.server.handler.DefaultHandler@5b7a5baa] - STARTED
 |   += org.eclipse.jetty.server.handler.ContextHandlerCollection@5bf0d49[o.e.j.w.WebAppContext@520a3426{/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war}] - STARTED
 |   |   +~ o.e.j.w.WebAppContext@520a3426{/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war} - FAILED
 |   += org.eclipse.jetty.server.handler.DefaultHandler@5b7a5baa - STARTED
 +- [org.eclipse.jetty.webapp.WebInfConfiguration, org.eclipse.jetty.webapp.WebXmlConfiguration, org.eclipse.jetty.webapp.MetaInfConfiguration, org.eclipse.jetty.webapp.FragmentConfiguration, org.eclipse.jetty.plus.webapp.EnvConfiguration, org.eclipse.jetty.plus.webapp.PlusConfiguration, org.eclipse.jetty.annotations.AnnotationConfiguration, org.eclipse.jetty.webapp.JettyWebXmlConfiguration]
 += org.eclipse.jetty.deploy.DeploymentManager@776aec5c - STARTED
 |   +~ org.eclipse.jetty.deploy.providers.WebAppProvider@1d296da - STARTED
 += ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   +~ org.eclipse.jetty.server.Server@3ffc5af1 - STARTED
 |   +~ qtp1818402158{STARTED,10<=10<=200,i=7,q=0} - STARTED
 |   +~ org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@17ed40e0 - STARTED
 |   +- org.eclipse.jetty.io.ArrayByteBufferPool@7c7a06ec
 |   += HttpConnectionFactory@4de8b406[HTTP/1.1] - STARTED
 |   |   +- HttpConfiguration@75d4a5c2{32768/8192,8192/8192,https://:443,[ForwardedRequestCustomizer@557caf28]}
 |   += org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@408d971b - STARTED
 |   |   += org.eclipse.jetty.io.ManagedSelector@6c6cb480 id=0 keys=0 selected=0 id=0
 |   |       +- sun.nio.ch.EPollSelectorImpl@411e07b3 keys=0
 |   +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:8080]
 |   +- qtp1818402158-20-acceptor-0@589c2f1c-ServerConnector@d8355a8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
 += org.eclipse.jetty.server.handler.ErrorHandler@292b08d6 - STARTED
 +- {file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701, file:///opt/jetty-home/lib/servlet-api-3.1.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701}
 +- {file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701, file:///opt/jetty-home/lib/servlet-api-3.1.jar=org.eclipse.jetty.util.resource.EmptyResource@1a04f701}
 +- {file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar=[jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/c-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/scriptfree.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/fmt-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/sql-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/c-1_1.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/permittedTaglibs.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/x-1_0-rt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/fmt.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/sql.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/x.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/c.tld, jar:file:///opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar!/META-INF/fn.tld], file:///opt/jetty-home/lib/servlet-api-3.1.jar=[]}
 |
 +> startJarLoader@4bf558aa
     +- file:/var/lib/jetty/resources/
     +- file:/opt/jetty-home/lib/servlet-api-3.1.jar
     +- file:/opt/jetty-home/lib/jetty-schemas-3.1.jar
     +- file:/opt/jetty-home/lib/jetty-http-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-server-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-xml-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-util-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-io-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-jndi-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jndi/javax.mail.glassfish-1.4.1.v201005082020.jar
     +- file:/opt/jetty-home/lib/jndi/javax.transaction-api-1.2.jar
     +- file:/opt/jetty-home/lib/jetty-security-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-servlet-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-webapp-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-plus-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/jetty-annotations-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/annotations/asm-5.1.jar
     +- file:/opt/jetty-home/lib/annotations/asm-commons-5.1.jar
     +- file:/opt/jetty-home/lib/annotations/javax.annotation-api-1.2.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.eclipse.jdt.core.compiler.ecj-4.4.2.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.eclipse.jetty.apache-jsp-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.mortbay.jasper.apache-el-8.5.9.1.jar
     +- file:/opt/jetty-home/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.5.9.1.jar
     +- file:/opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar
     +- file:/opt/jetty-home/lib/apache-jstl/org.apache.taglibs.taglibs-standard-spec-1.2.5.jar
     +- file:/opt/jetty-home/lib/jetty-deploy-9.4.3.v20170317.jar
     +- file:/opt/jetty-home/lib/setuid/jetty-setuid-java-1.0.3.jar
     +- file:/var/lib/jetty/lib/gcp/jetty9-base-0.1.0-SNAPSHOT.jar
     +- sun.misc.Launcher$AppClassLoader@18b4aac2
2017-05-23 13:56:02.866:WARN:oejx.XmlConfiguration:main:
java.lang.IllegalStateException: No Available Context
    at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
Caused by: java.lang.IllegalStateException: No Available Context
    at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    ... 7 more
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:222)
    at org.eclipse.jetty.start.Main.start(Main.java:486)
    at org.eclipse.jetty.start.Main.main(Main.java:79)
Caused by: java.lang.IllegalStateException: No Available Context
    at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)
    ... 7 more

Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
       java -jar $JETTY_HOME/start.jar --help  # for more information

Failed to deploy '[2017-05-23 19:22:53] Maven build: backend_flexible. Project: healthy-dragon-168416. Version: 1': Deployment failed with exit code: 1
Please make sure that you are using the latest version of the Google Cloud SDK.
Run ''gcloud components update'' to update the SDK. (See: https://cloud.google.com/sdk/gcloud/reference/components/update.)

And, here is the deployment window I am presented with just before deploying:

Does anyone have any idea why this might be happening?


问:
Progressive Web App in Chrome Custom Tab
I am building a Progressive Web App. When I open it in the Chrome browser, I correctly see the "add to home screen" option come up in a bottom sheet. However, when I open my app in a Chrome Custom tab, the "add to home screen" bottom sheet is not appearing.

Does anyone know if Chrome Custom tabs supports the Progressive Web Apps manifest?

Update: I've filed a bug against Chromium for this issue https://bugs.chromium.org/p/chromium/issues/detail?id=731171#c2

答:
Chrome Custom Tabs has the ability to show an "Add to Homescreen" menu item, at least in recent builds of Chrome.

I can confirm that manually selecting the "Add to Homescreen" menu item will make use of the web app manifest data when creating the homescreen item.

However, I don't believe that the logic for automatically triggering the Web App Install Banner is enabled for page views with Chrome Custom Tab at this time—I experimented a bit and never got the banner to appear, at least.


问:
T-SQL: how do I query a table that results in a list of the fields that have NULLS
I'm looking to set up an array of data quality scripts on a new set of data that my group is getting. One of the issues I'd like to keep track of is maintaining a list of fields that contain nulls. Some fields that's ok, others it is not, although we don't want to block the bulk insert because we've not allowed certain fields to null.

Example:

```<code>SELECT [columns]
FROM [TABLE] T
WHERE [columns] CONTAINS NULLS
</code>```

答:
You could use something like this in a function to loop thru all of the columns and see if there is a count of null values in the table. The code is kind of brute force but it would work. </p>

```<code>declare @tablename nvarchar(255) = 'schema.tablename'

declare @results table (ColumnName nvarchar(255))

/* Declare the Variables to be used in the cusor*/
declare @column_name nvarchar(255)

/* Declare the cursor and the value set that will be used*/
declare tbl_Crawler cursor
    for SELECT name FROM sys.columns
        WHERE object_id = OBJECT_ID(@tablename)

/* Make the Cursor Available*/
open tbl_Crawler

/*Load the first row into the variables (must match sequence in cursor select)*/
fetch next from tbl_Crawler
    into @column_name

/*Creates While loop that will run until the curor is empty*/
while @@fetch_status = 0
    begin

/*statement to be run every loop of the cursor*/

    DECLARE @sqlCommand nvarchar(1000)

    declare @counts int

    SET @sqlCommand = 'SELECT @cnt=COUNT(*) FROM '+@tablename+' WHERE '+ @column_name + '  is null'
    EXECUTE sp_executesql @sqlCommand, N'@cnt int OUTPUT',  @cnt=@counts OUTPUT

    if (isnull(@counts,0) > 0)
        insert into @results
        select @column_name

/*Loads the next row of records into the variables (must match sequence in cursor select)*/
    fetch next from tbl_Crawler
        into @column_name
    end
/*Release the cursor so that it is not retained in memory*/
close tbl_Crawler
deallocate tbl_Crawler

/* if in function return @results*/
    select * from @results
</code>```

Body:
I'm looking to set up an array of data quality scripts on a new set of data that my group is getting. One of the issues I'd like to keep track of is maintaining a list of fields that contain nulls. Some fields that's ok, others it is not, although we don't want to block the bulk insert because we've not allowed certain fields to null.

Example:

SELECT [columns]
FROM [TABLE] T
WHERE [columns] CONTAINS NULLS

Body:
You could use something like this in a function to loop thru all of the columns and see if there is a count of null values in the table. The code is kind of brute force but it would work.

declare @tablename nvarchar(255) = 'schema.tablename'

declare @results table (ColumnName nvarchar(255))

/* Declare the Variables to be used in the cusor*/
declare @column_name nvarchar(255)

/* Declare the cursor and the value set that will be used*/
declare tbl_Crawler cursor
    for SELECT name FROM sys.columns
        WHERE object_id = OBJECT_ID(@tablename)

/* Make the Cursor Available*/
open tbl_Crawler

/*Load the first row into the variables (must match sequence in cursor select)*/
fetch next from tbl_Crawler
    into @column_name

/*Creates While loop that will run until the curor is empty*/
while @@fetch_status = 0
    begin

/*statement to be run every loop of the cursor*/

    DECLARE @sqlCommand nvarchar(1000)

    declare @counts int

    SET @sqlCommand = 'SELECT @cnt=COUNT(*) FROM '+@tablename+' WHERE '+ @column_name + '  is null'
    EXECUTE sp_executesql @sqlCommand, N'@cnt int OUTPUT',  @cnt=@counts OUTPUT

    if (isnull(@counts,0) > 0)
        insert into @results
        select @column_name

/*Loads the next row of records into the variables (must match sequence in cursor select)*/
    fetch next from tbl_Crawler
        into @column_name
    end
/*Release the cursor so that it is not retained in memory*/
close tbl_Crawler
deallocate tbl_Crawler

/* if in function return @results*/
    select * from @results


问:
SSRS Conditional Border Report
I have report as table component. I want to apply the following logic:

If value INCID is not null, the border should be "Solid" (meaning it should have border),

If value INCID is null, the border should be "None" (meaning the table should have no border).

I used =IIf(IsNothing(Fields!INCID.Value) = 1,"Solid","None") but it doesn't work. Where could be the problem? If I apply this and save this settings and then go back to the expression, it is not saved.

答:
3 Years late, but my answer was different and maybe will help someone else one day.

I was able to make the expression work by entering it into the BorderStyle Properties.

Click on a given cell > Open Properties > Expand BorderStyle > Choose desired Side of Cell > Enter iif expression.

For example the following worked for me:

```<code>=iif(MAX(Fields!DistinctDevicecount.Value) > 1, "Solid", "None")
</code>```

Title: SSRS Conditional Border Report

Body:
3 Years late, but my answer was different and maybe will help someone else one day.

I was able to make the expression work by entering it into the BorderStyle Properties.

Click on a given cell > Open Properties > Expand BorderStyle > Choose desired Side of Cell > Enter iif expression.

For example the following worked for me:

=iif(MAX(Fields!DistinctDevicecount.Value) > 1, "Solid", "None")


问:
Delphi DataSnap Rest
I'm running some Datasnap tests with REST and json.

There in Unit ServerMethods, which Delphi itself creates, has the "ReverseString" function, but well, how do I know who sent it?

I would like to keep a log of information from the clients who called this method.

I know it could be passed as a parameter, but it would be the responsibility of the client to pass this information to me, which I do not want, let's say the method would be public and several clients would be triggering this information. I can easily lose this control, if I do not get the information directly by the control of the server.

I found on the web, that in the ServerConteiner unit, has a "DSServer" object, this object has an event called "OnConnect", so it can get the following sa data:

```<code>Procedure TServerContainer1.DSServer1Connect (
  DSConnectEventObject: TDSConnectEventObject);
Begin
  DSConnectEventObject.ChannelInfo.ClientInfo.IpAddress;
  DSConnectEventObject.ChannelInfo.ClientInfo.ClientPort;
  DSConnectEventObject.ChannelInfo.ClientInfo.Protocol;
  DSConnectEventObject.ChannelInfo.ClientInfo.AppName;
End;
</code>```

But I am not able to find how there in ServerMethods.ReverseString I can get this data ...

I believe that the processing is in thread on the server, so I can not pass this value as global, because it can pick up information from other simultaneous connections.

In the method, ReverseString, I tried as follows:

```<code>Var
    ADSServerClass: TDSServerClass;
Begin
  ADSServerClass: = TDSServerClass (GetOwner);
  TDSServer (ADSServerClass.Server). ???
  // I got to the server, but I can not find it, and I do not know if it is this way to find the data of who is requesting me to execute the ReverseString
End;
</code>```

答:
Regards,

solution:

Delphi XE5 Rest Datasnap Server. Getting Client IP Address

```<code>var
  Session: TDSSession;
  Protocol, IpAddress, AppName: string;
begin
  Session := TDSSessionManager.GetThreadSession;
  Protocol := Session.GetData('CommunicationProtocol');
  IpAddress := Session.GetData('RemoteIP');
  AppName := Session.GetData('RemoteAppName');
end;
</code>```

Title: Delphi DataSnap Rest

Body:
I'm running some Datasnap tests with REST and json.

There in Unit ServerMethods, which Delphi itself creates, has the "ReverseString" function, but well, how do I know who sent it?

I would like to keep a log of information from the clients who called this method.

I know it could be passed as a parameter, but it would be the responsibility of the client to pass this information to me, which I do not want, let's say the method would be public and several clients would be triggering this information. I can easily lose this control, if I do not get the information directly by the control of the server.

I found on the web, that in the ServerConteiner unit, has a "DSServer" object, this object has an event called "OnConnect", so it can get the following sa data:

Procedure TServerContainer1.DSServer1Connect (
  DSConnectEventObject: TDSConnectEventObject);
Begin
  DSConnectEventObject.ChannelInfo.ClientInfo.IpAddress;
  DSConnectEventObject.ChannelInfo.ClientInfo.ClientPort;
  DSConnectEventObject.ChannelInfo.ClientInfo.Protocol;
  DSConnectEventObject.ChannelInfo.ClientInfo.AppName;
End;

But I am not able to find how there in ServerMethods.ReverseString I can get this data ...

I believe that the processing is in thread on the server, so I can not pass this value as global, because it can pick up information from other simultaneous connections.

In the method, ReverseString, I tried as follows:

Var
    ADSServerClass: TDSServerClass;
Begin
  ADSServerClass: = TDSServerClass (GetOwner);
  TDSServer (ADSServerClass.Server). ???
  // I got to the server, but I can not find it, and I do not know if it is this way to find the data of who is requesting me to execute the ReverseString
End;

Body:
Regards,

solution:

Delphi XE5 Rest Datasnap Server. Getting Client IP Address

var
  Session: TDSSession;
  Protocol, IpAddress, AppName: string;
begin
  Session := TDSSessionManager.GetThreadSession;
  Protocol := Session.GetData('CommunicationProtocol');
  IpAddress := Session.GetData('RemoteIP');
  AppName := Session.GetData('RemoteAppName');
end;


问:
How to show opaque background on jQuery click event
In order to show an opaque background or animated gif while executing some method after an button click fails to show this. It only runs after all the code has been executed.

Can I do this in jQuery, i.e. on a click event render html changes before and after main code.

The long running method is adding 100-500 divs to the page that takes about 10 seconds to finish.

```
$('#button).click(function() {
    $('#curtain').css('visibility', 'visible');
    longRunningMethod();
    $('#curtain').css('visibility', 'hidden');
 });
```

The problem is that the #curtain div never shows, as the complete javascript has to be executed before rendering all the changes.

Style:

```

#curtain {
    position: fixed;
    _position: absolute;
    z-index: 99;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    _height: expression(document.body.offsetHeight + "px");
    background-color: #CCCCCC;
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
    visibility: hidden;
}

```

答:
This is kind of a hack, but if you use setTimeout it might work.</p>

```<code>$('#button').click(function() {
    $('#curtain').css('visibility', 'visible');
    setTimeout(doBigJob, 100);
 });

function doBigJob()
{
    longRunningMethod();
    $('#curtain').css('visibility', 'hidden');
}
</code>```

Body:
In order to show an opaque background or animated gif while executing some method after an button click fails to show this. It only runs after all the code has been executed.

Can I do this in jQuery, i.e. on a click event render html changes before and after main code.

The long running method is adding 100-500 divs to the page that takes about 10 seconds to finish.

$('#button).click(function() {
    $('#curtain').css('visibility', 'visible');
    longRunningMethod();
    $('#curtain').css('visibility', 'hidden');
 });

The problem is that the #curtain div never shows, as the complete javascript has to be executed before rendering all the changes.

Style:

#curtain {
    position: fixed;
    _position: absolute;
    z-index: 99;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    _height: expression(document.body.offsetHeight + "px");
    background-color: #CCCCCC;
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
    visibility: hidden;
}

Body:
This is kind of a hack, but if you use setTimeout it might work.

$('#button').click(function() {
    $('#curtain').css('visibility', 'visible');
    setTimeout(doBigJob, 100);
 });

function doBigJob()
{
    longRunningMethod();
    $('#curtain').css('visibility', 'hidden');
}