问:
Understanding how label works when elements hidden
I am trying to understand, how a can label work in conjunction with elements states like input[type="type=""]:checked or input[type=""]:unchecked.I got a very basic example which I am trying to work out, but I cannot make the label a circle or square that can have a check mark or unchecked when clicked. What makes the label have that outlook and showing checked and unchecked state? Does the label need to have a width and height? If so do I need to make it a block level element.

```<code>input[type="checkbox"]{
  width:0;
  heigh:0;
/*   or display:none? */
}
label{
  position:relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
}
label:before,
label:after{
  font-size:50px;
}
label:before{
  content: '\f096'; /
   //Can be some good example
}
label:after{
  content: '\f00c';
  //Can be some good example
}
input[type="checkbox"]:checked{
  content:"check"
  //Can be some good example
}
input[type="checkbox"]:unchecked{
  content:"x"
  //Can be some good example
}
</code>```

Something achievable like this but without text next to labels as I want checkbox based on styling.

答:
You cannot change the content the label itself, but you can control the content of the pseudo element after and before. You can add the logic of square/circle with something that can represent check and uncheck.

```<code>input[type='checkbox'] {
  width: 0;
  height: 0;
}

input[type='checkbox']:checked + label:after {
  content: "checked";
}
</code>```

Demo

To answer your question in the comment

How they make funky circle buttons and put a checkbox inside it when one clicks?

You can use CSS animations. The label will already have the check symbol in it but won't have shown in the unchecked state of the input box. And when the element is checked, it will change the opacity to 1, showing the checkbox in an animated way.

```<code>input[type='checkbox'] {
  width: 0;
  height: 0;
}

input[type='checkbox'] + label:after {
  content: "checked";
  opacity: 0;
  -webkit-transition: all 0.50s;
  -moz-transition: all 0.50s;
  -o-transition: all 0.50s;
  transition: all 0.50s;
}

input[type='checkbox']:checked + label:after {
  opacity: 1;
}
</code>```

Demo

Body:
I am trying to understand, how a can label work in conjunction with elements states like input[type="type=""]:checked or input[type=""]:unchecked.I got a very basic example which I am trying to work out, but I cannot make the label a circle or square that can have a check mark or unchecked when clicked. What makes the label have that outlook and showing checked and unchecked state? Does the label need to have a width and height? If so do I need to make it a block level element.

input[type="checkbox"]{
  width:0;
  heigh:0;
/*   or display:none? */
}
label{
  position:relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
}
label:before,
label:after{
  font-size:50px;
}
label:before{
  content: '\f096'; /
   //Can be some good example
}
label:after{
  content: '\f00c';
  //Can be some good example
}
input[type="checkbox"]:checked{
  content:"check"
  //Can be some good example
}
input[type="checkbox"]:unchecked{
  content:"x"
  //Can be some good example
}

Something achievable like this but without text next to labels as I want checkbox based on styling.

Body:
You cannot change the content the label itself, but you can control the content of the pseudo element after and before. You can add the logic of square/circle with something that can represent check and uncheck.

input[type='checkbox'] {
  width: 0;
  height: 0;
}

input[type='checkbox']:checked + label:after {
  content: "checked";
}

Demo

To answer your question in the comment

How they make funky circle buttons and put a checkbox inside it when one clicks?

You can use CSS animations. The label will already have the check symbol in it but won't have shown in the unchecked state of the input box. And when the element is checked, it will change the opacity to 1, showing the checkbox in an animated way.

input[type='checkbox'] {
  width: 0;
  height: 0;
}

input[type='checkbox'] + label:after {
  content: "checked";
  opacity: 0;
  -webkit-transition: all 0.50s;
  -moz-transition: all 0.50s;
  -o-transition: all 0.50s;
  transition: all 0.50s;
}

input[type='checkbox']:checked + label:after {
  opacity: 1;
}

Demo


来源: stackexchange

问:
Conditional Sequence repeat In R
I have a matrix made of a very long series of integers bounded  between 1 and 6. I  would like to create an output matrix of the same length than the original matrix and 6 columns (the maximum value in the original matrix) where 1 is repeated  n time the value of the first encountered integer in the column of the integer value. (i.e if the first value is 6 it would repeat 1 x 6 times in the 6th column of the output matrix and then the value in in row 7 of the original matrix would be used for the next repeat sequence. I have shown an example in the below. Is there an efficient way to do this in R?

```<code>Original Matrix         output  Matrix
    c1          c1  c2  c3  c4  c5  c6
R1  1       R1  1   0   0   0   0   0
R2  1       R2  1   0   0   0   0   0
R3  3       R3  0   0   1   0   0   0
R4  2       R4  0   0   1   0   0   0
R5  6       R5  0   0   1   0   0   0
R6  1       R6  1   0   0   0   0   0
R7  1       R7  1   0   0   0   0   0
R8  1       R8  1   0   0   0   0   0
R9  1       R9  1   0   0   0   0   0
R10 4       R10 0   0   0   1   0   0
R11 4       R11 0   0   0   1   0   0
R12 2       R12 0   0   0   1   0   0
R13 1       R13 0   0   0   1   0   0
R14 3       R14 0   0   1   0   0   0
R15 1       R15 0   0   1   0   0   0
</code>```

A further example of the input and output matrix to make my above example clearer.

```<code>Input matrix            Output matrix
    c1          1   2   3   4   5   6
1   2       1   0   1   0   0   0   0
2   2       2   0   1   0   0   0   0
3   1       3   1   0   0   0   0   0
4   6       4   0   0   0   0   0   1
5   3       5   0   0   0   0   0   1
6   4       6   0   0   0   0   0   1
7   5       7   0   0   0   0   0   1
8   4       8   0   0   0   0   0   1
9   5       9   0   0   0   0   0   1
10  4       10  0   0   0   1   0   0
11  3       11  0   0   0   1   0   0
12  3       12  0   0   0   1   0   0
13  2       13  0   0   0   1   0   0
14  3       14  0   0   1   0   0   0
15  4       15  0   0   1   0   0   0
16  5       16  0   0   1   0   0   0
17  5       17  0   0   0   0   1   0
18  5       18  0   0   0   0   1   0
</code>```

ContentLicense: CC BY-SA 3.0

Title: Conditional Sequence repeat In R

Body:
I have a matrix made of a very long series of integers bounded  between 1 and 6. I  would like to create an output matrix of the same length than the original matrix and 6 columns (the maximum value in the original matrix) where 1 is repeated  n time the value of the first encountered integer in the column of the integer value. (i.e if the first value is 6 it would repeat 1 x 6 times in the 6th column of the output matrix and then the value in in row 7 of the original matrix would be used for the next repeat sequence. I have shown an example in the below. Is there an efficient way to do this in R?

Original Matrix         output  Matrix
    c1          c1  c2  c3  c4  c5  c6
R1  1       R1  1   0   0   0   0   0
R2  1       R2  1   0   0   0   0   0
R3  3       R3  0   0   1   0   0   0
R4  2       R4  0   0   1   0   0   0
R5  6       R5  0   0   1   0   0   0
R6  1       R6  1   0   0   0   0   0
R7  1       R7  1   0   0   0   0   0
R8  1       R8  1   0   0   0   0   0
R9  1       R9  1   0   0   0   0   0
R10 4       R10 0   0   0   1   0   0
R11 4       R11 0   0   0   1   0   0
R12 2       R12 0   0   0   1   0   0
R13 1       R13 0   0   0   1   0   0
R14 3       R14 0   0   1   0   0   0
R15 1       R15 0   0   1   0   0   0

A further example of the input and output matrix to make my above example clearer.

Input matrix            Output matrix
    c1          1   2   3   4   5   6
1   2       1   0   1   0   0   0   0
2   2       2   0   1   0   0   0   0
3   1       3   1   0   0   0   0   0
4   6       4   0   0   0   0   0   1
5   3       5   0   0   0   0   0   1
6   4       6   0   0   0   0   0   1
7   5       7   0   0   0   0   0   1
8   4       8   0   0   0   0   0   1
9   5       9   0   0   0   0   0   1
10  4       10  0   0   0   1   0   0
11  3       11  0   0   0   1   0   0
12  3       12  0   0   0   1   0   0
13  2       13  0   0   0   1   0   0
14  3       14  0   0   1   0   0   0
15  4       15  0   0   1   0   0   0
16  5       16  0   0   1   0   0   0
17  5       17  0   0   0   0   1   0
18  5       18  0   0   0   0   1   0

Body:
This is a simplistic solution but it works:

input_data <- c(1, 1, 3, 2, 6, 1, 1, 1, 1, 4, 4, 2, 1, 3, 1)
result <- matrix(0, nrow = length(input_data), ncol = 6)

counter <- 0
for (i in 1:length(input_data)){
  if (counter == 0){
      counter <- set_value <- input_data[i]
  }

  result[i, set_value]  <- 1
  counter <- counter - 1

}

> cbind(input_data, result)

 [1,]          1 1 0 0 0 0 0
 [2,]          1 1 0 0 0 0 0
 [3,]          3 0 0 1 0 0 0
 [4,]          2 0 0 1 0 0 0
 [5,]          6 0 0 1 0 0 0
 [6,]          1 1 0 0 0 0 0
 [7,]          1 1 0 0 0 0 0
 [8,]          1 1 0 0 0 0 0
 [9,]          1 1 0 0 0 0 0
[10,]          4 0 0 0 1 0 0
[11,]          4 0 0 0 1 0 0
[12,]          2 0 0 0 1 0 0
[13,]          1 0 0 0 1 0 0
[14,]          3 0 0 1 0 0 0
[15,]          1 0 0 1 0 0 0


问:
check string valid or not in PHP
How to know which word has valid id card with criterion? If id card has 10 characters or more then id card is valid otherwise it is not valid.

example of sentences :

```<code>$String_1 = "i'm john and my id card 12334435345 my favorite team xxxxxxxx.";

$String_2 = "i'm ananda ramadina and my id card 9090909889 my favorite team YYYYYYYYYY.";

$String_3 = "i'm dinda rahayu and my id card 909 my favorite team RRRRRRRR.";
</code>```

答:
if in your string only card number then use filter_var with FILTER_SANITIZE_NUMBER_INT

```<code>$String_1 = "i'm john and my id card 112312312312312 my favorite team xxxxxxxx.";
$card_number = filter_var($String_1, FILTER_SANITIZE_NUMBER_INT);

// compare the length for $card_number
if (strlen($card_number) < 10){
    echo 'invalid';
} else {
   echo 'valid';
}
</code>```

you can use this code if in your string have 2 or many number type

```<code>$String_1 = "i'm john and my id card 1 my favorite team xxxxxxxx.";
$get_card_info = explode('id card', $String_1);

$get_card_format = explode('my favorite', $get_card_info[1]);

if (strlen($get_card_format[0]) > 10) {
    echo 'valid';
} else {
    echo 'not valid';
}
</code>```

Title: check string valid or not in PHP

Body:
How to know which word has valid id card with criterion? If id card has 10 characters or more then id card is valid otherwise it is not valid.

example of sentences :

$String_1 = "i'm john and my id card 12334435345 my favorite team xxxxxxxx.";

$String_2 = "i'm ananda ramadina and my id card 9090909889 my favorite team YYYYYYYYYY.";

$String_3 = "i'm dinda rahayu and my id card 909 my favorite team RRRRRRRR.";

Body:
if in your string only card number then use filter_var with FILTER_SANITIZE_NUMBER_INT

$String_1 = "i'm john and my id card 112312312312312 my favorite team xxxxxxxx.";
$card_number = filter_var($String_1, FILTER_SANITIZE_NUMBER_INT);

// compare the length for $card_number
if (strlen($card_number) < 10){
    echo 'invalid';
} else {
   echo 'valid';
}

you can use this code if in your string have 2 or many number type

$String_1 = "i'm john and my id card 1 my favorite team xxxxxxxx.";
$get_card_info = explode('id card', $String_1);

$get_card_format = explode('my favorite', $get_card_info[1]);

if (strlen($get_card_format[0]) > 10) {
    echo 'valid';
} else {
    echo 'not valid';
}


问:
How to integrate Hive (avro tables) with Schema Registry?
Hive provides two table properties allowing to define Avro schema: avro.schema.literal and avro.schema.url, where the former can specify a hdfs path or http endpoint serving the schema. I'd like to use Schema Registry as my schema service, but the problem is its endpoints return schema wrapped in a bigger json object:

Request:

```<code>GET /schemas/ids/1
</code>```

Response:

```<code>HTTP/1.1 200 OK
Content-Type: application/vnd.schemaregistry.v1+json

{
  "schema": "{\"type\": \"string\"}"
}
</code>```

Request:

```<code>GET /subjects/test/versions/1
</code>```

Response:

```<code>HTTP/1.1 200 OK
Content-Type: application/vnd.schemaregistry.v1+json

{
  "name": "test",
  "version": 1,
  "schema": "{\"type\": \"string\"}"
}
</code>```

The above responses cannot be parsed by Hive.

答:
My idea so far is to put a proxy service in front of Schema Registry (serving pure avro schemas) and scale it with HAProxy. Schema Registry itself seems to have scalable architecture for reads. To be honest I don't understand the paragraph about avro.schema.url property in AvroSerDe hive documentation:

Specifies a URL to access the schema from. For http schemas, this
  works for testing and small-scale clusters, but as the schema will be
  accessed at least once from each task in the job, this can quickly
  turn the job into a DDOS attack against the URL provider (a web
  server, for instance). Use caution when using this parameter for
  anything other than testing.

I think that my proposal is a viable solution.

Having schemas in centralised repo allows for schema evolution and checking backward/forward compatibility, hence it's better than defining hdfs path, which is recommended in AvroSerDe docs.

Body:
Hive provides two table properties allowing to define Avro schema: avro.schema.literal and avro.schema.url, where the former can specify a hdfs path or http endpoint serving the schema. I'd like to use Schema Registry as my schema service, but the problem is its endpoints return schema wrapped in a bigger json object:

Request:

GET /schemas/ids/1

Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.schemaregistry.v1+json

{
  "schema": "{\"type\": \"string\"}"
}

Request:

GET /subjects/test/versions/1

Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.schemaregistry.v1+json

{
  "name": "test",
  "version": 1,
  "schema": "{\"type\": \"string\"}"
}

The above responses cannot be parsed by Hive.


问:
Got exceptions after upgrading environment to use JasperReports with Java 8 and new jdt compiler
I want to generate JasperReports's report by using my jrxml and Java code.
I'm using Netbeans 8 and jdk8.

I got a lot of exceptions during template compilation:

```<code>Exception in thread "main" net.sf.jasperreports.engine.JRException:
Errors were encountered when compiling report expressions class file:
1. java.lang.Integer cannot be resolved or is not a type
                value = new java.lang.Integer(1); //$JR_EXPR_ID=0$
                                <--------------->
java.util.Date cannot be resolved or is not a type
                value = new java.util.Date(); //$JR_EXPR_ID=9$
                            <------------>
java.sql.Connection cannot be resolved or is not a type
                value = ((java.sql.Connection)parameter_REPORT_CONNECTION.getValue()); //$JR_EXPR_ID=21$
                          <----------------->
</code>```

I've already added jdt jar files.

The full list of jar files:

org.eclipse.jdt.core-3.7.1

jdtcore-3.1.0

org.eclipse.jdt.core-3.11.1.v20150902-1521

jasper-compiler-jdt-5.5.9

jtds-1.3.1

jdt-0.15.0

How to fix this issue?

答:
only jasper-compiler-jdt-5.5.9.jar is required. above listed .jar files are not necessary.
i add new jasper library but not removed old jar.
so please remove old jar first than add latest version of jar.

Body:
I want to generate JasperReports's report by using my jrxml and Java code.
I'm using Netbeans 8 and jdk8.

I got a lot of exceptions during template compilation:

Exception in thread "main" net.sf.jasperreports.engine.JRException:
Errors were encountered when compiling report expressions class file:
1. java.lang.Integer cannot be resolved or is not a type
                value = new java.lang.Integer(1); //$JR_EXPR_ID=0$
                                <--------------->
java.util.Date cannot be resolved or is not a type
                value = new java.util.Date(); //$JR_EXPR_ID=9$
                            <------------>
java.sql.Connection cannot be resolved or is not a type
                value = ((java.sql.Connection)parameter_REPORT_CONNECTION.getValue()); //$JR_EXPR_ID=21$
                          <----------------->

I've already added jdt jar files.

The full list of jar files:

org.eclipse.jdt.core-3.7.1

jdtcore-3.1.0

org.eclipse.jdt.core-3.11.1.v20150902-1521

jasper-compiler-jdt-5.5.9

jtds-1.3.1

jdt-0.15.0

How to fix this issue?


问:
How to append dynamically created div into current mainDiv not all the mainDiv when click on a button
I'm trying to appendTo a
 into current
 when click on a button. Now its appendTo all the class='mainDiv' & after the cloning. I need it only to the current clicked
. Can someone help me to solve it?

(function($) {

  function div2() {
    $('
').addClass('div2').text('This is a Content').appendTo('.mainDiv');
  }

  function cloneIt() {
    $('.mainDiv').clone().detach().appendTo('body');
  }

  $(document).on('click', '.div1', function() {
    div2();
  });

  $(document).on('click', 'span', function() {
    cloneIt();
  });

})(jQuery);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  display: flex;
  justify-content: space-around;
}

.mainDiv {
  background-color: #000;
  width: 100px;
  height: 100px;
  color: #fff;
  padding: 20px;
  margin-left: 15px;
  margin-right: 15px;
}

.div1 {
  background-color: blue;
  padding: 10px;
  cursor: pointer;
}

.div2 {
  background-color: red;
  padding: 10px;
}

span {
  display: block;
  padding: 10px;
  background-color: green;
  margin-bottom: 15px;
  cursor: pointer;
}</code>```

  Clone it

click to append div

```

答:
You can add the newly created div to the correct .mainDiv with the following

(function($) {

  function div2(el) {
    $('
').addClass('div2').text('This is a Content').appendTo(el);
  }

  function cloneIt() {
    $('.mainDiv').clone().detach().appendTo('body');
  }

  $(document).on('click', '.div1', function() {
  var el = $(this).parent('.mainDiv');
    div2(el);
  });

  $(document).on('click', 'span', function() {
    cloneIt();
  });

})(jQuery);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  display: flex;
  justify-content: space-around;
}

.mainDiv {
  background-color: #000;
  width: 100px;
  height: 100px;
  color: #fff;
  padding: 20px;
  margin-left: 15px;
  margin-right: 15px;
}

.div1 {
  background-color: blue;
  padding: 10px;
  cursour: pointer;
}

.div2 {
  background-color: red;
  padding: 10px;
}

span {
  display: block;
  padding: 10px;
  background-color: green;
  margin-bottom: 15px;
  cursor: pointer;
}</code>```

  Clone it

click to append div

  Clone it

click to append div

  Clone it

click to append div

```

Body:
I'm trying to appendTo a
 into current
 when click on a button. Now its appendTo all the class='mainDiv' & after the cloning. I need it only to the current clicked
. Can someone help me to solve it?

(function($) {

  function div2() {
    $('
').addClass('div2').text('This is a Content').appendTo('.mainDiv');
  }

  function cloneIt() {
    $('.mainDiv').clone().detach().appendTo('body');
  }

  $(document).on('click', '.div1', function() {
    div2();
  });

  $(document).on('click', 'span', function() {
    cloneIt();
  });

})(jQuery);

body {
  display: flex;
  justify-content: space-around;
}

.mainDiv {
  background-color: #000;
  width: 100px;
  height: 100px;
  color: #fff;
  padding: 20px;
  margin-left: 15px;
  margin-right: 15px;
}

.div1 {
  background-color: blue;
  padding: 10px;
  cursor: pointer;
}

.div2 {
  background-color: red;
  padding: 10px;
}

span {
  display: block;
  padding: 10px;
  background-color: green;
  margin-bottom: 15px;
  cursor: pointer;
}

  Clone it

click to append div

Body:
You can add the newly created div to the correct .mainDiv with the following

(function($) {

  function div2(el) {
    $('<div/>').addClass('div2').text('This is a Content').appendTo(el);
  }

  function cloneIt() {
    $('.mainDiv').clone().detach().appendTo('body');
  }

  $(document).on('click', '.div1', function() {
  var el = $(this).parent('.mainDiv');
    div2(el);
  });

  $(document).on('click', 'span', function() {
    cloneIt();
  });

})(jQuery);

body {
  display: flex;
  justify-content: space-around;
}

.mainDiv {
  background-color: #000;
  width: 100px;
  height: 100px;
  color: #fff;
  padding: 20px;
  margin-left: 15px;
  margin-right: 15px;
}

.div1 {
  background-color: blue;
  padding: 10px;
  cursour: pointer;
}

.div2 {
  background-color: red;
  padding: 10px;
}

span {
  display: block;
  padding: 10px;
  background-color: green;
  margin-bottom: 15px;
  cursor: pointer;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="mainDiv">
  <span>Clone it</span>
  <div class="div1">click to append div</div>
</div>
<div class="mainDiv">
  <span>Clone it</span>
  <div class="div1">click to append div</div>
</div>
<div class="mainDiv">
  <span>Clone it</span>
  <div class="div1">click to append div</div>
</div>


问:
XmlSerializer - Same Element with different Attributes
Expected XML Output:

```<code><add>
 <doc>
  <field name="id">1</field>
  <field name="Myname">MyName1</field1>
 </doc>
 <doc>
  <field name="id">2</field>
  <field name="Myname">MyName2</field>
 </doc>
 <doc>
  <field name="id">3</field>
  <field name="Myname">MyName3</field>
 </doc>
</add>
</code>```

To get the above XML document, I designed the following class

```<code>public class doc
{
    [XmlElement("field")]
    public ID Id
    {
        get;
        set;
    }
    [XmlElement("field2")]
    public Name Myname
    {
        get;
        set;
    }
}
</code>```

Name class will be

```<code> public class Name
{
    [XmlText]
    public string Namevalue
    {
        get;
        set;
    }
    [XmlAttribute("name")]
    public string Myname
    {
        get;
        set;
    }
}
</code>```

XmlSerializer Code:

```<code>XmlSerializer serializer = new XmlSerializer(typeof(List<doc>), new XmlRootAttribute("add"));
</code>```

This give me the following output

```<code><add>
 <doc>
  <field name="id">1</field>
  <field2 name="Myname">MyName1</field2>
 </doc>
 <doc>
  <field name="id">2</field>
  <field2 name="Myname">MyName2</field2>
 </doc>
 <doc>
  <field name="id">3</field>
  <field2 name="Myname">MyName3</field2>
 </doc>
</add>
</code>```

Here the field2 should be field I know I need to change the field2 as field in doc class but that results in error.

How should I design my class to get the expected output?

Edit: ID class will also look like Name class with its own attributes

答:
Two options

```<code> [XmlRoot("doc")]
    public class Doc
    {
        [XmlElement("field",Order = 1)]
        public Field Id
        {
            get;
            set;
        }
        [XmlElement("field", Order = 2)]
        public Field Name
        {
            get;
            set;
        }
    }

    [XmlRoot("doc")]
    public class Field
    {
        [XmlText]
        public string Value
        {
            get;
            set;
        }

        [XmlAttribute("name")]
        public string Name
        {
            get;
            set;
        }
    }
enter code here
</code>```

this will produce  elements in given order. Or use arrays like

```<code>[XmlRoot("doc")]
    public class Doc
    {
        [XmlArray("field")]
        public Field[] Fields
        {
            get;
            set;
        }
    }
</code>```

ContentLicense: CC BY-SA 2.5

Body:
Expected XML Output:

<add>
 <doc>
  <field name="id">1</field>
  <field name="Myname">MyName1</field1>
 </doc>
 <doc>
  <field name="id">2</field>
  <field name="Myname">MyName2</field>
 </doc>
 <doc>
  <field name="id">3</field>
  <field name="Myname">MyName3</field>
 </doc>
</add>

To get the above XML document, I designed the following class

public class doc
{
    [XmlElement("field")]
    public ID Id
    {
        get;
        set;
    }
    [XmlElement("field2")]
    public Name Myname
    {
        get;
        set;
    }
}

Name class will be

 public class Name
{
    [XmlText]
    public string Namevalue
    {
        get;
        set;
    }
    [XmlAttribute("name")]
    public string Myname
    {
        get;
        set;
    }
}

XmlSerializer Code:

XmlSerializer serializer = new XmlSerializer(typeof(List<doc>), new XmlRootAttribute("add"));

This give me the following output

<add>
 <doc>
  <field name="id">1</field>
  <field2 name="Myname">MyName1</field2>
 </doc>
 <doc>
  <field name="id">2</field>
  <field2 name="Myname">MyName2</field2>
 </doc>
 <doc>
  <field name="id">3</field>
  <field2 name="Myname">MyName3</field2>
 </doc>
</add>

Here the field2 should be field I know I need to change the field2 as field in doc class but that results in error.

How should I design my class to get the expected output?

Edit: ID class will also look like Name class with its own attributes

Body:
Two options

 [XmlRoot("doc")]
    public class Doc
    {
        [XmlElement("field",Order = 1)]
        public Field Id
        {
            get;
            set;
        }
        [XmlElement("field", Order = 2)]
        public Field Name
        {
            get;
            set;
        }
    }

    [XmlRoot("doc")]
    public class Field
    {
        [XmlText]
        public string Value
        {
            get;
            set;
        }

        [XmlAttribute("name")]
        public string Name
        {
            get;
            set;
        }
    }
enter code here

this will produce  elements in given order. Or use arrays like

[XmlRoot("doc")]
    public class Doc
    {
        [XmlArray("field")]
        public Field[] Fields
        {
            get;
            set;
        }
    }


问:
Carry a small image file in String variable?
I have created a java program,
my program needs an image at some point to be written into Back end database(MySQL).

after this Question i know that i can't read files from deployed jar files,
So therefore t tried this

```<code>package sample;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws IOException {

        File file = new File("11.jpg");

        byte[] allBytes=Files.readAllBytes(file.toPath());
         Path path = Paths.get("0.txt");

         Files.write(path, allBytes);

    }

}
</code>```

where 11.jpg is the image file that i want to use.
in the above code i converted 11.jpg to 0.txt
then i copied all from the 0 text and stored inside a String
and did this

```<code>package sample;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws IOException {

        File file = new File("11.jpg");

        String s = "���� \u0010JFIF \u0001\u0001\u0001 ` `  �� C \u0002\u0001\u0001\u0002\u0001\u0001\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0003\u0005\u0003\u0003\u0003\u0003\u0003\u0006\u0004\u0004\u0003\u0005\u0007\u0006\u0007\u0007\u0007\u0006\u0007\u0007\b\t\u000B\t\b\b\n" +
                "\b\u0007\u0007\n" +
                "\n" +
                "\n" +
                "\u000B\f\f\f\f\u0007\t\u000E\u000F\n" +
                "\f\u000E\u000B\f\f\f�� C\u0001\u0002\u0002\u0002\u0003\u0003\u0003\u0006\u0003\u0003\u0006\f\b\u0007\b\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f�� \u0011\b c D\u0003\u0001\" \u0002\u0011\u0001\u0003\u0011\u0001�� \u001F  \u0001\u0005\u0001\u0001\u0001\u0001\u0001\u0001        \u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n" +
                "\u000B�� �\u0010 \u0002\u0001\u0003\u0003\u0002\u0004\u0003\u0005\u0005\u0004\u0004  \u0001}\u0001\u0002\u0003 \u0004\u0011\u0005\u0012!1A\u0006\u0013Qa\u0007\"q\u00142���\b#B��\u0015R��$3br�\t\n" +
                "\u0016\u0017\u0018\u0019\u001A%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� \u001F\u0001 \u0003\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001      \u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n" +
                "\u000B�� �\u0011 \u0002\u0001\u0002\u0004\u0004\u0003\u0004\u0007\u0005\u0004\u0004 \u0001\u0002w \u0001\u0002\u0003\u0011\u0004\u0005!1\u0006\u0012AQ\u0007aq\u0013\"2�\b\u0014B����\t#3R�\u0015br�\n" +
                "\u0016$4�%�\u0017\u0018\u0019\u001A&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������� \f\u0003\u0001 \u0002\u0011\u0003\u0011 ? ���'\u0014?J��7���� d��7��h�ώ|sug4�\u001F�n�cu�j�Ӧ\u0001s\n" +
                "�3�\u0015�3'�s�2�\u0018p���� �ѥ:����n�糱�M|����\n" +
                "�ῂ\u001F\u0014�� \n" +
                "�\u000B�9�H��!��\u001A��|$'��9��o\u001E\t�\u000B���ċl�#\u0005v\u000B�\"\u0012$;+ʼ\u0013�_|qӼO�\n" +
                "k��2�\u001D�H�\u0010\u0012���\f���Ҧ����H�{ˉ��yhn\u0007��;If��['���_\u0018��?\u000F\u0013�\t��\u000F�_�5�|?���� �\u0017���\u0002�kگ�F�y\u001D������\tn �-�7@Nɽق�4j��\u0017'JO��d�v>�� ��ǩ궶�� ���\u0005+�x���K(����\u0015�\u0011I4�Y\u007F��E\u000F�\u0014�M!Xϖ@l�\u001F��gߏ^\u0017��>\n" +
                "�g�\u001F��H��\t���=GM�E*^7�\u0016S�:�dt<�+)�\u001A��\u05FFm-S���w��'�o\n" +
                "������xcF>!����(\u001A=���Y!�\u001Aŭέ�E\u000B��qYI\u001C� ��$�)x\u000BF=��B��5\u007F\u000F�>�\u007F��\u0011�� \u000E�[�\u0013I�\u000Bx��\u000E�m�\u001D\u001E���f��pB�#Ms5ݬ� [W�\b�r2ۏ67��zb�x�?ݫK�\u0005S��:q@�����g�\u0014o�%�|7�������g��\u007F��S��rA�\u0019[c�\u001Dr;_���\f�������n�\u001B�5�ˎI�����S����h�-�#Ya�'\u000F\u001C��*�Â\b �:��q\u0018J�mδ{3X�2�\u0014Q\\�\u00197\u000B_���Q�گ�w��� \u0005]����\u0005����3��\u000Fj���s�� d��{��,j��I�Z\u000B\t\u001AI�e���5hR8Oْf���dW�?�P����_\u0012�\u001C�\u007F\u0012|k��^\u0019o��s�]kJ�������\u00135�m\u0005�3[ʌ�����\u0004���W���cJ���-\b��?8�\u000E|\u001A�t�wV�>\u001D�xvx~\tk�\u0016o� ��������Z��|S>��N�gm �I?�ac\n" +
                "ٺ_3E�E���L�g��>#i� ��M�\u001F\u0011|\u001E�ρ|Q�/���.4�*�Y�ִ����Q��ƷX\u001D'���ċk#}��7h�_�U�q������~4����-��>\u001B����n.'�O\u0017x�K�\u0010���\u0001�G\u0017�v�}x�i!�;��e\u0003I\u001Dő>M/��)~ѿ�5=o�^\u000B��\u000B��w�:��\u0015���_\u0006xgQ_��\u000B+�9m$��Gi��!\u0017U�q�;ic���I��ڴ�g:=�ǿ�W�|s���\t~�\u007F\u0013>3k^%�\u0001�4\u007F\u0006��y��5����G�]�]�V��6V����md\ff(Q�{w�&\u001C� �)�OƚN����\u000E��}\u007Fź\\�߆�O\fh��\u0016z��o\"�\n" +
                "ƛ\u000E�\u0015�s\u0018Y//淲�k��e\u000F{\f04�\u000F�A?�/�^\u0006�< �\u001Cu�&���\u000EO���:\u0005����)[U�\u001BK�� ���m`{[��lEutd�4�\n" +
                "��VF\u0016�� gu�\u001E��#X�sJ��o��\u001C�:��y��]sA��>��� \u0014iq}�\u000F��N1�\u0012X\\Gn��\tg�^�������ь��\u007Fj\u001D?�o�~1h>#�|kq�����>\u001Dּm�kcD}\u000F������7���\u0018b��Ӧ���cz�t�y\u0015�ğ���E�o�:��\u0013��k������-\u0017E���j'}���A�&�3�<�&�[�x���\u0005�-������� \u0004����3�Oڻ�\u001F\u0003|K�x�W�+�h-�q���5m�4O\u001D��H��{[�WI\u0004ws[�i��-��s=���p�]ϐ���y�8ǰ\u001D\u0007�xy�x�\n" +
                "�Z�Jk[�QE\u0015��\\dW�~ڿ\u0005o�h�������1�MS��\u000Eմ+\u0016��\u001A�\\��\u0014E�����\u0018�Pl�_��Oz�S�u\u0014�@z��о����3K�<Iy�j:M�~(����Z��~��\u0019���+�\u0007FK�\u001A;Խ�U�U��u�^\\\u000Bp&VH\u007F���'wg�iZ^��9u�\n" +
                "O�\u007F\u000FxsU�b�w��_�3��\u001A\u000E�`ڝ��W\u0003X��9<7l�ͫIm\u0006����n��H�@�o��&\u001F��\"� �Z�\u001Eh�����W�\u0013����}\n" +
                "����mcR�l��#B�~�5��S:I\u0019�.%\u000F\f�����>��\t�\u0017����\u0003J���?\u0019x\n" +
                "?��\u0014�S��\u0018I,�'�Yj��\u001B�,%��;\u0017\\���<�,2�\u0014�w�\u0018��G\u0011\n" +
                "�S]�r٭\f�\u001Ax���zׅg�$]3]�>6h�#\uD896\uDFC7��e��:�\n" +
                "Eo.\u001B̝��i����$q]ޠ��&��K�\\x��7�\u001E���\u001A\u0006�{���Z\n" +
                "��t���R��w�߅t�(�c��kv�����k �X[�\n" +
                "Ω���e�$~��\u007F�\u001B�\u0003��#��\u0002�Ao�D>\u001C���L�� ŚDV��(�p�:����\u001B�V���\u0003M�m�!�Y.\f��\\���8�&� �W��|\u000B���\u000F\u0002�<C-��M?�\u0016�.��\\�X���7Z�����\u0012[�|�U�x�Z\u000B�gY��&\u0001�T#�tl\u000Fq� �\u001Ex'F���oC�\f��\u007F��<\u000F��F_\u0017x>��y~\u0007�\n" +
                "��$0�֗BI\":d�Ũ^C\u0005��=���!�ID��\u000E!_+\u007F�\u0017> Z�\u000B� �q|/�}OS�\u0017�<\u007F��7��\"ֵ+�on�\u001B��\u001Bs\u001A\u0019efc\u0015����B3��k\u0010�~�Q�_\u001D�b=�!���ޚ�E��+�(3H�\u0003�\n" +
                "T�u�\u000F\fh����woa�i��]�]\\H#��\u0018Ի��xUU\u0004�x U�.MF=@�c���c����\n" +
                "3�\u001Cx�{x���!�����|�cd�\u001E�'X�� ��}��\f �\b���|5�|x����\u007F��ÿ��zG����v�\u001D�]/�Zj~)��\tiw\"�\f�v\u05F7S۴��\\Z���Fk�\u007Fg�۳����~4�ڧĚg�O�O��\u001A���[�~\u0014�e��\u0006���]��X�jJ�ˆ6��Y��y����!\n" +
                "��\u0003���_�_�����\u007F�\u007F\u001E�\u0003��>$�o��!�O\u000B�xz\u0013���Z����ŻO\u001C&{��k�� ��O��\u0012�$.B}�\u001E���\u001ArwiX����\u001D����\u0014G�'�\u0006��ڞ���\u001E$մ�W�zy�M��kW�n��\u001C�,��V�s��7\"��؇�����/�o�Z��o����_\u0015�\u0005o�K���]{G��>��ov��./<;y4��A�_�ev��~1��oس�a�'�x[_�<{�V�i�<�g��]�K�\u0019�6�\u0011�ty\u0005���L�p�\\[�ah\f�\u0014�������٫�W�/���P\u001F\u0005�]�>\u0004��\u001A���\u0012h��\u0007�,��\u0004j\u0013���\u0017s�������\u0007;<@\u007F�\u0017�d�\u0019U��`�\u0016��\u0016ӌ�{\n" +
                "���\u0011gk�~�?\u0005 ���,`�\u000E�\u001D���\f��: �T�\t\u00038'���ٯ�?�'/�\u0014��\u0007�� ������\u0018�0��\u0007��tO�O\u000Fx��?���o|\n" +
                "�ޟ\u001BʱGm1kT�ѣڲ<��z�3G_�(�<���_\u001D�a'F���֦�i�J(����a�ҾG� ��x��~\u0002|4�v���h� \u0014�1�#�ڝ�ɾ=R�}n�[�Y\u0001��$0H���B�r\u0018���W�~�_����H~���\u0014�д�\u0018����\u000E]k0<�\t��:���\u0004syg�X�6�\u0017�72$��\\��ۗN0��S�2gw\u001D\u000F�?���������'o���;��_\u0002j\u001E.�W�k>\u001F�Ӯ\u0379��\u0016�\u001E�}�\u07FCW�ŵ.���/c\u0012\u0010�� �#IY�)� \u00051����m��\u000B@о\u001E��#���TAk\u0016��m?Qy�P����\u0005��-�['�,�\n" +
                "�\u0013�(�\u0004_�~\u000F��_\u001E�fOۿ�o��(�G㯅4O\u0004x\u000Ey4O\f�#ź����:�Dڽ��xr\u000B��{;�B��R\u0006��\f�@\\F���\u000F�L��_����7�|+�-[Hִ�C�ڦ��i�?Ҭ��>{�I�ZY[�H��ɬ`ho�R��\u0012��,\u001F��\u0007A���;��\u000Bk\u001Ew�|\u0006�e�'�<\u0003� \b��m\u001FH�_�F�IӴ�m;Ğ\u001C\u00105�+�\u000B�^�\uD956\uDF64�q5�Q9�����\u000F��\u007F��~��|\u0019�M�\u007F\u000Ex\u0013�~4���C�\u0016\u001E\u001A����n�5��t��k�u�S\f�a�]j�p�4�p叝]\u0017�|-��\u001E\u000F������?ŚE�\u0006'�Ğ\u001A����z�Z����:Y��ݶ��H��A�@n�k���?�� ���� վ\u0019�\u0014鷚\u0016��-\u0013L��ݗ�<+�\u0012\u001F@����w\u001B\u0016�%�\u0019'2\u0012Q��B�\u0006D�\u0014�֤�\u07B74� o\u000F�!N��\u0011�\u0002��|q�|G�-���7��9�1�� �O,���Ӧ�-bK�c�(�c-�f�����`w#\u0001�Y� \u0004�����y��>\u000Bx��!�Ğ-�6���2\u0004��f��Ie\n" +
                "8P����\u0018\n" +
                "�[��� `\u000F���Y\u000BO\fx\u001B�\u001E1��\u007F\u0007�g��់���բ�<q �L�&�����+�Nl��ت����\u0013\b�\u000F�_\n" +
                "xoO�w�t�\u001FJ���K�-b����|��D�#�}�T\u0001��\u001F;�\u001Fe\u001ASw�ˤ��i\n" +
                "(��`�l��B��\u000E\u0006���U\u07B5�k� \u0005G� �;��\u001E�6�a�W�|\u0005�gS��?\u000F���|9���]R\u001B�\u001E��&?l�[�w\u0006x\u001A\u001B�b�r$��|����p��MƬ�Irkc�[�W�������m>#|;�G�\u000B]-�[(|K�Z��f��\u0018�G\b[j�3�zW�i߰\u000F칣|}��D?����1�˦ǩ�j֞\u0011�O�upY��Auo��DAC4.\u0011�0t\u000E��%��\u001F�Bmw�v>.�<\u0017�� ���\n" +
                "��4�\fj>\u0016�φ�E����-\u000E����C����Z]��]�C��\u0005�L�\n" +
                "���?����7��\u0003�m��~��{{�\u000E�:��� \b���:]�\u001E\u0014�O��T� ���j;f{Xa�����@Ƀ�C\u000BB\u0011�U\u074Cy��>���\t��Z���\u0004��\u007Fv=J�\u0014\u007F�D��*�?�N��JU�ᗆo=>�\u000B\\���3f�E� �`� �)|a� ��w�#�ς�\u0014��'È�\u0018��\u000EA���Ԛ���\u00184�8�%�n�-�\\,Q�c��mA���\b�u��_�:�����R|7�<Y�̶\u001A\u0007��?du�?�B��I\u007Fl�BN<�Y�F�-A��\t<�ehc�S����w��ױ���|7�\"|\u0014է�g��c�4�7Ro\u000Fx/E�]^�#�+�l�5�f�f�sm8�p\u000F[�� \u0016Xx�ºv��\\5Ι���6�/\u000B20�\u001A7\u0001чFG\u0001��\u0018\u0002\b���\u0003�\b_�\u000F\u0004x�k=O�o��N�L\uD863\uDDCF�\u001A7�|?�j:������ R�i��L:u�ܚ\\���Py\u0013�l���À\u001A��� �[��?��\u007F�~���4\u001B-\u0016y|{�S͂����{Y���ay,v1�n��\u000Bf6$Q��\u00121\u001Cj��͎�a�G�F�4�\u0019J����qE-\u0015�\u001A��g���� |�}�?���Ȣ��O�R�U�\u001C\u0017a�h� �\u007F�\"���� <���\u0014QG�����\u000B��,_��?�G�b� �q� �\"�(�\u0014��}�v\u0006�3� ,���\u0014}�/���Ȣ�>�K�W�\u0017b��?�'��E\u0014Q�)\u007F*�����";

        byte[] allBytes=s.getBytes()

         Path path = Paths.get("11.jpg");

         Files.write(path, allBytes);

    }

}
</code>```

but the image file i got is unreadable!

the image is only about 1.3 kb.

is it possible what i am trying to do?

答:
Although it is a bad idea, you can carry an image in the string variable.

To do this you need to convert your image to Base64. E.g. you can use recommendations given in post How to convert an Image to base64 string in java?

Then you can use carry your image inside a string variable and save it to the DB in the text-based column.

But please consider other options like:

Storing binary data in BLOB format

Putting your image to your jar archive (Many asset files can be stored within "/resource" folder of you project. If you use maven please consider this option.

Body:
I have created a java program,
my program needs an image at some point to be written into Back end database(MySQL).

after this Question i know that i can't read files from deployed jar files,
So therefore t tried this

package sample;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws IOException {

        File file = new File("11.jpg");

        byte[] allBytes=Files.readAllBytes(file.toPath());
         Path path = Paths.get("0.txt");

         Files.write(path, allBytes);

    }

}

where 11.jpg is the image file that i want to use.
in the above code i converted 11.jpg to 0.txt
then i copied all from the 0 text and stored inside a String
and did this

package sample;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws IOException {

        File file = new File("11.jpg");

        String s = "���� \u0010JFIF \u0001\u0001\u0001 ` `  �� C \u0002\u0001\u0001\u0002\u0001\u0001\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0002\u0003\u0005\u0003\u0003\u0003\u0003\u0003\u0006\u0004\u0004\u0003\u0005\u0007\u0006\u0007\u0007\u0007\u0006\u0007\u0007\b\t\u000B\t\b\b\n" +
                "\b\u0007\u0007\n" +
                "\n" +
                "\n" +
                "\u000B\f\f\f\f\u0007\t\u000E\u000F\n" +
                "\f\u000E\u000B\f\f\f�� C\u0001\u0002\u0002\u0002\u0003\u0003\u0003\u0006\u0003\u0003\u0006\f\b\u0007\b\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f�� \u0011\b c D\u0003\u0001\" \u0002\u0011\u0001\u0003\u0011\u0001�� \u001F  \u0001\u0005\u0001\u0001\u0001\u0001\u0001\u0001        \u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n" +
                "\u000B�� �\u0010 \u0002\u0001\u0003\u0003\u0002\u0004\u0003\u0005\u0005\u0004\u0004  \u0001}\u0001\u0002\u0003 \u0004\u0011\u0005\u0012!1A\u0006\u0013Qa\u0007\"q\u00142���\b#B��\u0015R��$3br�\t\n" +
                "\u0016\u0017\u0018\u0019\u001A%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� \u001F\u0001 \u0003\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001      \u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n" +
                "\u000B�� �\u0011 \u0002\u0001\u0002\u0004\u0004\u0003\u0004\u0007\u0005\u0004\u0004 \u0001\u0002w \u0001\u0002\u0003\u0011\u0004\u0005!1\u0006\u0012AQ\u0007aq\u0013\"2�\b\u0014B����\t#3R�\u0015br�\n" +
                "\u0016$4�%�\u0017\u0018\u0019\u001A&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������� \f\u0003\u0001 \u0002\u0011\u0003\u0011 ? ���'\u0014?J��7���� d��7��h�ώ|sug4�\u001F�n�cu�j�Ӧ\u0001s\n" +
                "�3�\u0015�3'�s�2�\u0018p���� �ѥ:����n�糱�M|����\n" +
                "�ῂ\u001F\u0014�� \n" +
                "�\u000B�9�H��!��\u001A��|$'��9��o\u001E\t�\u000B���ċl�#\u0005v\u000B�\"\u0012$;+ʼ\u0013�_|qӼO�\n" +
                "k��2�\u001D�H�\u0010\u0012���\f���Ҧ����H�{ˉ��yhn\u0007��;If��['���_\u0018��?\u000F\u0013�\t��\u000F�_�5�|?���� �\u0017���\u0002�kگ�F�y\u001D������\tn �-�7@Nɽق�4j��\u0017'JO��d�v>�� ��ǩ궶�� ���\u0005+�x���K(����\u0015�\u0011I4�Y\u007F��E\u000F�\u0014�M!Xϖ@l�\u001F��gߏ^\u0017��>\n" +
                "�g�\u001F��H��\t���=GM�E*^7�\u0016S�:�dt<�+)�\u001A��\u05FFm-S���w��'�o\n" +
                "������xcF>!����(\u001A=���Y!�\u001Aŭέ�E\u000B��qYI\u001C� ��$�)x\u000BF=��B��5\u007F\u000F�>�\u007F��\u0011�� \u000E�[�\u0013I�\u000Bx��\u000E�m�\u001D\u001E���f��pB�#Ms5ݬ� [W�\b�r2ۏ67��zb�x�?ݫK�\u0005S��:q@�����g�\u0014o�%�|7�������g��\u007F��S��rA�\u0019[c�\u001Dr;_���\f�������n�\u001B�5�ˎI�����S����h�-�#Ya�'\u000F\u001C��*�Â\b �:��q\u0018J�mδ{3X�2�\u0014Q\\�\u00197\u000B_���Q�گ�w��� \u0005]����\u0005����3��\u000Fj���s�� d��{��,j��I�Z\u000B\t\u001AI�e���5hR8Oْf���dW�?�P����_\u0012�\u001C�\u007F\u0012|k��^\u0019o��s�]kJ�������\u00135�m\u0005�3[ʌ�����\u0004���W���cJ���-\b��?8�\u000E|\u001A�t�wV�>\u001D�xvx~\tk�\u0016o� ��������Z��|S>��N�gm �I?�ac\n" +
                "ٺ_3E�E���L�g��>#i� ��M�\u001F\u0011|\u001E�ρ|Q�/���.4�*�Y�ִ����Q��ƷX\u001D'���ċk#}��7h�_�U�q������~4����-��>\u001B����n.'�O\u0017x�K�\u0010���\u0001�G\u0017�v�}x�i!�;��e\u0003I\u001Dő>M/��)~ѿ�5=o�^\u000B��\u000B��w�:��\u0015���_\u0006xgQ_��\u000B+�9m$��Gi��!\u0017U�q�;ic���I��ڴ�g:=�ǿ�W�|s���\t~�\u007F\u0013>3k^%�\u0001�4\u007F\u0006��y��5����G�]�]�V��6V����md\ff(Q�{w�&\u001C� �)�OƚN����\u000E��}\u007Fź\\�߆�O\fh��\u0016z��o\"�\n" +
                "ƛ\u000E�\u0015�s\u0018Y//淲�k��e\u000F{\f04�\u000F�A?�/�^\u0006�< �\u001Cu�&���\u000EO���:\u0005����)[U�\u001BK�� ���m`{[��lEutd�4�\n" +
                "��VF\u0016�� gu�\u001E��#X�sJ��o��\u001C�:��y��]sA��>��� \u0014iq}�\u000F��N1�\u0012X\\Gn��\tg�^�������ь��\u007Fj\u001D?�o�~1h>#�|kq�����>\u001Dּm�kcD}\u000F������7���\u0018b��Ӧ���cz�t�y\u0015�ğ���E�o�:��\u0013��k������-\u0017E���j'}���A�&�3�<�&�[�x���\u0005�-������� \u0004����3�Oڻ�\u001F\u0003|K�x�W�+�h-�q���5m�4O\u001D��H��{[�WI\u0004ws[�i��-��s=���p�]ϐ���y�8ǰ\u001D\u0007�xy�x�\n" +
                "�Z�Jk[�QE\u0015��\\dW�~ڿ\u0005o�h�������1�MS��\u000Eմ+\u0016��\u001A�\\��\u0014E�����\u0018�Pl�_��Oz�S�u\u0014�@z��о����3K�<Iy�j:M�~(����Z��~��\u0019���+�\u0007FK�\u001A;Խ�U�U��u�^\\\u000Bp&VH\u007F���'wg�iZ^��9u�\n" +
                "O�\u007F\u000FxsU�b�w��_�3��\u001A\u000E�`ڝ��W\u0003X��9<7l�ͫIm\u0006����n��H�@�o��&\u001F��\"� �Z�\u001Eh�����W�\u0013����}\n" +
                "����mcR�l��#B�~�5��S:I\u0019�.%\u000F\f�����>��\t�\u0017����\u0003J���?\u0019x\n" +
                "?��\u0014�S��\u0018I,�'�Yj��\u001B�,%��;\u0017\\���<�,2�\u0014�w�\u0018��G\u0011\n" +
                "�S]�r٭\f�\u001Ax���zׅg�$]3]�>6h�#\uD896\uDFC7��e��:�\n" +
                "Eo.\u001B̝��i����$q]ޠ��&��K�\\x��7�\u001E���\u001A\u0006�{���Z\n" +
                "��t���R��w�߅t�(�c��kv�����k �X[�\n" +
                "Ω���e�$~��\u007F�\u001B�\u0003��#��\u0002�Ao�D>\u001C���L�� ŚDV��(�p�:����\u001B�V���\u0003M�m�!�Y.\f��\\���8�&� �W��|\u000B���\u000F\u0002�<C-��M?�\u0016�.��\\�X���7Z�����\u0012[�|�U�x�Z\u000B�gY��&\u0001�T#�tl\u000Fq� �\u001Ex'F���oC�\f��\u007F��<\u000F��F_\u0017x>��y~\u0007�\n" +
                "��$0�֗BI\":d�Ũ^C\u0005��=���!�ID��\u000E!_+\u007F�\u0017> Z�\u000B� �q|/�}OS�\u0017�<\u007F��7��\"ֵ+�on�\u001B��\u001Bs\u001A\u0019efc\u0015����B3��k\u0010�~�Q�_\u001D�b=�!���ޚ�E��+�(3H�\u0003�\n" +
                "T�u�\u000F\fh����woa�i��]�]\\H#��\u0018Ի��xUU\u0004�x U�.MF=@�c���c����\n" +
                "3�\u001Cx�{x���!�����|�cd�\u001E�'X�� ��}��\f �\b���|5�|x����\u007F��ÿ��zG����v�\u001D�]/�Zj~)��\tiw\"�\f�v\u05F7S۴��\\Z���Fk�\u007Fg�۳����~4�ڧĚg�O�O��\u001A���[�~\u0014�e��\u0006���]��X�jJ�ˆ6��Y��y����!\n" +
                "��\u0003���_�_�����\u007F�\u007F\u001E�\u0003��>$�o��!�O\u000B�xz\u0013���Z����ŻO\u001C&{��k�� ��O��\u0012�$.B}�\u001E���\u001ArwiX����\u001D����\u0014G�'�\u0006��ڞ���\u001E$մ�W�zy�M��kW�n��\u001C�,��V�s��7\"��؇�����/�o�Z��o����_\u0015�\u0005o�K���]{G��>��ov��./<;y4��A�_�ev��~1��oس�a�'�x[_�<{�V�i�<�g��]�K�\u0019�6�\u0011�ty\u0005���L�p�\\[�ah\f�\u0014�������٫�W�/���P\u001F\u0005�]�>\u0004��\u001A���\u0012h��\u0007�,��\u0004j\u0013���\u0017s�������\u0007;<@\u007F�\u0017�d�\u0019U��`�\u0016��\u0016ӌ�{\n" +
                "���\u0011gk�~�?\u0005 ���,`�\u000E�\u001D���\f��: �T�\t\u00038'���ٯ�?�'/�\u0014��\u0007�� ������\u0018�0��\u0007��tO�O\u000Fx��?���o|\n" +
                "�ޟ\u001BʱGm1kT�ѣڲ<��z�3G_�(�<���_\u001D�a'F���֦�i�J(����a�ҾG� ��x��~\u0002|4�v���h� \u0014�1�#�ڝ�ɾ=R�}n�[�Y\u0001��$0H���B�r\u0018���W�~�_����H~���\u0014�д�\u0018����\u000E]k0<�\t��:���\u0004syg�X�6�\u0017�72$��\\��ۗN0��S�2gw\u001D\u000F�?���������'o���;��_\u0002j\u001E.�W�k>\u001F�Ӯ\u0379��\u0016�\u001E�}�\u07FCW�ŵ.���/c\u0012\u0010�� �#IY�)� \u00051����m��\u000B@о\u001E��#���TAk\u0016��m?Qy�P����\u0005��-�['�,�\n" +
                "�\u0013�(�\u0004_�~\u000F��_\u001E�fOۿ�o��(�G㯅4O\u0004x\u000Ey4O\f�#ź����:�Dڽ��xr\u000B��{;�B��R\u0006��\f�@\\F���\u000F�L��_����7�|+�-[Hִ�C�ڦ��i�?Ҭ��>{�I�ZY[�H��ɬ`ho�R��\u0012��,\u001F��\u0007A���;��\u000Bk\u001Ew�|\u0006�e�'�<\u0003� \b��m\u001FH�_�F�IӴ�m;Ğ\u001C\u00105�+�\u000B�^�\uD956\uDF64�q5�Q9�����\u000F��\u007F��~��|\u0019�M�\u007F\u000Ex\u0013�~4���C�\u0016\u001E\u001A����n�5��t��k�u�S\f�a�]j�p�4�p叝]\u0017�|-��\u001E\u000F������?ŚE�\u0006'�Ğ\u001A����z�Z����:Y��ݶ��H��A�@n�k���?�� ���� վ\u0019�\u0014鷚\u0016��-\u0013L��ݗ�<+�\u0012\u001F@����w\u001B\u0016�%�\u0019'2\u0012Q��B�\u0006D�\u0014�֤�\u07B74� o\u000F�!N��\u0011�\u0002��|q�|G�-���7��9�1�� �O,���Ӧ�-bK�c�(�c-�f�����`w#\u0001�Y� \u0004�����y��>\u000Bx��!�Ğ-�6���2\u0004��f��Ie\n" +
                "8P����\u0018\n" +
                "�[��� `\u000F���Y\u000BO\fx\u001B�\u001E1��\u007F\u0007�g��់���բ�<q �L�&�����+�Nl��ت����\u0013\b�\u000F�_\n" +
                "xoO�w�t�\u001FJ���K�-b����|��D�#�}�T\u0001��\u001F;�\u001Fe\u001ASw�ˤ��i\n" +
                "(��`�l��B��\u000E\u0006���U\u07B5�k� \u0005G� �;��\u001E�6�a�W�|\u0005�gS��?\u000F���|9���]R\u001B�\u001E��&?l�[�w\u0006x\u001A\u001B�b�r$��|����p��MƬ�Irkc�[�W�������m>#|;�G�\u000B]-�[(|K�Z��f��\u0018�G\b[j�3�zW�i߰\u000F칣|}��D?����1�˦ǩ�j֞\u0011�O�upY��Auo��DAC4.\u0011�0t\u000E��%��\u001F�Bmw�v>.�<\u0017�� ���\n" +
                "��4�\fj>\u0016�φ�E����-\u000E����C����Z]��]�C��\u0005�L�\n" +
                "���?����7��\u0003�m��~��{{�\u000E�:��� \b���:]�\u001E\u0014�O��T� ���j;f{Xa�����@Ƀ�C\u000BB\u0011�U\u074Cy��>���\t��Z���\u0004��\u007Fv=J�\u0014\u007F�D��*�?�N��JU�ᗆo=>�\u000B\\���3f�E� �`� �)|a� ��w�#�ς�\u0014��'È�\u0018��\u000EA���Ԛ���\u00184�8�%�n�-�\\,Q�c��mA���\b�u��_�:�����R|7�<Y�̶\u001A\u0007��?du�?�B��I\u007Fl�BN<�Y�F�-A��\t<�ehc�S����w��ױ���|7�\"|\u0014է�g��c�4�7Ro\u000Fx/E�]^�#�+�l�5�f�f�sm8�p\u000F[�� \u0016Xx�ºv��\\5Ι���6�/\u000B20�\u001A7\u0001чFG\u0001��\u0018\u0002\b���\u0003�\b_�\u000F\u0004x�k=O�o��N�L\uD863\uDDCF�\u001A7�|?�j:������ R�i��L:u�ܚ\\���Py\u0013�l���À\u001A��� �[��?��\u007F�~���4\u001B-\u0016y|{�S͂����{Y���ay,v1�n��\u000Bf6$Q��\u00121\u001Cj��͎�a�G�F�4�\u0019J����qE-\u0015�\u001A��g���� |�}�?���Ȣ��O�R�U�\u001C\u0017a�h� �\u007F�\"���� <���\u0014QG�����\u000B��,_��?�G�b� �q� �\"�(�\u0014��}�v\u0006�3� ,���\u0014}�/���Ȣ�>�K�W�\u0017b��?�'��E\u0014Q�)\u007F*�����";

        byte[] allBytes=s.getBytes()

         Path path = Paths.get("11.jpg");

         Files.write(path, allBytes);

    }

}

but the image file i got is unreadable!

the image is only about 1.3 kb.

is it possible what i am trying to do?


问:
Can someone help me work out this error
This is my code, it is writen in python version 2.7.13:

```<code>import random
num=random.sample(range(1,9),4)
print(num)
thing=1
while thing==1:
    while thing==1:
        Usernum=str(input("Input a number of four DIFFRENT digits all of which are between 1 and 9 or exit"))
        if Usernum = "exit":
            print("Goodbye")
            break
        else:
            pass
        if len(set(Usernum)) == 4:
            pass
        else:
            print("You enterd a number that wasn't 4 digits, please try again!")
            thing==1
            pass

        if Usernum.isdigit:
            pass
        else:
            print("you entered something that isnt a number, please try again!")
            pass
        num1,num2,num3,num4 = Usernum.split()
        if num1 in (num2,num3,nub4) or num2 in (num3,num4) or num3==num4:
            print("you ented a number with duplicate digits, Please try again!")
        else:
            break
else:
pass
</code>```

Before i am getting a  error which I have never seen before. It says:

"ValueError: need more than 1 value to unpack"

答:
On line 26 you want to be testing for equality between num3 and num4 like this:

num3 == num4

Note the use of whitespace between the variable names and the operator, and the use of the double equals.

Title: Can someone help me work out this error

Body:
This is my code, it is writen in python version 2.7.13:

import random
num=random.sample(range(1,9),4)
print(num)
thing=1
while thing==1:
    while thing==1:
        Usernum=str(input("Input a number of four DIFFRENT digits all of which are between 1 and 9 or exit"))
        if Usernum = "exit":
            print("Goodbye")
            break
        else:
            pass
        if len(set(Usernum)) == 4:
            pass
        else:
            print("You enterd a number that wasn't 4 digits, please try again!")
            thing==1
            pass

        if Usernum.isdigit:
            pass
        else:
            print("you entered something that isnt a number, please try again!")
            pass
        num1,num2,num3,num4 = Usernum.split()
        if num1 in (num2,num3,nub4) or num2 in (num3,num4) or num3==num4:
            print("you ented a number with duplicate digits, Please try again!")
        else:
            break
else:
pass

Before i am getting a  error which I have never seen before. It says:

"ValueError: need more than 1 value to unpack"


问:
Call parent ViewModel from RecyclerView child ViewModel in Android
I have a View with a RecyclerView and a ViewModel, I have a list of objects, and I fill the RecyclerView with an Adapter and a ViewHolder.

Each of the objects is a ViewModel who has a click event who goes to a Detail, when the click event is fired the app asks for data to the server and if the data is correct navigates to the detail screen.

I have a "loading" check to prevent the user to press two times the same child, but as every child has his own instance of the viewmodel, if you press fast different buttons (fast than the server response) all of them are fired.

So, is there anyway to call the parent viewmodel of a RecyclerView viewmodel child, or any other option? Actually I can just think on make a singleton to keep the childs loading status.

答: add a boolean property in your viewmodel, smt like : isLoading, and set it to truewhen you calling webservice, and while isLoading == true disable click event from view child.


问:
Openh264 for arm android can't build
I'm trying to build openh264 for arm(and arm64) of android but fail!!It's succees to other platform(x86/x64/mip/mip64).
OS : Ubuntu 14.04-i386 (hyper-v)
Nasm : is 2.10.9

Error message:

ikaros@ikaros-Virtual-Machine:~/openh264/v1.6/openh264$ make os=android NDKROOT=~/ndk/android-ndk-r14b/ TARGET=android-12 ARCH=arm64 APP_ABI=armeabi  NDKLEVEL=21
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/common_tables.o codec/common/src/common_tables.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/copy_mb.o codec/common/src/copy_mb.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/cpu.o codec/common/src/cpu.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/crt_util_safe_x.o codec/common/src/crt_util_safe_x.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/deblocking_common.o codec/common/src/deblocking_common.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/expand_pic.o codec/common/src/expand_pic.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/intra_pred_common.o codec/common/src/intra_pred_common.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/mc.o codec/common/src/mc.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/memory_align.o codec/common/src/memory_align.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/sad_common.o codec/common/src/sad_common.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/utils.o codec/common/src/utils.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/welsCodecTrace.o codec/common/src/welsCodecTrace.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsTaskThread.o codec/common/src/WelsTaskThread.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsThread.o codec/common/src/WelsThread.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsThreadLib.o codec/common/src/WelsThreadLib.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsThreadPool.o codec/common/src/WelsThreadPool.cpp
  cc -O3 -DNDEBUG -DHAVE_NEON_AARCH64 -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER -I./codec/common/arm64/ -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/arm64/copy_mb_aarch64_neon.o codec/common/arm64/copy_mb_aarch64_neon.S
  codec/common/arm64/copy_mb_aarch64_neon.S: Assembler messages:
  codec/common/arm64/copy_mb_aarch64_neon.S:110: Error: no such instruction: sxtw x1,w1'
  codec/common/arm64/copy_mb_aarch64_neon.S:111: Error: no such instruction:sxtw x3,w3'
  codec/common/arm64/copy_mb_aarch64_neon.S:112: Error: no such instruction: ld1 {v0.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:112: Error: no such instruction:ld1 {v1.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:112: Error: no such instruction: ld1 {v2.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:112: Error: no such instruction:ld1 {v3.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:114: Error: no such instruction: st1 {v0.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:114: Error: no such instruction:st1 {v1.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:114: Error: no such instruction: st1 {v2.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:114: Error: no such instruction:st1 {v3.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:116: Error: no such instruction: ld1 {v4.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:116: Error: no such instruction:ld1 {v5.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:116: Error: no such instruction: ld1 {v6.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:116: Error: no such instruction:ld1 {v7.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:118: Error: no such instruction: st1 {v4.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:118: Error: no such instruction:st1 {v5.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:118: Error: no such instruction: st1 {v6.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:118: Error: no such instruction:st1 {v7.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:124: Error: no such instruction: sxtw x1,w1'
  codec/common/arm64/copy_mb_aarch64_neon.S:125: Error: no such instruction:sxtw x3,w3'
  codec/common/arm64/copy_mb_aarch64_neon.S:126: Error: no such instruction: ld1 {v0.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:126: Error: no such instruction:ld1 {v1.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:126: Error: no such instruction: ld1 {v2.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:126: Error: no such instruction:ld1 {v3.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:128: Error: no such instruction: st1 {v0.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:128: Error: no such instruction:st1 {v1.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:128: Error: no such instruction: st1 {v2.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:128: Error: no such instruction:st1 {v3.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:130: Error: no such instruction: ld1 {v16.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:130: Error: no such instruction:ld1 {v17.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:130: Error: no such instruction: ld1 {v18.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:130: Error: no such instruction:ld1 {v19.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:132: Error: no such instruction: st1 {v16.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:132: Error: no such instruction:st1 {v17.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:132: Error: no such instruction: st1 {v18.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:132: Error: no such instruction:st1 {v19.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:134: Error: no such instruction: ld1 {v0.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:134: Error: no such instruction:ld1 {v1.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:134: Error: no such instruction: ld1 {v2.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:134: Error: no such instruction:ld1 {v3.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:136: Error: no such instruction: st1 {v0.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:136: Error: no such instruction:st1 {v1.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:136: Error: no such instruction: st1 {v2.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:136: Error: no such instruction:st1 {v3.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:138: Error: no such instruction: ld1 {v16.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:138: Error: no such instruction:ld1 {v17.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:138: Error: no such instruction: ld1 {v18.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:138: Error: no such instruction:ld1 {v19.2d},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:140: Error: no such instruction: st1 {v16.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:140: Error: no such instruction:st1 {v17.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:140: Error: no such instruction: st1 {v18.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:140: Error: no such instruction:st1 {v19.2d},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:146: Error: no such instruction: sxtw x1,w1'
  codec/common/arm64/copy_mb_aarch64_neon.S:147: Error: no such instruction:sxtw x3,w3'
  codec/common/arm64/copy_mb_aarch64_neon.S:148: Error: no such instruction: ld1 {v0.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:148: Error: no such instruction:ld1 {v1.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:148: Error: no such instruction: ld1 {v2.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:148: Error: no such instruction:ld1 {v3.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:150: Error: no such instruction: st1 {v0.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:150: Error: no such instruction:st1 {v1.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:150: Error: no such instruction: st1 {v2.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:150: Error: no such instruction:st1 {v3.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:152: Error: no such instruction: ld1 {v16.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:152: Error: no such instruction:ld1 {v17.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:152: Error: no such instruction: ld1 {v18.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:152: Error: no such instruction:ld1 {v19.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:154: Error: no such instruction: st1 {v16.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:154: Error: no such instruction:st1 {v17.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:154: Error: no such instruction: st1 {v18.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:154: Error: no such instruction:st1 {v19.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:156: Error: no such instruction: ld1 {v0.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:156: Error: no such instruction:ld1 {v1.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:156: Error: no such instruction: ld1 {v2.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:156: Error: no such instruction:ld1 {v3.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:158: Error: no such instruction: st1 {v0.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:158: Error: no such instruction:st1 {v1.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:158: Error: no such instruction: st1 {v2.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:158: Error: no such instruction:st1 {v3.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:160: Error: no such instruction: ld1 {v16.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:160: Error: no such instruction:ld1 {v17.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:160: Error: no such instruction: ld1 {v18.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:160: Error: no such instruction:ld1 {v19.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:162: Error: no such instruction: st1 {v16.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:162: Error: no such instruction:st1 {v17.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:162: Error: no such instruction: st1 {v18.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:162: Error: no such instruction:st1 {v19.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:168: Error: no such instruction: sxtw x1,w1'
  codec/common/arm64/copy_mb_aarch64_neon.S:169: Error: no such instruction:sxtw x3,w3'
  codec/common/arm64/copy_mb_aarch64_neon.S:170: Error: no such instruction: ld1 {v0.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:170: Error: no such instruction:ld1 {v1.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:170: Error: no such instruction: ld1 {v2.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:170: Error: no such instruction:ld1 {v3.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:172: Error: no such instruction: st1 {v0.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:172: Error: no such instruction:st1 {v1.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:172: Error: no such instruction: st1 {v2.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:172: Error: no such instruction:st1 {v3.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:174: Error: no such instruction: ld1 {v16.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:174: Error: no such instruction:ld1 {v17.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:174: Error: no such instruction: ld1 {v18.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:174: Error: no such instruction:ld1 {v19.16b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:176: Error: no such instruction: st1 {v16.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:176: Error: no such instruction:st1 {v17.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:176: Error: no such instruction: st1 {v18.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:176: Error: no such instruction:st1 {v19.16b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:182: Error: no such instruction: sxtw x1,w1'
  codec/common/arm64/copy_mb_aarch64_neon.S:183: Error: no such instruction:sxtw x3,w3'
  codec/common/arm64/copy_mb_aarch64_neon.S:184: Error: no such instruction: ld1 {v0.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:184: Error: no such instruction:ld1 {v1.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:184: Error: no such instruction: ld1 {v2.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:184: Error: no such instruction:ld1 {v3.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:186: Error: no such instruction: st1 {v0.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:186: Error: no such instruction:st1 {v1.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:186: Error: no such instruction: st1 {v2.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:186: Error: no such instruction:st1 {v3.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:188: Error: no such instruction: ld1 {v4.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:188: Error: no such instruction:ld1 {v5.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:188: Error: no such instruction: ld1 {v6.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:188: Error: no such instruction:ld1 {v7.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:190: Error: no such instruction: st1 {v4.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:190: Error: no such instruction:st1 {v5.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:190: Error: no such instruction: st1 {v6.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:190: Error: no such instruction:st1 {v7.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:192: Error: no such instruction: ld1 {v0.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:192: Error: no such instruction:ld1 {v1.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:192: Error: no such instruction: ld1 {v2.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:192: Error: no such instruction:ld1 {v3.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:194: Error: no such instruction: st1 {v0.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:194: Error: no such instruction:st1 {v1.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:194: Error: no such instruction: st1 {v2.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:194: Error: no such instruction:st1 {v3.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:196: Error: no such instruction: ld1 {v4.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:196: Error: no such instruction:ld1 {v5.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:196: Error: no such instruction: ld1 {v6.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:196: Error: no such instruction:ld1 {v7.8b},[x2],x3'
  codec/common/arm64/copy_mb_aarch64_neon.S:198: Error: no such instruction: st1 {v4.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:198: Error: no such instruction:st1 {v5.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:198: Error: no such instruction: st1 {v6.8b},[x0],x1'
  codec/common/arm64/copy_mb_aarch64_neon.S:198: Error: no such instruction:st1 {v7.8b},[x0],x1'
  make: *** [codec/common/arm64/copy_mb_aarch64_neon.o] Error 1

This is to build arm result:

ikaros@ikaros-Virtual-Machine:~/openh264/v1.6/openh264$ make os=android NDKROOT=~/ndk/android-ndk-r14b/ TARGET=android-12 ARCH=arm  NDKLEVEL=21
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/common_tables.o codec/common/src/common_tables.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/copy_mb.o codec/common/src/copy_mb.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/cpu.o codec/common/src/cpu.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/crt_util_safe_x.o codec/common/src/crt_util_safe_x.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/deblocking_common.o codec/common/src/deblocking_common.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/expand_pic.o codec/common/src/expand_pic.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/intra_pred_common.o codec/common/src/intra_pred_common.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/mc.o codec/common/src/mc.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/memory_align.o codec/common/src/memory_align.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/sad_common.o codec/common/src/sad_common.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/utils.o codec/common/src/utils.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/welsCodecTrace.o codec/common/src/welsCodecTrace.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsTaskThread.o codec/common/src/WelsTaskThread.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsThread.o codec/common/src/WelsThread.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsThreadLib.o codec/common/src/WelsThreadLib.cpp
  g++ -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER  -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/src/WelsThreadPool.o codec/common/src/WelsThreadPool.cpp
  cc -O3 -DNDEBUG -DHAVE_NEON -Wall -fno-strict-aliasing -fPIC -MMD -MP -DGENERATED_VERSION_HEADER -I./codec/common/arm/ -march=armv7-a -mfpu=neon -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc   -c -o codec/common/arm/copy_mb_neon.o codec/common/arm/copy_mb_neon.S
  cc: error: unrecognized command line option ‘-mfpu=neon’
  make: *** [codec/common/arm/copy_mb_neon.o] Error 1

Help me please!!

答:
I had solve this problem,I had wrong command case.
https://github.com/cisco/openh264/issues/2759</p>

Title: Openh264 for arm android can't build


问:
How to make a regex for "data1,data2"?
I need to make a regex which matches patterns like:

```<code>data1,data2
data1
</code>```

but not data1&data2 or any other special character apart from ,.
I have tried few like flag_regex = new RegExp("[a-zA-Z0-9].*,.*[a-zA-Z0-9]*");

1 and 2 are two different strings, this is not a CSV.

My regex only matches the first pattern, not the second one.

I am doing this in JavaScript.

I am trying to do something like this.

```<code>var flag_regex = new RegExp("[a-zA-Z0-9].*,.*[a-zA-Z0-9]*");
if(!flag_regex.test(string))
{
    log.error("wrong query format");
    return res.status(404).send({"message":"wrong query format"});
}
</code>```

It should accept string as data1,data2 or just data1.

答:
Change your regex to

```<code>var flag_regex = /^[a-zA-Z0-9]+(?:,[a-zA-Z0-9]+)*$/;
</code>```

If you only allow 1 comma, replace the last * (zero or more repetitions) with ? (one or zero repetitions).

See the regex demo.

Details:

^ - start of string

[a-zA-Z0-9]+ - 1 or more alphanum

(?:,[a-zA-Z0-9]+)* - zero or more sequences of:

, - comma

[a-zA-Z0-9]+ - 1 or more alphanum

$ - end of string.

Title: How to make a regex for "data1,data2"?

Body:
I need to make a regex which matches patterns like:

data1,data2
data1

but not data1&data2 or any other special character apart from ,.
I have tried few like flag_regex = new RegExp("[a-zA-Z0-9].*,.*[a-zA-Z0-9]*");

1 and 2 are two different strings, this is not a CSV.

My regex only matches the first pattern, not the second one.

I am doing this in JavaScript.

I am trying to do something like this.

var flag_regex = new RegExp("[a-zA-Z0-9].*,.*[a-zA-Z0-9]*");
if(!flag_regex.test(string))
{
    log.error("wrong query format");
    return res.status(404).send({"message":"wrong query format"});
}

It should accept string as data1,data2 or just data1.

Body:
Change your regex to

var flag_regex = /^[a-zA-Z0-9]+(?:,[a-zA-Z0-9]+)*$/;

If you only allow 1 comma, replace the last * (zero or more repetitions) with ? (one or zero repetitions).

See the regex demo.

Details:

^ - start of string

[a-zA-Z0-9]+ - 1 or more alphanum

(?:,[a-zA-Z0-9]+)* - zero or more sequences of:

, - comma

[a-zA-Z0-9]+ - 1 or more alphanum

$ - end of string.


问:
Perflib 2 crashes when adding a counter (from Perfmon)
I have a C++ application (under Win32) for which I need to provide performance counter information. I'm using Perflib v2, so have created a manifest which is processed by CTRPP.

My provider then calls PerfAutoInitialize and PerfCreateInstance with no errors.

When I go to add the counter in Perfmon, my application crashes. Tracing through the disassembly shows the code in the perflib worker thread calling the internal function (pcwum.dll) PerfpAddOrRemoveCounter. This calls on to PerfpValidateCounter which returns an address in edi; this address is invalid and when caller dereferences it, the application crashes.

If I restart my provider, the counter is still visible in Perfmon and increments correctly.

Manifest follows

```<code><instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd"
     xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
  <instrumentation>
    <counters xmlns="http://schemas.microsoft.com/win/2005/12/counters">
      <provider callback = "custom"
        applicationIdentity = "TPerfStatsCollector.exe"
            providerName = "TPerfstatscollector"
        providerType = "userMode"
        providerGuid = "{33d68436-4cf9-4f58-9976-44b048b072f3}"
        symbol = "symbolGUID">
        <counterSet guid = "{381300a5-3be6-46d8-8615-12d8b259aae4}"
          uri = "A.AxPServer.Counters.Basic"
          name = "Basic counters"
          description = "These are the sample counters"
          instances = "Single"
          symbol = "setGUID">
          <counter id = "1"
            uri = "A.AxPServer.Counters.Basic.Session"
            name = "Sessions"
            description = "Number of sessions"
            type = "perf_counter_rawcount"
            detailLevel = "standard"
            defaultScale = "1">
          </counter>
        </counterSet>
      </provider>
   </counters>
  </instrumentation>
</instrumentationManifest>
</code>```

答: My bad. This was a 64/32 bit issue and I realised that I was building a 32 bit provider to run on a 64 bit OS. All works fine when this was straightened out.</p>

Body:
I have a C++ application (under Win32) for which I need to provide performance counter information. I'm using Perflib v2, so have created a manifest which is processed by CTRPP.

My provider then calls PerfAutoInitialize and PerfCreateInstance with no errors.

When I go to add the counter in Perfmon, my application crashes. Tracing through the disassembly shows the code in the perflib worker thread calling the internal function (pcwum.dll) PerfpAddOrRemoveCounter. This calls on to PerfpValidateCounter which returns an address in edi; this address is invalid and when caller dereferences it, the application crashes.

If I restart my provider, the counter is still visible in Perfmon and increments correctly.

Manifest follows

<instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd"
     xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
  <instrumentation>
    <counters xmlns="http://schemas.microsoft.com/win/2005/12/counters">
      <provider callback = "custom"
        applicationIdentity = "TPerfStatsCollector.exe"
            providerName = "TPerfstatscollector"
        providerType = "userMode"
        providerGuid = "{33d68436-4cf9-4f58-9976-44b048b072f3}"
        symbol = "symbolGUID">
        <counterSet guid = "{381300a5-3be6-46d8-8615-12d8b259aae4}"
          uri = "A.AxPServer.Counters.Basic"
          name = "Basic counters"
          description = "These are the sample counters"
          instances = "Single"
          symbol = "setGUID">
          <counter id = "1"
            uri = "A.AxPServer.Counters.Basic.Session"
            name = "Sessions"
            description = "Number of sessions"
            type = "perf_counter_rawcount"
            detailLevel = "standard"
            defaultScale = "1">
          </counter>
        </counterSet>
      </provider>
   </counters>
  </instrumentation>
</instrumentationManifest>


问:
How to pull new docker images to openshift cluster nodes from remote private registry?
All steps specified in https://blog.openshift.com/remotely-push-pull-container-images-openshift/ (and other sources) worked perfectly on master, but it does not help me to pull from nodes.

Details:

Logged in on master and two nodes to registry: docker login
https://my.registry:5000

Created new secret on master with: oc secrets new my.registry
.dockerconfigjson=/root/.docker/config.json (can't do the same on
nodes, because they do not have oc utility)

In my current project added secret for default account: oc secrets
add serviceaccount/default secrets/my.registry --for=pull

Now when I'm naking a new deployment, the pods created on master will start perfectly well (master will be able to pull needed images), but pods on nodes will fail to start unless I manually pull images on them with docker pull.

So how can I make all nodes from my openshift (origin) cluster pull images with specified default account?

答:
The problem was in https://github.com/openshift/origin/issues/13122
Master somehow managed to pull and extract images faster, while nodes had a timeout.</p>


问:
How to "inject" partialView elements into DOM to add jQuery code?
I have a partialView:

```<code><table class="table table-bordered table-condensed table-hover table-striped">
    <thead>
        <tr>
            <th>Trip Id</th>
            <th>Start Time</th>
            <th>End Time</th>
            <th>Actual Distance</th>
            <th>Air Distance</th>
            <th>Avg Speed</th>
            <th>Max Speed</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr class="trip" data-id="@item.TripId" data-url="@Url.Action("","")">
                <td>@item.TripId</td>
                <td>@item.StartTimeStamp</td>
                <td>@item.EndTimeStamp</td>
                <td>@item.ActualDistance</td>
                <td>@item.AirDistance</td>
                <td>@item.AvgSpeed</td>
                <td>@item.MaxSpeed</td>
            </tr>
        }
    </tbody>
</table>
</code>```

that is loaded through a jQuery .load() function. However I have found that when it is loaded like this inside my site.js file the .trip class is not added to the DOM before the load and therefore I can't write any code that reacts to:

```<code>$(".trip").click()
</code>```

How can I fix this issue?

NB: I have all my Javascript/jQuery code inside my site.js

Edit

Snippet for loading the partialView:

```<code>$("#TripPartial").slideUp('200', function () {
    $('#TripPartial').load(_this.data('url'), { id: _this.data('id') }, function () {
        $("#TripPartial").slideDown('200');
    });
});
</code>```

答:
You should use event delegation for elements which were added dynamically.

You should bind click event handler using .on() method.

Event delegation allows us to attach a single event listener, to a
  parent element, that will fire for all descendants matching a
  selector, whether those descendants exist now or are added in the
  future.

```<code>$(document).on('click','.trip',function(){

});
</code>```

Body:
I have a partialView:

            Trip Id
            Start Time
            End Time
            Actual Distance
            Air Distance
            Avg Speed
            Max Speed

        @foreach (var item in Model)
        {

                @item.TripId
                @item.StartTimeStamp
                @item.EndTimeStamp
                @item.ActualDistance
                @item.AirDistance
                @item.AvgSpeed
                @item.MaxSpeed

        }

that is loaded through a jQuery .load() function. However I have found that when it is loaded like this inside my site.js file the .trip class is not added to the DOM before the load and therefore I can't write any code that reacts to:

$(".trip").click()

How can I fix this issue?

NB: I have all my Javascript/jQuery code inside my site.js

Edit

Snippet for loading the partialView:

$("#TripPartial").slideUp('200', function () {
    $('#TripPartial').load(_this.data('url'), { id: _this.data('id') }, function () {
        $("#TripPartial").slideDown('200');
    });
});

Body:
You should use event delegation for elements which were added dynamically.

You should bind click event handler using .on() method.

Event delegation allows us to attach a single event listener, to a
  parent element, that will fire for all descendants matching a
  selector, whether those descendants exist now or are added in the
  future.

$(document).on('click','.trip',function(){

});


答:
If your card id string is always after the "card" word into the string you can try this code: </p>

```<code>$pieces = explode(" ", $String_1);

$cardId = $pieces[array_search('card', $pieces)+1];

if (strlen ( $cardId ) > 10)
{
   // Ok
}
else
{
   // Ko
}
</code>```

Title: check string valid or not in PHP

Body:
If your card id string is always after the "card" word into the string you can try this code:

$pieces = explode(" ", $String_1);

$cardId = $pieces[array_search('card', $pieces)+1];

if (strlen ( $cardId ) > 10)
{
   // Ok
}
else
{
   // Ko
}


问:
x:Name in XAML WPF - Visual Studio Community 2017 BUG
I have used Visual Studio Community 2015 and there was no problem. Since I updated to 2017...well...there is some issues...

When I drop new object to grid in WPF...no default name...both in the property window and the XAML code...mostly I design applications using XAML code, I do not use the property window. It is very frustrating to type for each new object x:Name = "Button", "TextBox" etc...

And to make things worse...Visual Studio works like how he wants...one day this is the default, second day I have to manually write. In 2015 this was always the default. Has anyone had a similar experience, whether you need to adjust something or is this really a bug?

答:
Go to: Tools->Options->XAML Designer
Select: 'Automatically name interactive elements on creation'

Now VS designer will name your new objects.


问:
Babel config in a MERN app
I have given up at trying to learn rails. I'm now focusing my energy on trying to get started with node, using the MERN stack. I have done both Stephen Grider and Andrew Mead's udemy course as well as all of the code school js courses. I'm afraid I'm not off to a promising start.

I'm stuck at getting my import statements to work. So far, I have tried to import files. For that I need babel. My package.json has:

```<code>"scripts": {
    "test": "mocha test/**/*-test.js --compilers js:babel-core/register --recursive",
    "start": "nodemon -w server.js server.js  --source-maps"
  },
  "author": "Ol",
  "license": "MIT",
  "dependencies": {
    "axios": "^0.16.1",
    "babel-cli": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-polyfill": "^6.13.0",
    "body-parser": "^1.17.1",
    "caniuse-api": "^2.0.0",
    "express": "^4.13.4",
    "lodash": "^4.17.4",
    "material-ui": "^0.18.0",
    "nodemon": "^1.11.0",
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "react-promise": "^1.1.2",
    "react-redux": "^5.0.4",
    "react-router": "^4.1.1",
    "react-tap-event-plugin": "^2.0.1",
    "redux": "^3.6.0",
    "redux-devtools": "^3.4.0",
    "redux-form": "^6.7.0",
    "redux-thunk": "^2.2.0",
    "socket.io": "^2.0.1",
    "source-map-support": "^0.4.15"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-core": "^6.24.1",
    "babel-loader": "^7.0.0",
    "babelify": "^7.3.0",
    "enzyme": "^2.8.2",
    "mocha": "^3.3.0",
    "react-addons-test-utils": "^15.5.1",
    "webpack": "^2.5.1"
  }
}
</code>```

My .babelrc has:

```<code>{
  "presets": ["react", "es2015"]
}
</code>```

My server.js has:

```<code>import express from 'express';
import bodyParser from 'body-parser';
import { MongoClient } from 'mongodb';
import 'babel-polyfill';
import SourceMapSupport from 'source-map-support';

SourceMapSupport.install(); //to get line numbers with file refs rather than compiled code line numbers

// const app = express();

app.use(express.static('open'));
app.use(bodyParser.json());

app.listen(3000, function(){
  console.log('listening on 3000');
});
</code>```

My webpack.config.js has:

```<code>module :{
    rules:[{
      // use : 'babel-loader',
      loader: 'babel-loader',
      query :{
        presets:['react','es2015']
        // ,'es2017'
      },
      test: /\.jsx?$/,
      exclude: /(node_modules|bower_components)/
    }]
</code>```

When I try to use npm start, I get an error with my import statements. It says:

```<code>{ import express from 'express';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
[nodemon] app crashed - waiting for file changes before starting...
</code>```

Can anyone give me a clue on how to get babel setup to work with a node app. I noticed that even when I run npm install in my console, I don't get a node_modules folder in my app. I used yarn to add dependencies to package.json, but don't seem to have the ability to generate an node_modules folder.

Next attempt

I then tried npm init and then npm upgrade (even though I use yarn for adding modules).

The output of npm upgrade is below, but I still don't end up with a node modules folder. I think the reason babel isn't working to recognise my import statements is because I don't have the module in my app. Does anyone know how to get a node modules file to be created in the setup? I thought that happened automatically.

```<code>npm update
npm WARN deprecated isarray@2.0.1: Just use Array.isArray directly

> uws@0.14.5 install /Users/mlc/may/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0

- ms@0.7.3 node_modules/engine.io-client/node_modules/ms
- debug@2.6.4 node_modules/engine.io-client/node_modules/debug
- ms@0.7.3 node_modules/finalhandler/node_modules/ms
- react-addons-create-fragment@15.5.4 node_modules/react-addons-create-fragment
- react-addons-transition-group@15.5.2 node_modules/react-addons-transition-group
- ms@0.7.3 node_modules/socket.io-client/node_modules/ms
- debug@2.6.4 node_modules/socket.io-client/node_modules/debug
- camelcase@1.2.1 node_modules/uglify-js/node_modules/camelcase
- cliui@2.1.0 node_modules/uglify-js/node_modules/cliui
cr@1.0.0 /Users/mlc/may
├── axios@0.16.2
├── body-parser@1.17.2
├── express@4.15.3
├── material-ui@0.18.2
├── mocha@3.4.2
├── react-promise@1.1.3
├── react-redux@5.0.5
├── socket.io@2.0.2
└── webpack@2.6.1
</code>```

答:
Use presets: ["es2015", "react", "stage-2"].

If you want to run your server.js with export and import, add babel-node.

package.json

```<code>...
"start": "cross-env NODE_ENV=production babel-node server.js",
"dev": "nodemon server.js --exec babel-node --presets es2015,react,stage-2"
...
</code>```

.babelrc

```<code>{
  "env": {
    "production": {
      "presets": ["es2015", "react", "stage-2"]
    },
    "development": {
      "presets": ["es2015", "react", "stage-2"]
    }
  }
}
</code>```

Title: Babel config in a MERN app

Body:
I have given up at trying to learn rails. I'm now focusing my energy on trying to get started with node, using the MERN stack. I have done both Stephen Grider and Andrew Mead's udemy course as well as all of the code school js courses. I'm afraid I'm not off to a promising start.

I'm stuck at getting my import statements to work. So far, I have tried to import files. For that I need babel. My package.json has:

"scripts": {
    "test": "mocha test/**/*-test.js --compilers js:babel-core/register --recursive",
    "start": "nodemon -w server.js server.js  --source-maps"
  },
  "author": "Ol",
  "license": "MIT",
  "dependencies": {
    "axios": "^0.16.1",
    "babel-cli": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-polyfill": "^6.13.0",
    "body-parser": "^1.17.1",
    "caniuse-api": "^2.0.0",
    "express": "^4.13.4",
    "lodash": "^4.17.4",
    "material-ui": "^0.18.0",
    "nodemon": "^1.11.0",
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "react-promise": "^1.1.2",
    "react-redux": "^5.0.4",
    "react-router": "^4.1.1",
    "react-tap-event-plugin": "^2.0.1",
    "redux": "^3.6.0",
    "redux-devtools": "^3.4.0",
    "redux-form": "^6.7.0",
    "redux-thunk": "^2.2.0",
    "socket.io": "^2.0.1",
    "source-map-support": "^0.4.15"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-core": "^6.24.1",
    "babel-loader": "^7.0.0",
    "babelify": "^7.3.0",
    "enzyme": "^2.8.2",
    "mocha": "^3.3.0",
    "react-addons-test-utils": "^15.5.1",
    "webpack": "^2.5.1"
  }
}

My .babelrc has:

{
  "presets": ["react", "es2015"]
}

My server.js has:

import express from 'express';
import bodyParser from 'body-parser';
import { MongoClient } from 'mongodb';
import 'babel-polyfill';
import SourceMapSupport from 'source-map-support';

SourceMapSupport.install(); //to get line numbers with file refs rather than compiled code line numbers

// const app = express();

app.use(express.static('open'));
app.use(bodyParser.json());

app.listen(3000, function(){
  console.log('listening on 3000');
});

My webpack.config.js has:

module :{
    rules:[{
      // use : 'babel-loader',
      loader: 'babel-loader',
      query :{
        presets:['react','es2015']
        // ,'es2017'
      },
      test: /\.jsx?$/,
      exclude: /(node_modules|bower_components)/
    }]

When I try to use npm start, I get an error with my import statements. It says:

{ import express from 'express';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
[nodemon] app crashed - waiting for file changes before starting...

Can anyone give me a clue on how to get babel setup to work with a node app. I noticed that even when I run npm install in my console, I don't get a node_modules folder in my app. I used yarn to add dependencies to package.json, but don't seem to have the ability to generate an node_modules folder.

Next attempt

I then tried npm init and then npm upgrade (even though I use yarn for adding modules).

The output of npm upgrade is below, but I still don't end up with a node modules folder. I think the reason babel isn't working to recognise my import statements is because I don't have the module in my app. Does anyone know how to get a node modules file to be created in the setup? I thought that happened automatically.

npm update
npm WARN deprecated isarray@2.0.1: Just use Array.isArray directly

> uws@0.14.5 install /Users/mlc/may/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0

- ms@0.7.3 node_modules/engine.io-client/node_modules/ms
- debug@2.6.4 node_modules/engine.io-client/node_modules/debug
- ms@0.7.3 node_modules/finalhandler/node_modules/ms
- react-addons-create-fragment@15.5.4 node_modules/react-addons-create-fragment
- react-addons-transition-group@15.5.2 node_modules/react-addons-transition-group
- ms@0.7.3 node_modules/socket.io-client/node_modules/ms
- debug@2.6.4 node_modules/socket.io-client/node_modules/debug
- camelcase@1.2.1 node_modules/uglify-js/node_modules/camelcase
- cliui@2.1.0 node_modules/uglify-js/node_modules/cliui
cr@1.0.0 /Users/mlc/may
├── axios@0.16.2
├── body-parser@1.17.2
├── express@4.15.3
├── material-ui@0.18.2
├── mocha@3.4.2
├── react-promise@1.1.3
├── react-redux@5.0.5
├── socket.io@2.0.2
└── webpack@2.6.1

Body:
Use presets: ["es2015", "react", "stage-2"].

If you want to run your server.js with export and import, add babel-node.

package.json

...
"start": "cross-env NODE_ENV=production babel-node server.js",
"dev": "nodemon server.js --exec babel-node --presets es2015,react,stage-2"
...

.babelrc

{
  "env": {
    "production": {
      "presets": ["es2015", "react", "stage-2"]
    },
    "development": {
      "presets": ["es2015", "react", "stage-2"]
    }
  }
}