问:
How to split the content of a String into a List
I am trying to iterate a txt file with java , I have the following code ,Firstly I read the txt file withouth any problem , then I add the lines that I am interested at the list called records and this arrays iterate correctly with the while.

The problem is that I received the content like this

```<code>  TCP    0.0.0.0:135            PCB:0             LISTENING
</code>```

I would like to split this content and avoid the white space  try before with split and trim but I am not doing this correctly.

Could anyone helps to me ?

```<code> String FILENAME = "src/example.txt";
        String line = null;
    Integer lines=0;
    Integer totalLines=countLines(FILENAME);
    List<String> records = new ArrayList<String>();

    try{
        InputStream fis=new FileInputStream(FILENAME);
        BufferedReader br=new BufferedReader(new InputStreamReader(fis));
            while ((line = br.readLine()) != null)
            {
                lines++;
                if (lines >= 5 && lines <= 180) {
                    records.add(line);
                }
            }
            br.close();

    }

    catch(Exception e){
        System.err.println("Error: Target File Cannot Be Read");
    }

    Iterator<String> it = records.iterator();

    while (it.hasNext()) {

        System.out.println(it.next());

    }
</code>```

Regards !

答:
Method 1

First of all replace more than one white spaces with single white space -

```<code>line = line.replaceAll("\\s+"," ");
</code>```

Than, split it by space,

```<code>String[] lineTokens = line.split(" ");
</code>```

Method 2

As David has suggested, you can do like this too -

```<code>String[] lineTokens = line.split("\\s+");
</code>```

Hope this will help you ;)

Body:
I am trying to iterate a txt file with java , I have the following code ,Firstly I read the txt file withouth any problem , then I add the lines that I am interested at the list called records and this arrays iterate correctly with the while.

The problem is that I received the content like this

  TCP    0.0.0.0:135            PCB:0             LISTENING

I would like to split this content and avoid the white space  try before with split and trim but I am not doing this correctly.

Could anyone helps to me ?

 String FILENAME = "src/example.txt";
        String line = null;
    Integer lines=0;
    Integer totalLines=countLines(FILENAME);
    List<String> records = new ArrayList<String>();

    try{
        InputStream fis=new FileInputStream(FILENAME);
        BufferedReader br=new BufferedReader(new InputStreamReader(fis));
            while ((line = br.readLine()) != null)
            {
                lines++;
                if (lines >= 5 && lines <= 180) {
                    records.add(line);
                }
            }
            br.close();

    }

    catch(Exception e){
        System.err.println("Error: Target File Cannot Be Read");
    }

    Iterator<String> it = records.iterator();

    while (it.hasNext()) {

        System.out.println(it.next());

    }

Regards !

Body:
Method 1

First of all replace more than one white spaces with single white space -

line = line.replaceAll("\\s+"," ");

Than, split it by space,

String[] lineTokens = line.split(" ");

Method 2

As David has suggested, you can do like this too -

String[] lineTokens = line.split("\\s+");

Hope this will help you ;)


来源: stackexchange

问:
Compare two objects by reference when equality operator is overridden
I need to check if two objects of the same type are the same instances and point to the same allocation of memory. The problem is that the type has overloaded equality operator and thus it will use it as comparing the both for equality, but I need to check them for reference. I looked through object.ReferenceEquals() method, but it internally applies equality operator

答:
ReferenceEquals does exactly what you need, unless you're talking about a dictionary. It does not check Equals (it literally just does ldarg.0, ldarg.1, ceq, ret). Alternatively, just cast to object:

```<code>bool same = (object)x == (object)y;
</code>```

If you need dictionary support (so: GetHashCode): System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj) is your friend.

ContentLicense: CC BY-SA 3.0

Body:
ReferenceEquals does exactly what you need, unless you're talking about a dictionary. It does not check Equals (it literally just does ldarg.0, ldarg.1, ceq, ret). Alternatively, just cast to object:

bool same = (object)x == (object)y;

If you need dictionary support (so: GetHashCode): System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj) is your friend.


问:
Error "no such element: Unable to locate element"
I am on this page

https://login.alibaba.com/?spm=a2700.8293689.0.0.NdeZUw&tracelog=hd_signin

And trying to access Email field by following web element code:

```<code>public static WebElement Email_Field(WebDriver driver) throws InterruptedException {

        //element = (new WebDriverWait(driver, 10)).until(ExpectedConditions
                //.visibilityOfElementLocated(By.xpath("//input[@id='fm-login-id']")));

        element = driver.findElement(By
                .xpath("//input[@id='fm-login-id']"));

        while (!isDisplayed(element)) {
            Thread.sleep(3000);
            System.out.println("Element is not visible yet");
        }

        return element;
    }

public static boolean isDisplayed(WebElement element) {
        try {
            if(element.isDisplayed())
                return element.isDisplayed();
            }catch (NoSuchElementException ex) {
            return false;
        }
        return false;
    }
</code>```

But getting the following exception:

```<code>Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":".//*[@id='fm-login-id']"}
  (Session info: chrome=59.0.3071.115)
</code>```

答:
The email field is inside the frame. Before access any element in the frame, you have to switch. please try following code.</p>

```<code>public static WebElement Email_Field(WebDriver driver) throws InterruptedException {

    WebElement element;

    (new WebDriverWait(driver, 30)).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("alibaba-login-box"));

    element = driver.findElement(By.xpath("//input[@id='fm-login-id']"));

    while (!isDisplayed(element)) {
        Thread.sleep(3000);
        System.out.println("Element is not visible yet");
    }

    return element;
}
</code>```

Body:
I am on this page

https://login.alibaba.com/?spm=a2700.8293689.0.0.NdeZUw&tracelog=hd_signin

And trying to access Email field by following web element code:

public static WebElement Email_Field(WebDriver driver) throws InterruptedException {

        //element = (new WebDriverWait(driver, 10)).until(ExpectedConditions
                //.visibilityOfElementLocated(By.xpath("//input[@id='fm-login-id']")));

        element = driver.findElement(By
                .xpath("//input[@id='fm-login-id']"));

        while (!isDisplayed(element)) {
            Thread.sleep(3000);
            System.out.println("Element is not visible yet");
        }

        return element;
    }

public static boolean isDisplayed(WebElement element) {
        try {
            if(element.isDisplayed())
                return element.isDisplayed();
            }catch (NoSuchElementException ex) {
            return false;
        }
        return false;
    }

But getting the following exception:

Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":".//*[@id='fm-login-id']"}
  (Session info: chrome=59.0.3071.115)

Body:
The email field is inside the frame. Before access any element in the frame, you have to switch. please try following code.

