问:
How to change fixed line height
I am trying to figure out how to change the line height of a specific item in a theme. It seems that this item has a fixed minimum line height, which I can't get around.

On https://aerycs.cocoto.eu if you put something into the basket an open the preview (top right corner, green link) theres a red title of the item.

I am not able to find out how to make the line height smaller.

You can see a sample image here: https://imgur.com/DNqRb7m

Appreciate all help!

答:
If I have understood this correctly, we are looking at this section of markup:

```<code><div class="meta-container">
<div>
<a href="/55-55-c-aero-wt-tour-testsieger-20-24-speichen-carbon-laufradsatz-clincher-wickel-technologie-tubeless-kompatibel-bis-110kg_2505_11402" class="item-name text-primary text-appearance">C 55/55 C AERO-WT - TOUR TESTSIEGER - Carbon Laufradsatz, Clincher, Wickel Technologie, tubeless kompatibel, bis 110kg</a>
</code>```

In which case, something like:

```<code>.meta-container .item-name.text-primary.text-appearance {
line-height: 36px;
}
</code>```

will target the text and apply a new line-height.

Title: How to change fixed line height

Body:
If I have understood this correctly, we are looking at this section of markup:

<div class="meta-container">
<div>
<a href="/55-55-c-aero-wt-tour-testsieger-20-24-speichen-carbon-laufradsatz-clincher-wickel-technologie-tubeless-kompatibel-bis-110kg_2505_11402" class="item-name text-primary text-appearance">C 55/55 C AERO-WT - TOUR TESTSIEGER - Carbon Laufradsatz, Clincher, Wickel Technologie, tubeless kompatibel, bis 110kg</a>

In which case, something like:

.meta-container .item-name.text-primary.text-appearance {
line-height: 36px;
}

will target the text and apply a new line-height.


来源: stackexchange

问:
how to add slides on display in bootstrap
i m trying to add number of slides per display.it show 4 number of slide.i tried adding .carousel-item class to css but it doesnt seems to work.all it does it displays last slide after the 4th slide.  tried changing lg-3 to lg-2 it shrinked the slide but dint added anything.

$('#multi-carousel').on('slide.bs.carousel', function (e) {
    var $e = $(e.relatedTarget);
    var idx = $e.index();
    var itemsPerSlide = 5;
    var totalItems = $('#multi-carousel .carousel-item').length;
    if (idx >= totalItems - (itemsPerSlide - 1)) {
        var it = itemsPerSlide - (totalItems - idx);
        for (var i = 0; i < it; i++) {
            // append slides to end
            if (e.direction == "left") {
                $('#multi-carousel .carousel-item').eq(i).appendTo('#multi-carousel .carousel-inner');
            }
            else {
                $('#multi-carousel .carousel-item').eq(0).appendTo('#multi-carousel .carousel-inner');
            }
        }
    }
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>@media (min-width: 768px) and (max-width: 991px) {
    /* Show 4th slide on md if col-md-4*/
    #multi-carousel .carousel-inner .active.col-md-4.carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -33.3333%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }
}

@media (min-width: 576px) and (max-width: 768px) {
    /* Show 3rd slide on sm if col-sm-6*/
    #multi-carousel .carousel-inner .active.col-sm-6.carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -50%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }
}

@media (min-width: 576px) {
    #multi-carousel .carousel-item {
        margin-right: 0;
    }
    /* show 2 items */
    #multi-carousel .carousel-inner .active + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left),
    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item {
        transition: none;
    }

    #multi-carousel .carousel-inner .carousel-item-next {
        position: relative;
        transform: translate3d(0, 0, 0);
    }
    /* left or forward direction */
    #multi-carousel .active.carousel-item-left + .carousel-item-next.carousel-item-left,
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item,
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    /* farthest right hidden item must be also positioned for animations */
    #multi-carousel .carousel-inner .carousel-item-prev.carousel-item-right {
        position: absolute;
        top: 0;
        left: 0;
        z-index: -1;
        display: block;
        visibility: visible;
    }
    /* right or prev direction */
    #multi-carousel .active.carousel-item-right + .carousel-item-prev.carousel-item-right,
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item,
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(100%, 0, 0);
        visibility: visible;
        display: block;
        visibility: visible;
    }
}
/* MD */
@media (min-width: 768px) {
    /* show 3rd of 3 item slide */
    #multi-carousel .carousel-inner .active + .carousel-item + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item + .carousel-item {
        transition: none;
    }

    #multi-carousel .carousel-inner .carousel-item-next {
        position: relative;
        transform: translate3d(0, 0, 0);
    }
    /* left or forward direction */
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    /* right or prev direction */
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(100%, 0, 0);
        visibility: visible;
        display: block;
        visibility: visible;
    }
}
/* LG */
@media (min-width: 991px) {
    /* show 4th item */
    #multi-carousel .carousel-inner .active + .carousel-item + .carousel-item + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item + .carousel-item + .carousel-item {
        transition: none;
    }
    /* Show 5th slide on lg if col-lg-3 */
    #multi-carousel .carousel-inner .active.col-lg-3.carousel-item + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -25%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }
    /* left or forward direction */
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    /* right or prev direction //t - previous slide direction last item animation fix */
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(100%, 0, 0);
        visibility: visible;
        display: block;
        visibility: visible;
    }
    }</code>```

                Previous

                Next

```

this is how it comes after adding .carousel-item

答:
i tried adding

#multi-carousel .carousel-inner .active + .carousel-item + .carousel-item + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item + .carousel-item + .carousel-item {
        transition: none;
    }
    /* Show 5th slide on lg if col-lg-3 */
    #multi-carousel .carousel-inner .active.col-lg-3.carousel-item + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -25%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }```

 this part of code multiple times..this seems to do the trick but second last item is not animating properly.

ContentLicense: CC BY-SA 4.0

Body:
i m trying to add number of slides per display.it show 4 number of slide.i tried adding .carousel-item class to css but it doesnt seems to work.all it does it displays last slide after the 4th slide.  tried changing lg-3 to lg-2 it shrinked the slide but dint added anything.

$('#multi-carousel').on('slide.bs.carousel', function (e) {
    var $e = $(e.relatedTarget);
    var idx = $e.index();
    var itemsPerSlide = 5;
    var totalItems = $('#multi-carousel .carousel-item').length;
    if (idx >= totalItems - (itemsPerSlide - 1)) {
        var it = itemsPerSlide - (totalItems - idx);
        for (var i = 0; i < it; i++) {
            // append slides to end
            if (e.direction == "left") {
                $('#multi-carousel .carousel-item').eq(i).appendTo('#multi-carousel .carousel-inner');
            }
            else {
                $('#multi-carousel .carousel-item').eq(0).appendTo('#multi-carousel .carousel-inner');
            }
        }
    }
});

@media (min-width: 768px) and (max-width: 991px) {
    /* Show 4th slide on md if col-md-4*/
    #multi-carousel .carousel-inner .active.col-md-4.carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -33.3333%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }
}

@media (min-width: 576px) and (max-width: 768px) {
    /* Show 3rd slide on sm if col-sm-6*/
    #multi-carousel .carousel-inner .active.col-sm-6.carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -50%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }
}

@media (min-width: 576px) {
    #multi-carousel .carousel-item {
        margin-right: 0;
    }
    /* show 2 items */
    #multi-carousel .carousel-inner .active + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left),
    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item {
        transition: none;
    }

    #multi-carousel .carousel-inner .carousel-item-next {
        position: relative;
        transform: translate3d(0, 0, 0);
    }
    /* left or forward direction */
    #multi-carousel .active.carousel-item-left + .carousel-item-next.carousel-item-left,
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item,
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    /* farthest right hidden item must be also positioned for animations */
    #multi-carousel .carousel-inner .carousel-item-prev.carousel-item-right {
        position: absolute;
        top: 0;
        left: 0;
        z-index: -1;
        display: block;
        visibility: visible;
    }
    /* right or prev direction */
    #multi-carousel .active.carousel-item-right + .carousel-item-prev.carousel-item-right,
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item,
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(100%, 0, 0);
        visibility: visible;
        display: block;
        visibility: visible;
    }
}
/* MD */
@media (min-width: 768px) {
    /* show 3rd of 3 item slide */
    #multi-carousel .carousel-inner .active + .carousel-item + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item + .carousel-item {
        transition: none;
    }

    #multi-carousel .carousel-inner .carousel-item-next {
        position: relative;
        transform: translate3d(0, 0, 0);
    }
    /* left or forward direction */
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    /* right or prev direction */
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(100%, 0, 0);
        visibility: visible;
        display: block;
        visibility: visible;
    }
}
/* LG */
@media (min-width: 991px) {
    /* show 4th item */
    #multi-carousel .carousel-inner .active + .carousel-item + .carousel-item + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item + .carousel-item + .carousel-item {
        transition: none;
    }
    /* Show 5th slide on lg if col-lg-3 */
    #multi-carousel .carousel-inner .active.col-lg-3.carousel-item + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -25%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }
    /* left or forward direction */
    #multi-carousel .carousel-item-next.carousel-item-left + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    /* right or prev direction //t - previous slide direction last item animation fix */
    #multi-carousel .carousel-item-prev.carousel-item-right + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: relative;
        transform: translate3d(100%, 0, 0);
        visibility: visible;
        display: block;
        visibility: visible;
    }
    }

                Previous

                Next

this is how it comes after adding .carousel-item

Body:
i tried adding

#multi-carousel .carousel-inner .active + .carousel-item + .carousel-item + .carousel-item {
        display: block;
    }

    #multi-carousel .carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item + .carousel-item + .carousel-item {
        transition: none;
    }
    /* Show 5th slide on lg if col-lg-3 */
    #multi-carousel .carousel-inner .active.col-lg-3.carousel-item + .carousel-item + .carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -25%; /*change this with javascript in the future*/
        z-index: -1;
        display: block;
        visibility: visible;
    }

 this part of code multiple times..this seems to do the trick but second last item is not animating properly.


问:
Loading Multiple files Parallelly in ODI12c
I am working in ODI12c Project. I have a Scenario in which i need to load multiple files in a single table Parallelly.
I tried through file List and using Loop in ODI package,but its loading data in serial i.e. 1st file then 2nd file etc.
Please suggest how should i load data Parallelly.</p>

答:
I have an another approach to achieve this:

Create a simple package for loading the file.

Create a another package which is calling the another one.

Load all the files name in a oracle table like:

File_id    Name

1      File1

2        File2

Now create a increment variable with pull the name of 1st file and then 2 .
Now call the file loading package inside another package &  make it asynchronous.

Pass the increment variable which is having the file name into model created for loading file ( resource Name).

Each time when variable is getting incremented it's gonna pull the next file and create a different session for each file loading . there might be a gap of 1 sec for each file loading because of increment of variables,i think that would be ok.

I hope you got the way in case any help you can add comment.


问:
Nested if-conditions vs multiple separated if-conditions with return statement in each one
What is the most professional code-style in the below two functions ?

And what if the function become more complex & larger such as to have 20 checks ?

Note: i need to do some stuff after each check, so i can't concatenate all in one if-statement like:

if (vehicle.isBus) && (vehicle.numberOfWheels == 6) && (vehicle.motorVersion == 2019)

