问:
How to find maximum points between different classes (counting sorting)
I'm studying counting and sorting. I have a problem with this task:

Some people participate in math competition. Winner is a person with
  the biggest amount of points reached (winners are distributed for each
  grade). Find the value of max points reached for each grade. In each
  grade takes part one person or more

INPUT

Information about all participants in a file ('input.txt', for example) where each line is supposed to have this structure:

```<code>family_name name grade result
</code>```

Family name and name should be written as a string, grades are in
  range 10 to 12, results (points) are in range 0 to 100.

OUTPUT

Print three numbers: points of each winner of 10th, 11th and 12th grades. Inner file is supposed to be written in this way:

```<code>open('input.txt', 'r', encoding='utf8')
</code>```

I have already solved this task but I didn't use counting sorting.
Here is full code

def listAverage(list):
    sum = 0
    for i in list:
        sum += i
    return sum / len(list)
classes = []
inFile = open('input.txt', 'r', encoding='utf-8')
for line in inFile:
    grade, mark = line.split()[2:]
    if grade in classes:
        classes[grade].append(int(mark))
    else:
        classes[grade] = [int(mark)]
for i in range(10, 13):
    print(listAverage(classes[str(i)]), end=' ')
```

答:
A few observations:

don't use variable that shadow built-in names; for example list should not be used, rather use num_list or something similar.

you should always close files that you open. I suggest using a context manager (with open() as f:) to avoid forgetting to close files.

a shorter version the calculate the average would be sum(num_list) / len(num_list)
(raises error if list is empty; see also this question)

Here is a modified version of your code to address some issues; I also included a few suggestions (for example collections.defaultdict).

Maybe this helps you (or maybe not).

```<code>import collections
marks_per_grade = collections.defaultdict(list)

with open('input.txt', 'r', encoding='utf-8') as f:
    for line in f:
        line = line.strip()             # remove newline from the end of the line

        if len(line) > 0:               # assure that the line is not empty
            last_name, first_name, grade, mark = line.split()

            # because it is a 'collections.defaultdict', if the grade does not
            # yet exist, then it will add it with an empty list as initial value
            marks_per_grade[int(grade)].append(int(mark))

for grade, mark_list in sorted(marks_per_grade.items()):
    # this will raise error if the list is empty
    avg_mark = sum(mark_list) / len(mark_list)

    print(
        '{:3d} {:3d} {:5.1f} {}'.format(
            grade,
            max(mark_list),
            avg_mark,
            mark_list))
</code>```

Body:
I'm studying counting and sorting. I have a problem with this task:

Some people participate in math competition. Winner is a person with
  the biggest amount of points reached (winners are distributed for each
  grade). Find the value of max points reached for each grade. In each
  grade takes part one person or more

INPUT

Information about all participants in a file ('input.txt', for example) where each line is supposed to have this structure:

family_name name grade result

Family name and name should be written as a string, grades are in
  range 10 to 12, results (points) are in range 0 to 100.

OUTPUT

Print three numbers: points of each winner of 10th, 11th and 12th grades. Inner file is supposed to be written in this way:

open('input.txt', 'r', encoding='utf8')

I have already solved this task but I didn't use counting sorting.
Here is full code

def listAverage(list):
    sum = 0
    for i in list:
        sum += i
    return sum / len(list)
classes = []
inFile = open('input.txt', 'r', encoding='utf-8')
for line in inFile:
    grade, mark = line.split()[2:]
    if grade in classes:
        classes[grade].append(int(mark))
    else:
        classes[grade] = [int(mark)]
for i in range(10, 13):
    print(listAverage(classes[str(i)]), end=' ')

Body:
A few observations:

don't use variable that shadow built-in names; for example list should not be used, rather use num_list or something similar.

you should always close files that you open. I suggest using a context manager (with open() as f:) to avoid forgetting to close files.

a shorter version the calculate the average would be sum(num_list) / len(num_list)
(raises error if list is empty; see also this question)

Here is a modified version of your code to address some issues; I also included a few suggestions (for example collections.defaultdict).

Maybe this helps you (or maybe not).

import collections
marks_per_grade = collections.defaultdict(list)

with open('input.txt', 'r', encoding='utf-8') as f:
    for line in f:
        line = line.strip()             # remove newline from the end of the line

        if len(line) > 0:               # assure that the line is not empty
            last_name, first_name, grade, mark = line.split()

            # because it is a 'collections.defaultdict', if the grade does not
            # yet exist, then it will add it with an empty list as initial value
            marks_per_grade[int(grade)].append(int(mark))

for grade, mark_list in sorted(marks_per_grade.items()):
    # this will raise error if the list is empty
    avg_mark = sum(mark_list) / len(mark_list)

    print(
        '{:3d} {:3d} {:5.1f} {}'.format(
            grade,
            max(mark_list),
            avg_mark,
            mark_list))


来源: stackexchange

问:
How do I display the contents of local Storage after button click without refreshing the page?
I want the contents of the local Storage to be displayed when the submit button is clicked without having to refresh the page. I don't see the changes made until I manually refresh the page

This function handles the page load. When a button is clicked it shows wrong data. The correct data is only shown when the page is manually refreshed.

```<code>const loadData = () =>
  document.querySelector('body').addEventListener('load', displayStorage());
</code>```

This is the event listener that handles saving:

```<code>notesForm.addEventListener('submit', e => {
  e.preventDefault();
  const save = (sid, spost, sdate) => {
    const obj = { id: sid, post: spost, date: sdate };
    localStorage.setItem(`${sid}`, JSON.stringify(obj));
  };
  save(generateId(), post.value, dateFormat());
  loadData();
});
</code>```

答:
try providing the function as a handler to be invoked by the load event. Not invoke it by yourself

```<code>const loadData = () =>
  document.querySelector('body').addEventListener('load', displayStorage);