public static WebElement Email_Field(WebDriver driver) throws InterruptedException {

    WebElement element;

    (new WebDriverWait(driver, 30)).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("alibaba-login-box"));

    element = driver.findElement(By.xpath("//input[@id='fm-login-id']"));

    while (!isDisplayed(element)) {
        Thread.sleep(3000);
        System.out.println("Element is not visible yet");
    }

    return element;
}


问:
Getting the triangles of a mesh from its vertices
I am having trouble implementing the Polygon-Soup Collision detection on this page. I have implemented the methods presented in that paper but I am not sure how to get the values for the CollisionPacket class. Can anyone help me in getting the values for the CollisionPacket class?

EDIT: I have implemented that, but how can get the triangles of the mesh from its vertices for the checkTriangle() method?

答: I found the answer. It was to obtain the vertex positions while loading the .obj files and store it in the RawModel class in my game. Thanks for any help.</p>


问:
Vertically centered text in a dynamic height wrapper
I'd normally just use line-height for vertical centering, but on this occasion the layout I'm working to is a little trickier.

I've put together this jsfiddle to show where I'm at so far. All the CSS hacks suggest using table-cell trickery for this but I can only get it to work if the wrapper has an absolute height, so for me this text isn't vertically centered:

```<code><div class="wrap">
    <a href="#">
        <img src="http://www.thekrausemouse.com/wp-content/uploads/2016/03/sample-1.jpg" />
        <span class="text"><span>Text that might span multiple lines</span></span>
    </a>
</div>
</code>```

https://jsfiddle.net/fdtbvmcw/

What I basically need is for the text, regardless of how many lines it spans, to sit in the middle of the image. The image can't be a background-image and I can't attach fixed widths or heights to the wrapper.

The wrapper is simulating a responsive column within a bigger page template and I need the image to retain full width of that column you see. Other HTML can be added within the column if need be.

Thoughts?

答:
I think is better use translateY, it works in more devices

```<code>//CSS
.wrap {
  height: auto;
  position: relative;
  width: 50%;
}

.wrap a img {
  height: auto;
  width: 100%;
}

.wrap span {
  color: #fff;
  font-size: 26px;
  font-weight: bold;
  line-height: 30px;
  vertical-align: middle;
  top: 50%;
  transform: translateY(-50%);
  display:block;
  position:absolute;
  text-align:center;
}

//HTML
<div class="wrap">
<a href="#">
  <img src="http://www.thekrausemouse.com/wp-content/uploads/2016/03/sample-1.jpg" />
  <span>Text that might span multiple lines</span>
</a>
</div>
</code>```

https://jsfiddle.net/MAXXALANDER/fdtbvmcw/2/

Body:
I'd normally just use line-height for vertical centering, but on this occasion the layout I'm working to is a little trickier.

I've put together this jsfiddle to show where I'm at so far. All the CSS hacks suggest using table-cell trickery for this but I can only get it to work if the wrapper has an absolute height, so for me this text isn't vertically centered:

        Text that might span multiple lines

https://jsfiddle.net/fdtbvmcw/

What I basically need is for the text, regardless of how many lines it spans, to sit in the middle of the image. The image can't be a background-image and I can't attach fixed widths or heights to the wrapper.

The wrapper is simulating a responsive column within a bigger page template and I need the image to retain full width of that column you see. Other HTML can be added within the column if need be.

Thoughts?

Body:
I think is better use translateY, it works in more devices

//CSS
.wrap {
  height: auto;
  position: relative;
  width: 50%;
}

.wrap a img {
  height: auto;
  width: 100%;
}

.wrap span {
  color: #fff;
  font-size: 26px;
  font-weight: bold;
  line-height: 30px;
  vertical-align: middle;
  top: 50%;
  transform: translateY(-50%);
  display:block;
  position:absolute;
  text-align:center;
}

//HTML
<div class="wrap">
<a href="#">
  <img src="http://www.thekrausemouse.com/wp-content/uploads/2016/03/sample-1.jpg" />
  <span>Text that might span multiple lines</span>
</a>
</div>

https://jsfiddle.net/MAXXALANDER/fdtbvmcw/2/


问:
Download all dpkg dependencies for a package
I need to use apt-offline on a debian system which is offline all the time. At the moment this package is not installed so I want to download all dependencies for it and install it offline from a usb drive. Is there any tool to put all dependencies inside a folder for a given package?</p>

答:
To install apt-offline offline you should download the .deb file from debian-package

There is an example on debian stretch:

```<code>wget http://ftp.us.debian.org/debian/pool/main/a/apt-offline/apt-offline_1.7.2_all.deb
dpkg -i apt-offline_1.7.2_all.deb
</code>```

After running the dpkg command you will show an error listing the missing dependencies (a sample output from an updated system):

```<code>dpkg: dependency problems prevent configuration of apt-offline:
apt-offline depends on python-magic; however:
Package python-magic is not installed.
</code>```

The missing dependencies can installed through dpkg after getting the .deb file from the official website by searching

Body:
To install apt-offline offline you should download the .deb file from debian-package

There is an example on debian stretch:

wget http://ftp.us.debian.org/debian/pool/main/a/apt-offline/apt-offline_1.7.2_all.deb
dpkg -i apt-offline_1.7.2_all.deb

After running the dpkg command you will show an error listing the missing dependencies (a sample output from an updated system):

dpkg: dependency problems prevent configuration of apt-offline:
apt-offline depends on python-magic; however:
Package python-magic is not installed.

The missing dependencies can installed through dpkg after getting the .deb file from the official website by searching


问:
Get a user Asp .net MVC C#
I am trying to get an Application User by its Id but it is always returning null. I need it to chow its details on the edit view but because it is null, my edit view has all fields empty.

This is my controller:

```<code>public ActionResult Edit(string id) {

  ApplicationDbContext db = new ApplicationDbContext();
  ApplicationUser user = db.Users.Find(id);
  return View(user);
}

[HttpPost]
public ActionResult Edit(ApplicationUser user) {
    if (ModelState.IsValid) {
      ApplicationDbContext db = new ApplicationDbContext();
      db.Entry(user).State = EntityState.Modified;
      db.SaveChanges();
      return RedirectToAction("Index");

      return View(user);
    }
</code>```

The problem is that the "db.Users.Find(id);" is returning null. Instead of that If I do the following code everything works:

```<code>public ActionResult Edit(string id) {

  ApplicationDbContext db = new ApplicationDbContext();

  ApplicationUser user = new ApplicationUser();
  user.Email = "test@gmail.com";
  //(...)

  return View(user);
}
</code>```