```<code>//first alternative
public bool validate(Vehicle vehicle)
{
    if(vehicle.isBus)
    {
        //do some stuff here related to vehicle.isBus
        if (vehicle.numberOfWheels == 6)
        {
            //do some stuff here related to vehicle.numberOfWheels
            if (vehicle.motorVersion == 2019)
            {
                //do some stuff here related to vehicle.motorVersion
                return true;
            }
        }
    }
    return false;
}

//second alternative
public bool validate(Vehicle vehicle)
{
    if (!vehicle.isBus)
    {
        return false;
    }
    //do some stuff here related to vehicle.isBus

    if (vehicle.numberOfWheels != 6)
    {
        return false;
    }
    //do some stuff here related to vehicle.numberOfWheels

    if (vehicle.motorVersion != 2019)
    {
        return false;
    }
    //do some stuff here related to vehicle.motorVersion

    return true;
}
</code>```

答:
One golden rule I follow is to Avoid Nesting as much as I can.

Use the one that makes the code more readable and understandable. For just two conditions, the first way is more logical and readable. It might not be the case anymore with 5 or 6 conditions linked with &&, || and !.

So when the number of checks are 5+ then you should prefer second alternative.

Note : Multiple ifs without each calling return implies that 2 or more ifs could be true.

Body:
What is the most professional code-style in the below two functions ?

And what if the function become more complex & larger such as to have 20 checks ?

Note: i need to do some stuff after each check, so i can't concatenate all in one if-statement like:

if (vehicle.isBus) && (vehicle.numberOfWheels == 6) && (vehicle.motorVersion == 2019)

//first alternative
public bool validate(Vehicle vehicle)
{
    if(vehicle.isBus)
    {
        //do some stuff here related to vehicle.isBus
        if (vehicle.numberOfWheels == 6)
        {
            //do some stuff here related to vehicle.numberOfWheels
            if (vehicle.motorVersion == 2019)
            {
                //do some stuff here related to vehicle.motorVersion
                return true;
            }
        }
    }
    return false;
}

//second alternative
public bool validate(Vehicle vehicle)
{
    if (!vehicle.isBus)
    {
        return false;
    }
    //do some stuff here related to vehicle.isBus

    if (vehicle.numberOfWheels != 6)
    {
        return false;
    }
    //do some stuff here related to vehicle.numberOfWheels

    if (vehicle.motorVersion != 2019)
    {
        return false;
    }
    //do some stuff here related to vehicle.motorVersion

    return true;
}


问:
Why is fprintf causing memory leak and behaving unpredictably when width argument is missing
The following simple program is behaving unpredictably. Sometimes it prints "0.00000", sometimes it prints more "0" than I can count. Some times it uses up all memory on the system, before the system either kills some process, or it fails with bad_alloc.

```<code>#include "stdio.h"

int main() {
  fprintf(stdout, "%.*f", 0.0);
}
</code>```

I'm aware that this is incorrect usage of fprintf. There should be another argument specifying the width of the formatting. It's just surprising that the behavior is so unpredictable. Sometimes it seems to use a default width, while sometimes it fails very badly. Could this not be made to always fail or always use some default behaviour?

I came over similar usage in some code at work, and spent a lot of time figuring out what was happening. It only seemed to happen with debug builds, but would not happen while debugging with gdb. Another curiosity is that running it through valgrind would consistently bring about the printing of many "0"s case, which otherwise happens quite seldom, but the memory usage issue would never occur then either.

I am running Red Hat Enterprise Linux 7, and compiled with gcc 4.8.5.

答:
Undefined behaviour is undefined.

However, on x86-64 System-V ABI it is well-known that arguments are not passed on stack but in registers. Floating point variables are passed in floating-point registers, and integers are passed in general-purpose registers. There is no parameter store on stack, so the width of the arguments does not matter. Since you never passed any integer in the variable argument part, the general purpose register corresponding to the first argument will contain whatever garbage it had from before.

This program will show how the floating point values and integers are passed separately:

```<code>#include <stdio.h>

int main() {
    fprintf(stdout, "%.*f\n", 42, 0.0);
    fprintf(stdout, "%.*f\n", 0.0, 42);
}
</code>```

Compiled on x86-64, GCC  + Glibc, both printfs will produce the same output:

```<code>0.000000000000000000000000000000000000000000
0.000000000000000000000000000000000000000000
</code>```

Body:
The following simple program is behaving unpredictably. Sometimes it prints "0.00000", sometimes it prints more "0" than I can count. Some times it uses up all memory on the system, before the system either kills some process, or it fails with bad_alloc.

#include "stdio.h"

int main() {
  fprintf(stdout, "%.*f", 0.0);
}

I'm aware that this is incorrect usage of fprintf. There should be another argument specifying the width of the formatting. It's just surprising that the behavior is so unpredictable. Sometimes it seems to use a default width, while sometimes it fails very badly. Could this not be made to always fail or always use some default behaviour?

I came over similar usage in some code at work, and spent a lot of time figuring out what was happening. It only seemed to happen with debug builds, but would not happen while debugging with gdb. Another curiosity is that running it through valgrind would consistently bring about the printing of many "0"s case, which otherwise happens quite seldom, but the memory usage issue would never occur then either.

I am running Red Hat Enterprise Linux 7, and compiled with gcc 4.8.5.

Body:
Undefined behaviour is undefined.

However, on x86-64 System-V ABI it is well-known that arguments are not passed on stack but in registers. Floating point variables are passed in floating-point registers, and integers are passed in general-purpose registers. There is no parameter store on stack, so the width of the arguments does not matter. Since you never passed any integer in the variable argument part, the general purpose register corresponding to the first argument will contain whatever garbage it had from before.

This program will show how the floating point values and integers are passed separately:

#include <stdio.h>

int main() {
    fprintf(stdout, "%.*f\n", 42, 0.0);
    fprintf(stdout, "%.*f\n", 0.0, 42);
}

Compiled on x86-64, GCC  + Glibc, both printfs will produce the same output:

0.000000000000000000000000000000000000000000
0.000000000000000000000000000000000000000000


问:
How to add xsi:type attribute to an XML element
How can I add xsi:type in xml element.

I am writing a routine in C# which is serializing an Xml file using XmlSerializer. Everything seems to be fine except something I first thought was a minor but turned out not to be so.

here is my code,

```<code>public class OuterElement
        {
            public string firstElement { get; set; }

            public string secondElement { get; set; }

            public InnerElement innerElement = new InnerElement();
        }

        public class InnerElement
        {
            [XmlAttribute(AttributeName="xsi:type")]
            public string type { get; set; }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(OuterElement));
            OuterElement outerElement = new OuterElement();
            outerElement.firstElement = "name";
            outerElement.secondElement = "CD";
            outerElement.innerElement.type = "testsample";

            using (TextWriter writer = new StreamWriter(@"G:\abc.xml"))
            {
                serializer.Serialize(writer, outerElement);
            }
        }
</code>```

'

I want xml like this,

```<code><OuterElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" lns:xsd="http://www.w3.org/2001/XMLSchema">
    <innerElement xsi:type="testsample">
    </innerElement>
    <firstElement>name</firstElement>
    <secondElement>CD</secondElement>
</OuterElement>
</code>```

Thanks in advance.

答:
You need to use the XmlTypeAttribute

```<code>[XmlType("testsample")]
public class InnerElement
{
}
</code>```

This will produce the folowing:

```<code><innerElement xsi:type="testsample" />
</code>```

ContentLicense: CC BY-SA 3.0

Body:
How can I add xsi:type in xml element.

I am writing a routine in C# which is serializing an Xml file using XmlSerializer. Everything seems to be fine except something I first thought was a minor but turned out not to be so.

here is my code,

public class OuterElement
        {
            public string firstElement { get; set; }

            public string secondElement { get; set; }

            public InnerElement innerElement = new InnerElement();
        }

        public class InnerElement
        {
            [XmlAttribute(AttributeName="xsi:type")]
            public string type { get; set; }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(OuterElement));
            OuterElement outerElement = new OuterElement();
            outerElement.firstElement = "name";
            outerElement.secondElement = "CD";
            outerElement.innerElement.type = "testsample";

            using (TextWriter writer = new StreamWriter(@"G:\abc.xml"))
            {
                serializer.Serialize(writer, outerElement);
            }
        }

'

I want xml like this,

<OuterElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" lns:xsd="http://www.w3.org/2001/XMLSchema">
    <innerElement xsi:type="testsample">
    </innerElement>
    <firstElement>name</firstElement>
    <secondElement>CD</secondElement>
</OuterElement>

Thanks in advance.

Body:
You need to use the XmlTypeAttribute

[XmlType("testsample")]
public class InnerElement
{
}

This will produce the folowing:

<innerElement xsi:type="testsample" />


问:
Possible to test Google social login locally?
I want to test the Google Social login system on my local machine. However when I create a new OAuth button: 'Create New Client ID' it requires me to fill in the Authorized redirect URI which needs to be a valid address (ends with .com or .org).

Obviously when we develop locally we don't have the .com or .org at the end. I have a virtualhost setup... and my address to my local development is mywebsite.local

Is there a way to input the redirect URI to be mywebsite.local without receinv the error:

Invalid Redirect: http://mywebsite.local/login/auth must end with a
  public top-level domain (such as .com or .org)

答: You can ngrok to tunnel your localhost into public site, as described here.</p>


问:
Set value on model when checkbox changes
I have a page which contains usnernames and checkboxes for every user.
it looks like a matrix.

Now when changing one of the checkboxes, I want to change a value on the user, so I know which user is changed. This way I can check which users I need to update in the database.

My page-code looks as follows:

```<code>@for(var i = 0; i < Model.EmployeeList.Count; i++)
{
    <input type="hidden" asp-for="EmployeeList[i].Id"/>
    <tr>
    <th scope="row">@Model.EmployeeList[i].Name @Model.EmployeeList[i].Surname</th>
<th scope="row">@Model.EmployeeList[i].Location</th>
@for (var j = 0; j < Model.EmployeeList[i].SelectedSkillList.Count; j++)
{
<td>

    @*<div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" id="customCheck1">
        <label class="custom-control-label" for="customCheck1">Check</label>
    </div>*@
        <label class="label">
            <input asp-for="EmployeeList[i].SelectedSkillList[j].IsSelected" type="checkbox" class="label__checkbox"/>
            <span class="label__text">
                <span class="label__check">
                    <i class="fa fa-check icon"></i>
                </span>
            </span>
        </label>

    @*<input asp-for="EmployeeList[i].SelectedSkillList[j].IsSelected" type="checkbox" />*@
    @*If this is not included, prefix becomes null*@
    @Html.HiddenFor(x => Model.EmployeeList[i].SelectedSkillList[j].Prefix)
    @Html.HiddenFor(x => Model.EmployeeList[i].IsChanged)
</td>
}
</tr>
}
</code>```

When I click the checkbox I would like to set the value of Model.EmployeeList[i].IsChanged to true.

答:
To solve the problem, you should know that an Id should be unique for any element. For that reason you will get different Ids for hiddens. I don't remember how is composed the MVC Id for repeated elements but that's not a problem: you shall obtain the Id with the HTML helper @Html.Id(Model.EmployeeList[i].IsChanged) So, you can bind the Hidden Id to a checkbox attribute in this way:

<input asp-for=" .. ... " data-changedHidden="@Html.Id(Model.EmployeeList[i].IsChanged)"