</code>```

You can try reloading the page by yourself using location.reload

```<code>notesForm.addEventListener('submit', e => {
  e.preventDefault();
  const save = (sid, spost, sdate) => {
    const obj = { id: sid, post: spost, date: sdate };
    localStorage.setItem(`${sid}`, JSON.stringify(obj));
  };
  save(generateId(), post.value, dateFormat());
  loadData();
  location.reload()
});
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I want the contents of the local Storage to be displayed when the submit button is clicked without having to refresh the page. I don't see the changes made until I manually refresh the page

This function handles the page load. When a button is clicked it shows wrong data. The correct data is only shown when the page is manually refreshed.

const loadData = () =>
  document.querySelector('body').addEventListener('load', displayStorage());

This is the event listener that handles saving:

notesForm.addEventListener('submit', e => {
  e.preventDefault();
  const save = (sid, spost, sdate) => {
    const obj = { id: sid, post: spost, date: sdate };
    localStorage.setItem(`${sid}`, JSON.stringify(obj));
  };
  save(generateId(), post.value, dateFormat());
  loadData();
});

Body:
try providing the function as a handler to be invoked by the load event. Not invoke it by yourself

const loadData = () =>
  document.querySelector('body').addEventListener('load', displayStorage);

You can try reloading the page by yourself using location.reload

notesForm.addEventListener('submit', e => {
  e.preventDefault();
  const save = (sid, spost, sdate) => {
    const obj = { id: sid, post: spost, date: sdate };
    localStorage.setItem(`${sid}`, JSON.stringify(obj));
  };
  save(generateId(), post.value, dateFormat());
  loadData();
  location.reload()
});


问:
Unable to invoke mixin module method in spec
I have the following module:

```<code># lib/translator/sms_command.rb
module Translator
  module SmsCommand
    def self.included(klass)
      puts "SmsCommand initialized in #{klass}"
    end
    def alias_command(name)

    end
  end
end
</code>```

And the following spec:

```<code># spec/translator/sms_command_spec.rb
require 'spec_helper'

class ExampleCommand
  include Translator::SmsCommand
  alias_command :x
end

module Translator
  describe SmsCommand do
    describe "#alias_command" do
      it "registers the class with the command registry" do
        Translator::SmsCommand.command_registry.should include_key :x
      end

    end
  end
end
</code>```

Yes #alias_command does nothing at this stage but that's because I'm in the midst of developing it.  However, when I run my spec I am seeing...

```<code>SmsCommand initialized in ExampleCommand
</code>```

so the module is certainly being mixed in, however the spec barfs on the alias_command :x line in the ExampleCommand as if the alias_command method is never becoming available.

```<code>/spec/translator/sms_command_spec.rb:5:in `<class:ExampleCommand>': undefined method `alias_command' for ExampleCommand:Class (NoMethodError)
</code>```

I could solve this problem through inheritance though I'd prefer the mixin module.  What am I missing?

答:
It's because it's not an include but an extend to access alias_command in your Class method</p>

```<code>class ExampleCommand
  extend Translator::SmsCommand
  alias_command :x
end
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have the following module:

# lib/translator/sms_command.rb
module Translator
  module SmsCommand
    def self.included(klass)
      puts "SmsCommand initialized in #{klass}"
    end
    def alias_command(name)

    end
  end
end

And the following spec:

# spec/translator/sms_command_spec.rb
require 'spec_helper'

class ExampleCommand
  include Translator::SmsCommand
  alias_command :x
end

module Translator
  describe SmsCommand do
    describe "#alias_command" do
      it "registers the class with the command registry" do
        Translator::SmsCommand.command_registry.should include_key :x
      end

    end
  end
end

Yes #alias_command does nothing at this stage but that's because I'm in the midst of developing it.  However, when I run my spec I am seeing...

SmsCommand initialized in ExampleCommand

so the module is certainly being mixed in, however the spec barfs on the alias_command :x line in the ExampleCommand as if the alias_command method is never becoming available.

/spec/translator/sms_command_spec.rb:5:in `<class:ExampleCommand>': undefined method `alias_command' for ExampleCommand:Class (NoMethodError)

I could solve this problem through inheritance though I'd prefer the mixin module.  What am I missing?

Body:
It's because it's not an include but an extend to access alias_command in your Class method

class ExampleCommand
  extend Translator::SmsCommand
  alias_command :x
end


问:
SVG animation diagonal viewbox
I want to be able to make a design like this:

https://www.reddit.com/r/webdev/comments/bromkj/ello_everyone_this_is_a_ui_i_made_in_adobe_xd/

You can find my site at: El Paso Texas Graphic Design and Web Design | Desert Sun Studio

It's basic set up is having two fixed SVG's on different z-indexes on top of a orange HTML and body.

html, body{
  margin: 0;
  padding: 0;
  font-family: "Oxygen", "Arial", sans-serif;
  background-color: #A36D00;
}

#left-panel{
  position: fixed;
  z-index: 3;
  animation-name: left-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}

#right-panel{
  position: fixed;
  z-index: 4;
  animation-name: right-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}
```

<p>You can see that the SVG's are masked as a rectangle when this animation runs:</p>

<pre class="lang-css prettyprint-override"><code>@keyframes right-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(15%, 10%);}
}

@keyframes left-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(-15%, -10%);}
}
</code>```

However you can see that I have my black square on my SVG's much larger than the artboard.

I was wondering if there was anything I can do to this code to make the SVG's run all the way across the screen diagonally, specifically to the viewbox:

```<code><svg version="1.1" id="ab9dac86-5d7c-460b-b35e-9ae3db46aedc"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1920 1080"
     style="enable-background:new 0 0 1920 1080;" xml:space="preserve">
</code>```

答:
```<code>@keyframes right-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(15%, 10%);}
}

@keyframes left-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(-15%, -10%);}
}

.left-panelmove{
  animation-name: left-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}

.right-panelmove{
  animation-name: right-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}
</code>```

i moved the @keyframes and class to appropriate SVG (left and right) inside the SVG style tag and it worked perfectly.

Title: SVG animation diagonal viewbox

Body:
I want to be able to make a design like this:

https://www.reddit.com/r/webdev/comments/bromkj/ello_everyone_this_is_a_ui_i_made_in_adobe_xd/

You can find my site at: El Paso Texas Graphic Design and Web Design | Desert Sun Studio

It's basic set up is having two fixed SVG's on different z-indexes on top of a orange HTML and body.

html, body{
  margin: 0;
  padding: 0;
  font-family: "Oxygen", "Arial", sans-serif;
  background-color: #A36D00;
}

#left-panel{
  position: fixed;
  z-index: 3;
  animation-name: left-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}

#right-panel{
  position: fixed;
  z-index: 4;
  animation-name: right-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}

You can see that the SVG's are masked as a rectangle when this animation runs:

@keyframes right-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(15%, 10%);}
}

@keyframes left-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(-15%, -10%);}
}

However you can see that I have my black square on my SVG's much larger than the artboard.

I was wondering if there was anything I can do to this code to make the SVG's run all the way across the screen diagonally, specifically to the viewbox:

<svg version="1.1" id="ab9dac86-5d7c-460b-b35e-9ae3db46aedc"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1920 1080"
     style="enable-background:new 0 0 1920 1080;" xml:space="preserve">

Body:
@keyframes right-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(15%, 10%);}
}

@keyframes left-panelmove {
    from {transform: translate(0, 0);}
    to {transform: translate(-15%, -10%);}
}

.left-panelmove{
  animation-name: left-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}

.right-panelmove{
  animation-name: right-panelmove;
  animation-duration: 200ms;
  animation-fill-mode: forwards;
  animation-delay: 500ms;
}

i moved the @keyframes and class to appropriate SVG (left and right) inside the SVG style tag and it worked perfectly.


问:
How to get an element's int value from a String matrix?
I would like to get an element's int value from a String matrix.

My task is to implement the easiest version of Uniqual (https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/unequal.html) with some kind of tree or graph search algorithm.

That's why I thought of implementing the table as a string, as it can contain both characters and digits.

I have already tried this method:
Character.isDigit(matrix[i].charAt(j))
for my issue. I guess it's not the correct way to do so.
Maybe if I get the element's char value, I could implement a simple function that checks whether it is a number or a digit or special char.

答:
Character.isDigit(matrix[i].charAt(j)) just tells you if the character is a digit character. To get the value from the character, simply subtract 0's character value

```<code>int val = (int) (matrix[i].charAt(j) - (int)'0');
</code>```

Body:
Character.isDigit(matrix[i].charAt(j)) just tells you if the character is a digit character. To get the value from the character, simply subtract 0's character value

int val = (int) (matrix[i].charAt(j) - (int)'0');


问:
UIActivityViewController: access the navigation items to change color of presented view
I am changing a project colors and this old orange color not changed on UIActivityViewController button. I want to change button color orange to white.
This look is when user press the share button and select "Add to Notes" button. How can I access these buttons and change colors?

First problem solved. This code is working on buttons:

```<code>UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white
</code>```

When I click to "New Note" this look is came. How can I change the title color on this view?
I want to change this title color black to white.

This is my sharing code and I was trying every bar tint color code.

```<code>func shareLink(_ link: String) {
    let activityViewController = UIActivityViewController(activityItems: [link], applicationActivities: nil)

    activityViewController.navigationController?.navigationBar.barTintColor = .white
    activityViewController.navigationController?.navigationBar.tintColor = .white
    activityViewController.tabBarController?.navigationItem.backBarButtonItem?.tintColor = .white
    activityViewController.tabBarController?.navigationController?.navigationBar.tintColor = .white

    self.present(activityViewController, animated: true)
}
</code>```

Also I tried adding some code on AppDelegate in didFinishLaunchingWithOptions function

```<code>UINavigationBar.appearance().tintColor = .white
UIApplication.shared.keyWindow?.tintColor = .white
</code>```

答:
Ok. These buttons are not accessible. So I solved the problem as follows:

It's for all UINavigationBar buttons:

```<code>UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white
</code>```

It's for all UINavigationBar titles:

```<code>UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
</code>```

Body:
I am changing a project colors and this old orange color not changed on UIActivityViewController button. I want to change button color orange to white.
This look is when user press the share button and select "Add to Notes" button. How can I access these buttons and change colors?

First problem solved. This code is working on buttons:

UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white

When I click to "New Note" this look is came. How can I change the title color on this view?
I want to change this title color black to white.

This is my sharing code and I was trying every bar tint color code.

func shareLink(_ link: String) {
    let activityViewController = UIActivityViewController(activityItems: [link], applicationActivities: nil)

    activityViewController.navigationController?.navigationBar.barTintColor = .white
    activityViewController.navigationController?.navigationBar.tintColor = .white
    activityViewController.tabBarController?.navigationItem.backBarButtonItem?.tintColor = .white
    activityViewController.tabBarController?.navigationController?.navigationBar.tintColor = .white

    self.present(activityViewController, animated: true)
}

Also I tried adding some code on AppDelegate in didFinishLaunchingWithOptions function

UINavigationBar.appearance().tintColor = .white
UIApplication.shared.keyWindow?.tintColor = .white

Body:
Ok. These buttons are not accessible. So I solved the problem as follows:

It's for all UINavigationBar buttons:

UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white

It's for all UINavigationBar titles:

UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]


问:
SSRS ReportViewer Web Control - How to not show the "WaitControl" at all when rendering as Async?
I'm using the latest (2010) ReportViewer Web Control in an ASP.NET 4 project. My client wants me to suppress / hide the initial "Loading" message that gets displayed while the report is being fetched.

Yeah... I know... why hide information that tells you what's going on? But, the client wants what the client wants.

I know that if you use the report viewer control with AsyncRendering=False that you can then set the WaitControlDisplayAfter property to a ridiculously long value.