Can you give me an idea of what can be wrong with this?

Thanks in advance for any help.

Update:
Thanks for all your comments. As some of you pointed out the reason is actually very simple - I am searching for id's that don't exist on the DB. However I don't know how it is happening. When I show my ids on a table (check code below), the ids are different from the ones I can see on my table on SQL Object Explorer. How can that happen? Every other information (name and email) is right.

```<code>@model IEnumerable<FMS.Models.ApplicationUser>
<table class="table table-striped table-hover ">
  <thead>
    <tr>
      <th>Name</th>
      <th>E-mail</th>
      <th>ID</th>
    </tr>
  </thead>
  <tbody>

    @foreach (var user in Model) {
    <tr>
      <td>@user.Name</td>
      <td>@user.Email</td>
      <td>@user.Id</td>
      <td class="pull-right">
        @Html.ActionLink("Edit", "Edit", new { id = user.Id})
      </td>
    </tr>

    }

  </tbody>
</table>
</code>```

Update 2:
I just noticed that every time I refresh the view, the id's on the ID column are different! What can be causing this?

答:
You can write following way :</p>

```<code>public ActionResult Edit(string id) {

  ApplicationDbContext db = new ApplicationDbContext();
  ApplicationUser currentUser = db.Users.FirstOrDefault(x => x.Id == id);
  return View(user);
}
</code>```

Title: Get a user Asp .net MVC C#

Body:
I am trying to get an Application User by its Id but it is always returning null. I need it to chow its details on the edit view but because it is null, my edit view has all fields empty.

This is my controller:

public ActionResult Edit(string id) {

  ApplicationDbContext db = new ApplicationDbContext();
  ApplicationUser user = db.Users.Find(id);
  return View(user);
}