Then,you can bind the onchange event in Javascript, check the bind "data-changedHidden" of the changed checkbox, get the element by id and refresh his val. For example, foreach row you'll get something like:

```<code><input type="checkbox" data-changedHidden="IsChanged-3" class="label__checkbox"... />
</code>```

Then you can use javascript for subscribe the onchanged checkbox event, get his data-changedhidden attribute and because it is the id of the hidden that is rendered in the row, you can use it to reach the specific hidden and update his value. For semplicty's sake, an example with jQuery:

```<code>$( function(){
    $(".label__checkbox").on("change",
        function(){
            var t=$(this);
            var hdnIsChangedId=t.data("changedHidden");
            var hidden=$("#"+hdnIsChangedId);
            hidden.val("changed!!");
        });
    } );
  );
</code>```

Body:
I have a page which contains usnernames and checkboxes for every user.
it looks like a matrix.

Now when changing one of the checkboxes, I want to change a value on the user, so I know which user is changed. This way I can check which users I need to update in the database.

My page-code looks as follows:

@for(var i = 0; i < Model.EmployeeList.Count; i++)
{
    <input type="hidden" asp-for="EmployeeList[i].Id"/>

    @Model.EmployeeList[i].Name @Model.EmployeeList[i].Surname
@Model.EmployeeList[i].Location
@for (var j = 0; j < Model.EmployeeList[i].SelectedSkillList.Count; j++)
{

    @*

        <input type="checkbox" class="custom-control-input" id="customCheck1">
        Check

*@

            <input asp-for="EmployeeList[i].SelectedSkillList[j].IsSelected" type="checkbox" class="label__checkbox"/>

    @*<input asp-for="EmployeeList[i].SelectedSkillList[j].IsSelected" type="checkbox" />*@
    @*If this is not included, prefix becomes null*@
    @Html.HiddenFor(x => Model.EmployeeList[i].SelectedSkillList[j].Prefix)
    @Html.HiddenFor(x => Model.EmployeeList[i].IsChanged)

}

}

When I click the checkbox I would like to set the value of Model.EmployeeList[i].IsChanged to true.

Body:
To solve the problem, you should know that an Id should be unique for any element. For that reason you will get different Ids for hiddens. I don't remember how is composed the MVC Id for repeated elements but that's not a problem: you shall obtain the Id with the HTML helper @Html.Id(Model.EmployeeList[i].IsChanged) So, you can bind the Hidden Id to a checkbox attribute in this way:

<input asp-for=" .. ... " data-changedHidden="@Html.Id(Model.EmployeeList[i].IsChanged)"

Then,you can bind the onchange event in Javascript, check the bind "data-changedHidden" of the changed checkbox, get the element by id and refresh his val. For example, foreach row you'll get something like:

<input type="checkbox" data-changedHidden="IsChanged-3" class="label__checkbox"... />

Then you can use javascript for subscribe the onchanged checkbox event, get his data-changedhidden attribute and because it is the id of the hidden that is rendered in the row, you can use it to reach the specific hidden and update his value. For semplicty's sake, an example with jQuery:

$( function(){
    $(".label__checkbox").on("change",
        function(){
            var t=$(this);
            var hdnIsChangedId=t.data("changedHidden");
            var hidden=$("#"+hdnIsChangedId);
            hidden.val("changed!!");
        });
    } );
  );


问:
I cannot get Rainbow Text to work. Am i doing something wrong here?
So currently i am finishing a website via Codeanywhere for one of my college classes and i can't seem to get rainbow text to work with my code.