Unfortunately, I need to have AsyncRendering=True (showing multiple reports on a type of Dashboard thingy). This (according to MSDN http://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.reportviewer.waitcontroldisplayafter.aspx see Remarks section) will mean that the "Wait Control" will always show. (Grr-r-rr!)

So the question is, how to I not show this control using async rendering?

(An aside question the client asked me, was that they wanted to see a cached copy of the report while it's loading an updated one - any takers on this one?)

Thanks,
Jaans

答:
I found a way to hide the loading message by manipulating the DOM with jQuery.  Adding the following script to the page with the reportviewer did the trick:</p>

```<code><script type="text/javascript">
    $(function () {
        var waitMsg = $("div[id$='AsyncWait_Wait']");
        waitMsg.wrap("<div style='display:none; visibility: hidden'></div>");
    });
</script>
</code>```

ContentLicense: CC BY-SA 2.5

Body:
I found a way to hide the loading message by manipulating the DOM with jQuery.  Adding the following script to the page with the reportviewer did the trick:

<script type="text/javascript">
    $(function () {
        var waitMsg = $("div[id$='AsyncWait_Wait']");
        waitMsg.wrap("<div style='display:none; visibility: hidden'></div>");
    });
</script>


问:
drupal database error (layout_builder module Update fix_tempstore_keys Failed:)
How to solve this issue in drupal 8?
layout_builder module
Update fix_tempstore_keys

Failed: Drupal\Component\Plugin\Exception\ContextException: The
  view_mode context is not a valid context. in
  Drupal\Component\Plugin\ContextAwarePluginBase->getContextDefinition()
  (line 92 of
  /home/t8f7rclkg1a0/public_html/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php).

答: you can remove tempstore.shared.layout_builder.section_storage.overrides row from key_value_expire table. It just indicates that you have started modifying some layout builder template, but didn't save the override yet. And Drupal update tries to fix it and fails.


问:
Unable to connect Spring boot to consulMesos server
Declared all the consul properties in boostrap.properties. Trying to run the application it fails to shutdown.

```2019-05-07 14:49:34.323  INFO 12423 --- [  restartedMain] o.s.i.endpoint.EventDrivenConsumer       : started _org.springframework.integration.errorLogger
2019-05-07 14:49:35.054  INFO 12423 --- [  restartedMain] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='consul', propertySources=[ConsulPropertySource {name='config/dataReflectorApp,cloud-dev/'}, ConsulPropertySource {name='config/dataReflectorApp/'}, ConsulPropertySource {name='config/application,cloud-dev/'}, ConsulPropertySource {name='config/application/'}]}
2019-05-07 14:50:31.823  WARN 12423 --- [  restartedMain] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
2019-05-07 14:50:31.826  INFO 12423 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-07 14:50:31.840 ERROR 12423 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1754) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:291) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.doGetBinder(DefaultBinderFactory.java:192) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:130) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:337) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:229) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindableProxyFactory.createAndBindOutputs(BindableProxyFactory.java:287) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) ~[na:1.8.0_211]
    at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:48) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.rccl.ncp.datareflector.DataReflectorApplication.main(DataReflectorApplication.java:14) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.1.3.RELEASE.jar:2.1.3.RELEASE]
Caused by: com.ecwid.consul.v1.OperationException: OperationException(statusCode=404, statusMessage='Not Found', statusContent='')
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:76) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:63) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.ConsulClient.eventList(ConsulClient.java:423) ~[consul-api-1.4.1.jar:na]
    at org.springframework.cloud.consul.binder.EventService.getEventsResponse(EventService.java:80) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.cloud.consul.binder.EventService.init(EventService.java:59) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 45 common frames omitted

2019-05-07 14:50:31.843  WARN 12423 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
2019-05-07 14:50:31.846  INFO 12423 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'configWatchTaskScheduler'
2019-05-07 14:50:31.847  INFO 12423 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'catalogWatchTaskScheduler'
2019-05-07 14:50:31.877  INFO 12423 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2019-05-07 14:50:31.879  INFO 12423 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'taskScheduler'
2019-05-07 14:50:31.881  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: springCloudBusInput
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: errorChannel
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: springCloudBusOutput
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: nullChannel
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: _org.springframework.integration.errorLogger.handler
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: org.springframework.cloud.stream.binding.StreamListenerMessageHandler@5c282dd5
2019-05-07 14:50:31.898  INFO 12423 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-07 14:50:31.900 ERROR 12423 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.rccl.ncp.datareflector.DataReflectorApplication.main(DataReflectorApplication.java:14) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.3.RELEASE.jar:2.1.3.RELEASE]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1754) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:291) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.doGetBinder(DefaultBinderFactory.java:192) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:130) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:337) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:229) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindableProxyFactory.createAndBindOutputs(BindableProxyFactory.java:287) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) ~[na:1.8.0_211]
    at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:48) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 19 common frames omitted
Caused by: com.ecwid.consul.v1.OperationException: OperationException(statusCode=404, statusMessage='Not Found', statusContent='')
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:76) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:63) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.ConsulClient.eventList(ConsulClient.java:423) ~[consul-api-1.4.1.jar:na]
    at org.springframework.cloud.consul.binder.EventService.getEventsResponse(EventService.java:80) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.cloud.consul.binder.EventService.init(EventService.java:59) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 45 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:55668', transport: 'socket'

Process finished with exit code 0
```

It run the spring boot application successfully and connection to consul/mesos should be established.

答:
Try to fix Consul URL as it says 404. If you haven't set up consul in local follow below steps:

download consul package from https://www.consul.io/downloads.html

Extract to folder

In case my case it is windows, cmd to C:\Program Files (x86)\consul

"consul agent -dev" - brings up consul

http://localhost:8500/ - brings up consul UI

check properties as below.
cloud:
consul:
  host: http://localhost
  port: 8500
  config:
    enabled: false
    fail-fast: true

re-start spring boot application

Body:
Declared all the consul properties in boostrap.properties. Trying to run the application it fails to shutdown.

2019-05-07 14:49:34.323  INFO 12423 --- [  restartedMain] o.s.i.endpoint.EventDrivenConsumer       : started _org.springframework.integration.errorLogger
2019-05-07 14:49:35.054  INFO 12423 --- [  restartedMain] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='consul', propertySources=[ConsulPropertySource {name='config/dataReflectorApp,cloud-dev/'}, ConsulPropertySource {name='config/dataReflectorApp/'}, ConsulPropertySource {name='config/application,cloud-dev/'}, ConsulPropertySource {name='config/application/'}]}
2019-05-07 14:50:31.823  WARN 12423 --- [  restartedMain] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
2019-05-07 14:50:31.826  INFO 12423 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-07 14:50:31.840 ERROR 12423 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1754) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:291) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.doGetBinder(DefaultBinderFactory.java:192) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:130) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:337) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:229) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindableProxyFactory.createAndBindOutputs(BindableProxyFactory.java:287) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) ~[na:1.8.0_211]
    at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:48) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34) [spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.rccl.ncp.datareflector.DataReflectorApplication.main(DataReflectorApplication.java:14) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.1.3.RELEASE.jar:2.1.3.RELEASE]