[HttpPost]
public ActionResult Edit(ApplicationUser user) {
    if (ModelState.IsValid) {
      ApplicationDbContext db = new ApplicationDbContext();
      db.Entry(user).State = EntityState.Modified;
      db.SaveChanges();
      return RedirectToAction("Index");

      return View(user);
    }

The problem is that the "db.Users.Find(id);" is returning null. Instead of that If I do the following code everything works:

public ActionResult Edit(string id) {

  ApplicationDbContext db = new ApplicationDbContext();

  ApplicationUser user = new ApplicationUser();
  user.Email = "test@gmail.com";
  //(...)

  return View(user);
}

Can you give me an idea of what can be wrong with this?

Thanks in advance for any help.

Update:
Thanks for all your comments. As some of you pointed out the reason is actually very simple - I am searching for id's that don't exist on the DB. However I don't know how it is happening. When I show my ids on a table (check code below), the ids are different from the ones I can see on my table on SQL Object Explorer. How can that happen? Every other information (name and email) is right.

@model IEnumerable<FMS.Models.ApplicationUser>

      Name
      E-mail
      ID

    @foreach (var user in Model) {

      @user.Name
      @user.Email
      @user.Id

        @Html.ActionLink("Edit", "Edit", new { id = user.Id})

    }

Update 2:
I just noticed that every time I refresh the view, the id's on the ID column are different! What can be causing this?

Body:
You can write following way :

public ActionResult Edit(string id) {

  ApplicationDbContext db = new ApplicationDbContext();
  ApplicationUser currentUser = db.Users.FirstOrDefault(x => x.Id == id);
  return View(user);
}


问:
merge similar xml tags to single using regex
i have my xml tags as below

```<code> <additionaPtahsType>receive</additionaPtahsType>
    <additionaPtahsType>send</additionaPtahsType>
    <additionaPtahsType>section</additionaPtahsType>
</code>```

need regex to merge these xml tags as result below

receive|send|section

答:
Simple answer: don't.

Long answer: Instead of using Regex, use XML parser. Regex is not a viable solution to parse XML (or any markup language at all). See here: RegEx match open tags except XHTML self-contained tags

Wrong answer: If it is only one XML tag you want to capture contents of, you can do this with regex, but it's highly discouraged. Simply wrap anything you want into a group, get all matches into a collection and then combine them with your pipe ('|') character. Look here: Regex101.com demo

Disclaimer: this solution is very naive. If there would be any nested tags it will also match them, which is rather not the expected result. If there are wrong/incomplete tags - it won't work. That's why you should use a parser.

Body:
i have my xml tags as below

 <additionaPtahsType>receive</additionaPtahsType>
    <additionaPtahsType>send</additionaPtahsType>
    <additionaPtahsType>section</additionaPtahsType>

need regex to merge these xml tags as result below

receive|send|section


问:
String manipulation in C#. Inserting "+" between words
This is as far as I have got. My thinking was to stuff the string into an array, format it and recast it into a string.

```<code>    //input search term
    Console.WriteLine("What is your search query?:");
    string searchTerm = Console.ReadLine();

    //stuff the search term into an array to split it out
    string separator = " "; //assumes search terms are separated by spaces
    string[] searchTermArray = searchTerm.Split(separator.ToCharArray());

    //construct the search term
    string searchTermFormat = "";

    for (int i = 0; i < searchTermArray.Length; i++)
    {
        searchTermFormat += searchTermArray[i] + "+";
        //Console.WriteLine(searchTermFormat);
    }
</code>```

Desired output

```<code>word1+word2+word3
</code>```

where the number of words are not fixed.

答: That a typical String.Replace job or RegEx</p>

ContentLicense: CC BY-SA 2.5

Body:
This is as far as I have got. My thinking was to stuff the string into an array, format it and recast it into a string.

    //input search term
    Console.WriteLine("What is your search query?:");
    string searchTerm = Console.ReadLine();

    //stuff the search term into an array to split it out
    string separator = " "; //assumes search terms are separated by spaces
    string[] searchTermArray = searchTerm.Split(separator.ToCharArray());

    //construct the search term
    string searchTermFormat = "";

    for (int i = 0; i < searchTermArray.Length; i++)
    {
        searchTermFormat += searchTermArray[i] + "+";
        //Console.WriteLine(searchTermFormat);
    }

Desired output

word1+word2+word3

where the number of words are not fixed.


问:
Extract data from nested JSON Node JS
I need to extract the text value of Distance and Duration but unfortunately i haven't been able to traverse the JSON. Any ideas about how to traverse the nodes in Node JS the simplest way possible ?

```<code>     {
   "destination_addresses" : [ "Chennai, Tamil Nadu, India" ],
   "origin_addresses" : [ "Kolkata, West Bengal, India" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "1,671 km",
                  "value" : 1671269
               },
               "duration" : {
                  "text" : "1 day 5 hours",
                  "value" : 104370
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}
</code>```

答:
assuming that your JSON is object named data

```<code>var data =     {
   "destination_addresses" : [ "Chennai, Tamil Nadu, India" ],
   "origin_addresses" : [ "Kolkata, West Bengal, India" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "1,671 km",
                  "value" : 1671269
               },
               "duration" : {
                  "text" : "1 day 5 hours",
                  "value" : 104370
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}
</code>```

You would access distance element like this

data.rows[0].elements[0].distance

Title: Extract data from nested JSON Node JS

Body:
I need to extract the text value of Distance and Duration but unfortunately i haven't been able to traverse the JSON. Any ideas about how to traverse the nodes in Node JS the simplest way possible ?

     {
   "destination_addresses" : [ "Chennai, Tamil Nadu, India" ],
   "origin_addresses" : [ "Kolkata, West Bengal, India" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "1,671 km",
                  "value" : 1671269
               },
               "duration" : {
                  "text" : "1 day 5 hours",
                  "value" : 104370
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}

Body:
assuming that your JSON is object named data

var data =     {
   "destination_addresses" : [ "Chennai, Tamil Nadu, India" ],
   "origin_addresses" : [ "Kolkata, West Bengal, India" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "1,671 km",
                  "value" : 1671269
               },
               "duration" : {
                  "text" : "1 day 5 hours",
                  "value" : 104370
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}

You would access distance element like this

data.rows[0].elements[0].distance


问:
Change Color Of button According to time
I want to change the color of button according to my shift timings. Likewise if it's a morning shift going the button color should be blue and in the evening it should automatically change to red or any different color. I need four different colors. Can anyone help me in this?

$(document).ready(function(){
  $("#hex").on('change', function(){
    var hex = $("#hex").val();
    $("#btn").css({"background-color":hex});
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="hex" />
<input type="button" id="btn" /></code>```

答:
I have just break the 24 hours in four set each of 6 hours. Change as per your need. Use script as :</p>

```<code>$(document).ready(function() {
 var hours = new Date().getHours();
 var color = '';
 if (hours <= 6)
   color = '#f00';
 else if (hours > 6 && hours <= 12)
   color = '#0f0';
 else if (hours > 12 && hours <= 18)
   color = '#00f';
 else if (hours > 18 && hours <= 24)
   color = '#ff0';
 $("#btn").css({"background-color": color});
});
</code>```

Body:
I want to change the color of button according to my shift timings. Likewise if it's a morning shift going the button color should be blue and in the evening it should automatically change to red or any different color. I need four different colors. Can anyone help me in this?

$(document).ready(function(){
  $("#hex").on('change', function(){
    var hex = $("#hex").val();
    $("#btn").css({"background-color":hex});
  });
});

<input type="text" id="hex" />
<input type="button" id="btn" />

Body:
I have just break the 24 hours in four set each of 6 hours. Change as per your need. Use script as :

$(document).ready(function() {
 var hours = new Date().getHours();
 var color = '';
 if (hours <= 6)
   color = '#f00';
 else if (hours > 6 && hours <= 12)
   color = '#0f0';
 else if (hours > 12 && hours <= 18)
   color = '#00f';
 else if (hours > 18 && hours <= 24)
   color = '#ff0';
 $("#btn").css({"background-color": color});
});


问:
React isn't rendering an array of objects with map() in a stateless component
I've just started exploring React.js and I can't figure out why there are errors when I try to map over all of the days in the StudyDayList Component:

1) Warning: React.createElement: type is invalid --
  expected a string (for built-in components) or a class/function (for
  composite components) but got: undefined. You likely forgot to export
  your component from the file it's defined in. Check the render method
  of StudyDayList.
      in StudyDayList

2) Uncaught Error: Element type is invalid: expected a string (for
  built-in components) or a class/function (for composite components)
  but got: undefined. You likely forgot to export your component from
  the file it's defined in. Check the render method of StudyDayList.

```<code>// index.js

import React from 'react';
import {render} from 'react-dom';
import {StudyDayList} from '../src/components/StudyDayList';

window.React = React;

render(
<StudyDayList days={
    [
        {
            study: "React Essentials",
            date: new Date("4/7/2017"),
            practice: true
        },
        {
            study: "Web Security",
            date: new Date("3/7/2017"),
            practice: false
        }
    ]
} />,
document.getElementById('react-container')
);
</code>```

What I've tried

This particular part of the code doesn't work. All displays well if I am removing this part of the code in StudyDayList.js:

```<code>{days.map((day, i) =>
      <StudyDayRow key={i}
               study={day.study}
               date={day.date}
               practice={day.practice} />
)}
</code>```

Also, I've tried to change syntaxis:

```<code>{days.map(day, i => (
      <StudyDayRow key={i}
               study={day.study}
               date={day.date}
               practice={day.practice} />
))}
</code>```

and it gives another error:

Uncaught ReferenceError: day is not defined

I've checked the value of days from index.js by propTypes and days: PropTypes.array is true and the length is not null.

StudyDayList Component

```<code>// StudyDayList.js

import Terrain from 'react-icons/lib/md/terrain';
import StudyDayRow from './StudyDayRow';

export const StudyDayList = ({days}) => (
<table>
    <thead>
        <tr>
            <th>Date</th>
            <th>Study</th>
            <th>Practice</th>
        </tr>
    </thead>
    <tbody>

        // The part of code which I was removing

        {days.map((day, i) =>
            <StudyDayRow key={i}
                        study={day.study}
                        date={day.date}
                        practice={day.practice} />
        )}

    </tbody>
</table>
)
</code>```

StudyDayRow Component

I'm not sure if StudyDayRow Component could cause the errors. I think it couldn't, but I've attached it in case it could.

```<code>// StudyDayRow.js

import Terrain from 'react-icons/lib/md/terrain';

export const StudyDayRow = ({study, date, practice}) => (
<tr>
    <td>
        {date.getMonth()+1}/{date.getDate()}/{date.getFullYear()}
    </td>
    <td>
        {study}
    </td>
    <td>
        {(practice) ? <Terrain /> : null}
    </td>
</tr>
)
</code>```

答:
Your code is working fine on this CodeSandbox snippet. Your problem is likely arising from your import syntax, since you're doing export const and not export default. Note that you cannot do export default const someVariable, you'll need to export it after assigning the variable to a value.

If you want to keep your current syntax, change your imports to be named imports, like so

```<code>import { StudyDayRow } from './StudyDayRow';
</code>```

Also, the reason days.map(day, i => ... doesn't work but days.map((day, i) => ... does is because arrow functions need the parenthesis whenever that function takes in more than one argument.

Body:
I've just started exploring React.js and I can't figure out why there are errors when I try to map over all of the days in the StudyDayList Component:

1) Warning: React.createElement: type is invalid --
  expected a string (for built-in components) or a class/function (for
  composite components) but got: undefined. You likely forgot to export
  your component from the file it's defined in. Check the render method
  of StudyDayList.
      in StudyDayList

2) Uncaught Error: Element type is invalid: expected a string (for
  built-in components) or a class/function (for composite components)
  but got: undefined. You likely forgot to export your component from
  the file it's defined in. Check the render method of StudyDayList.

// index.js

import React from 'react';
import {render} from 'react-dom';
import {StudyDayList} from '../src/components/StudyDayList';

window.React = React;

render(
<StudyDayList days={
    [
        {
            study: "React Essentials",
            date: new Date("4/7/2017"),
            practice: true
        },
        {
            study: "Web Security",
            date: new Date("3/7/2017"),
            practice: false
        }
    ]
} />,
document.getElementById('react-container')
);

What I've tried

This particular part of the code doesn't work. All displays well if I am removing this part of the code in StudyDayList.js:

{days.map((day, i) =>
      <StudyDayRow key={i}
               study={day.study}
               date={day.date}
               practice={day.practice} />
)}

Also, I've tried to change syntaxis:

{days.map(day, i => (
      <StudyDayRow key={i}
               study={day.study}
               date={day.date}
               practice={day.practice} />
))}

and it gives another error:

Uncaught ReferenceError: day is not defined

I've checked the value of days from index.js by propTypes and days: PropTypes.array is true and the length is not null.

StudyDayList Component

// StudyDayList.js

import Terrain from 'react-icons/lib/md/terrain';
import StudyDayRow from './StudyDayRow';

export const StudyDayList = ({days}) => (

            Date
            Study
            Practice

        // The part of code which I was removing

        {days.map((day, i) =>
            <StudyDayRow key={i}
                        study={day.study}
                        date={day.date}
                        practice={day.practice} />
        )}

)

StudyDayRow Component

I'm not sure if StudyDayRow Component could cause the errors. I think it couldn't, but I've attached it in case it could.

// StudyDayRow.js

import Terrain from 'react-icons/lib/md/terrain';

export const StudyDayRow = ({study, date, practice}) => (

        {date.getMonth()+1}/{date.getDate()}/{date.getFullYear()}

        {study}

        {(practice) ? <Terrain /> : null}

)

Body:
Your code is working fine on this CodeSandbox snippet. Your problem is likely arising from your import syntax, since you're doing export const and not export default. Note that you cannot do export default const someVariable, you'll need to export it after assigning the variable to a value.

If you want to keep your current syntax, change your imports to be named imports, like so

import { StudyDayRow } from './StudyDayRow';

Also, the reason days.map(day, i => ... doesn't work but days.map((day, i) => ... does is because arrow functions need the parenthesis whenever that function takes in more than one argument.


问:
iPhone Icons retina/normal with Ending: @2x.png
My question is about TabBar-Icons:
I define standartsized TabBarIcons (20x20) and for retina resolution I'll just add the same image in big (40x40) and name it xxx@2.png.

Thats it, Am I right ?

cheers Simon

答:
The Retina display has double the screen resolution (640px x 960px). Appending the @2x at the end of the image filename will allow the iPhone 4 to use those images instead.

Apple Developer Article:

http://developer.apple.com/library/ios/#qa/qa2010/qa1686.html


问:
use multiple column selectors jQuery datatable export CSV?
I am trying to export the datatables to CSV and it is working fine. I want to exclude first and last column  while exporting, additionally I also want to export only visible columns. Here is what I am doing :

```<code>"buttons": [{
    extend: 'csvHtml5',
    exportOptions: {
        columns: [':visible',':not(:last-child,:first-child)']
    }
 }
</code>```

If I remove :visible the other one starts to work fine and same is the case with the other. But I want to use both at the same time. I am using datatable export for the first time. Sorry for any inconvenience, any help would be appreciated.

答:
I think you can use something like this instead:</p>

```<code>columns: [':not(:last-child,:first-child):visible']
</code>```

Body:
I am trying to export the datatables to CSV and it is working fine. I want to exclude first and last column  while exporting, additionally I also want to export only visible columns. Here is what I am doing :

"buttons": [{
    extend: 'csvHtml5',
    exportOptions: {
        columns: [':visible',':not(:last-child,:first-child)']
    }
 }

If I remove :visible the other one starts to work fine and same is the case with the other. But I want to use both at the same time. I am using datatable export for the first time. Sorry for any inconvenience, any help would be appreciated.

Body:
I think you can use something like this instead:

columns: [':not(:last-child,:first-child):visible']


问:
How do I generate script for LocalDB database?
I'm using localdb for development with Visual Studio and SSDT. I want to export the database schema and import it in full-fledged SQL Server instance. How do I do that?

I don't have (or want to install) SSMS. Can this be done with Visual Studio/SSDT only?

答:
I'll summarize the answers and give a bit more suggestions.

Use schema compare

As @Nick.McDermaid mentioned you can use schema compare to generate the script. However if you use variables it might not work as you expected. Moreover pre/post scripts will not be included to the output script

Use SSDT Publish

Right-click on the project and choose Publish. There setup the connection and you will have 2 options.

Publish

Generate script

Choose the one you need

Dacpac

You can build the project and find the project_name.dacpac file in the bin folder. Then you can use SqlPackage to deploy your changes (HOWTO)


问:
Error compiling app on emulator
I'm trying to install my app into the emulator to prove it but when I try to start the app this crash and doesn't let me open

I'm using CoordinarorLayout in the MainActivity:

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="mx.com.dtss.carritocompras.MainActivity">

    <android.support.v7.app.AlertController.RecycleListView
        android:id="@+id/recycler"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </android.support.v7.app.AlertController.RecycleListView>

</android.support.design.widget.CoordinatorLayout>
</code>```

and in other activity I use a CardView:

```<code>    <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.FitWindowsLinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/img"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/txtDesPro"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/txtDetalle"/>
        </LinearLayout>
    </android.support.v7.widget.FitWindowsLinearLayout>

</android.support.v7.widget.CardView>
</code>```

this is what I've in my AndroidManifest:

```<code>    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="mx.com.dtss.carritocompras" >

        <uses-permission android:name="android.permission.INTERNET"></uses-permission>

        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme" >
            <activity android:name=".MainActivity" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>

and this is what I have in my `MainActivity`:

package mx.com.dtss.carritocompras;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    RecyclerView recycler;
    RecyclerView.Adapter adap;
    ArrayList<elemento> listaCard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        recycler = (RecyclerView)findViewById(R.id.recycler);
        recycler.setHasFixedSize(true);
        recycler.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

        Thread tr = new Thread(){
            @Override
            public void run(){
                String NAMESPACE = "http://tempuri.org/";
                String URL = "http://192.168.0.14/Publicacion/WebServiceCarrito.asmx";
                String METHOD_NAME = "listarProductos";
                String SOAP_ACTION = "http://tempuri.org/listarProductos";

                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet= true;
                envelope.setOutputSoapObject(request);
                HttpTransportSE transporte = new HttpTransportSE(URL);

                try{
                    transporte.call(SOAP_ACTION, envelope);
                    final SoapObject soap = (SoapObject)envelope.getResponse();

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            listarProductos(soap);
                        }
                    });
                } catch (Exception e){

                }
            }
        };
        tr.start();
    }

    public void listarProductos(SoapObject soap){
        listaCard = new ArrayList<elemento>();
            for(int i = 0; i < soap.getPropertyCount(); i++){
                SoapObject reg = (SoapObject)soap.getProperty(i);
                elemento e1 = new elemento(reg.getProperty(0).toString(), reg.getProperty(1).toString(),
                        reg.getProperty(2).toString(), Double.parseDouble(reg.getProperty(4).toString()),
                        reg.getProperty(5).toString());

                listaCard.add(e1);
        }

        adap = new Adaptador(listaCard, getApplication());
        recycler.setAdapter(adap);
    }
}
</code>```

And this is the error that throw me when I try to compile:

```<code>07-04 22:34:30.059 13691-13691/mx.com.dtss.carritocompras E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: mx.com.dtss.carritocompras, PID: 13691
                                                                            java.lang.RuntimeException: Unable to start activity ComponentInfo{mx.com.dtss.carritocompras/mx.com.dtss.carritocompras.MainActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class android.support.v7.app.AlertController.RecycleListView
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                             Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class android.support.v7.app.AlertController.RecycleListView
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                at mx.com.dtss.carritocompras.MainActivity.onCreate(MainActivity.java:24)
                                                                                at android.app.Activity.performCreate(Activity.java:6445)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                             Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class android.support.v7.app.AlertController.RecycleListView
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                                                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                at mx.com.dtss.carritocompras.MainActivity.onCreate(MainActivity.java:24)
                                                                                at android.app.Activity.performCreate(Activity.java:6445)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                             Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AlertController.RecycleListView" on path: DexPathList[[zip file "/data/app/mx.com.dtss.carritocompras-1/base.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_dependencies_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_0_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_1_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_2_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_3_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_4_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_5_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_6_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_7_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_8_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/mx.com.dtss.carritocompras-1/lib/arm64, /vendor/lib64, /system/lib64]]
                                                                                at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                at android.view.LayoutInflater.createView(LayoutInflater.java:583)
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                                                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                at mx.com.dtss.carritocompras.MainActivity.onCreate(MainActivity.java:24)
                                                                                at android.app.Activity.performCreate(Activity.java:6445)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                Suppressed: java.lang.ClassNotFoundException: android.support.v7.app.AlertController.RecycleListView
                                                                                at java.lang.Class.classForName(Native Method)
</code>```

I hope someone can help me

答:
RecycleListView is an internal class not intended for external use. The fact that it is showing up publicly in the support library is probably a mistake.

Use this code in your xml file to create a ListView

```<code>android.support.v7.widget.RecyclerView
</code>```

Title: Error compiling app on emulator

Body:
I'm trying to install my app into the emulator to prove it but when I try to start the app this crash and doesn't let me open

I'm using CoordinarorLayout in the MainActivity:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="mx.com.dtss.carritocompras.MainActivity">

    <android.support.v7.app.AlertController.RecycleListView
        android:id="@+id/recycler"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </android.support.v7.app.AlertController.RecycleListView>

</android.support.design.widget.CoordinatorLayout>

and in other activity I use a CardView:

    <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.FitWindowsLinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/img"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/txtDesPro"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/txtDetalle"/>
        </LinearLayout>
    </android.support.v7.widget.FitWindowsLinearLayout>

</android.support.v7.widget.CardView>

this is what I've in my AndroidManifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="mx.com.dtss.carritocompras" >

        <uses-permission android:name="android.permission.INTERNET"></uses-permission>

        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme" >
            <activity android:name=".MainActivity" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>

and this is what I have in my `MainActivity`:

package mx.com.dtss.carritocompras;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    RecyclerView recycler;
    RecyclerView.Adapter adap;
    ArrayList<elemento> listaCard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        recycler = (RecyclerView)findViewById(R.id.recycler);
        recycler.setHasFixedSize(true);
        recycler.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

        Thread tr = new Thread(){
            @Override
            public void run(){
                String NAMESPACE = "http://tempuri.org/";
                String URL = "http://192.168.0.14/Publicacion/WebServiceCarrito.asmx";
                String METHOD_NAME = "listarProductos";
                String SOAP_ACTION = "http://tempuri.org/listarProductos";

                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet= true;
                envelope.setOutputSoapObject(request);
                HttpTransportSE transporte = new HttpTransportSE(URL);

                try{
                    transporte.call(SOAP_ACTION, envelope);
                    final SoapObject soap = (SoapObject)envelope.getResponse();

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            listarProductos(soap);
                        }
                    });
                } catch (Exception e){

                }
            }
        };
        tr.start();
    }

    public void listarProductos(SoapObject soap){
        listaCard = new ArrayList<elemento>();
            for(int i = 0; i < soap.getPropertyCount(); i++){
                SoapObject reg = (SoapObject)soap.getProperty(i);
                elemento e1 = new elemento(reg.getProperty(0).toString(), reg.getProperty(1).toString(),
                        reg.getProperty(2).toString(), Double.parseDouble(reg.getProperty(4).toString()),
                        reg.getProperty(5).toString());

                listaCard.add(e1);
        }

        adap = new Adaptador(listaCard, getApplication());
        recycler.setAdapter(adap);
    }
}

And this is the error that throw me when I try to compile:

07-04 22:34:30.059 13691-13691/mx.com.dtss.carritocompras E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: mx.com.dtss.carritocompras, PID: 13691
                                                                            java.lang.RuntimeException: Unable to start activity ComponentInfo{mx.com.dtss.carritocompras/mx.com.dtss.carritocompras.MainActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class android.support.v7.app.AlertController.RecycleListView
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                             Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class android.support.v7.app.AlertController.RecycleListView
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                at mx.com.dtss.carritocompras.MainActivity.onCreate(MainActivity.java:24)
                                                                                at android.app.Activity.performCreate(Activity.java:6445)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                             Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class android.support.v7.app.AlertController.RecycleListView
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                                                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                at mx.com.dtss.carritocompras.MainActivity.onCreate(MainActivity.java:24)
                                                                                at android.app.Activity.performCreate(Activity.java:6445)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                             Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AlertController.RecycleListView" on path: DexPathList[[zip file "/data/app/mx.com.dtss.carritocompras-1/base.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_dependencies_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_0_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_1_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_2_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_3_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_4_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_5_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_6_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_7_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_8_apk.apk", zip file "/data/app/mx.com.dtss.carritocompras-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/mx.com.dtss.carritocompras-1/lib/arm64, /vendor/lib64, /system/lib64]]
                                                                                at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                at android.view.LayoutInflater.createView(LayoutInflater.java:583)
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
                                                                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                                                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                at mx.com.dtss.carritocompras.MainActivity.onCreate(MainActivity.java:24)
                                                                                at android.app.Activity.performCreate(Activity.java:6445)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                                at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5477)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                Suppressed: java.lang.ClassNotFoundException: android.support.v7.app.AlertController.RecycleListView
                                                                                at java.lang.Class.classForName(Native Method)

I hope someone can help me

Body:
RecycleListView is an internal class not intended for external use. The fact that it is showing up publicly in the support library is probably a mistake.

Use this code in your xml file to create a ListView

android.support.v7.widget.RecyclerView


问:
Docker service start failed
I have a CentOS 7.2 VM with Docker installed. Docker service and Docker container worked normally previously. But when I tried to pull a docker image, the VM was shutdown abruptly. After I restarted the VM, the Docker service could not be started:

```<code>[root@AY13091717064020986bZ ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
</code>```

systemctl status docker.service output:

```<code>[root@AY13091717064020986bZ ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2016-08-23 19:11:19 CST; 13min ago
     Docs: http://docs.docker.com
  Process: 1404 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 1404 (code=exited, status=1/FAILURE)

Aug 23 19:11:17 AY13091717064020986bZ systemd[1]: Starting Docker Application Container Engine...
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.448828158+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly discou...v section."
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" faile...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: de...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
</code>```

"journalctl -xe" output:

```<code>[root@AY13091717064020986bZ ~]# journalctl -xe
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: btree spine: node_check failed: csum 1600702373 != wanted 1600827965
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: Buffer I/O error on device dm-1, logical block 2621424
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" failed: devmapper:
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmapper: Base
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Aug 23 19:11:19 AY13091717064020986bZ polkitd[1014]: Unregistered Authentication Agent for unix-process:1370:16052 (system bus name :1.22, object path /org/freedesktop/PolicyKit1/Authenticati
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.
</code>```

Docker version:

```<code>[root@AY13091717064020986bZ ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64
 Go version:      go1.6.3
 Git commit:      d381c64-unsupported
 Built:           Thu Aug  4 13:21:17 2016
 OS/Arch:         linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
</code>```

Linux kernel version:

```<code>[root@AY13091717064020986bZ ~]# uname -a
Linux AY13091717064020986bZ 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@AY13091717064020986bZ ~]#
</code>```

CentOS version:

```<code>[root@AY13091717064020986bZ ~]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID:    CentOS
Description:    CentOS Linux release 7.2.1511 (Core)
Release:    7.2.1511
Codename:    Core
[root@AY13091717064020986bZ ~]#
</code>```

答:
I had a similar problem, which seems to have been caused by cruft left in /var/lib/docker from a previous installation.

Background details: I'd briefly used Docker from the CentOS extras repository; I had then removed it, installed the Docker repository, and installed docker-ce from that repository. This left /var/lib/docker behind and populated, but not owned by the docker-ce package.

The following fixed this:

rpm -e docker-ce

rm -f /var/lib/docker

yum install docker-ce

ContentLicense: CC BY-SA 4.0

Title: Docker service start failed

Body:
I have a CentOS 7.2 VM with Docker installed. Docker service and Docker container worked normally previously. But when I tried to pull a docker image, the VM was shutdown abruptly. After I restarted the VM, the Docker service could not be started:

[root@AY13091717064020986bZ ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

systemctl status docker.service output:

[root@AY13091717064020986bZ ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2016-08-23 19:11:19 CST; 13min ago
     Docs: http://docs.docker.com
  Process: 1404 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 1404 (code=exited, status=1/FAILURE)

Aug 23 19:11:17 AY13091717064020986bZ systemd[1]: Starting Docker Application Container Engine...
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.448828158+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly discou...v section."
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" faile...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: de...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

"journalctl -xe" output:

[root@AY13091717064020986bZ ~]# journalctl -xe
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: btree spine: node_check failed: csum 1600702373 != wanted 1600827965
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: Buffer I/O error on device dm-1, logical block 2621424
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" failed: devmapper:
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmapper: Base
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Aug 23 19:11:19 AY13091717064020986bZ polkitd[1014]: Unregistered Authentication Agent for unix-process:1370:16052 (system bus name :1.22, object path /org/freedesktop/PolicyKit1/Authenticati
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.

Docker version:

[root@AY13091717064020986bZ ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64
 Go version:      go1.6.3
 Git commit:      d381c64-unsupported
 Built:           Thu Aug  4 13:21:17 2016
 OS/Arch:         linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Linux kernel version:

[root@AY13091717064020986bZ ~]# uname -a
Linux AY13091717064020986bZ 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@AY13091717064020986bZ ~]#

CentOS version:

[root@AY13091717064020986bZ ~]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID:    CentOS
Description:    CentOS Linux release 7.2.1511 (Core)
Release:    7.2.1511
Codename:    Core
[root@AY13091717064020986bZ ~]#


问:
saving values from radio buttons to database. rails app
I'm adding radio buttons to my page.
I want the user to be able to pick whether the order gets sent or they pick it up.

I'm having troubles to save the values to the database.

can someone advise me?

```<code>    <div class="col-md-5 pick-up-buttons" id="country_div">

    <li><%= f.radio_button :pick_up, true %></li>
    <li><%= f.label :pick_up, "Pick up order in store", :value => "false"  %></li>

    <li><%= f.radio_button :pick_up, false, :checked => true %></li>
    <li><%= f.label :pick_up, "have the order delivered", :value => "true" %></li>

  </div>
</code>```

here is the schema_file

```<code>  create_table "orders", force: :cascade do |t|
    t.string   "name"
    t.string   "email"
    t.text     "address"
    t.string   "city"
    t.string   "country"
    t.datetime "created_at",                 null: false
    t.datetime "updated_at",                 null: false
    t.boolean  "shipped",    default: false
    t.string   "pick_up"

  end
</code>```

答:
Datatype of pickup column should be boolean to save true/false value.

```<code><%= f.radio_button :pick_up, "1", checked: @order.pick_up?, data: { question: 'Pick up order in store' } %> <%= f.label :pick_up, "Yes" %>
<%= f.radio_button :pick_up, "0", checked: @order.pick_up?, data: { question: 'have the order delivered?' } %> <%= f.label :pick_up, "No" %>
</code>```

Body:
I'm adding radio buttons to my page.
I want the user to be able to pick whether the order gets sent or they pick it up.

I'm having troubles to save the values to the database.

can someone advise me?

<%= f.radio_button :pick_up, true %>

<%= f.label :pick_up, "Pick up order in store", :value => "false"  %>

<%= f.radio_button :pick_up, false, :checked => true %>

<%= f.label :pick_up, "have the order delivered", :value => "true" %>

here is the schema_file

  create_table "orders", force: :cascade do |t|
    t.string   "name"
    t.string   "email"
    t.text     "address"
    t.string   "city"
    t.string   "country"
    t.datetime "created_at",                 null: false
    t.datetime "updated_at",                 null: false
    t.boolean  "shipped",    default: false
    t.string   "pick_up"

  end

Body:
Datatype of pickup column should be boolean to save true/false value.

<%= f.radio_button :pick_up, "1", checked: @order.pick_up?, data: { question: 'Pick up order in store' } %> <%= f.label :pick_up, "Yes" %>
<%= f.radio_button :pick_up, "0", checked: @order.pick_up?, data: { question: 'have the order delivered?' } %> <%= f.label :pick_up, "No" %>


问:
PHP Laravel route not working
I've installd PHP laravel from Composer so i created a route:

```<code>Route::get('cats/{id}', function()
{
return "Cat #$id";
});
</code>```

But when i get into: http://www.oktech-servers.net/cats/12345

A error msg prompt: Whoops, looks like something went wrong.

I want to mention also the htaccess:

```<code>RewriteEngine On
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
</code>```

My host administrator says that mod-rewrite is working properly but i can't find why i get this error!!

Regards.

答:
get thet parameter $id in your function. You have not used it</p>

```<code>Route::get('user/{id}', function($id) {
   return 'User '.$id;
});
</code>```

Title: PHP Laravel route not working

Body:
I've installd PHP laravel from Composer so i created a route:

Route::get('cats/{id}', function()
{
return "Cat #$id";
});

But when i get into: http://www.oktech-servers.net/cats/12345

A error msg prompt: Whoops, looks like something went wrong.

I want to mention also the htaccess:

RewriteEngine On
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

My host administrator says that mod-rewrite is working properly but i can't find why i get this error!!

Regards.

Body:
get thet parameter $id in your function. You have not used it

Route::get('user/{id}', function($id) {
   return 'User '.$id;
});


问:
Could not load file or assembly 'Antlr3.Runtime (1)' or one of its dependencies
I'm getting this error while trying to run my MVC4 project, it was working fine until last time on my other machines, but when I'm trying to run it from another machine it's giving me this error:

Could not load file or assembly 'Antlr3.Runtime (1)' or one of its
  dependencies. The located assembly's manifest definition does not
  match the assembly reference. (Exception from HRESULT: 0x80131040)

After reading about this here I've tried to do:

Install-Package Antlr3.Runtime -Pre

but it didn't help, any ideas?

答:
After trying to delete .netframework temp file without success, I changed

```<code><system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.6.1" />
    <httpRuntime />
    <pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
</code>```

With only targetFramework="4.6" instead of 4.6.1
Web site displays without errors.
Next I changed again to targetFramework="4.6.1" and restart server.
Everything remains Ok.

Body:
After trying to delete .netframework temp file without success, I changed

<system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.6.1" />
    <httpRuntime />
    <pages controlRenderingCompatibilityVersion="4.0" />
</system.web>

With only targetFramework="4.6" instead of 4.6.1
Web site displays without errors.
Next I changed again to targetFramework="4.6.1" and restart server.
Everything remains Ok.


问:
How to compare two folders and add/remove files with Powershell
I have two different folders (old and new) with child-folders and .xml files. I need to know which files was added or removed (not edited!) in new folder relative to old folder. How to do this with PowerShell?</p>

答:
simplest one  (will be looking recursively for all XML files in folder(s)):

```<code>    $folder1 = ""
$folder2 = ""

$fol1 = Get-ChildItem -Recurse $folder1 -Filter *.xml| select name, directory, CreationTime
$fol2 = Get-ChildItem -Recurse $folder2 -Filter *.xml| select name, directory, CreationTime

Compare-Object $fol1 $fol2 -Property name -PassThru | select name, CreationTime, @{
    N = "Folder"; e= {
        if ($_.sideindicator -eq "=>") { "Not Found in $folder2" }
        elseif ($_.sideindicator -eq "<=") { "Not Found in $folder1" }
    }
}
</code>```

output:

Name                  CreationTime            Folder
----                  ------------            ------
New Text Document.txt 7/5/2017 1:24:35 PM     Not Found in G:\xxx
1.exe                 6/14/2017 3:17:29 PM    Not Found in G:\111
1.dll                 6/14/2017 3:17:37 PM    Not Found in G:\1
```

Body:
simplest one  (will be looking recursively for all XML files in folder(s)):

    $folder1 = ""
$folder2 = ""

$fol1 = Get-ChildItem -Recurse $folder1 -Filter *.xml| select name, directory, CreationTime
$fol2 = Get-ChildItem -Recurse $folder2 -Filter *.xml| select name, directory, CreationTime

Compare-Object $fol1 $fol2 -Property name -PassThru | select name, CreationTime, @{
    N = "Folder"; e= {
        if ($_.sideindicator -eq "=>") { "Not Found in $folder2" }
        elseif ($_.sideindicator -eq "<=") { "Not Found in $folder1" }
    }
}

output:

Name                  CreationTime            Folder
----                  ------------            ------
New Text Document.txt 7/5/2017 1:24:35 PM     Not Found in G:\xxx
1.exe                 6/14/2017 3:17:29 PM    Not Found in G:\111
1.dll                 6/14/2017 3:17:37 PM    Not Found in G:\1