I have attempted to work through this >> https://w3bits.com/rainbow-text/
But with no successful outcomes being made.

  @media only screen and (min-width: 1025px) {
  .navbar-item img {
    max-height: 50px;
  }
  .column {
    border-radius: 10px;
    box-shadow: 0px 1px 10px 3px black;
    margin-right: 20px;
    background-color: #201f20;
  }
  .rainbow-text {
    background-image: repeating-linear-gradient(45deg, violet, indigo, blue, green, yellow, orange, red, violet);
    text-align: center;
    background-size: 800% 800%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    animation: rainbow 8s ease infinite;
  }
  @keyframes rainbow {
    0% {
      background-position: 0% 50%
    }
    50% {
      background-position: 100% 25%
    }
    100% {
      background-position: 0% 50%
    }
  }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="hero-body">
  <div class="container has-text-centered">
    <h1 class="title" style="">
      1st Level - Clearnet
    </h1>
    <hr style="background-color: grey; margin-bottom: 40px;">
    <div class="column">
      <img align="right" src="../images/imagine.jpg" border="0">
      <div class="ranbow-text">
        <p class="subtitle">
          Imagine there is a large paragraph of text here
        </p>
      </div>
    </div>
  </div>
</div></code>```

So essentially i am attempting to get "imagine there is a large paragraph of text here" to be rainbow coloured. So far i have failed and now need help.

答:
you have a typo in
 you are missing an 'i' ->
.
In addition, your styles will only apply if the window is over 1025px wide as per your media query, so when running the code in the small box in stackoverflow.com it won't work even when you fix the typo. It is also possible that you are developing with the dev tools open in the same window and that takes some of your width and thus you are unable to see the rainbow colors.

See working example from your code below:

  @media only screen and (min-width: 200px) {
  .navbar-item img {
    max-height: 50px;
  }
  .column {
    border-radius: 10px;
    box-shadow: 0px 1px 10px 3px black;
    margin-right: 20px;
    background-color: #201f20;
  }
  .rainbow-text {
    background-image: repeating-linear-gradient(45deg, violet, indigo, blue, green, yellow, orange, red, violet);
    text-align: center;
    background-size: 800% 800%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    animation: rainbow 8s ease infinite;
  }
  @keyframes rainbow {
    0% {
      background-position: 0% 50%
    }
    50% {
      background-position: 100% 25%
    }
    100% {
      background-position: 0% 50%
    }
  }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="hero-body">
  <div class="container has-text-centered">
    <h1 class="title" style="">
      1st Level - Clearnet
    </h1>
    <hr style="background-color: grey; margin-bottom: 40px;">
    <div class="column">
      <img align="right" src="../images/imagine.jpg" border="0">
      <div class="rainbow-text">
        <p class="subtitle">
          Imagine there is a large paragraph of text here
        </p>
      </div>
    </div>
  </div>
</div></code>```

Body:
So currently i am finishing a website via Codeanywhere for one of my college classes and i can't seem to get rainbow text to work with my code.

I have attempted to work through this >> https://w3bits.com/rainbow-text/
But with no successful outcomes being made.

  @media only screen and (min-width: 1025px) {
  .navbar-item img {
    max-height: 50px;
  }
  .column {
    border-radius: 10px;
    box-shadow: 0px 1px 10px 3px black;
    margin-right: 20px;
    background-color: #201f20;
  }
  .rainbow-text {
    background-image: repeating-linear-gradient(45deg, violet, indigo, blue, green, yellow, orange, red, violet);
    text-align: center;
    background-size: 800% 800%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    animation: rainbow 8s ease infinite;
  }
  @keyframes rainbow {
    0% {
      background-position: 0% 50%
    }
    50% {
      background-position: 100% 25%
    }
    100% {
      background-position: 0% 50%
    }
  }

      1st Level - Clearnet

          Imagine there is a large paragraph of text here

So essentially i am attempting to get "imagine there is a large paragraph of text here" to be rainbow coloured. So far i have failed and now need help.

Body:
you have a typo in <div class="ranbow-text"> you are missing an 'i' -> <div class="rainbow-text">.
In addition, your styles will only apply if the window is over 1025px wide as per your media query, so when running the code in the small box in stackoverflow.com it won't work even when you fix the typo. It is also possible that you are developing with the dev tools open in the same window and that takes some of your width and thus you are unable to see the rainbow colors.

See working example from your code below:

  @media only screen and (min-width: 200px) {
  .navbar-item img {
    max-height: 50px;
  }
  .column {
    border-radius: 10px;
    box-shadow: 0px 1px 10px 3px black;
    margin-right: 20px;
    background-color: #201f20;
  }
  .rainbow-text {
    background-image: repeating-linear-gradient(45deg, violet, indigo, blue, green, yellow, orange, red, violet);
    text-align: center;
    background-size: 800% 800%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    animation: rainbow 8s ease infinite;
  }
  @keyframes rainbow {
    0% {
      background-position: 0% 50%
    }
    50% {
      background-position: 100% 25%
    }
    100% {
      background-position: 0% 50%
    }
  }

<div class="hero-body">
  <div class="container has-text-centered">
    <h1 class="title" style="">
      1st Level - Clearnet
    </h1>
    <hr style="background-color: grey; margin-bottom: 40px;">
    <div class="column">
      <a imageanchor="1"><img align="right" src="../images/imagine.jpg" border="0"></a>
      <div class="rainbow-text">
        <p class="subtitle">
          Imagine there is a large paragraph of text here
        </p>
      </div>
    </div>
  </div>
</div>


问:
Get the average mean of entries per month with datetime in Pandas
I have a large df with many entries per month. I would like to see the average entries per month as to see as an example if there are any months that normally have more entries. (Ideally I'd like to plot this with a line of the over all mean to compare with but that is maybe a later question).
My df is something like this:

```<code>ufo=pd.read_csv('https://raw.githubusercontent.com/justmarkham/pandas-videos/master/data/ufo.csv')
ufo['Time']=pd.to_datetime(ufo.Time)
</code>```

Where the head looks like this:

So if I'd like to see if there are more ufo-sightings in the summer as an example, how would I go about?

I have tried:

```<code>ufo.groupby(ufo.Time.month).mean()
</code>```

But it does only work if I am calculating a numerical value. If I use count()instead I get the sum of all entries for all months.

EDIT: To clarify, I would like to have the mean of entries - ufo-sightings - per month.

答:
Do you mean you want to group your data by month? I think we can do this

```<code>ufo['month'] = ufo['Time'].apply(lambda t: t.month)
ufo['year'] = ufo['Time'].apply(lambda t: t.year)
</code>```

In this way, you will have 'year' and 'month' to group your data.

```<code>ufo_2 = ufo.groupby(['year', 'month'])['place_holder'].mean()
</code>```

Body:
I have a large df with many entries per month. I would like to see the average entries per month as to see as an example if there are any months that normally have more entries. (Ideally I'd like to plot this with a line of the over all mean to compare with but that is maybe a later question).
My df is something like this:

ufo=pd.read_csv('https://raw.githubusercontent.com/justmarkham/pandas-videos/master/data/ufo.csv')
ufo['Time']=pd.to_datetime(ufo.Time)

Where the head looks like this:

So if I'd like to see if there are more ufo-sightings in the summer as an example, how would I go about?

I have tried:

ufo.groupby(ufo.Time.month).mean()

But it does only work if I am calculating a numerical value. If I use count()instead I get the sum of all entries for all months.

EDIT: To clarify, I would like to have the mean of entries - ufo-sightings - per month.

Body:
Do you mean you want to group your data by month? I think we can do this

ufo['month'] = ufo['Time'].apply(lambda t: t.month)
ufo['year'] = ufo['Time'].apply(lambda t: t.year)

In this way, you will have 'year' and 'month' to group your data.

ufo_2 = ufo.groupby(['year', 'month'])['place_holder'].mean()


问:
Named outlet in lazy loaded module (angular 6.0.5)
I thought this was fixed with angular 6 but either i'm missing something or fix is not complete.

This is the setup...in app.routing:

```<code>{
    path: '',
    component: LayoutContainerComponent,
    children: [
      {
        path: 'management',
        loadChildren: 'app/features/management/management.module#ManagementModule'
      }
    ]
  }
</code>```

LayerContainerComponent just splits the view into header & content area.

in management.routing:

```<code>{
    path: '',
    component: ManagementLayoutContainerComponent,
    children: [
      {
        path: 'someroute',
        component: SomeRouteContainerComponent,
        canActivate: [
          SomeGuard
        ]
      },
      {
         path: 'updatemodal',
         component: UpdateModalComponent,
         outlet: 'modal'
      }
   ]
}
</code>```

ManagementLayoutContainerComponent contains one regular router-outlet and also <router-outlet name="modal"></router-outlet>

on route management/someroute i have template with: [routerLink]="[{ outlets: { modal: 'updatemodal' } }]"

Now, usecase:

navigate to management/someroute

click to link with given routerlink (above)

error thrown:

Error: Cannot match any routes. URL Segment:
  'management/someroute'
      at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError
  (router.js:1359)

Basically, error says that it cannot match route on which it already is!

Now, when i hover that link, url seems correct: /management/someroute/(modal:updatemodal)

Question:
Am i missing something or is this still a problem in angular?

答: Use [routerLink]="[ '', { outlets: { modal: 'updatemodal' } }]

Body:
I thought this was fixed with angular 6 but either i'm missing something or fix is not complete.

This is the setup...in app.routing:

{
    path: '',
    component: LayoutContainerComponent,
    children: [
      {
        path: 'management',
        loadChildren: 'app/features/management/management.module#ManagementModule'
      }
    ]
  }

LayerContainerComponent just splits the view into header & content area.

in management.routing:

{
    path: '',
    component: ManagementLayoutContainerComponent,
    children: [
      {
        path: 'someroute',
        component: SomeRouteContainerComponent,
        canActivate: [
          SomeGuard
        ]
      },
      {
         path: 'updatemodal',
         component: UpdateModalComponent,
         outlet: 'modal'
      }
   ]
}

ManagementLayoutContainerComponent contains one regular router-outlet and also <router-outlet name="modal"></router-outlet>

on route management/someroute i have template with: [routerLink]="[{ outlets: { modal: 'updatemodal' } }]"

Now, usecase:

navigate to management/someroute

click to link with given routerlink (above)

error thrown:

Error: Cannot match any routes. URL Segment:
  'management/someroute'
      at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError
  (router.js:1359)

Basically, error says that it cannot match route on which it already is!

Now, when i hover that link, url seems correct: /management/someroute/(modal:updatemodal)

Question:
Am i missing something or is this still a problem in angular?


问:
Concatenate two more tables in power bi
I have 3 tables in power bi e.g

Table1

```<code>name
Fan_count
connections.likes.id
connections.likes.name
connections.post.id
connections.post.name
</code>```

and so on

Table2

```<code>name
Fan_count
connections.likes.id
connections.likes.name
connections.post.id
connections.post.name
</code>```

and so on

Table3

```<code>name
Fan_count
connections.likes.id
connections.likes.name
connections.post.id
connections.post.name
</code>```

and so on

for further kindly check attached power bi file

where i have 3 tables and all have same column name so i want to concatenate
these tables .. how i do this

check file

https://www.dropbox.com/s/zxoyqr3le3qgdlc/social%20media.pbix?dl=0

答:
You can use Combine -> Append Queries -> Append Queries as New to combine these tables into one:

This will make a new table, which will contain all rows from your source tables. In the dialog shown, select Three or more tables option and add your tables to the list:

Title: Concatenate two more tables in power bi

Body:
I have 3 tables in power bi e.g

Table1

name
Fan_count
connections.likes.id
connections.likes.name
connections.post.id
connections.post.name

and so on

Table2

name
Fan_count
connections.likes.id
connections.likes.name
connections.post.id
connections.post.name

and so on

Table3

name
Fan_count
connections.likes.id
connections.likes.name
connections.post.id
connections.post.name

and so on

for further kindly check attached power bi file

where i have 3 tables and all have same column name so i want to concatenate
these tables .. how i do this

check file

https://www.dropbox.com/s/zxoyqr3le3qgdlc/social%20media.pbix?dl=0


问:
Which COM smart pointer classes to use?
I'm confused by the choices for COM smart pointers classes for C++ programming:

There's three four I'm aware of:

CCOMPtr from ATL

_com_ptr_t from the MS Com Support Classes

TComInterface (because I'm using C++Builder 2009)

CCOMQIPtr, (which I'd previously forgotten)

I've read about the error vs. exception handling differences of the first two, but TComInterface seems totally undocumented. Both the first two seem to have gotchas or 'unexpected' behaviour, from what I can find.

Ideally, I'd like something that's clean and modern C++, but boost::com doesn't exist as far as I know...

I need to control an application from another vendor. They provide a COM interface via a TLB file.

答:
I've used the first two, CComPtr and _com_ptr_t.

It sounds like you've already read about the difference with errors and exception handling, so pick the one you liked best, or that fits in most consistently with the rest of the error handling in your code.

Title: Which COM smart pointer classes to use?


问:
Text recognition on Azure Cognitive Services
I've developed a quick sample code using the ComputerVisionClient.

The results are good, but for some reason, I can't get the ComputerVisionClient to output Portuguese charactes like 'ã' or 'é', etc.

I've looked in the documentation and I tried to use two methods. The RecognizeTextInStreamAsync and RecognizePrintedTextInStreamAsync. Only the RecognizePrintedTextInStreamAsync allows me to specify the language. But even when I specify OcrLanguages.Pt, the portuguese characters dont's show up. Instead of 'ç' I get a 'c'.

Is there anything I'm missing, or this is the expected behaviour by design?

Thanks in advance

答:
First of all, the two different methods are used for different scenarios, as below.

RecognizeTextInStreamAsync for extracting either printed or handwritten text

RecognizePrintedTextInStreamAsync for extracting printed text

Please carefully refer to the two sections Explore the Recognize Text (OCR) scenario and Explore the Recognize Text V2 (English) scenario of the offical document Sample: Explore an image processing app with C#, as the screenshots below.

There is the offical code sample referenced by the document: https://github.com/microsoft/Cognitive-Vision-Windows/tree/master/Sample-WPF . You can find the two files OCrPage.xaml and TextRecognitionPage.xaml.

Hope them can help you to make your code works.

Update：

I researched the REST APIs of Computer Vision: OCR and Recognize Text, then the OCR REST API can be specified the language option as request parameter.

So I tried to set language=pt to call the OCR API via curl, the command as below.

```<code>curl -v -X POST "https://southeastasia.api.cognitive.microsoft.com/vision/v2.0/ocr?language=pt"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: <subscription key>"
--data-ascii '{"url":"https://i.imgur.com/o6i3UDH.png"}'
</code>```

The response as below, but the OCR result is bad.

```<code>{"language":"pt","textAngle":0.0,"orientation":"Down","regions":[{"boundingBox":"245,123,367,736","lines":[{"boundingBox":"326,123,62,9","words":[{"boundingBox":"326,123,49,9","text":"(SVOSS3d"},{"boundingBox":"383,124,5,8","text":"Z"}]},{"boundingBox":"339,146,61,9","words":[{"boundingBox":"339,146,61,9","text":"(1YN010dO)"}]},{"boundingBox":"255,169,248,8","words":[{"boundingBox":"255,169,56,8","text":"sol]Nnsoo"},{"boundingBox":"491,169,12,8","text":"00"}]},{"boundingBox":"398,191,56,9","words":[{"boundingBox":"398,192,18,8","text":"001"},{"boundingBox":"424,191,30,9","text":"VOU)"}]},{"boundingBox":"261,214,274,9","words":[{"boundingBox":"261,215,6,8","text":"3"},{"boundingBox":"306,214,11,9","text":"n"},{"boundingBox":"325,215,18,8","text":"uS"},{"boundingBox":"350,215,12,8","text":"30"},{"boundingBox":"523,215,12,8","text":"30"}]},{"boundingBox":"312,268,203,8","words":[{"boundingBox":"312,268,12,8","text":"no"},{"boundingBox":"382,268,12,8","text":"30"},{"boundingBox":"447,268,11,8","text":"no"},{"boundingBox":"504,268,11,8","text":"30"}]},{"boundingBox":"253,289,323,9","words":[{"boundingBox":"253,289,2,3","text":"•"},{"boundingBox":"258,290,56,8","text":"s013Rnsoo"},{"boundingBox":"417,290,6,8","text":"v"},{"boundingBox":"424,290,31,8","text":"10830"},{"boundingBox":"494,290,12,8","text":"00"},{"boundingBox":"558,290,18,8","text":"Roo"}]},{"boundingBox":"402,313,18,8","words":[{"boundingBox":"402,313,18,8","text":"oze"}]},{"boundingBox":"277,335,242,9","words":[{"boundingBox":"277,336,6,8","text":"3"},{"boundingBox":"328,335,11,9","text":"//"},{"boundingBox":"348,335,55,9","text":"(OH11h0N)"},{"boundingBox":"507,336,12,8","text":"vo"}]},{"boundingBox":"424,389,107,8","words":[{"boundingBox":"424,389,18,8","text":"NOO"},{"boundingBox":"494,389,37,8","text":"OOV01d"}]},{"boundingBox":"373,411,82,9","words":[{"boundingBox":"373,411,11,9","text":"//"},{"boundingBox":"392,412,43,8","text":"OH11noN"},{"boundingBox":"443,412,12,8","text":"30"}]},{"boundingBox":"277,487,235,9","words":[{"boundingBox":"277,488,6,8","text":"3"},{"boundingBox":"328,487,11,9","text":"//"},{"boundingBox":"347,488,38,8","text":"vOVSSv"},{"boundingBox":"430,488,12,8","text":"30"},{"boundingBox":"501,488,11,8","text":"30"}]},{"boundingBox":"379,541,69,8","words":[{"boundingBox":"379,541,51,8","text":"vou1soN"},{"boundingBox":"437,541,11,8","text":"30"}]},{"boundingBox":"355,563,151,9","words":[{"boundingBox":"355,563,2,3","text":"•"},{"boundingBox":"360,564,31,8","text":"s003S"},{"boundingBox":"398,564,37,8","text":"solnyg"},{"boundingBox":"443,564,18,8","text":"Roo"},{"boundingBox":"468,563,38,9","text":"VON1no"}]},{"boundingBox":"296,585,184,9","words":[{"boundingBox":"296,586,6,8","text":"3"},{"boundingBox":"348,585,10,9","text":"//"},{"boundingBox":"469,586,11,8","text":"30"}]},{"boundingBox":"453,640,18,8","words":[{"boundingBox":"453,640,18,8","text":"Roo"}]},{"boundingBox":"302,661,153,9","words":[{"boundingBox":"302,662,6,8","text":"3"},{"boundingBox":"315,661,31,9","text":"oo•tz"},{"boundingBox":"354,661,11,9","text":"n"},{"boundingBox":"373,662,31,8","text":"nA9VH"},{"boundingBox":"443,662,12,8","text":"30"}]},{"boundingBox":"430,716,12,8","words":[{"boundingBox":"430,716,12,8","text":"30"}]},{"boundingBox":"338,737,113,9","words":[{"boundingBox":"338,738,5,8","text":"3"},{"boundingBox":"389,737,11,9","text":"//"},{"boundingBox":"440,738,11,8","text":"30"}]},{"boundingBox":"245,839,367,20","words":[{"boundingBox":"245,840,4,3","text":"•"},{"boundingBox":"300,839,98,20","text":"wawevo"},{"boundingBox":"530,839,60,18","text":"* Connection #0 to host southeastasia.api.cognitive.microsoft.com left intact
naca"},{"boundingBox":"596,839,16,15","text":"o"}]}]}]}
</code>```

However, when I set the parameter language=unk(AutoDetect), the result is good and recognize the language is pt Portuguese correctly.

```<code>curl -v -X POST "https://southeastasia.api.cognitive.microsoft.
com/vision/v2.0/ocr?language=unk"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: <subscription key>"
--data-ascii '{"url":"https://i.imgur.com/o6i3UDH.png"}'
</code>```

It correctly recognized Ã not A.

```<code>{"language":"pt","textAngle":0.0,"orientation":"Up","regions":[{"boundingBox":"175,64,389,736","lines":[{"boundingBox":"175,64,388,20","words":[{"boundingBox":"175,69,16,15","text":"a"},{"boundingBox":"197,66,60,18","text":"cahne"},{"boundingBox":"389,64,142,20","text":"ahomemdõa"},{"boundingBox":"538,80,4,3","text":"."},{"boundingBox":"553,80,10,3","text":".."}]},{"boundingBox":"356,106,31,8","words":[{"boundingBox":"356,106,31,8","text":"CARNE"}]},{"boundingBox":"297,177,152,9","words":[{"boundingBox":"297,177,31,8","text":"PEITO"},{"boundingBox":"336,177,11,8","text":"DE"},{"boundingBox":"355,177,24,8","text":"PATO"},{"boundingBox":"387,177,11,9","text":"//"},{"boundingBox":"406,177,31,9","text":"19.50"},{"boundingBox":"444,177,5,8","text":"€"}]},{"boundingBox":"300,199,146,8","words":[{"boundingBox":"300,199,38,8","text":"BULGUR"},{"boundingBox":"345,199,12,8","text":"DE"},{"boundingBox":"364,199,82,8","text":"RAS-EL-HANOUT"}]},{"boundingBox":"262,253,223,9","words":[{"boundingBox":"262,253,63,8","text":"ENTRECOSTO"},{"boundingBox":"332,253,12,8","text":"DE"},{"boundingBox":"352,253,24,8","text":"BIFE"},{"boundingBox":"383,253,31,8","text":"HAGYU"},{"boundingBox":"422,253,11,9","text":"//"},{"boundingBox":"441,253,31,9","text":"24.00"},{"boundingBox":"479,253,6,8","text":"€"}]},{"boundingBox":"316,275,114,8","words":[{"boundingBox":"316,275,18,8","text":"COM"},{"boundingBox":"341,275,32,8","text":"MOLHO"},{"boundingBox":"380,275,50,8","text":"BARBECUE"}]},{"boundingBox":"256,327,235,11","words":[{"boundingBox":"256,329,43,8","text":"BARRIGA"},{"boundingBox":"307,329,11,8","text":"DE"},{"boundingBox":"326,327,37,10","text":"LEITÃO"},{"boundingBox":"370,329,51,8","text":"CROCANTE"},{"boundingBox":"429,329,10,9","text":"//"},{"boundingBox":"448,329,30,9","text":"19.50"},{"boundingBox":"485,329,6,8","text":"€"}]},{"boundingBox":"281,351,151,9","words":[{"boundingBox":"281,351,38,9","text":"QUINOA"},{"boundingBox":"326,351,18,8","text":"cog"},{"boundingBox":"352,351,37,8","text":"FRUTOS"},{"boundingBox":"396,351,36,9","text":"SECOS."}]},{"boundingBox":"288,372,171,10","words":[{"boundingBox":"288,374,5,8","text":"E"},{"boundingBox":"300,374,31,8","text":"MOLHO"},{"boundingBox":"339,374,11,8","text":"DE"},{"boundingBox":"357,374,51,8","text":"MOSTARDA"},{"boundingBox":"416,374,11,8","text":"EH"},{"boundingBox":"434,372,25,10","text":"GRÃO"}]},{"boundingBox":"236,427,274,9","words":[{"boundingBox":"236,427,31,8","text":"PERNA"},{"boundingBox":"275,427,11,8","text":"DE"},{"boundingBox":"294,427,43,8","text":"BORREGO"},{"boundingBox":"345,427,12,8","text":"DE"},{"boundingBox":"365,427,30,8","text":"LEITE"},{"boundingBox":"402,427,38,8","text":"ASSADA"},{"boundingBox":"448,427,11,9","text":"//"},{"boundingBox":"466,427,31,9","text":"20.50"},{"boundingBox":"504,427,6,8","text":"€"}]},{"boundingBox":"297,448,152,11","words":[{"boundingBox":"297,448,24,10","text":"PURÉ"},{"boundingBox":"329,450,42,9","text":"BATATA."},{"boundingBox":"380,450,69,8","text":"RATATOUILLE"}]},{"boundingBox":"281,501,184,11","words":[{"boundingBox":"281,501,44,10","text":"TÁRTARO"},{"boundingBox":"332,503,12,8","text":"DE"},{"boundingBox":"352,503,43,8","text":"NOVILHO"},{"boundingBox":"403,503,11,9","text":"//"},{"boundingBox":"422,503,31,9","text":"16.50"},{"boundingBox":"460,503,5,8","text":"€"}]},{"boundingBox":"256,526,235,8","words":[{"boundingBox":"256,526,37,8","text":"PICADO"},{"boundingBox":"314,526,24,8","text":"FACA"},{"boundingBox":"345,526,18,8","text":"COH"},{"boundingBox":"370,526,57,8","text":"BATATINHA"},{"boundingBox":"434,526,57,8","text":"GAUFRETTE"}]},{"boundingBox":"236,579,274,9","words":[{"boundingBox":"236,579,25,8","text":"BIFE"},{"boundingBox":"268,579,12,8","text":"OA"},{"boundingBox":"287,579,32,8","text":"VAZIA"},{"boundingBox":"326,579,50,8","text":"GRELHADO"},{"boundingBox":"384,579,55,9","text":"(NOVILHO)"},{"boundingBox":"448,579,11,9","text":"//"},{"boundingBox":"466,579,31,9","text":"20.50"},{"boundingBox":"504,579,6,8","text":"€"}]},{"boundingBox":"336,602,74,9","words":[{"boundingBox":"336,602,23,9","text":"(4/-"},{"boundingBox":"367,602,18,8","text":"220"},{"boundingBox":"393,602,17,9","text":"GR)"}]},{"boundingBox":"211,625,323,9","words":[{"boundingBox":"211,625,18,8","text":"cog"},{"boundingBox":"236,625,38,8","text":"BATATA"},{"boundingBox":"281,625,12,8","text":"00"},{"boundingBox":"300,625,23,9","text":"DIA."},{"boundingBox":"332,625,38,8","text":"CEBOLA"},{"boundingBox":"377,625,76,8","text":"CARAMELIZADA"},{"boundingBox":"460,625,5,8","text":"E"},{"boundingBox":"473,625,61,9","text":"COGUMELOS."}]},{"boundingBox":"181,645,383,10","words":[{"boundingBox":"181,647,51,8","text":"MANTEIGA"},{"boundingBox":"239,645,25,10","text":"CAFÉ"},{"boundingBox":"272,647,11,8","text":"DE"},{"boundingBox":"291,647,30,8","text":"PARIS"},{"boundingBox":"329,647,11,8","text":"OU"},{"boundingBox":"348,647,38,8","text":"CROSTA"},{"boundingBox":"393,647,12,8","text":"DE"},{"boundingBox":"412,647,44,8","text":"PIMENTA"},{"boundingBox":"463,647,12,8","text":"OU"},{"boundingBox":"482,647,31,8","text":"MOLHO"},{"boundingBox":"521,645,43,10","text":"BEARNÊS"}]},{"boundingBox":"220,698,306,11","words":[{"boundingBox":"220,698,25,10","text":"COTE"},{"boundingBox":"252,700,12,8","text":"DE"},{"boundingBox":"272,700,30,8","text":"80EUF"},{"boundingBox":"310,700,50,8","text":"GRELHADO"},{"boundingBox":"367,700,18,8","text":"COM"},{"boundingBox":"394,700,24,8","text":"FLOR"},{"boundingBox":"425,700,12,8","text":"DE"},{"boundingBox":"444,700,18,8","text":"SAL"},{"boundingBox":"470,700,11,9","text":"//"},{"boundingBox":"489,700,24,9","text":"6.80"},{"boundingBox":"520,700,6,8","text":"€"}]},{"boundingBox":"333,723,80,9","words":[{"boundingBox":"333,723,30,9","text":"(CADA"},{"boundingBox":"371,723,18,8","text":"100"},{"boundingBox":"396,723,17,9","text":"GR)"}]},{"boundingBox":"214,746,318,9","words":[{"boundingBox":"214,746,18,8","text":"COH"},{"boundingBox":"239,746,38,8","text":"BATATA"},{"boundingBox":"284,746,12,8","text":"00"},{"boundingBox":"304,746,23,9","text":"DIA."},{"boundingBox":"335,746,38,8","text":"CEBOLA"},{"boundingBox":"380,746,76,8","text":"CARAMELIZADA"},{"boundingBox":"464,746,5,8","text":"E"},{"boundingBox":"476,746,56,8","text":"COGUMELOS"}]},{"boundingBox":"297,766,151,11","words":[{"boundingBox":"297,768,31,8","text":"MOLHO"},{"boundingBox":"335,766,44,10","text":"BEARNÊS"},{"boundingBox":"387,768,61,9","text":"(OPCIONAL)"}]},{"boundingBox":"285,791,176,9","words":[{"boundingBox":"285,791,75,9","text":"(RECOMENDADO"},{"boundingBox":"368,791,24,8","text":"PARA"},{"boundingBox":"399,791,5,8","text":"2"},{* Connection #0 to host southeastasia.api.cognitive.microsoft.com left intact
"boundingBox":"412,791,49,9","text":"PESSOAS)"}]}]}]}
</code>```

I don't know why unk be better than pt. You can reproduce and compare their results. Hope it helps.

Body:
First of all, the two different methods are used for different scenarios, as below.

RecognizeTextInStreamAsync for extracting either printed or handwritten text

RecognizePrintedTextInStreamAsync for extracting printed text

Please carefully refer to the two sections Explore the Recognize Text (OCR) scenario and Explore the Recognize Text V2 (English) scenario of the offical document Sample: Explore an image processing app with C#, as the screenshots below.

There is the offical code sample referenced by the document: https://github.com/microsoft/Cognitive-Vision-Windows/tree/master/Sample-WPF . You can find the two files OCrPage.xaml and TextRecognitionPage.xaml.

Hope them can help you to make your code works.

Update：

I researched the REST APIs of Computer Vision: OCR and Recognize Text, then the OCR REST API can be specified the language option as request parameter.

So I tried to set language=pt to call the OCR API via curl, the command as below.

curl -v -X POST "https://southeastasia.api.cognitive.microsoft.com/vision/v2.0/ocr?language=pt"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: <subscription key>"
--data-ascii '{"url":"https://i.imgur.com/o6i3UDH.png"}'

The response as below, but the OCR result is bad.

{"language":"pt","textAngle":0.0,"orientation":"Down","regions":[{"boundingBox":"245,123,367,736","lines":[{"boundingBox":"326,123,62,9","words":[{"boundingBox":"326,123,49,9","text":"(SVOSS3d"},{"boundingBox":"383,124,5,8","text":"Z"}]},{"boundingBox":"339,146,61,9","words":[{"boundingBox":"339,146,61,9","text":"(1YN010dO)"}]},{"boundingBox":"255,169,248,8","words":[{"boundingBox":"255,169,56,8","text":"sol]Nnsoo"},{"boundingBox":"491,169,12,8","text":"00"}]},{"boundingBox":"398,191,56,9","words":[{"boundingBox":"398,192,18,8","text":"001"},{"boundingBox":"424,191,30,9","text":"VOU)"}]},{"boundingBox":"261,214,274,9","words":[{"boundingBox":"261,215,6,8","text":"3"},{"boundingBox":"306,214,11,9","text":"n"},{"boundingBox":"325,215,18,8","text":"uS"},{"boundingBox":"350,215,12,8","text":"30"},{"boundingBox":"523,215,12,8","text":"30"}]},{"boundingBox":"312,268,203,8","words":[{"boundingBox":"312,268,12,8","text":"no"},{"boundingBox":"382,268,12,8","text":"30"},{"boundingBox":"447,268,11,8","text":"no"},{"boundingBox":"504,268,11,8","text":"30"}]},{"boundingBox":"253,289,323,9","words":[{"boundingBox":"253,289,2,3","text":"•"},{"boundingBox":"258,290,56,8","text":"s013Rnsoo"},{"boundingBox":"417,290,6,8","text":"v"},{"boundingBox":"424,290,31,8","text":"10830"},{"boundingBox":"494,290,12,8","text":"00"},{"boundingBox":"558,290,18,8","text":"Roo"}]},{"boundingBox":"402,313,18,8","words":[{"boundingBox":"402,313,18,8","text":"oze"}]},{"boundingBox":"277,335,242,9","words":[{"boundingBox":"277,336,6,8","text":"3"},{"boundingBox":"328,335,11,9","text":"//"},{"boundingBox":"348,335,55,9","text":"(OH11h0N)"},{"boundingBox":"507,336,12,8","text":"vo"}]},{"boundingBox":"424,389,107,8","words":[{"boundingBox":"424,389,18,8","text":"NOO"},{"boundingBox":"494,389,37,8","text":"OOV01d"}]},{"boundingBox":"373,411,82,9","words":[{"boundingBox":"373,411,11,9","text":"//"},{"boundingBox":"392,412,43,8","text":"OH11noN"},{"boundingBox":"443,412,12,8","text":"30"}]},{"boundingBox":"277,487,235,9","words":[{"boundingBox":"277,488,6,8","text":"3"},{"boundingBox":"328,487,11,9","text":"//"},{"boundingBox":"347,488,38,8","text":"vOVSSv"},{"boundingBox":"430,488,12,8","text":"30"},{"boundingBox":"501,488,11,8","text":"30"}]},{"boundingBox":"379,541,69,8","words":[{"boundingBox":"379,541,51,8","text":"vou1soN"},{"boundingBox":"437,541,11,8","text":"30"}]},{"boundingBox":"355,563,151,9","words":[{"boundingBox":"355,563,2,3","text":"•"},{"boundingBox":"360,564,31,8","text":"s003S"},{"boundingBox":"398,564,37,8","text":"solnyg"},{"boundingBox":"443,564,18,8","text":"Roo"},{"boundingBox":"468,563,38,9","text":"VON1no"}]},{"boundingBox":"296,585,184,9","words":[{"boundingBox":"296,586,6,8","text":"3"},{"boundingBox":"348,585,10,9","text":"//"},{"boundingBox":"469,586,11,8","text":"30"}]},{"boundingBox":"453,640,18,8","words":[{"boundingBox":"453,640,18,8","text":"Roo"}]},{"boundingBox":"302,661,153,9","words":[{"boundingBox":"302,662,6,8","text":"3"},{"boundingBox":"315,661,31,9","text":"oo•tz"},{"boundingBox":"354,661,11,9","text":"n"},{"boundingBox":"373,662,31,8","text":"nA9VH"},{"boundingBox":"443,662,12,8","text":"30"}]},{"boundingBox":"430,716,12,8","words":[{"boundingBox":"430,716,12,8","text":"30"}]},{"boundingBox":"338,737,113,9","words":[{"boundingBox":"338,738,5,8","text":"3"},{"boundingBox":"389,737,11,9","text":"//"},{"boundingBox":"440,738,11,8","text":"30"}]},{"boundingBox":"245,839,367,20","words":[{"boundingBox":"245,840,4,3","text":"•"},{"boundingBox":"300,839,98,20","text":"wawevo"},{"boundingBox":"530,839,60,18","text":"* Connection #0 to host southeastasia.api.cognitive.microsoft.com left intact
naca"},{"boundingBox":"596,839,16,15","text":"o"}]}]}]}

However, when I set the parameter language=unk(AutoDetect), the result is good and recognize the language is pt Portuguese correctly.

curl -v -X POST "https://southeastasia.api.cognitive.microsoft.
com/vision/v2.0/ocr?language=unk"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: <subscription key>"
--data-ascii '{"url":"https://i.imgur.com/o6i3UDH.png"}'

It correctly recognized Ã not A.

{"language":"pt","textAngle":0.0,"orientation":"Up","regions":[{"boundingBox":"175,64,389,736","lines":[{"boundingBox":"175,64,388,20","words":[{"boundingBox":"175,69,16,15","text":"a"},{"boundingBox":"197,66,60,18","text":"cahne"},{"boundingBox":"389,64,142,20","text":"ahomemdõa"},{"boundingBox":"538,80,4,3","text":"."},{"boundingBox":"553,80,10,3","text":".."}]},{"boundingBox":"356,106,31,8","words":[{"boundingBox":"356,106,31,8","text":"CARNE"}]},{"boundingBox":"297,177,152,9","words":[{"boundingBox":"297,177,31,8","text":"PEITO"},{"boundingBox":"336,177,11,8","text":"DE"},{"boundingBox":"355,177,24,8","text":"PATO"},{"boundingBox":"387,177,11,9","text":"//"},{"boundingBox":"406,177,31,9","text":"19.50"},{"boundingBox":"444,177,5,8","text":"€"}]},{"boundingBox":"300,199,146,8","words":[{"boundingBox":"300,199,38,8","text":"BULGUR"},{"boundingBox":"345,199,12,8","text":"DE"},{"boundingBox":"364,199,82,8","text":"RAS-EL-HANOUT"}]},{"boundingBox":"262,253,223,9","words":[{"boundingBox":"262,253,63,8","text":"ENTRECOSTO"},{"boundingBox":"332,253,12,8","text":"DE"},{"boundingBox":"352,253,24,8","text":"BIFE"},{"boundingBox":"383,253,31,8","text":"HAGYU"},{"boundingBox":"422,253,11,9","text":"//"},{"boundingBox":"441,253,31,9","text":"24.00"},{"boundingBox":"479,253,6,8","text":"€"}]},{"boundingBox":"316,275,114,8","words":[{"boundingBox":"316,275,18,8","text":"COM"},{"boundingBox":"341,275,32,8","text":"MOLHO"},{"boundingBox":"380,275,50,8","text":"BARBECUE"}]},{"boundingBox":"256,327,235,11","words":[{"boundingBox":"256,329,43,8","text":"BARRIGA"},{"boundingBox":"307,329,11,8","text":"DE"},{"boundingBox":"326,327,37,10","text":"LEITÃO"},{"boundingBox":"370,329,51,8","text":"CROCANTE"},{"boundingBox":"429,329,10,9","text":"//"},{"boundingBox":"448,329,30,9","text":"19.50"},{"boundingBox":"485,329,6,8","text":"€"}]},{"boundingBox":"281,351,151,9","words":[{"boundingBox":"281,351,38,9","text":"QUINOA"},{"boundingBox":"326,351,18,8","text":"cog"},{"boundingBox":"352,351,37,8","text":"FRUTOS"},{"boundingBox":"396,351,36,9","text":"SECOS."}]},{"boundingBox":"288,372,171,10","words":[{"boundingBox":"288,374,5,8","text":"E"},{"boundingBox":"300,374,31,8","text":"MOLHO"},{"boundingBox":"339,374,11,8","text":"DE"},{"boundingBox":"357,374,51,8","text":"MOSTARDA"},{"boundingBox":"416,374,11,8","text":"EH"},{"boundingBox":"434,372,25,10","text":"GRÃO"}]},{"boundingBox":"236,427,274,9","words":[{"boundingBox":"236,427,31,8","text":"PERNA"},{"boundingBox":"275,427,11,8","text":"DE"},{"boundingBox":"294,427,43,8","text":"BORREGO"},{"boundingBox":"345,427,12,8","text":"DE"},{"boundingBox":"365,427,30,8","text":"LEITE"},{"boundingBox":"402,427,38,8","text":"ASSADA"},{"boundingBox":"448,427,11,9","text":"//"},{"boundingBox":"466,427,31,9","text":"20.50"},{"boundingBox":"504,427,6,8","text":"€"}]},{"boundingBox":"297,448,152,11","words":[{"boundingBox":"297,448,24,10","text":"PURÉ"},{"boundingBox":"329,450,42,9","text":"BATATA."},{"boundingBox":"380,450,69,8","text":"RATATOUILLE"}]},{"boundingBox":"281,501,184,11","words":[{"boundingBox":"281,501,44,10","text":"TÁRTARO"},{"boundingBox":"332,503,12,8","text":"DE"},{"boundingBox":"352,503,43,8","text":"NOVILHO"},{"boundingBox":"403,503,11,9","text":"//"},{"boundingBox":"422,503,31,9","text":"16.50"},{"boundingBox":"460,503,5,8","text":"€"}]},{"boundingBox":"256,526,235,8","words":[{"boundingBox":"256,526,37,8","text":"PICADO"},{"boundingBox":"314,526,24,8","text":"FACA"},{"boundingBox":"345,526,18,8","text":"COH"},{"boundingBox":"370,526,57,8","text":"BATATINHA"},{"boundingBox":"434,526,57,8","text":"GAUFRETTE"}]},{"boundingBox":"236,579,274,9","words":[{"boundingBox":"236,579,25,8","text":"BIFE"},{"boundingBox":"268,579,12,8","text":"OA"},{"boundingBox":"287,579,32,8","text":"VAZIA"},{"boundingBox":"326,579,50,8","text":"GRELHADO"},{"boundingBox":"384,579,55,9","text":"(NOVILHO)"},{"boundingBox":"448,579,11,9","text":"//"},{"boundingBox":"466,579,31,9","text":"20.50"},{"boundingBox":"504,579,6,8","text":"€"}]},{"boundingBox":"336,602,74,9","words":[{"boundingBox":"336,602,23,9","text":"(4/-"},{"boundingBox":"367,602,18,8","text":"220"},{"boundingBox":"393,602,17,9","text":"GR)"}]},{"boundingBox":"211,625,323,9","words":[{"boundingBox":"211,625,18,8","text":"cog"},{"boundingBox":"236,625,38,8","text":"BATATA"},{"boundingBox":"281,625,12,8","text":"00"},{"boundingBox":"300,625,23,9","text":"DIA."},{"boundingBox":"332,625,38,8","text":"CEBOLA"},{"boundingBox":"377,625,76,8","text":"CARAMELIZADA"},{"boundingBox":"460,625,5,8","text":"E"},{"boundingBox":"473,625,61,9","text":"COGUMELOS."}]},{"boundingBox":"181,645,383,10","words":[{"boundingBox":"181,647,51,8","text":"MANTEIGA"},{"boundingBox":"239,645,25,10","text":"CAFÉ"},{"boundingBox":"272,647,11,8","text":"DE"},{"boundingBox":"291,647,30,8","text":"PARIS"},{"boundingBox":"329,647,11,8","text":"OU"},{"boundingBox":"348,647,38,8","text":"CROSTA"},{"boundingBox":"393,647,12,8","text":"DE"},{"boundingBox":"412,647,44,8","text":"PIMENTA"},{"boundingBox":"463,647,12,8","text":"OU"},{"boundingBox":"482,647,31,8","text":"MOLHO"},{"boundingBox":"521,645,43,10","text":"BEARNÊS"}]},{"boundingBox":"220,698,306,11","words":[{"boundingBox":"220,698,25,10","text":"COTE"},{"boundingBox":"252,700,12,8","text":"DE"},{"boundingBox":"272,700,30,8","text":"80EUF"},{"boundingBox":"310,700,50,8","text":"GRELHADO"},{"boundingBox":"367,700,18,8","text":"COM"},{"boundingBox":"394,700,24,8","text":"FLOR"},{"boundingBox":"425,700,12,8","text":"DE"},{"boundingBox":"444,700,18,8","text":"SAL"},{"boundingBox":"470,700,11,9","text":"//"},{"boundingBox":"489,700,24,9","text":"6.80"},{"boundingBox":"520,700,6,8","text":"€"}]},{"boundingBox":"333,723,80,9","words":[{"boundingBox":"333,723,30,9","text":"(CADA"},{"boundingBox":"371,723,18,8","text":"100"},{"boundingBox":"396,723,17,9","text":"GR)"}]},{"boundingBox":"214,746,318,9","words":[{"boundingBox":"214,746,18,8","text":"COH"},{"boundingBox":"239,746,38,8","text":"BATATA"},{"boundingBox":"284,746,12,8","text":"00"},{"boundingBox":"304,746,23,9","text":"DIA."},{"boundingBox":"335,746,38,8","text":"CEBOLA"},{"boundingBox":"380,746,76,8","text":"CARAMELIZADA"},{"boundingBox":"464,746,5,8","text":"E"},{"boundingBox":"476,746,56,8","text":"COGUMELOS"}]},{"boundingBox":"297,766,151,11","words":[{"boundingBox":"297,768,31,8","text":"MOLHO"},{"boundingBox":"335,766,44,10","text":"BEARNÊS"},{"boundingBox":"387,768,61,9","text":"(OPCIONAL)"}]},{"boundingBox":"285,791,176,9","words":[{"boundingBox":"285,791,75,9","text":"(RECOMENDADO"},{"boundingBox":"368,791,24,8","text":"PARA"},{"boundingBox":"399,791,5,8","text":"2"},{* Connection #0 to host southeastasia.api.cognitive.microsoft.com left intact
"boundingBox":"412,791,49,9","text":"PESSOAS)"}]}]}]}

I don't know why unk be better than pt. You can reproduce and compare their results. Hope it helps.


问:
Failed to avoid entering password multiple times using scp, and looping not working
I've written the below script that looping through names in a csv file and copy specific files to remote computer:

```<code>list_filepath=/home/bella/lists
destination_path=/home/pome/Documents/newfiles
NS_samples_source_path=/home/bella/final/acs/pa/1_ns
th_samples_source_path=/home/bella/final/acs/pa/4_th
ad_samples_source_path=/home/bella/final/new2018/ad

cat $list_filepath/new_list.csv | while read line
do

  if [[ $line == AD* ]]
     then
     echo $line
     ssh pome@203.177.32.11 mkdir -p $destination_path/$line
     cd $ad_samples_source_path/$line
     find $ad_samples_source_path/$line/ -regex '.*\.\(csv\|xml\|gz\)$' -exec scp {} pome@203.177.32.11:$destination_path/$line \;

  elif [[ $line == NS* ]]
     then
     echo $line
     ssh pome@203.177.32.11 "mkdir -p $destination_path/$line"
     cd $NS_samples_source/$line
     find $NS_samples_source/$line/ -regex '.*\.\(csv\|xml\|gz\)$' -exec scp {} pome@203.177.32.11:$destination_path/$line \;

  else
     echo $line
     ssh pome@203.177.32.11 "mkdir -p $destination_path/$line"
     cd $th_samples_source_path/$line
     find $th_samples_source_path/$line/ -regex '.*\.\(csv\|xml\|gz\)$' -exec scp {} pome@203.177.32.11:$destination_path/$line \;

  fi

done
</code>```

I have 2 main problems:

I have to enter multiple times the password for the remote, even though I'v set a password-less key as below:

```<code>ssh-keygen
ssh-copy-id -i pome@203.177.32.11
</code>```

it still asks for the password for each file it copies.

The scripts ends after creating one directory with the copied files, it seems to fail to move to the next line in the csv file.

Ideas anybody how to address those issues?

Thanks!

答:
Please check rsync for your solution.

Also SSH authenticating with SSH key files is better for automation.

Body:
I've written the below script that looping through names in a csv file and copy specific files to remote computer:

list_filepath=/home/bella/lists
destination_path=/home/pome/Documents/newfiles
NS_samples_source_path=/home/bella/final/acs/pa/1_ns
th_samples_source_path=/home/bella/final/acs/pa/4_th
ad_samples_source_path=/home/bella/final/new2018/ad

cat $list_filepath/new_list.csv | while read line
do

  if [[ $line == AD* ]]
     then
     echo $line
     ssh pome@203.177.32.11 mkdir -p $destination_path/$line
     cd $ad_samples_source_path/$line
     find $ad_samples_source_path/$line/ -regex '.*\.\(csv\|xml\|gz\)$' -exec scp {} pome@203.177.32.11:$destination_path/$line \;

  elif [[ $line == NS* ]]
     then
     echo $line
     ssh pome@203.177.32.11 "mkdir -p $destination_path/$line"
     cd $NS_samples_source/$line
     find $NS_samples_source/$line/ -regex '.*\.\(csv\|xml\|gz\)$' -exec scp {} pome@203.177.32.11:$destination_path/$line \;

  else
     echo $line
     ssh pome@203.177.32.11 "mkdir -p $destination_path/$line"
     cd $th_samples_source_path/$line
     find $th_samples_source_path/$line/ -regex '.*\.\(csv\|xml\|gz\)$' -exec scp {} pome@203.177.32.11:$destination_path/$line \;

  fi

done

I have 2 main problems:

I have to enter multiple times the password for the remote, even though I'v set a password-less key as below:

ssh-keygen
ssh-copy-id -i pome@203.177.32.11

it still asks for the password for each file it copies.

The scripts ends after creating one directory with the copied files, it seems to fail to move to the next line in the csv file.

Ideas anybody how to address those issues?

Thanks!


问:
npm - EPERM: operation not permitted on Windows
I ran

```<code>npm config set prefix /usr/local
</code>```

After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.

```<code>Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'
at Error (native)
</code>```

Have deleted all files from

```<code>C:\Users\<your username>\.config\configstore\
</code>```

It did not work.

Any suggestion ?

答: Try npm i -g npm . NPM version  6.9 is work to me. </p>

Body:
I ran

npm config set prefix /usr/local

After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.

Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'
at Error (native)

Have deleted all files from

C:\Users\<your username>\.config\configstore\

It did not work.

Any suggestion ?


问:
wrap child div text onto next line when browser resized
How do I get a child's  full text content to move to the next line when the browser is resized and it no longer fits?

so it ends up like this

This text is in - first child

This text is in second child

.child1 {
  display: inline;
  margin-right: 10px;
}

.child2 {
  display: inline;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div>
  <div class="child1">
    This text is in - first child
  </div>
  <div class="child2">
    This text is in second child
  </div>
</div></code>```

答:
Use display:inline-block or float:left instead display:inline for next line

.child1 {
  display: inline-block;
  margin-right: 10px;
}

.child2 {
  display: inline-block;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div>
  <div class="child1">
    This text is in - first child
  </div>
  <div class="child2">
    This text is in second child
  </div>
</div></code>```

Body:
How do I get a child's  full text content to move to the next line when the browser is resized and it no longer fits?

so it ends up like this

This text is in - first child

This text is in second child

.child1 {
  display: inline;
  margin-right: 10px;
}

.child2 {
  display: inline;
}

    This text is in - first child

    This text is in second child

Body:
Use display:inline-block or float:left instead display:inline for next line

.child1 {
  display: inline-block;
  margin-right: 10px;
}

.child2 {
  display: inline-block;
}

<div>
  <div class="child1">
    This text is in - first child
  </div>
  <div class="child2">
    This text is in second child
  </div>
</div>


问:
eclipse error: glassfish\domains\domain1 does not exist
I have java ee6 web profile sdk & I am using eclipse ee. I installed Glassfish plugin for eclipse using Download additional server adapters in the New Server wizard. Now during building a test app, eclipse raise this error  glassfish\domains\domain1 does not exist. Whats the reason & how can I remove it?

答:
Either your eclipse glassfish plugin points to the wrong domain or your server has no domain although there should be at least a default domain which is usually named domain1.

Check what's the name of your domain in glassfish-install-dir\glassfish\domains directory. If there is no subdir, you can create a domain with the asadmin tool:

```<code>glassfish-install-dir\bin\asadmin create-domain your-domain-name
</code>```

See this description of the create-domain command.

If you already have a domain with a different name than domain1, you have to reconfigure your eclipse glassfish plugin. (Since I don't use eclipse, I can't take you any further. But I remember a BalusC tutorial on this topic).

Body:
Either your eclipse glassfish plugin points to the wrong domain or your server has no domain although there should be at least a default domain which is usually named domain1.

Check what's the name of your domain in glassfish-install-dir\glassfish\domains directory. If there is no subdir, you can create a domain with the asadmin tool:

glassfish-install-dir\bin\asadmin create-domain your-domain-name

See this description of the create-domain command.

If you already have a domain with a different name than domain1, you have to reconfigure your eclipse glassfish plugin. (Since I don't use eclipse, I can't take you any further. But I remember a BalusC tutorial on this topic).


问:
How do I properly set this variable?
I want to read a epoch time stamp from a file and then compare it with the current epoch time.

The comparison is not working and I get error:

./script.sh: line 13: 1559122886- : syntax error: operand expected (error token is "- ")

```<code>#!/bin/bash
RSTL=restart.log
if [ -f $RSTL ]; then
    while IFS='|' read -r NRST LRST
    do
        echo "NRST is: $NRST"
        echo "LRST is: $LRST"
    done <$RSTL
CTIME=$(date +"%s")
echo "CTIME is: $CTIME"
fi
#LRST=$(date +"%s")
DIFF=$(( $CTIME-$LRST ))
echo "DIFF is: $DIFF"
if [[ $DIFF -gt 86400 ]]; then
    echo "1|GREATER"
    echo "1|$CTIME" > $RSTL
elif [[ $LRST -lt 86400 ]]; then
    echo "LESS THAN"
    echo "2|$CTIME" > $RSTL
else
    echo "1|NEW"
    echo "0|$CTIME" > $RSTL
fi
exit
</code>```

答:
In line 12 remove "#" and in line 13 remove "$" from $CTIME and $LRST.</p>

```<code>#!/bin/bash
RSTL=restart.log
if [ -f $RSTL ]; then
    while IFS='|' read -r NRST LRST
    do
        echo "NRST is: $NRST"
        echo "LRST is: $LRST"
    done <$RSTL
CTIME=$(date +"%s")
echo "CTIME is: $CTIME"
fi
LRST=$(date +"%s")
DIFF=$(( CTIME-LRST )) # Remove $ from $CTIME and $LRST
echo "DIFF is: $DIFF"
if [[ $DIFF -gt 86400 ]]; then
    echo "1|GREATER"
    echo "1|$CTIME" > $RSTL
elif [[ $LRST -lt 86400 ]]; then
    echo "LESS THAN"
    echo "2|$CTIME" > $RSTL
else
    echo "1|NEW"
    echo "0|$CTIME" > $RSTL
fi
exit
</code>```

Title: How do I properly set this variable?

Body:
I want to read a epoch time stamp from a file and then compare it with the current epoch time.

The comparison is not working and I get error:

./script.sh: line 13: 1559122886- : syntax error: operand expected (error token is "- ")

#!/bin/bash
RSTL=restart.log
if [ -f $RSTL ]; then
    while IFS='|' read -r NRST LRST
    do
        echo "NRST is: $NRST"
        echo "LRST is: $LRST"
    done <$RSTL
CTIME=$(date +"%s")
echo "CTIME is: $CTIME"
fi
#LRST=$(date +"%s")
DIFF=$(( $CTIME-$LRST ))
echo "DIFF is: $DIFF"
if [[ $DIFF -gt 86400 ]]; then
    echo "1|GREATER"
    echo "1|$CTIME" > $RSTL
elif [[ $LRST -lt 86400 ]]; then
    echo "LESS THAN"
    echo "2|$CTIME" > $RSTL
else
    echo "1|NEW"
    echo "0|$CTIME" > $RSTL
fi
exit

Body:
In line 12 remove "#" and in line 13 remove "$" from $CTIME and $LRST.

#!/bin/bash
RSTL=restart.log
if [ -f $RSTL ]; then
    while IFS='|' read -r NRST LRST
    do
        echo "NRST is: $NRST"
        echo "LRST is: $LRST"
    done <$RSTL
CTIME=$(date +"%s")
echo "CTIME is: $CTIME"
fi
LRST=$(date +"%s")
DIFF=$(( CTIME-LRST )) # Remove $ from $CTIME and $LRST
echo "DIFF is: $DIFF"
if [[ $DIFF -gt 86400 ]]; then
    echo "1|GREATER"
    echo "1|$CTIME" > $RSTL
elif [[ $LRST -lt 86400 ]]; then
    echo "LESS THAN"
    echo "2|$CTIME" > $RSTL
else
    echo "1|NEW"
    echo "0|$CTIME" > $RSTL
fi
exit


问:
Flat File Destination Failed the pre-execute phase. Cannot open the datafile
I am executing a SSIS Package from a C# WinForm project.  It executes and runs about halfway when it tries to create/write a file (An Expression in the Flat File Manager).

When I check the SSISDB Catalog on the SQL Server, I see the following errors for the package:

Flat File Destination failed the pre-execute phase and returned error
code 0xC020200E.

PO Header:Error: Cannot open the datafile "\Server\path\Admin Shared
Folders\Information
Systems\Projects\projectPath\filepath\636943168325507712-1070-15175.txt".

Based on the path and filename, the expression resolved fine.  When I run the SSIS package directly it runs fine, so it appears to be a permission issue.

I am using Integration Services (MS SQL Server 2014) and right now I am using windows authentication in my connect string:

```<code>Integrated Security=SSPI;
</code>```

However, the group who will be using the app will not have full permissions, so a specific user account will be created in SQL Server that I will use to connect.  That said, assuming that this is a permission issue, how does the SQL Server account need to be created / what permissions and considerations need to be applied?  What other permission issues/considerations need to be taken into account?

ie, we have no idea how to create the account to make this work and need help!

答:
Make sure that SQL service account can access to this path and has needed permissions:

Configure File System Permissions for Database Engine Access

Body:
I am executing a SSIS Package from a C# WinForm project.  It executes and runs about halfway when it tries to create/write a file (An Expression in the Flat File Manager).

When I check the SSISDB Catalog on the SQL Server, I see the following errors for the package:

Flat File Destination failed the pre-execute phase and returned error
code 0xC020200E.

PO Header:Error: Cannot open the datafile "\Server\path\Admin Shared
Folders\Information
Systems\Projects\projectPath\filepath\636943168325507712-1070-15175.txt".

Based on the path and filename, the expression resolved fine.  When I run the SSIS package directly it runs fine, so it appears to be a permission issue.

I am using Integration Services (MS SQL Server 2014) and right now I am using windows authentication in my connect string:

Integrated Security=SSPI;

However, the group who will be using the app will not have full permissions, so a specific user account will be created in SQL Server that I will use to connect.  That said, assuming that this is a permission issue, how does the SQL Server account need to be created / what permissions and considerations need to be applied?  What other permission issues/considerations need to be taken into account?

ie, we have no idea how to create the account to make this work and need help!


问:
Overlay Each Bar of Stacked ggplot2 Barchart with Line
I have a stacked ggplot2 barchart, which looks as follows:

```<code># Example data
data <- data.frame(level = rep(1:3, 3),
                   values = c(20, 30, 25, 15, 10, 5, 18, 20, 30),
                   group = as.factor(rep(LETTERS[1:3], each = 3)))

# Draw plot without lines
library("ggplot2")
my_plot <- ggplot(data, aes(x = level, y = values, fill = group)) +
  geom_bar(stat = "identity") +
  scale_fill_manual(breaks = c("A", "B", "C"),
                    values = c("forestgreen", "darkgoldenrod1", "brown2"))
my_plot
</code>```

Now, I want to overlay each bar of this barchart with a blue line of a certain height. The blue lines should also be represented in the legend of the plot.

The data for these lines looks as follows:

```<code># Data for lines
data_line <- data.frame(level = 1:3,
                        values = c(25, 40, 10),
                        group = as.factor("D"))
</code>```

The output should look as follows (image drawn in paint):

Question: How could I add these data as overlaying lines?

答:
One option using geom_segment

```<code>my_plot +
  geom_segment(data = data_line,
               aes(x = level - 0.45,
                   xend = level + 0.45,
                   y = values,
                   yend = values,
                   col = "D"), # 'fake' a legend
               size = 2,
               inherit.aes = FALSE) +
  scale_color_manual(name = NULL,
                     values = c(D = "#007fff")) +
  guides(fill = guide_legend(order = 1),
         color = guide_legend(order = 2)) +
  theme(legend.margin = margin(t = -1, b = -15)) # trial and error
</code>```

Body:
I have a stacked ggplot2 barchart, which looks as follows:

# Example data
data <- data.frame(level = rep(1:3, 3),
                   values = c(20, 30, 25, 15, 10, 5, 18, 20, 30),
                   group = as.factor(rep(LETTERS[1:3], each = 3)))

# Draw plot without lines
library("ggplot2")
my_plot <- ggplot(data, aes(x = level, y = values, fill = group)) +
  geom_bar(stat = "identity") +
  scale_fill_manual(breaks = c("A", "B", "C"),
                    values = c("forestgreen", "darkgoldenrod1", "brown2"))
my_plot

Now, I want to overlay each bar of this barchart with a blue line of a certain height. The blue lines should also be represented in the legend of the plot.

The data for these lines looks as follows:

# Data for lines
data_line <- data.frame(level = 1:3,
                        values = c(25, 40, 10),
                        group = as.factor("D"))

The output should look as follows (image drawn in paint):

Question: How could I add these data as overlaying lines?

Body:
One option using geom_segment

my_plot +
  geom_segment(data = data_line,
               aes(x = level - 0.45,
                   xend = level + 0.45,
                   y = values,
                   yend = values,
                   col = "D"), # 'fake' a legend
               size = 2,
               inherit.aes = FALSE) +
  scale_color_manual(name = NULL,
                     values = c(D = "#007fff")) +
  guides(fill = guide_legend(order = 1),
         color = guide_legend(order = 2)) +
  theme(legend.margin = margin(t = -1, b = -15)) # trial and error


问:
Code about occurences of a word in a file in BASH
I want to count the occurences of a word in a file with only one line of code. Example: for the input: "hi, welcome to the himalaya. hihi" "hi" the output will be 4 (because the word "hi" occurs 4 times)

I tried using tr and grep, but it doesn't count "hihi" twice, but only once.

```<code>tr 'WORD' '\n' < $1 | grep $2 | wc -l
</code>```

For the given example above, the output was 3 instead of 4.
Thank you!

答:
since you tagged the question with awk:

```<code>awk '{s+=gsub(/WORD/,1)}END{print s}' file
</code>```

thus, a single process solution, also possible to be extended.

Body:
I want to count the occurences of a word in a file with only one line of code. Example: for the input: "hi, welcome to the himalaya. hihi" "hi" the output will be 4 (because the word "hi" occurs 4 times)

I tried using tr and grep, but it doesn't count "hihi" twice, but only once.

tr 'WORD' '\n' < $1 | grep $2 | wc -l

For the given example above, the output was 3 instead of 4.
Thank you!

Body:
since you tagged the question with awk:

awk '{s+=gsub(/WORD/,1)}END{print s}' file

thus, a single process solution, also possible to be extended.


问:
SSRS Grand Total should sum subtotals and not source values
I am trying to sum timesheet entries by user, users enter actual duration and the report then applies a minimum 0.5 day rule to each user.

The problem is that the grand total is recalculating based on the source values when it need to sum the user subtotal after the 0.5 day rule is applied.

A day is defined as 7.5 hours

Formula used for rounding Ceiling(((Sum(Fields!minutes.Value)/60)/7.5) / 0.5) *0.5, this is used for the line items, subtotal and grand total.

This uses a Matrix control to display the data

Example

Source Data

user----minutes

Bob-----60

Bob-----60

Alice---1680

Report

user----days

Bob-----0.5

Alice---4

Total---4

What I actually want

Report

user----days

Bob-----0.5

Alice---4

Total---4.5

答:
Credit for this goes to @steve-o169 and @FrankBall for reminding me you can do aggregation in FetchXML

As suggested above, I changed the FetchXML query to perform the aggregation at the server level, then added a calculated field on the data set to apply the formula and used the calculated field in the Matrix control.