Caused by: com.ecwid.consul.v1.OperationException: OperationException(statusCode=404, statusMessage='Not Found', statusContent='')
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:76) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:63) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.ConsulClient.eventList(ConsulClient.java:423) ~[consul-api-1.4.1.jar:na]
    at org.springframework.cloud.consul.binder.EventService.getEventsResponse(EventService.java:80) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.cloud.consul.binder.EventService.init(EventService.java:59) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 45 common frames omitted

2019-05-07 14:50:31.843  WARN 12423 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
2019-05-07 14:50:31.846  INFO 12423 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'configWatchTaskScheduler'
2019-05-07 14:50:31.847  INFO 12423 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'catalogWatchTaskScheduler'
2019-05-07 14:50:31.877  INFO 12423 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2019-05-07 14:50:31.879  INFO 12423 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'taskScheduler'
2019-05-07 14:50:31.881  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: springCloudBusInput
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: errorChannel
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: springCloudBusOutput
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: nullChannel
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: _org.springframework.integration.errorLogger.handler
2019-05-07 14:50:31.882  INFO 12423 --- [  restartedMain] o.s.i.monitor.IntegrationMBeanExporter   : Summary on shutdown: org.springframework.cloud.stream.binding.StreamListenerMessageHandler@5c282dd5
2019-05-07 14:50:31.898  INFO 12423 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-07 14:50:31.900 ERROR 12423 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.rccl.ncp.datareflector.DataReflectorApplication.main(DataReflectorApplication.java:14) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.3.RELEASE.jar:2.1.3.RELEASE]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventService': Invocation of init method failed; nested exception is OperationException{statusCode=404, statusMessage='Not Found', statusContent=''}
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1754) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:291) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.doGetBinder(DefaultBinderFactory.java:192) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:130) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:337) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:229) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.BindableProxyFactory.createAndBindOutputs(BindableProxyFactory.java:287) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) ~[na:1.8.0_211]
    at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:48) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34) ~[spring-cloud-stream-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 19 common frames omitted
Caused by: com.ecwid.consul.v1.OperationException: OperationException(statusCode=404, statusMessage='Not Found', statusContent='')
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:76) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.event.EventConsulClient.eventList(EventConsulClient.java:63) ~[consul-api-1.4.1.jar:na]
    at com.ecwid.consul.v1.ConsulClient.eventList(ConsulClient.java:423) ~[consul-api-1.4.1.jar:na]
    at org.springframework.cloud.consul.binder.EventService.getEventsResponse(EventService.java:80) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.cloud.consul.binder.EventService.init(EventService.java:59) ~[spring-cloud-consul-binder-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 45 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:55668', transport: 'socket'

Process finished with exit code 0

It run the spring boot application successfully and connection to consul/mesos should be established.


问:
how do i redirect to home page(root )when user signed out?
I am trying to get devise working on my simple rails app where;

1.I'd like when user_signed out it will redirect to home page(root).!

2.when the user create his/her own products, when go to products.index it will show all the products that users have created, and when signed in as a specific user, the person will see their own created products on the user dashboard.(at the moment the added products will automatically added to the products index page)

many thanks!

```<code><header class="navbar">

  <nav class="menu">
    <ul>
      <li>
        <a href="#"> Products <i class="fa fa-sort-desc" aria-hidden="true"></i></a>
          <ul>
            <li>
              <%= link_to "Create a product",new_product_path %>
             </li>
            </li>
            </li>
            <li>
              <%= link_to "View all the products", products_path%></i>
            </li>
          </ul>
      </li>
      <li>
        <a href="#">Profile <i class="fa fa-sort-desc" aria-hidden="true"></i></a>
        <ul>
          <%= link_to "My dashboard", profile_path %>
          <%= link_to "Log out", destroy_user_session_path, method: :delete %>
        </ul>
      </li>
      <li><a href="#">Contact </a></li>
    </ul>
  </nav>

</header>
</code>```

```<code><h2>Log in</h2>

<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
  <div class='signup_create_product'>
    <%= f.input :email,
                required: false,
                autofocus: true,
                input_html: { autocomplete: "email" } %>
    <%= f.input :password,
                required: false,
                input_html: { autocomplete: "current-password" } %>
    <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
  </div>

  <div class="form-actions">
    <%= f.button :submit, "Log in" %>
  </div>
<% end %>

<%= render "devise/shared/links" %>

</code>```

```<code>class ProductsController < ApplicationController

  def index
    @products = Product.all
  end

  def show
    @product = Product.find(params[:id])
  end

  def new
    @product = Product.new
  end

  def create

     @product = Product.new(product_params)
     @product.user = current_user

    if @product.save
      redirect_to products_path
    else
      render :new
    end
  end

  def edit
    @product = Product.find(params[:id])
  end

  def destroy
    @product = Product.find(params[:id])
    @product.destroy
    redirect_to products_path
  end

  private

  def product_params
    params.require(:product).permit(:product_name, :description)
  end
end
</code>```

user show page

```<code> <h1><%= @user.name %></h1>
</code>```

答:
Regarding question 1:

Check @Mark answer

Regarding question 2:

Assuming you have the relationship:

```<code># app/models/user.rb

class User < ApplicationRecord
  has_many :products
end
</code>```

```<code># app/models/product.rb

class Product < ApplicationRecord
  belongs_to :user
end
</code>```

In the user#show implementation add

```<code># app/controller/users_controller.rb

def show
  ...
  @products = current_user.products
  ...
end
</code>```

Now in the users/show view you can loop @products for the user's products.

```<code><h1>User products</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Description</th>
    <th>Condition</th>
  </tr>

  <% @products.each do |product| %>
    <tr>
      <td><%= product.name %></td>
      <td><%= product.description %></td>
      <td><%= product.condition %></td>
    </tr>
  <% end %>
</table>
</code>```

Body:
I am trying to get devise working on my simple rails app where;

1.I'd like when user_signed out it will redirect to home page(root).!

2.when the user create his/her own products, when go to products.index it will show all the products that users have created, and when signed in as a specific user, the person will see their own created products on the user dashboard.(at the moment the added products will automatically added to the products index page)

many thanks!

         Products

              <%= link_to "Create a product",new_product_path %>

              <%= link_to "View all the products", products_path%>

        Profile

          <%= link_to "My dashboard", profile_path %>
          <%= link_to "Log out", destroy_user_session_path, method: :delete %>

Contact

Log in

<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>

    <%= f.input :email,
                required: false,
                autofocus: true,
                input_html: { autocomplete: "email" } %>
    <%= f.input :password,
                required: false,
                input_html: { autocomplete: "current-password" } %>
    <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>

    <%= f.button :submit, "Log in" %>

<% end %>

<%= render "devise/shared/links" %>

class ProductsController < ApplicationController

  def index
    @products = Product.all
  end

  def show
    @product = Product.find(params[:id])
  end

  def new
    @product = Product.new
  end

  def create

     @product = Product.new(product_params)
     @product.user = current_user

    if @product.save
      redirect_to products_path
    else
      render :new
    end
  end

  def edit
    @product = Product.find(params[:id])
  end

  def destroy
    @product = Product.find(params[:id])
    @product.destroy
    redirect_to products_path
  end

  private

  def product_params
    params.require(:product).permit(:product_name, :description)
  end
end

user show page

<%= @user.name %>

Body:
Regarding question 1:

Check @Mark answer

Regarding question 2:

Assuming you have the relationship:

# app/models/user.rb

class User < ApplicationRecord
  has_many :products
end

# app/models/product.rb

class Product < ApplicationRecord
  belongs_to :user
end

In the user#show implementation add

# app/controller/users_controller.rb

def show
  ...
  @products = current_user.products
  ...
end

Now in the users/show view you can loop @products for the user's products.

<h1>User products</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Description</th>
    <th>Condition</th>
  </tr>

  <% @products.each do |product| %>
    <tr>
      <td><%= product.name %></td>
      <td><%= product.description %></td>
      <td><%= product.condition %></td>
    </tr>
  <% end %>
</table>


问:
Ionic 3 native plugin of sms not working on my device
I am using Ionic 3 and my device is 4.4.2 android.

Setup:

```<code>ionic cordova plugin add cordova-sms-plugin
npm install --save @ionic-native/sms@4
</code>```

I have add to app.module

import { SMS } from '@ionic-native/sms';

providers: [..., SMS]

home.ts

```<code>...
import { SMS } from '@ionic-native/sms';

...
constructor(..., private sms: SMS){}

sendSMS(){
this.sms.send('0030699999999', 'sos')
}
</code>```

home.html

```<code><button ion-button block (click)="sendSMS()" margin-top color="dark">SMS</button>
</code>```

I install the apk to my phone with below command:

```<code>ionic cordova run android
</code>```

When I am pressing the button, my app breaks and exit, without sending a message.

I tried to remove platform android and added again, but nothing.

答: Allow from app settings on your phone</p>

Body:
I am using Ionic 3 and my device is 4.4.2 android.

Setup:

ionic cordova plugin add cordova-sms-plugin
npm install --save @ionic-native/sms@4

I have add to app.module

import { SMS } from '@ionic-native/sms';

providers: [..., SMS]

home.ts

...
import { SMS } from '@ionic-native/sms';

...
constructor(..., private sms: SMS){}

sendSMS(){
this.sms.send('0030699999999', 'sos')
}

home.html

<button ion-button block (click)="sendSMS()" margin-top color="dark">SMS</button>

I install the apk to my phone with below command:

ionic cordova run android

When I am pressing the button, my app breaks and exit, without sending a message.

I tried to remove platform android and added again, but nothing.

Body: Allow from app settings on your phone


问:
Is there a way to convert categorical variable into dummy with a dict with Pandas?
I'm currently working on a pandas.DataFrame whose I need to convert some categorical variables into dummies.

However, as I construct my pandas.DataFrame from a proportion of a heavy database, I pretty sure that I'll miss some modalities if I simply use pd.get_dummies.

Fortunately, I retrieved all the modalities from the features that I need to convert.

I wanted to know if it's possible (using pd.get_dummies or not) ,to efficiently convert my variables depending on the modalities that I retrieved ?

I looked for a solution, with and without get_dummies but didn't found one.

Thanks :)

答:
IIUC, you can use Pandas.Categorical dtype to handle this.

Example

```<code># Setup
np.random.seed(0)
df = pd.DataFrame(np.random.choice(['A', 'B', 'C'], 6), columns=['cat'])
print(df)
</code>```

[out]

```<code>  cat
0   A
1   B
2   A
3   B
4   B
5   C
</code>```

And running pandas.get_dummies on this yields...

```<code>pd.get_dummies(df['cat'])
</code>```

[out]

```<code>   A  B  C
0  1  0  0
1  0  1  0
2  1  0  0
3  0  1  0
4  0  1  0
5  0  0  1
</code>```

Now cast this Series to categorical dtype, and pass in the list of known categories...

```<code>categories = ['A', 'B', 'C', 'D', 'E']
df['cat'] = pd.Categorical(df['cat'], categories=categories)

pd.get_dummies(df['cat'])
</code>```

[out]

```<code>   A  B  C  D  E
0  1  0  0  0  0
1  0  1  0  0  0
2  1  0  0  0  0
3  0  1  0  0  0
4  0  1  0  0  0
5  0  0  1  0  0
</code>```

Body:
IIUC, you can use Pandas.Categorical dtype to handle this.

Example

# Setup
np.random.seed(0)
df = pd.DataFrame(np.random.choice(['A', 'B', 'C'], 6), columns=['cat'])
print(df)

[out]

  cat
0   A
1   B
2   A
3   B
4   B
5   C

And running pandas.get_dummies on this yields...

pd.get_dummies(df['cat'])

[out]

   A  B  C
0  1  0  0
1  0  1  0
2  1  0  0
3  0  1  0
4  0  1  0
5  0  0  1

Now cast this Series to categorical dtype, and pass in the list of known categories...

categories = ['A', 'B', 'C', 'D', 'E']
df['cat'] = pd.Categorical(df['cat'], categories=categories)

pd.get_dummies(df['cat'])

[out]

   A  B  C  D  E
0  1  0  0  0  0
1  0  1  0  0  0
2  1  0  0  0  0
3  0  1  0  0  0
4  0  1  0  0  0
5  0  0  1  0  0


问:
How tho solve the permission denied problem in NDK code?
I want to read a bmp file in ndk code, but it always failed.and the error code showed the permission denied. how to solve this problem?

The IDE is Android Studio 3.1.2,but I think it is nothing to do with IDE. The device is hikey960 with Android 9 API28.
I have referenced some similay issues and added the user-permission in Manifest.xml and specify the absolute path, but it still doesn't work! But if I build it as a executalbe file and push to /data/ and give a full permission, it works normally!

here is the ndk code:

```<code>FILE *fpbmp = fopen (imagefile, "r+");

if (fpbmp == NULL) {
    LOGD ("open file failed!");
    LOGD("code %s \n", strerror(errno));

}
</code>```

and the AndroidManifest.xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.wangzh.normaltest">
    <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE" />
</code>```

....

The logcat shows that the error code means permission denied:

```<code>/sdcard/DCIM/1_1.bmp
open file failed!
code Permission denied
</code>```

Could someone give some advices? Anything will be appreciated!

答:
I think I find the reason!
the permission of the bmp file in /sdcard/DCIM/ is -rw-rw----. It can't be changed even though run the chmod command and set permission in AndroidManifest.xml and run-time.

So I mv file to /data/ and chmod 777 thefile. then it  work well and doesn't need permission in AndroidManifest.xml or run-time permission.

Body:
I want to read a bmp file in ndk code, but it always failed.and the error code showed the permission denied. how to solve this problem?

The IDE is Android Studio 3.1.2,but I think it is nothing to do with IDE. The device is hikey960 with Android 9 API28.
I have referenced some similay issues and added the user-permission in Manifest.xml and specify the absolute path, but it still doesn't work! But if I build it as a executalbe file and push to /data/ and give a full permission, it works normally!

here is the ndk code:

FILE *fpbmp = fopen (imagefile, "r+");

if (fpbmp == NULL) {
    LOGD ("open file failed!");
    LOGD("code %s \n", strerror(errno));

}

and the AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.wangzh.normaltest">
    <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE" />

....

The logcat shows that the error code means permission denied:

/sdcard/DCIM/1_1.bmp
open file failed!
code Permission denied

Could someone give some advices? Anything will be appreciated!


问:
Sending email in R version 3.6.0 via outlook by RDCOMClient package
I updated R in version 3.6.0. Then I started to have problem with Library RDCOMClient. Does anyone know how to solve problem with R version 3.6.0 and library RDCOMClient? Or does it exist some alternative way how to send emails in R via Outlook?

Installing package into ‘C:/Users/xxxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

Warning in install.packages :   package ‘RDCOMClient’ is not available (for R version 3.6.0)

答: I've had success with the mailR package in the past. Might be worth looking at.</p>


问:
Programmatically create a SQL Server CE table from DataTable
Does anyone know the best way to create a SQL Server CE (Compact 3.5) table based on the schema of a DataTable at runtime? I don’t want to have to formulate a CREATE TABLE statement based on all the different possible datatypes, etc.

As a bonus – do you then know how to fill it directly from a datatable?

答:
I've used and updated the Code from Ben Breen:

Changed GetSqlServerCETypeName to work with all types

Added a function fow a whole Dataset

And some minor tweaks

GetSqlDBTypeFromType

```<code>/// <summary>
    /// Gets the correct SqlDBType for a given .NET type. Useful for working with SQL CE.
    /// </summary>
    /// <param name="type">The .Net Type used to find the SqlDBType.</param>
    /// <returns>The correct SqlDbType for the .Net type passed in.</returns>
    public static SqlDbType GetSqlDBTypeFromType(Type type)
    {
        TypeConverter tc = TypeDescriptor.GetConverter(typeof(DbType));
        if (/*tc.CanConvertFrom(type)*/ true)
        {
            DbType dbType = (DbType)tc.ConvertFrom(type.Name);
            // A cheat, but the parameter class knows how to map between DbType and SqlDBType.
            SqlCeParameter param = new SqlCeParameter();
            param.DbType = dbType;
            return param.SqlDbType; // The parameter class did the conversion for us!!
        }
        else
        {
            throw new Exception("Cannot get SqlDbType from: " + type.Name);
        }
    }
</code>```

GetSqlServerCETypeName

```<code>/// <summary>
    /// The method gets the SQL CE type name for use in SQL Statements such as CREATE TABLE
    /// </summary>
    /// <param name="dbType">The SqlDbType to get the type name for</param>
    /// <param name="size">The size where applicable e.g. to create a nchar(n) type where n is the size passed in.</param>
    /// <returns>The SQL CE compatible type for use in SQL Statements</returns>
    public static string GetSqlServerCETypeName(SqlDbType dbType, int size)
    {
        // Conversions according to: http://msdn.microsoft.com/en-us/library/ms173018.aspx
        bool max = (size == int.MaxValue) ? true : false;
        bool over4k = (size > 4000) ? true : false;

        if (size>0)
        {
            return string.Format(Enum.GetName(typeof(SqlDbType), dbType)+" ({0})", size);
        }
        else
        {
            return Enum.GetName(typeof(SqlDbType), dbType);
        }
    }
</code>```

GetCreateTableStatement

```<code>/// <summary>
    /// Genenerates a SQL CE compatible CREATE TABLE statement based on a schema obtained from
    /// a SqlDataReader or a SqlCeDataReader.
    /// </summary>
    /// <param name="tableName">The name of the table to be created.</param>
    /// <param name="schema">The schema returned from reader.GetSchemaTable().</param>
    /// <returns>The CREATE TABLE... Statement for the given schema.</returns>
    public static string GetCreateTableStatement(DataTable table)
    {
        StringBuilder builder = new StringBuilder();
        builder.Append(string.Format("CREATE TABLE [{0}] (", table.TableName));

        foreach (DataColumn col in table.Columns)
        {
            SqlDbType dbType = GetSqlDBTypeFromType(col.DataType);
            builder.Append("[");
            builder.Append(col.ColumnName);
            builder.Append("]");
            builder.Append(" ");
            builder.Append(GetSqlServerCETypeName(dbType, col.MaxLength));
            builder.Append(", ");
        }

        if (table.Columns.Count > 0) builder.Length = builder.Length - 2;

        builder.Append(")");
        return builder.ToString();
    }
</code>```

CreateFromDataset

```<code>public static void CreateFromDataset(DataSet set, SqlCeConnection conn)
    {
        conn.Open();
        SqlCeCommand cmd;
        foreach (DataTable table in set.Tables)
        {
            string createSql = copyDB.GetCreateTableStatement(table);
            Console.WriteLine(createSql);

            cmd = new SqlCeCommand(createSql, conn);
            Console.WriteLine(cmd.ExecuteNonQuery());
        }
        conn.Close();
    }

}
</code>```

Body:
I've used and updated the Code from Ben Breen:

Changed GetSqlServerCETypeName to work with all types

Added a function fow a whole Dataset

And some minor tweaks

GetSqlDBTypeFromType

/// <summary>
    /// Gets the correct SqlDBType for a given .NET type. Useful for working with SQL CE.
    /// </summary>
    /// <param name="type">The .Net Type used to find the SqlDBType.</param>
    /// <returns>The correct SqlDbType for the .Net type passed in.</returns>
    public static SqlDbType GetSqlDBTypeFromType(Type type)
    {
        TypeConverter tc = TypeDescriptor.GetConverter(typeof(DbType));
        if (/*tc.CanConvertFrom(type)*/ true)
        {
            DbType dbType = (DbType)tc.ConvertFrom(type.Name);
            // A cheat, but the parameter class knows how to map between DbType and SqlDBType.
            SqlCeParameter param = new SqlCeParameter();
            param.DbType = dbType;
            return param.SqlDbType; // The parameter class did the conversion for us!!
        }
        else
        {
            throw new Exception("Cannot get SqlDbType from: " + type.Name);
        }
    }

GetSqlServerCETypeName

/// <summary>
    /// The method gets the SQL CE type name for use in SQL Statements such as CREATE TABLE
    /// </summary>
    /// <param name="dbType">The SqlDbType to get the type name for</param>
    /// <param name="size">The size where applicable e.g. to create a nchar(n) type where n is the size passed in.</param>
    /// <returns>The SQL CE compatible type for use in SQL Statements</returns>
    public static string GetSqlServerCETypeName(SqlDbType dbType, int size)
    {
        // Conversions according to: http://msdn.microsoft.com/en-us/library/ms173018.aspx
        bool max = (size == int.MaxValue) ? true : false;
        bool over4k = (size > 4000) ? true : false;

        if (size>0)
        {
            return string.Format(Enum.GetName(typeof(SqlDbType), dbType)+" ({0})", size);
        }
        else
        {
            return Enum.GetName(typeof(SqlDbType), dbType);
        }
    }

GetCreateTableStatement

/// <summary>
    /// Genenerates a SQL CE compatible CREATE TABLE statement based on a schema obtained from
    /// a SqlDataReader or a SqlCeDataReader.
    /// </summary>
    /// <param name="tableName">The name of the table to be created.</param>
    /// <param name="schema">The schema returned from reader.GetSchemaTable().</param>
    /// <returns>The CREATE TABLE... Statement for the given schema.</returns>
    public static string GetCreateTableStatement(DataTable table)
    {
        StringBuilder builder = new StringBuilder();
        builder.Append(string.Format("CREATE TABLE [{0}] (", table.TableName));

        foreach (DataColumn col in table.Columns)
        {
            SqlDbType dbType = GetSqlDBTypeFromType(col.DataType);
            builder.Append("[");
            builder.Append(col.ColumnName);
            builder.Append("]");
            builder.Append(" ");
            builder.Append(GetSqlServerCETypeName(dbType, col.MaxLength));
            builder.Append(", ");
        }

        if (table.Columns.Count > 0) builder.Length = builder.Length - 2;

        builder.Append(")");
        return builder.ToString();
    }

CreateFromDataset

public static void CreateFromDataset(DataSet set, SqlCeConnection conn)
    {
        conn.Open();
        SqlCeCommand cmd;
        foreach (DataTable table in set.Tables)
        {
            string createSql = copyDB.GetCreateTableStatement(table);
            Console.WriteLine(createSql);

            cmd = new SqlCeCommand(createSql, conn);
            Console.WriteLine(cmd.ExecuteNonQuery());
        }
        conn.Close();
    }

}