问:
WPF In-Code Preview Colour Feature VS2019
I would like to know if there is a setting for WPF in VS2019 to enable "colour preview" in code, such that when I type the hex colour code it displays the colour (without having to apply the colour to any UI element – just a pure visual preview)?

I have a project, where I use a multitude of colours, and it is getting difficult to keep track of which colour is which, so it would be nice to have a visual guide.

My general code for colours in the Resource Dictionary is:

```<code><Color x:Key="BackgroundLight">#efefef</Color>
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}" />
</code>```

Is there such setting in VS2019? I believe I saw something like this in one youtube video, where the hex code was underlined by the corresponding colour, but I can neither figure out how to achieve that, nor can I find the video now.

答:
There's a vsix

https://marketplace.visualstudio.com/items?itemName=NikolaMSFT.InlineColorPicker

This extension can't be installed in VisualStudio 2019 Pro, but you can use this method mentioned in another answer as workaround to install it in VisualStudio 2019 Pro.

https://stackoverflow.com/a/62040646/7387963

Body:
I would like to know if there is a setting for WPF in VS2019 to enable "colour preview" in code, such that when I type the hex colour code it displays the colour (without having to apply the colour to any UI element – just a pure visual preview)?

I have a project, where I use a multitude of colours, and it is getting difficult to keep track of which colour is which, so it would be nice to have a visual guide.

My general code for colours in the Resource Dictionary is:

<Color x:Key="BackgroundLight">#efefef</Color>
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}" />

Is there such setting in VS2019? I believe I saw something like this in one youtube video, where the hex code was underlined by the corresponding colour, but I can neither figure out how to achieve that, nor can I find the video now.


来源: stackexchange

问:
Microsoft Bing Translator. I need help
Is there anyone who has already tried to use the Microsoft Bing translator web service. if yes, could you please help me. I was not able to find useful information in google</p>

答:
You can also try the open source project Bing Translator .NET Extension Methods:
http://maspoint.wordpress.com/2011/08/09/bing-translator-net-extension-methodscodeplex/

It's more easier to develop using .NET Extension methods than consuming the SOAP services.

ContentLicense: CC BY-SA 2.5

Title: Microsoft Bing Translator. I need help

ContentLicense: CC BY-SA 3.0


问:
Duplicate class com.google.android.flexbox - Android Admob
I am using admob and facebook for ads in my app and its done but I want to check it so i have added Mediation Test Suite depnedancy

```<code> implementation 'com.google.android.ads:mediation-test-suite:2.0.0'
</code>```

And the app could not build it shows

```<code>Duplicate class com.google.android.flexbox.AlignContent found in modules jetified-flexbox-1.1.1-runtime (com.google.android:flexbox:1.1.1) and jetified-flexbox-3.0.0-runtime (com.google.android.flexbox:flexbox:3.0.0)
Duplicate class com.google.android.flexbox.AlignItems found in modules jetified-flexbox-1.1.1-runtime (com.google.android:flexbox:1.1.1) and jetified-flexbox-3.0.0-runtime (com.google.android.flexbox:flexbox:3.0.0)
</code>```

And many more Duplicate Class of Flexbox

my admob version

```<code>implementation 'com.google.android.gms:play-services-ads:20.4.0'
</code>```

答:
The package name is wrong.

```<code>com.google.android:flexbox:1.1.1
</code>```

Here is the correct one. ↓

```<code>implementation ('com.google.android.ads:mediation-test-suite:2.0.0') {
   exclude group: "com.google.android", module: "flexbox"
}
</code>```

It worked for me.

ContentLicense: CC BY-SA 4.0

Body:
I am using admob and facebook for ads in my app and its done but I want to check it so i have added Mediation Test Suite depnedancy

 implementation 'com.google.android.ads:mediation-test-suite:2.0.0'

And the app could not build it shows

Duplicate class com.google.android.flexbox.AlignContent found in modules jetified-flexbox-1.1.1-runtime (com.google.android:flexbox:1.1.1) and jetified-flexbox-3.0.0-runtime (com.google.android.flexbox:flexbox:3.0.0)
Duplicate class com.google.android.flexbox.AlignItems found in modules jetified-flexbox-1.1.1-runtime (com.google.android:flexbox:1.1.1) and jetified-flexbox-3.0.0-runtime (com.google.android.flexbox:flexbox:3.0.0)

And many more Duplicate Class of Flexbox

my admob version

implementation 'com.google.android.gms:play-services-ads:20.4.0'

Body:
The package name is wrong.

com.google.android:flexbox:1.1.1

Here is the correct one. ↓

implementation ('com.google.android.ads:mediation-test-suite:2.0.0') {
   exclude group: "com.google.android", module: "flexbox"
}

It worked for me.


问:
Flutter Execution failed for task ':audioplayers:compileDebugKotlin'
I tried installing audioplayers: ^0.17.1 and ran my flutter project. It throws the following error. Can someone help, please?

```<code>e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (181, 52): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (231, 38): Expecting an argument
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\ByteDataSource.kt: (8, 37): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedMediaPlayer.kt: (10, 39): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (168, 32): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (205, 26): Expecting an argument
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (46, 77): Type inference failed. Expected type mismatch: inferred type is List<???> but MutableList<WrappedSoundPool> was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':audioplayers:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 37s
Exception: Gradle task assembleDebug failed with exit code 1
</code>```

答:
Open C:\Users\User\flutter.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\ folder and delete it.

It helps me

Body:
I tried installing audioplayers: ^0.17.1 and ran my flutter project. It throws the following error. Can someone help, please?

e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (181, 52): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (231, 38): Expecting an argument
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\ByteDataSource.kt: (8, 37): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedMediaPlayer.kt: (10, 39): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (168, 32): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (205, 26): Expecting an argument
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (46, 77): Type inference failed. Expected type mismatch: inferred type is List<???> but MutableList<WrappedSoundPool> was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':audioplayers:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 37s
Exception: Gradle task assembleDebug failed with exit code 1


问:
A href pointed to nowhere added # to url
I have a href which pointed to #

```<code><a href="#" id="bla" >Bla<a>
</code>```

I have onclick function which displaying popup on click on that a href.

```<code>function doingClick()
{
   //display popup
   return false;
}
</code>```

But after click symbol # every time added to the url in browser.

So for example if url was like that before I click on my link http://mywebsite.com

But after click on a href the url looking like that: http://mywebsite.com#

Is there any way to avoid such behavior?

答:
So i think the better way of doing this is to remove href from a element

```<code><a id="bla" class="href" >Bla</a>
</code>```

and than to make it looks like a href just add simple css class

```<code>.href
{
    color: #2289b8; //color of the link
    cursor: pointer;
}
</code>```

This idea comes to me when i looked in to source of SO add comment button

Body:
I have a href which pointed to #

Bla

I have onclick function which displaying popup on click on that a href.

function doingClick()
{
   //display popup
   return false;
}

But after click symbol # every time added to the url in browser.

So for example if url was like that before I click on my link http://mywebsite.com

But after click on a href the url looking like that: http://mywebsite.com#

Is there any way to avoid such behavior?

Body:
So i think the better way of doing this is to remove href from a element

<a id="bla" class="href" >Bla</a>

and than to make it looks like a href just add simple css class

.href
{
    color: #2289b8; //color of the link
    cursor: pointer;
}

This idea comes to me when i looked in to source of SO add comment button


问:
Scroll only when text length is greater than particular number - Flutter Marquee
I am using Marquee widget to scroll texts.
I have made a lists of some texts, but some text contains only two or three words, and some text contains more words.
I just want to scroll the texts which have more words, not every texts.

```<code>Container(
                color: Colors.green,
                width: MediaQuery.of(context).size.width * 0.5,
                height: MediaQuery.of(context).size.width * 0.1,
                child: Marquee(
                    showFadingOnlyWhenScrolling: true,
                    startAfter: Duration(seconds: 5),
                    pauseAfterRound: Duration(seconds: 2),
                    fadingEdgeEndFraction: 0.3,
                    blankSpace: 100,
                    velocity: 50,
                    text: title,
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: 25,
                        decoration: isDone
                            ? TextDecoration.lineThrough
                            : TextDecoration.none)),
              ),
</code>```

答:
first you need to know how long your String is. For that you can save your String in a variable.

then you can get the length from the string like this:

```<code>String myString = "abc";

// this will print 3
print(myString.length);

</code>```

so after this you can use a simple if:

```<code>String myString = "abc";

if(myString.length > 10) {
  scroll();
}
</code>```

you also can do:

```<code>String myString = "abc";

...

//                  if             else
myString.length > 10 ? Widget1(...) : Widget2(...)
</code>```

Body:
I am using Marquee widget to scroll texts.
I have made a lists of some texts, but some text contains only two or three words, and some text contains more words.
I just want to scroll the texts which have more words, not every texts.

Container(
                color: Colors.green,
                width: MediaQuery.of(context).size.width * 0.5,
                height: MediaQuery.of(context).size.width * 0.1,
                child: Marquee(
                    showFadingOnlyWhenScrolling: true,
                    startAfter: Duration(seconds: 5),
                    pauseAfterRound: Duration(seconds: 2),
                    fadingEdgeEndFraction: 0.3,
                    blankSpace: 100,
                    velocity: 50,
                    text: title,
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: 25,
                        decoration: isDone
                            ? TextDecoration.lineThrough
                            : TextDecoration.none)),
              ),

Body:
first you need to know how long your String is. For that you can save your String in a variable.

then you can get the length from the string like this:

String myString = "abc";

// this will print 3
print(myString.length);

so after this you can use a simple if:

String myString = "abc";

if(myString.length > 10) {
  scroll();
}

you also can do:

String myString = "abc";

...

//                  if             else
myString.length > 10 ? Widget1(...) : Widget2(...)


问:
Rxjs number of observable subscriptions
In my Angular 2 app i have many observables and subscriptions.
Ofcourse I should unsubscribe when I leave the page, but i'm trying to find out if it's possible to get the number of active subscriptions.
Just for debugging info or when i forget to unsubscribe.

Is there such information available in rxjs?

答:
You can make use the Subscription class will come with an add, remove and unsubscribe method for you to manage subscription. The length of _subscriptions properties basically tells you how many active subscription that you have. This approach play very well with observable unsubscription upon onDestroy in Angular

```<code>import { interval, Subscription } from "rxjs";

const subs = new Subscription();
const sub = interval(1000).subscribe();

subs.add(sub);
console.log(sub);
</code>```

Title: Rxjs number of observable subscriptions

Body:
You can make use the Subscription class will come with an add, remove and unsubscribe method for you to manage subscription. The length of _subscriptions properties basically tells you how many active subscription that you have. This approach play very well with observable unsubscription upon onDestroy in Angular

import { interval, Subscription } from "rxjs";

const subs = new Subscription();
const sub = interval(1000).subscribe();

subs.add(sub);
console.log(sub);


问:
Adding a JSON elements to an Array of JSON in Javascript
I have JSON and JSON array and I want to push every elements of JSON to JSON array with some condition.

Here is my code:

```<code>let json = { Jack: 10, Merry: 29, Charles: 37, Lahm: 0 }
let jsonArray = [
    {
        match: {
            Ashley: 46,
        },
    },
]

for (const key in json) {
    if (json[key] !== 0) {
        jsonArray.push({
            match: `{${key}: ${json[key]}}`,
        })
    }
}

</code>```

I get the following response:

```<code>[
  { match: { Ashley: 46 } },
  { match: '{Jack: 10}' },
  { match: '{Merry: 29}' },
  { match: '{Charles: 37}' }
]

</code>```

The problem is that pushed elements has single quotes which I don't want.
Is there a way to push those elements without quotes?

答:
You need to access the key/value pairs of the JS object, and not add a string to the array. Once that's completed for all the properties - if you need to - you can then stringify the array to JSON.

const obj = { Jack: 10, Merry: 29, Charles: 37, Lahm: 0 };
const arr = [ { match: { Ashley: 46 } }];

for (const key in obj) {
  arr.push({
    match: { [key]: obj[key] }
  });
}

console.log(arr);
console.log(JSON.stringify(arr));```

Body:
I have JSON and JSON array and I want to push every elements of JSON to JSON array with some condition.

Here is my code:

let json = { Jack: 10, Merry: 29, Charles: 37, Lahm: 0 }
let jsonArray = [
    {
        match: {
            Ashley: 46,
        },
    },
]

for (const key in json) {
    if (json[key] !== 0) {
        jsonArray.push({
            match: `{${key}: ${json[key]}}`,
        })
    }
}

I get the following response:

[
  { match: { Ashley: 46 } },
  { match: '{Jack: 10}' },
  { match: '{Merry: 29}' },
  { match: '{Charles: 37}' }
]

The problem is that pushed elements has single quotes which I don't want.
Is there a way to push those elements without quotes?


问:
Make element selected/active (like when you using tab)
I am trying to make element lets say button active on page open. By active I mean when u pressing tab buttons elements, tabs and stuff us getting active one after one. But how can I achieve that element is selected defaulty on page start.</p>

答:
Try using:

element.focus();

Link to javascript documentation


问:
How to aggregate two rows with the same value in another column?
I have a dataframe like this:

name
cluster

'sock'
1

'graceful'
2

'disgrace'
2

'fixture'
3

'winnow'
4

'window'
4

and a function common_substring that takes in two strings and returns the longest common substring.

I want to return

name
cluster

'sock'
1

'grace'
2

'fixture'
3

'win'
4

I know I'm supposed to group by cluster, but I'm struggling with how to aggregate and apply a function that takes two values.

答:
Based on the @jezrael and the link:

```<code>from functools import partial, reduce
from itertools import chain
from typing import Iterator

def ngram(seq: str, n: int) -> Iterator[str]:
    return (seq[i: i+n] for i in range(0, len(seq)-n+1))

def allngram(seq: str) -> set:
    lengths = range(len(seq))
    ngrams = map(partial(ngram, seq), lengths)
    return set(chain.from_iterable(ngrams))

def func(a, b):
    seqs_ngrams = map(allngram, [a,b])
    intersection = reduce(set.intersection, seqs_ngrams)
    longest = max(intersection, key=len)
    return longest

def f(x):
    try:
        return func(x.iat[0], x.iat[1])
    except:
        return 'Unique value'

df = df.groupby('cluster')['name'].agg(f).reset_index()
print (df)
</code>```

Demonstration:

```<code>df = pd.DataFrame({'name':['winnow', 'window'], 'cluster':[4,4]})
df = df.groupby('cluster')['name'].agg(f).reset_index()
</code>```

output:

For, any length input:

```<code>from functools import partial, reduce
from itertools import chain
from typing import Iterator

def ngram(seq: str, n: int) -> Iterator[str]:
    return (seq[i: i+n] for i in range(0, len(seq)-n+1))

def allngram(seq: str) -> set:
    lengths = range(len(seq)+1)
    ngrams = map(partial(ngram, seq), lengths)
    return set(chain.from_iterable(ngrams))

def func(seq):
    seq=seq.values
    seqs_ngrams = map(allngram, seq)
    intersection = reduce(set.intersection, seqs_ngrams)

    longest = max(intersection, key=len)
    return longest

def f(x):
    return func(x)
df = pd.DataFrame({'name':['winnow', 'window', 'win', 'sock', 'graceful', 'disgrace','fixture'], 'cluster':[4,4,4,1,2,2,3]})

df = df.groupby('cluster')['name'].agg(f).reset_index()
</code>```

Ooutput:

Body:
Based on the @jezrael and the link:

from functools import partial, reduce
from itertools import chain
from typing import Iterator

def ngram(seq: str, n: int) -> Iterator[str]:
    return (seq[i: i+n] for i in range(0, len(seq)-n+1))

def allngram(seq: str) -> set:
    lengths = range(len(seq))
    ngrams = map(partial(ngram, seq), lengths)
    return set(chain.from_iterable(ngrams))

def func(a, b):
    seqs_ngrams = map(allngram, [a,b])
    intersection = reduce(set.intersection, seqs_ngrams)
    longest = max(intersection, key=len)
    return longest

def f(x):
    try:
        return func(x.iat[0], x.iat[1])
    except:
        return 'Unique value'

df = df.groupby('cluster')['name'].agg(f).reset_index()
print (df)

Demonstration:

df = pd.DataFrame({'name':['winnow', 'window'], 'cluster':[4,4]})
df = df.groupby('cluster')['name'].agg(f).reset_index()

output:

For, any length input:

from functools import partial, reduce
from itertools import chain
from typing import Iterator

def ngram(seq: str, n: int) -> Iterator[str]:
    return (seq[i: i+n] for i in range(0, len(seq)-n+1))

def allngram(seq: str) -> set:
    lengths = range(len(seq)+1)
    ngrams = map(partial(ngram, seq), lengths)
    return set(chain.from_iterable(ngrams))

def func(seq):
    seq=seq.values
    seqs_ngrams = map(allngram, seq)
    intersection = reduce(set.intersection, seqs_ngrams)

    longest = max(intersection, key=len)
    return longest

def f(x):
    return func(x)
df = pd.DataFrame({'name':['winnow', 'window', 'win', 'sock', 'graceful', 'disgrace','fixture'], 'cluster':[4,4,4,1,2,2,3]})

df = df.groupby('cluster')['name'].agg(f).reset_index()

Ooutput:


问:
AVAssetWriterInput and readyForMoreMediaData
Is AVAssetWriterInput's readyForMoreMediaData updated in a background thread? If readyForMoreMediaData is NO, can I block in the main thread and wait until the value changes to YES?

I'm using an AVAssetWriterInput by pushing data to it (i.e. without using requestMediaDataWhenReadyOnQueue) and I've set expectsMediaDataInRealTime, and 99.9% of the time I can just call appendSampleBuffer (or appendPixelBuffer) on it as fast as my app can generate frames.

This works fine unless you put the device (iPhone 3GS) to sleep for 15 minutes or so in the middle of an AVAssetWriter session. After waking up the device, appendPixelBuffer sometimes gets an error saying, "A pixel buffer cannot be appended when readyForMoreMediaData is NO". Hence my question - how best to respond to readyForMoreMediaData=NO and if I can just wait a bit in the main thread like so:

```<code>while ( ![assetWriterInput readyForMoreMediaData] )
{
    Sleep for a few milliseconds
}
</code>```

答:
Polling is not the advisable solution.

You should be using requestMediaDataWhenReadyOnQueue

```<code>[writerInput requestMediaDataWhenReadyOnQueue:mediaInputQueue usingBlock:^{
    [writerInput appendSampleBuffer:nextBuffer];
}
</code>```

Body:
Is AVAssetWriterInput's readyForMoreMediaData updated in a background thread? If readyForMoreMediaData is NO, can I block in the main thread and wait until the value changes to YES?

I'm using an AVAssetWriterInput by pushing data to it (i.e. without using requestMediaDataWhenReadyOnQueue) and I've set expectsMediaDataInRealTime, and 99.9% of the time I can just call appendSampleBuffer (or appendPixelBuffer) on it as fast as my app can generate frames.

This works fine unless you put the device (iPhone 3GS) to sleep for 15 minutes or so in the middle of an AVAssetWriter session. After waking up the device, appendPixelBuffer sometimes gets an error saying, "A pixel buffer cannot be appended when readyForMoreMediaData is NO". Hence my question - how best to respond to readyForMoreMediaData=NO and if I can just wait a bit in the main thread like so:

while ( ![assetWriterInput readyForMoreMediaData] )
{
    Sleep for a few milliseconds
}

Body:
Polling is not the advisable solution.

You should be using requestMediaDataWhenReadyOnQueue

[writerInput requestMediaDataWhenReadyOnQueue:mediaInputQueue usingBlock:^{
    [writerInput appendSampleBuffer:nextBuffer];
}


问:
Why this import is not working
I'm using a the normalize function to get the absolute path from a String,

```<code>org.apache.commons.io.FilenameUtils.normalize(String)
</code>```

But when I use just normalize(String) I get :

The method normalize(String) is undefined for the type MyClass

I tried : import org.apache.commons.io.FilenameUtils;

I downloaded the library from Apache website, and linked it to my project but I get the same error.

I don't want to write everytime the whole line to call the function.

Is there any solution for this ?

Thanks

答:
Either import the class:

```<code>import org.apache.commons.io.FilenameUtils;

FilenameUtils.normalize(string);
</code>```

or import the method:

```<code>import static org.apache.commons.io.FilenameUtils.normalize;

normalize(string);
</code>```

And if you are using Eclipse, just press Ctrl-shift-M to import what your cursor is at.
Also autocompleting classnames should add imports.

Title: Why this import is not working

Body:
I'm using a the normalize function to get the absolute path from a String,

org.apache.commons.io.FilenameUtils.normalize(String)

But when I use just normalize(String) I get :

The method normalize(String) is undefined for the type MyClass

I tried : import org.apache.commons.io.FilenameUtils;

I downloaded the library from Apache website, and linked it to my project but I get the same error.

I don't want to write everytime the whole line to call the function.

Is there any solution for this ?

Thanks

Body:
Either import the class:

import org.apache.commons.io.FilenameUtils;

FilenameUtils.normalize(string);

or import the method:

import static org.apache.commons.io.FilenameUtils.normalize;

normalize(string);

And if you are using Eclipse, just press Ctrl-shift-M to import what your cursor is at.
Also autocompleting classnames should add imports.


问:
How can send a url to telegram bot?
I write a code to send a proxy link to my telegram bot but when i send the request
my proxy link don't send complete

this is my code

```<code>#/bin/bash

TOKEN="***********************"
ID="************"
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
PRLINK="tg://proxy?server=xxx.xxx.xxx.xxx&port=443&secret=eeb000000000000000000000000000"

curl -s -X POST $URL -d chat_id=$ID -d text=${PRLINK} > /root/sendResult
</code>```

and this response

```<code>{ [..] ,"text":"tg://proxy?server=18.202.178.109", [..]}

</code>```

in response

"text":"tg://proxy?server=18.202.178.109" no equal to PRLINK that me send with curl

答:
The problem is related to URL encoding: https://www.w3schools.com/tags/ref_urlencode.ASP

In a nutshell, you should encode the ampersand character in order to let the entire URL be considered properly.

So that, the ampersand character is encoded as %26, therefore:

Your code should be:

```<code>#/bin/bash

TOKEN="***********************"
ID="************"
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
PRLINK="tg://proxy?server=xxx.xxx.xxx.xxx%26port=443%26secret=eeb000000000000000000000000000"

curl -s -X POST $URL -d chat_id=$ID -d text=${PRLINK} > /root/sendResult
</code>```

Title: How can send a url to telegram bot?

Body:
I write a code to send a proxy link to my telegram bot but when i send the request
my proxy link don't send complete

this is my code

#/bin/bash

TOKEN="***********************"
ID="************"
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
PRLINK="tg://proxy?server=xxx.xxx.xxx.xxx&port=443&secret=eeb000000000000000000000000000"

curl -s -X POST $URL -d chat_id=$ID -d text=${PRLINK} > /root/sendResult

and this response

{ [..] ,"text":"tg://proxy?server=18.202.178.109", [..]}

in response

"text":"tg://proxy?server=18.202.178.109" no equal to PRLINK that me send with curl

Body:
The problem is related to URL encoding: https://www.w3schools.com/tags/ref_urlencode.ASP

In a nutshell, you should encode the ampersand character in order to let the entire URL be considered properly.

So that, the ampersand character is encoded as %26, therefore:

Your code should be:

#/bin/bash

TOKEN="***********************"
ID="************"
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
PRLINK="tg://proxy?server=xxx.xxx.xxx.xxx%26port=443%26secret=eeb000000000000000000000000000"

curl -s -X POST $URL -d chat_id=$ID -d text=${PRLINK} > /root/sendResult


问:
Qlikview - show min and max date from date listbox
I have ListBox with value day(Date) and shows results:

1
2
3
4
5
6
7

I want when select number from 2 to 5 in table get result

```<code>Date from       Date To
02-02-2022      05-02-2022
</code>```

Can anyone help me please, how to show first and last selected value from list box?

答:
You could do it in 2 text boxes of the form

```<code>='Date from'&chr(15)&
  date(min(Date),'DD-MM-YYYY')
</code>```

chr(15) is to create a new line. Just switch out the min() for max() as needed

Body:
I have ListBox with value day(Date) and shows results:

1
2
3
4
5
6
7

I want when select number from 2 to 5 in table get result

Date from       Date To
02-02-2022      05-02-2022

Can anyone help me please, how to show first and last selected value from list box?

Body:
You could do it in 2 text boxes of the form

='Date from'&chr(15)&
  date(min(Date),'DD-MM-YYYY')

chr(15) is to create a new line. Just switch out the min() for max() as needed


问:
Maven clean/install failing
when I'm trying to clean/install maven following error I'm facing... any suggestions
Error: Could not find or load main class Pictures.spring-tool-suite-3.7.1.RELEASE-e4.5.1-win32-x86_64.sts-bundle.sts-3.7.1.RELEASE.configuration.org.eclipse.osgi.24.0..cp.;.D:.Saved

答:
Two ways:

below setting is tested in intellij IDE:

edit configuration->Configuration->Main class: specify fully qualified path.

you can specify main class through maven plugin in your pom.xml like below:.

```<code>  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>fully.qualified.MainClass</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
</code>```

Title: Maven clean/install failing

Body:
Two ways:

below setting is tested in intellij IDE:

edit configuration->Configuration->Main class: specify fully qualified path.

you can specify main class through maven plugin in your pom.xml like below:.

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>fully.qualified.MainClass</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>


问:
How to disable and uninstall a Drupal module programmatically?
I want to be able to disable and then uninstall a module programmatically on my local environment and then easily push that code to prod so everything gets updated.

I'm guessing it's something with the hook_update_N. But not sure where to start.

答:
you can use drush and forcefully uninstall the module just like the following:</p>
```<code>drush eval "\$module_data = \Drupal::config('core.extension')->get('module'); unset(\$module_data['MODULE_NAME']); \Drupal::configFactory()->getEditable('core.extension')->set('module', \$module_data)->save();"
</code>```

Body:
you can use drush and forcefully uninstall the module just like the following:

drush eval "\$module_data = \Drupal::config('core.extension')->get('module'); unset(\$module_data['MODULE_NAME']); \Drupal::configFactory()->getEditable('core.extension')->set('module', \$module_data)->save();"


问:
How to test loop with jest?
I am new to jest. There is a task to test a cycle.

```<code> let values = [];
    for (let i = 1; i <= 100; i++) {
      if (i % 3 === 0 && i % 5 === 0) {
        values.push("fizzbuzz");
      } else if (i % 3 === 0) {
        values.push("fizz");
      } else if (i % 5 === 0) {
        values.push("buzz");
      } else {
        values.push("-");
      }
    }
</code>```

I did the following.

```<code>require("./fizzBuzzLoop");

describe("loop for with fizzbuzz", () => {
   let values = [];

   test("define a conditions for string values in loop", () => {
      for (let i = 1; i <= 100; i++) {
         if (i % 3 === 0 && i % 5 === 0) {
            values.push("fizzbuzz");
            expect(values).toContain("fizzbuzz");
         } else if (i % 3 === 0) {
            values.push("fizz");
            expect(values).toContain("fizz");
         } else if (i % 5 === 0) {
            values.push("buzz");
            expect(values).toContain("buzz");
         } else {
            values.push("-");
            expect(values).toContain("-");
         }
      }
   });
});
</code>```

I don't fully understand how the loop should be tested. I will be grateful for help

答:
I found a more general way

```<code>        let values = [];
    for (let i = 1; i <= 100; i++) {
       if (i % 3 === 0 && i % 5 === 0) {
          values.push("fizzbuzz");
       } else if (i % 3 === 0) {
          values.push("fizz");
       } else if (i % 5 === 0) {
          values.push("buzz");
       } else {
          values.push("-");
       }
    }

       module.exports = values;
</code>```

The solution to the problem is done in the forehead. But you can reduce the number of tests and check the entire array for compliance at once.

```<code>    const values = require('./fizzBuzzLoop');

    const expected = ['-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
'-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz'];

    describe("loop for with fizzbuzz", () => {
       test("check array for matching values", () => {
          expect(expected).toEqual(values);
       });
    });
</code>```

Title: How to test loop with jest?

Body:
I am new to jest. There is a task to test a cycle.

 let values = [];
    for (let i = 1; i <= 100; i++) {
      if (i % 3 === 0 && i % 5 === 0) {
        values.push("fizzbuzz");
      } else if (i % 3 === 0) {
        values.push("fizz");
      } else if (i % 5 === 0) {
        values.push("buzz");
      } else {
        values.push("-");
      }
    }

I did the following.

require("./fizzBuzzLoop");

describe("loop for with fizzbuzz", () => {
   let values = [];

   test("define a conditions for string values in loop", () => {
      for (let i = 1; i <= 100; i++) {
         if (i % 3 === 0 && i % 5 === 0) {
            values.push("fizzbuzz");
            expect(values).toContain("fizzbuzz");
         } else if (i % 3 === 0) {
            values.push("fizz");
            expect(values).toContain("fizz");
         } else if (i % 5 === 0) {
            values.push("buzz");
            expect(values).toContain("buzz");
         } else {
            values.push("-");
            expect(values).toContain("-");
         }
      }
   });
});

I don't fully understand how the loop should be tested. I will be grateful for help

Body:
I found a more general way

        let values = [];
    for (let i = 1; i <= 100; i++) {
       if (i % 3 === 0 && i % 5 === 0) {
          values.push("fizzbuzz");
       } else if (i % 3 === 0) {
          values.push("fizz");
       } else if (i % 5 === 0) {
          values.push("buzz");
       } else {
          values.push("-");
       }
    }

       module.exports = values;

The solution to the problem is done in the forehead. But you can reduce the number of tests and check the entire array for compliance at once.

    const values = require('./fizzBuzzLoop');

    const expected = ['-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
'-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz',
    '-',
    'fizz',
    '-',
    '-',
    'fizzbuzz',
    '-',
    '-',
    'fizz',
    '-',
    'buzz',
    'fizz',
    '-',
    '-',
    'fizz',
    'buzz'];

    describe("loop for with fizzbuzz", () => {
       test("check array for matching values", () => {
          expect(expected).toEqual(values);
       });
    });


问:
GCP Composer - ModuleNotFoundError: No module named 'airflow.providers.sftp'
I trying to getting data from FTP server's txt file by GCP Composer Tasks.

So I imported SFTPOperator package in code.

but error occurred:

```<code>ModuleNotFoundError: No module named 'airflow.providers.sftp'
</code>```

then, I tried few ways:

Getting exception "No module named 'airflow.providers.sftp'"

Install apache-airflow-providers-sftp by composer pypi packages

but didn't work.

My GCP Composer Environment is as below:

Image Version : composer-1.17.7-airflow-2.1.4

python version : 3

Network VPC-native : Enable

How can I use SFTPOperator ?

答:
For this you will have to install sftp package, pip install 'apache-airflow[sftp]'  . You can check the built-in and extras packages that airflow components have when installed (varies from version).

Once you have it installed you should be able to use SFTPOperator by importing the operator inside your DAG.

```<code>from airflow.providers.sftp.operators.sftp import SFTPOperation,SFTPOperator

with DAG(...) as dag:

   upload_op = SFTPOperator(
    task_id="test_sftp",
    ssh_conn_id="ssh_default",
    local_filepath="/tmp/file.txt",
    remote_filepath="/tmp/tmp1/tmp2/file.txt",
    operation=SFTPOperation.GET,
    dag=dag
   )

   ...
</code>```

You can also find a mock tests on the airflow git hub project that can provide you some guidance, check this link.

UPDATE 17/08/2022: As commented by Diana, Composer has a documented way to install its components as mention on this link. Be advised to pick up the composer version your project uses as there is version1 and version2 guides.

Body:
I trying to getting data from FTP server's txt file by GCP Composer Tasks.

So I imported SFTPOperator package in code.

but error occurred:

ModuleNotFoundError: No module named 'airflow.providers.sftp'

then, I tried few ways:

Getting exception "No module named 'airflow.providers.sftp'"

Install apache-airflow-providers-sftp by composer pypi packages

but didn't work.

My GCP Composer Environment is as below:

Image Version : composer-1.17.7-airflow-2.1.4

python version : 3

Network VPC-native : Enable

How can I use SFTPOperator ?

Body:
For this you will have to install sftp package, pip install 'apache-airflow[sftp]'  . You can check the built-in and extras packages that airflow components have when installed (varies from version).

Once you have it installed you should be able to use SFTPOperator by importing the operator inside your DAG.

from airflow.providers.sftp.operators.sftp import SFTPOperation,SFTPOperator

with DAG(...) as dag:

   upload_op = SFTPOperator(
    task_id="test_sftp",
    ssh_conn_id="ssh_default",
    local_filepath="/tmp/file.txt",
    remote_filepath="/tmp/tmp1/tmp2/file.txt",
    operation=SFTPOperation.GET,
    dag=dag
   )

   ...

You can also find a mock tests on the airflow git hub project that can provide you some guidance, check this link.

UPDATE 17/08/2022: As commented by Diana, Composer has a documented way to install its components as mention on this link. Be advised to pick up the composer version your project uses as there is version1 and version2 guides.


问:
Why is this code deleting the contents of previous XML tags?
This is openFrameworks C++ code. It's saving information about each move made in a game, but each new game wipes out all of the values inside <MOVE> <PLAYER/> <MOVE/> for any previous <GAME><GAME/> tags.

```<code>bool My_xml::setup() {
  XML.loadFile(ofxiPhoneGetDocumentsDirectory() + "scoresAndSettings.xml")

  //read the settings from XML
  //if the settings file doesn't exist we assign default values

  globalsettings.user_id = XML.getValue("GLOBALSETTINGS:USERID", ofRandom(std::numeric_limits<float>::max() - 1));
  if (globalsettings.user_id == 0) { // for first game only
    XML.setValue("GLOBALSETTINGS:USERID", globalsettings.user_id);
  }
  globalsettings.playing_big_board = XML.getValue("GLOBALSETTINGS:BIGBOARD", false);
  globalsettings.drawCrossHairs = XML.getValue("GLOBALSETTINGS:DRAWCROSSHAIRS", false);
  globalsettings.graphFFT = XML.getValue("GLOBALSETTINGS:GRAPHFFT", true); //
  globalsettings.showDebugText = XML.getValue("GLOBALSETTINGS:SHOWDEBUGTEXT", false);

  gameNumber = XML.addTag("GAME");
  XML.setAttribute("GAME", "number", gameNumber+1, gameNumber);
  XML.setAttribute("GAME", "start", makeTimeStamp(), gameNumber);
  XML.pushTag("GAME", gameNumber);

  return true;
}

void My_xml::saveMoveInfo() {
  int moveNumber    = XML.addTag("MOVE");
  if( XML.pushTag("MOVE", moveNumber) ){
    // put in data from this move
    int player = ((testApp*)ofGetAppPtr())->gameplay->whoseTurnIsIt;
    string playerTag = "PLAYER " + ofToString(player);
    int tagNum = XML.addTag(playerTag);
    XML.addAttribute(playerTag, "move", moveNumber++, tagNum);
    XML.addAttribute(playerTag, "duration", lastMoveDuration, tagNum);
    XML.addAttribute(playerTag, "wait", waitBeforeThisMove, tagNum);
    XML.addAttribute(playerTag, "timestamp", makeTimeStamp(), tagNum);
    XML.popTag();
  }

  XML.saveFile( ofxiPhoneGetDocumentsDirectory() + "scoresAndSettings.xml" );
}

void My_xml::winGame() {
  writeToFile();
}

void My_xml::writeToFile() {
  XML.popTag();
  XML.setAttribute("GAME", "lat", ofToString(coreLocation->getLatitude(), 10), gameNumber);
  XML.setAttribute("GAME", "long", ofToString(coreLocation->getLongitude(), 10), gameNumber);
  XML.setAttribute("GAME", "end", makeTimeStamp(), gameNumber);
  XML.saveFile( ofxiPhoneGetDocumentsDirectory() + "scoresAndSettings.xml" );
}
</code>```

EDIT/Addition: This code, which stores calibration data, doesn't get overwritten/cleared/eaten each game.

```<code>  if (animations->training != NOT_TRAINING) {
    int numGameTags = XML.XML.getNumTags("GAME");
    XML.XML.pushTag("GAME", numGameTags-1);
    int moveNumber  = XML.XML.addTag("CALIBRATION");

    if (gameplay->whoseTurnIsIt < 2) { // PLAYER 1
      switch (animations->training) {
        case TRAINING_UP:
          XML.player1settings.pitch_high = gameplay->high_pitch_thresh;
          XML.XML.setAttribute("CALIBRATION", "player", gameplay->whoseTurnIsIt, moveNumber);
          XML.XML.setAttribute("CALIBRATION", "type", "pitch", moveNumber);
          XML.XML.setAttribute("CALIBRATION", "level", "high", moveNumber);
          XML.XML.setValue("CALIBRATION", gameplay->high_pitch_thresh, moveNumber);
          break;
        // etc.
        default:
          break;
      }
    } else { // PLAYER 2
      switch (animations->training) {
        case TRAINING_UP:
          XML.player2settings.pitch_high = gameplay->high_pitch_thresh;
          XML.XML.setAttribute("CALIBRATION", "player", gameplay->whoseTurnIsIt, moveNumber);
          XML.XML.setAttribute("CALIBRATION", "type", "pitch", moveNumber);
          XML.XML.setAttribute("CALIBRATION", "level", "high", moveNumber);
          XML.XML.setValue("CALIBRATION", gameplay->high_pitch_thresh, moveNumber);
          break;
        // etc.
        default:
          break;
      } // end switch
    } // end else
    XML.XML.popTag();
  }
</code>```

EDIT 2:
I just noticed that the XML tags are actually being altered, not just having the contents removed. Note that the tag is <PLAYER 1> or <PLAYER 2> in the most recent game, but just <PLAYER /> in all the old data...

```<code><GAME number="3" start="2011-08-19|16:00:59|2.7" lat="51.38325077" long="-2.36163312" end="2011-08-19|16:01:29|32.8">
    <PLAYER />
</GAME>
<GAME number="4" start="2011-08-19|16:14:12|2.6">
    <PLAYER />
</GAME>
<GAME number="5" start="2011-08-19|16:16:10|2.9">
    <PLAYER 1 col="0" row="2" err="0" move="1" duration="0.012999" wait="19.784000" timestamp="2011-08-19|16:16:30|22.8"></PLAYER 1>
    <PLAYER 2 col="0" row="2" err="-2" move="1" duration="0.219000" wait="1.605001" timestamp="2011-08-19|16:16:32|24.6"></PLAYER 2>
    <PLAYER 2 col="0" row="2" err="-2" move="2" duration="0.226000" wait="1.500000" timestamp="2011-08-19|16:16:34|26.4"></PLAYER 2>
</GAME>
</code>```

EDIT3: Aaaaand that's it. No spaces in a tag name. Sheesh.

答:
are you shure that gamenumber is the same in setup() and writeToFile() ?
Is your XML File written correctly after one save?
Also be shure to be in the right tags with pushTag() and popTag(). Its better to do this straight before you use the tag. So if I'm understanding your code right writeToFile() has to be called directly after setup() because you push to your Game Node already in setup(). I would  try to fix that and would make a parameter to writeToFile with the Game ID.

Body:
This is openFrameworks C++ code. It's saving information about each move made in a game, but each new game wipes out all of the values inside <MOVE> <PLAYER/> <MOVE/> for any previous <GAME><GAME/> tags.

bool My_xml::setup() {
  XML.loadFile(ofxiPhoneGetDocumentsDirectory() + "scoresAndSettings.xml")

  //read the settings from XML
  //if the settings file doesn't exist we assign default values

  globalsettings.user_id = XML.getValue("GLOBALSETTINGS:USERID", ofRandom(std::numeric_limits<float>::max() - 1));
  if (globalsettings.user_id == 0) { // for first game only
    XML.setValue("GLOBALSETTINGS:USERID", globalsettings.user_id);
  }
  globalsettings.playing_big_board = XML.getValue("GLOBALSETTINGS:BIGBOARD", false);
  globalsettings.drawCrossHairs = XML.getValue("GLOBALSETTINGS:DRAWCROSSHAIRS", false);
  globalsettings.graphFFT = XML.getValue("GLOBALSETTINGS:GRAPHFFT", true); //
  globalsettings.showDebugText = XML.getValue("GLOBALSETTINGS:SHOWDEBUGTEXT", false);

  gameNumber = XML.addTag("GAME");
  XML.setAttribute("GAME", "number", gameNumber+1, gameNumber);
  XML.setAttribute("GAME", "start", makeTimeStamp(), gameNumber);
  XML.pushTag("GAME", gameNumber);

  return true;
}

void My_xml::saveMoveInfo() {
  int moveNumber    = XML.addTag("MOVE");
  if( XML.pushTag("MOVE", moveNumber) ){
    // put in data from this move
    int player = ((testApp*)ofGetAppPtr())->gameplay->whoseTurnIsIt;
    string playerTag = "PLAYER " + ofToString(player);
    int tagNum = XML.addTag(playerTag);
    XML.addAttribute(playerTag, "move", moveNumber++, tagNum);
    XML.addAttribute(playerTag, "duration", lastMoveDuration, tagNum);
    XML.addAttribute(playerTag, "wait", waitBeforeThisMove, tagNum);
    XML.addAttribute(playerTag, "timestamp", makeTimeStamp(), tagNum);
    XML.popTag();
  }

  XML.saveFile( ofxiPhoneGetDocumentsDirectory() + "scoresAndSettings.xml" );
}

void My_xml::winGame() {
  writeToFile();
}

void My_xml::writeToFile() {
  XML.popTag();
  XML.setAttribute("GAME", "lat", ofToString(coreLocation->getLatitude(), 10), gameNumber);
  XML.setAttribute("GAME", "long", ofToString(coreLocation->getLongitude(), 10), gameNumber);
  XML.setAttribute("GAME", "end", makeTimeStamp(), gameNumber);
  XML.saveFile( ofxiPhoneGetDocumentsDirectory() + "scoresAndSettings.xml" );
}

EDIT/Addition: This code, which stores calibration data, doesn't get overwritten/cleared/eaten each game.

  if (animations->training != NOT_TRAINING) {
    int numGameTags = XML.XML.getNumTags("GAME");
    XML.XML.pushTag("GAME", numGameTags-1);
    int moveNumber  = XML.XML.addTag("CALIBRATION");

    if (gameplay->whoseTurnIsIt < 2) { // PLAYER 1
      switch (animations->training) {
        case TRAINING_UP:
          XML.player1settings.pitch_high = gameplay->high_pitch_thresh;
          XML.XML.setAttribute("CALIBRATION", "player", gameplay->whoseTurnIsIt, moveNumber);
          XML.XML.setAttribute("CALIBRATION", "type", "pitch", moveNumber);
          XML.XML.setAttribute("CALIBRATION", "level", "high", moveNumber);
          XML.XML.setValue("CALIBRATION", gameplay->high_pitch_thresh, moveNumber);
          break;
        // etc.
        default:
          break;
      }
    } else { // PLAYER 2
      switch (animations->training) {
        case TRAINING_UP:
          XML.player2settings.pitch_high = gameplay->high_pitch_thresh;
          XML.XML.setAttribute("CALIBRATION", "player", gameplay->whoseTurnIsIt, moveNumber);
          XML.XML.setAttribute("CALIBRATION", "type", "pitch", moveNumber);
          XML.XML.setAttribute("CALIBRATION", "level", "high", moveNumber);
          XML.XML.setValue("CALIBRATION", gameplay->high_pitch_thresh, moveNumber);
          break;
        // etc.
        default:
          break;
      } // end switch
    } // end else
    XML.XML.popTag();
  }

EDIT 2:
I just noticed that the XML tags are actually being altered, not just having the contents removed. Note that the tag is <PLAYER 1> or <PLAYER 2> in the most recent game, but just <PLAYER /> in all the old data...

<GAME number="3" start="2011-08-19|16:00:59|2.7" lat="51.38325077" long="-2.36163312" end="2011-08-19|16:01:29|32.8">
    <PLAYER />
</GAME>
<GAME number="4" start="2011-08-19|16:14:12|2.6">
    <PLAYER />
</GAME>
<GAME number="5" start="2011-08-19|16:16:10|2.9">
    <PLAYER 1 col="0" row="2" err="0" move="1" duration="0.012999" wait="19.784000" timestamp="2011-08-19|16:16:30|22.8"></PLAYER 1>
    <PLAYER 2 col="0" row="2" err="-2" move="1" duration="0.219000" wait="1.605001" timestamp="2011-08-19|16:16:32|24.6"></PLAYER 2>
    <PLAYER 2 col="0" row="2" err="-2" move="2" duration="0.226000" wait="1.500000" timestamp="2011-08-19|16:16:34|26.4"></PLAYER 2>
</GAME>

EDIT3: Aaaaand that's it. No spaces in a tag name. Sheesh.


问:
How Do I Uninstall Yarn
How can I uninstall yarn? I've used it for a react-native project and now whenever I move the code out of index.ios.js or index.android.js it throws an error so I'd like to just use npm but whenever I initialize a react-native project it defaults to yarn. I tried npm uninstall yarn but that didn't work. Thanks.

答:
It really works when I'm still getting errors after deleting ~/.yarn

rm ~/.yarnrc.yml

We must delete .yarnrc.yml or .yarnrc file

Title: How Do I Uninstall Yarn


问:
Change default 'delimiters' in excel
I am using Excel for Mac 2016 on macOS Sierra software. Although I have been successfully copying and pasting CSV files into excel for some time now, recently, they have begun to behave in an odd way. When I paste the data, the content of each row seems to split over many columns. Where as before one cell would have been able to contain many words, it seems now as though each cell is only able to contain one word, so it splits the content of what would normally be in one cell, over many cells, making some rows of data spread out over up to 100 columns!

I have tried Data tab>> From text>> which takes me through a Text Wizard. There I choose Delimited>> Choose Delimiters: Untick the 'Space' box ('Tab' box is still ticked)>> Column data as 'General'>> Finish. Following this process appears to import the data into its correct columns. It works. BUT, a lot of work to get there!

Question: Is there any way to change the default settings of Delimiters, so that the 'Space' delimiter does not automatically divide the data?

答:
Choose delimiter directly in CSV file to open in Excel

For Excel to be able to read a CSV file with a field separator used in a given CSV file, you can specify the separator directly in that file. For this, open your file in any text editor, say Notepad, and type the below string before any other data:

To separate values with comma: sep=,

To separate values with semicolon: sep=;

To separate values with a pipe: sep=|

In a similar fashion, you can use any other character for the delimiter - just type the character after the equality sign.

For example, to correctly open a semicolon delimited CSV in Excel, we explicitly indicate that the field separator is a semicolon:

reference

Title: Change default 'delimiters' in excel


问:
Choosing from an array many
```<code>$first  = 1.22;
$second = 1.55;
$third  = 1.77;
$fourth = 1.3;
$fifth = 1.5;
$sixth = 1.2;
$seventh = 1.4;
$eighth = 1.8;
$ninghth = 1.9;
$tenth = 1.24;

$array  = array($first, $second, $third,$fourth, $fifth, $sixth, $seventh, $eighth, $ninghth, $tenth);
echo $array[mt_rand(0, count($array) - 1)]*$array[mt_rand(0, count($array) - 1)];
</code>```

This works but i need it to show me what variables were multiplied and also, assign a text value on them.

答:
In that case you should do it in two steps, something like that:</p>
```<code>$array  = array($first, $second, $third,$fourth, $fifth, $sixth, $seventh, $eighth, $ninghth, $tenth);
$firstValue = $array[mt_rand(0, count($array) - 1)];
$secondValue = $array[mt_rand(0, count($array) - 1)];
echo "multiplying: " . $firstValue . " and " . $secondValue;
echo $firstValue*$secondvalue;
</code>```

Title: Choosing from an array many

Body:
$first  = 1.22;
$second = 1.55;
$third  = 1.77;
$fourth = 1.3;
$fifth = 1.5;
$sixth = 1.2;
$seventh = 1.4;
$eighth = 1.8;
$ninghth = 1.9;
$tenth = 1.24;

$array  = array($first, $second, $third,$fourth, $fifth, $sixth, $seventh, $eighth, $ninghth, $tenth);
echo $array[mt_rand(0, count($array) - 1)]*$array[mt_rand(0, count($array) - 1)];

This works but i need it to show me what variables were multiplied and also, assign a text value on them.

Body:
In that case you should do it in two steps, something like that:

$array  = array($first, $second, $third,$fourth, $fifth, $sixth, $seventh, $eighth, $ninghth, $tenth);
$firstValue = $array[mt_rand(0, count($array) - 1)];
$secondValue = $array[mt_rand(0, count($array) - 1)];
echo "multiplying: " . $firstValue . " and " . $secondValue;
echo $firstValue*$secondvalue;


问:
moved to left and right after click?
My code does not work. What I want is to move my pagination to the left and to the right after #prev_pag and #next_pag are clicked on. I don't know why this code isn't working?

EXAMPLE: http://jsfiddle.net/szVKD/

JS code:

```<code>$('#next_pag').click(function() {
        $('#pagination').animate({
            marginLeft: '-=100px'
        },
        500);
    });
    $('#prev_pag').click(function() {
        $('#pagination').animate({
            marginLeft: '+=100px'
        },
        500);
    });
});
</code>```

答:
```<code>$('#next_pag').click(function(e) {
         e.preventDefault(); //prevent the default behaviour
        $('#pagination').animate({
            left: '-=100px'
        },
        500);
    });
    $('#prev_pag').click(function(e) {
        e.preventDefault(); //prevent the default behaviour
        $('#pagination').animate({
            left: '+=100px'
        },
        500);
    });
});
</code>```

Title: moved to left and right after click?

Body:
My code does not work. What I want is to move my pagination to the left and to the right after #prev_pag and #next_pag are clicked on. I don't know why this code isn't working?

EXAMPLE: http://jsfiddle.net/szVKD/

JS code:

$('#next_pag').click(function() {
        $('#pagination').animate({
            marginLeft: '-=100px'
        },
        500);
    });
    $('#prev_pag').click(function() {
        $('#pagination').animate({
            marginLeft: '+=100px'
        },
        500);
    });
});


问:
How do I create a Reusable/Global Button Component in Nuxtjs or vuejs?
We've all been here. Good code avoids repetition. If you repeat the same code in more than one file, how about making it a component? Use your own threshold/judgement to measure if the code really needs to be a component.

How do I do this?

答:
I'll take you through how to create a Global(component that can be used app-wide) button component in NuxtJs but can also apply for Vue.js.

First create the component file in your components directory, in my case PrimaryButton.vue. The code inside my PrimaryButton component looks something like this

```<code><template>
  <button class="rounded-button-cyan subheading4" @click="callback($event)">
    {{ buttonText }}
  </button>
</template>

<script>
export default {
  props: {
    buttonText: String,
  },
  methods: {
    callback: function (e) {
      this.$emit("click", e);
    },
  },
};
</script>
</code>```

In the above snippet we have created a global PrimarButton that can take in a prop buttonText and a click event as well.

So let's now use it.
We can now use the button in any file like...

```<code><template>
  <PrimaryButton  @click="showAlert()" buttonText="Show Alert" />
</template>

<script>
export default {
  methods: {
    showAlert() {
      alert("EARTH HACKED ");
    },
  },
};
</script>
</code>```

Body:
I'll take you through how to create a Global(component that can be used app-wide) button component in NuxtJs but can also apply for Vue.js.

First create the component file in your components directory, in my case PrimaryButton.vue. The code inside my PrimaryButton component looks something like this

<template>
  <button class="rounded-button-cyan subheading4" @click="callback($event)">
    {{ buttonText }}
  </button>
</template>

<script>
export default {
  props: {
    buttonText: String,
  },
  methods: {
    callback: function (e) {
      this.$emit("click", e);
    },
  },
};
</script>

In the above snippet we have created a global PrimarButton that can take in a prop buttonText and a click event as well.

So let's now use it.
We can now use the button in any file like...

<template>
  <PrimaryButton  @click="showAlert()" buttonText="Show Alert" />
</template>

<script>
export default {
  methods: {
    showAlert() {
      alert("EARTH HACKED ");
    },
  },
};
</script>


问:
JPA OneToMany : List vs Set
I have two entities: UserAccount and Notification. These have a relationship as shown below.

```<code> public class UserAccount {

    @Id
    @Column(name = "USER_NAME")
    private String emailId;

    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinTable(name = "USERS_NOTIFICATIONS", joinColumns = { @JoinColumn(name = "USER_NAME") }, inverseJoinColumns = { @JoinColumn(name = "NOTIFICATION_ID") })
    private List<Notification> notifications;

    //setters, getter, equals and hashcode
 }
</code>```

Both equals() and hashcode() are overridden (generated by the IDE with business key/primary key).

Given a UserAccount, when I add the first Notification, it results in an INSERT statement. But on further addition for the same UserAccount, it first deletes and then inserts:

```<code>Hibernate: delete from USERS_NOTIFICATIONS where USER_NAME=?
Hibernate: insert into USERS_NOTIFICATIONS (USER_NAME, NOTIFICATION_ID) values (?, ?)
Hibernate: insert into USERS_NOTIFICATIONS (USER_NAME, NOTIFICATION_ID) values (?, ?)
Hibernate: insert into USERS_NOTIFICATIONS (USER_NAME, NOTIFICATION_ID) values (?, ?)
//as many inserts as the notifications the user has
</code>```

The same happens with every UserAccount. If I replace the List with Set, a normal INSERT occurs. I found the reason after reading this documentation and a blog.

Observations from docs

In a unidirectional @OneToMany association, Set is preferred.

It should be clear that indexed Collections and Sets allow the most efficient operations in terms of adding, removing and updating elements.

In a bidirectional @OneToMany relationship (@ManyToOne managing), List and Bags are efficient.

Bags and Lists are the most efficient inverse Collections.

Having said that, which is more preferable:

A Set over a List in a unidirectional @OneToMany mapping?

Or, do I have to tweak my domain model by adding a bidirectional relationship to use a List, especially when there are duplicates?

答:
I use a Set when I do not need ordering. This enables also set-operations.
On the other hand, I use a List if ordering is required.

The semantic of the container is in my eyes the relevant aspect to decide which one to use.

Title: JPA OneToMany : List vs Set

Body:
I have two entities: UserAccount and Notification. These have a relationship as shown below.

 public class UserAccount {

    @Id
    @Column(name = "USER_NAME")
    private String emailId;

    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinTable(name = "USERS_NOTIFICATIONS", joinColumns = { @JoinColumn(name = "USER_NAME") }, inverseJoinColumns = { @JoinColumn(name = "NOTIFICATION_ID") })
    private List<Notification> notifications;

    //setters, getter, equals and hashcode
 }

Both equals() and hashcode() are overridden (generated by the IDE with business key/primary key).

Given a UserAccount, when I add the first Notification, it results in an INSERT statement. But on further addition for the same UserAccount, it first deletes and then inserts:

Hibernate: delete from USERS_NOTIFICATIONS where USER_NAME=?
Hibernate: insert into USERS_NOTIFICATIONS (USER_NAME, NOTIFICATION_ID) values (?, ?)
Hibernate: insert into USERS_NOTIFICATIONS (USER_NAME, NOTIFICATION_ID) values (?, ?)
Hibernate: insert into USERS_NOTIFICATIONS (USER_NAME, NOTIFICATION_ID) values (?, ?)
//as many inserts as the notifications the user has

The same happens with every UserAccount. If I replace the List with Set, a normal INSERT occurs. I found the reason after reading this documentation and a blog.

Observations from docs

In a unidirectional @OneToMany association, Set is preferred.

It should be clear that indexed Collections and Sets allow the most efficient operations in terms of adding, removing and updating elements.

In a bidirectional @OneToMany relationship (@ManyToOne managing), List and Bags are efficient.

Bags and Lists are the most efficient inverse Collections.

Having said that, which is more preferable:

A Set over a List in a unidirectional @OneToMany mapping?

Or, do I have to tweak my domain model by adding a bidirectional relationship to use a List, especially when there are duplicates?


问:
Adding bracket lines via CSS or HTML to existing interactive tournament bracket
Been using this codepen (https://codepen.io/meredithz/pen/VYadPy) to build out a tournament bracket live on my site. Struggling to find a useful solution to add lines like a normal bracket has (i.e. two feed into the next match, etc.).

I tried experimenting with some pseudo elements like ::after like this:

```<code>bracket-matchup::after {
    content: "";
    border-width: 2px 2px 0 0;
    border-bottom: 2px solid transparent;
    border-radius: 0 2px 0 0;
}
</code>```

but have struggled to make much progress there, any ideas?

答:
You can "experiment" with something like this. It may not fully solve the problem but, it is a step in the right direction.</p>
```<code>.bracket-level {
    position: relative;
}
.bracket-level::after {
    content: "";
    position: absolute;
    width: 1px;
    height: 100%;
    background-color: red;
}
</code>```

Body:
Been using this codepen (https://codepen.io/meredithz/pen/VYadPy) to build out a tournament bracket live on my site. Struggling to find a useful solution to add lines like a normal bracket has (i.e. two feed into the next match, etc.).

I tried experimenting with some pseudo elements like ::after like this:

bracket-matchup::after {
    content: "";
    border-width: 2px 2px 0 0;
    border-bottom: 2px solid transparent;
    border-radius: 0 2px 0 0;
}

but have struggled to make much progress there, any ideas?

Body:
You can "experiment" with something like this. It may not fully solve the problem but, it is a step in the right direction.

.bracket-level {
    position: relative;
}
.bracket-level::after {
    content: "";
    position: absolute;
    width: 1px;
    height: 100%;
    background-color: red;
}


问:
How to loop list class
I have below  class. And data is serialized using JsonConvert.DeserializeObject. The data is returning from list. But I want to loop using for or for each. Please advice.

Thank you.

```<code>    var result = client.getInvocieLine
    (call Context);

   string strResultJson = JsonConvert.SerializeObject(result);

   System.IO.File.WriteAllText(@"D:\jsondata\invoicedata.json", strResultJson);

   string fileName = @"D:\jsondata\invoicedata.json";
   string jsonText = System.IO.File.ReadAllText(fileName)
  List<EInvoiceModel.Class1> data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EInvoiceModel.Class1>>(jsonText);

            EInvoiceModel.Invoiceline invoicelined = new EInvoiceModel.Invoiceline();

            for(int i=0; i < data.Count; i++)
            {
                invoicelined.parmItemId = data[i].invoiceLines[i].parmItemId; //Its bring only one record. I need all record from data. Please advice.
            }
            return Ok(invoicelined);

</code>```

Please find my EInvoiceModel contains below structure, Which i designed as per my json response. yes I need same index for data and invoiceLines in data[i].invoiceLines[i]. How can I get this to return all values. Index currently pointing only one record and return one record. If I change position its return another record. But I need all please.

```<code>public class Class1
{
    public Invoiceline[] invoiceLines { get; set; }
    public string parmCustName { get; set; }
    public DateTime parmInvoiceDate { get; set; }
}     public class Invoiceline
{
    public string parmItemId { get; set; }
    public string parmItemNameDisplay { get; set; }
    public float parmQty { get; set; }}
</code>```

Please find my json structure. I wist to repeat all parameter-ids from json response.

```<code>{"invoiceLines":[{"parmCurrencyCode":null,"parmCustExchRate":0.0,"parmInvoiceId":null,"parmItemId":null,"parmItemNameDisplay":null,"parmQty":0.0,"parmSalesLinePercent":0.0,"parmSalesUnit":null,"parmdiscountAmount":0.0,"parmnetTotal":0.0,"parmsalesPrice":0.0,"parmsalesTotal":0.0,"parmtotalItemsLineDisc":0.0,"parmtotalTaxableFees":0.0}],"parmCustName":null,"parmInvoiceDate":"0001-01-01T00:00:00","parmInvoiceId":null,"parmSalesId":null,"parmnetAmount":0.0,"parmtotalAmount":0.0,"parmtotalAmountWithDisc":0.0,"parmtotalItemsDiscountAmount":0.0,"parmtotalSalesAmount":0.0}
</code>```

Please I want return all parmItemId below way. I don't want damage my json structure.

```<code>      EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();
       List<EInvoiceModel.Class1> data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EInvoiceModel.Class1>>(jsonText);
       // List<EInvoiceModel.Invoiceline> data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EInvoiceModel.Invoiceline>>(jsonText);

        for (int i = 0; i < data.Count; i++)
        {

            ds.invoiceLines = new List<EInvoiceModel.Invoiceline>
        {
             new EInvoiceModel.Invoiceline
             {
             parmItemId = data[i].invoiceLines[i].parmItemId
             }
        };

        }
        return Ok(ds);
</code>```

答:
You now have this:

```<code>EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();

for (int i = 0; i < data.Count; i++)
{
    ds.invoiceLines = new List<EInvoiceModel.Invoiceline>
       {
           new EInvoiceModel.Invoiceline
           {
              parmItemId = data[i].invoiceLines[i].parmItemId
           }
        };
}
</code>```

This means that on every iteration you overwrite that ds.invoiceLines with a new list, containing a single item. So you end up with only the last one.

A possibly better way would be this:

```<code>EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();
ds.invoiceLines = new List<EInvoiceModel.Invoiceline>(); // create a list once

for (int i = 0; i < data.Count; i++)
{
    // add one item to that list
    ds.invoiceLines.Add(new EInvoiceModel.Invoiceline
           {
              parmItemId = data[i].invoiceLines[i].parmItemId
           }
        );
}
</code>```

This way you assign a new (empty) list once (you can skip this when invoiceLines already contains an empty list, after you created a new Class1).

And then, in the loop, you don't assign a new list, but just add a new item to that existing list. At the end, you get a list with as many items as there are in your input data.

By the way, this assumes that you really need to make a list of data[i].invoiceLines[i].parmItemId. I find it curious that for data[3] you need an invoiceLines[3] and for data[7] an invoiceLines[7]. I would expect one loop through all data and then an inner loop over all its invoiceLines. But you know your data best.

Apparently, you do need to loop over the inner objects. So modify that code like this:

```<code>EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();
ds.invoiceLines = new List<EInvoiceModel.Invoiceline>(); // create a list once

// loop over all "data" items
for (int i = 0; i < data.Count; i++)
{
    // then loop over the invoiceLines inside the current data item
    for (int j = 0; j < data[i].invoiceLines.Count(); j++)
    {
        // add one item to that list
        ds.invoiceLines.Add(new EInvoiceModel.Invoiceline
           {
              parmItemId = data[i].invoiceLines[j].parmItemId
           }
        );
    }
}
</code>```

Note that I still use index i in data[i] from the outer loop, but now use index j in invoiceLines[j] from the inner loop.

Title: How to loop list class

Body:
I have below  class. And data is serialized using JsonConvert.DeserializeObject. The data is returning from list. But I want to loop using for or for each. Please advice.

Thank you.

    var result = client.getInvocieLine
    (call Context);

   string strResultJson = JsonConvert.SerializeObject(result);

   System.IO.File.WriteAllText(@"D:\jsondata\invoicedata.json", strResultJson);

   string fileName = @"D:\jsondata\invoicedata.json";
   string jsonText = System.IO.File.ReadAllText(fileName)
  List<EInvoiceModel.Class1> data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EInvoiceModel.Class1>>(jsonText);

            EInvoiceModel.Invoiceline invoicelined = new EInvoiceModel.Invoiceline();

            for(int i=0; i < data.Count; i++)
            {
                invoicelined.parmItemId = data[i].invoiceLines[i].parmItemId; //Its bring only one record. I need all record from data. Please advice.
            }
            return Ok(invoicelined);

Please find my EInvoiceModel contains below structure, Which i designed as per my json response. yes I need same index for data and invoiceLines in data[i].invoiceLines[i]. How can I get this to return all values. Index currently pointing only one record and return one record. If I change position its return another record. But I need all please.

public class Class1
{
    public Invoiceline[] invoiceLines { get; set; }
    public string parmCustName { get; set; }
    public DateTime parmInvoiceDate { get; set; }
}     public class Invoiceline
{
    public string parmItemId { get; set; }
    public string parmItemNameDisplay { get; set; }
    public float parmQty { get; set; }}

Please find my json structure. I wist to repeat all parameter-ids from json response.

{"invoiceLines":[{"parmCurrencyCode":null,"parmCustExchRate":0.0,"parmInvoiceId":null,"parmItemId":null,"parmItemNameDisplay":null,"parmQty":0.0,"parmSalesLinePercent":0.0,"parmSalesUnit":null,"parmdiscountAmount":0.0,"parmnetTotal":0.0,"parmsalesPrice":0.0,"parmsalesTotal":0.0,"parmtotalItemsLineDisc":0.0,"parmtotalTaxableFees":0.0}],"parmCustName":null,"parmInvoiceDate":"0001-01-01T00:00:00","parmInvoiceId":null,"parmSalesId":null,"parmnetAmount":0.0,"parmtotalAmount":0.0,"parmtotalAmountWithDisc":0.0,"parmtotalItemsDiscountAmount":0.0,"parmtotalSalesAmount":0.0}

Please I want return all parmItemId below way. I don't want damage my json structure.

      EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();
       List<EInvoiceModel.Class1> data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EInvoiceModel.Class1>>(jsonText);
       // List<EInvoiceModel.Invoiceline> data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EInvoiceModel.Invoiceline>>(jsonText);

        for (int i = 0; i < data.Count; i++)
        {

            ds.invoiceLines = new List<EInvoiceModel.Invoiceline>
        {
             new EInvoiceModel.Invoiceline
             {
             parmItemId = data[i].invoiceLines[i].parmItemId
             }
        };

        }
        return Ok(ds);

Body:
You now have this:

EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();

for (int i = 0; i < data.Count; i++)
{
    ds.invoiceLines = new List<EInvoiceModel.Invoiceline>
       {
           new EInvoiceModel.Invoiceline
           {
              parmItemId = data[i].invoiceLines[i].parmItemId
           }
        };
}

This means that on every iteration you overwrite that ds.invoiceLines with a new list, containing a single item. So you end up with only the last one.

A possibly better way would be this:

EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();
ds.invoiceLines = new List<EInvoiceModel.Invoiceline>(); // create a list once

for (int i = 0; i < data.Count; i++)
{
    // add one item to that list
    ds.invoiceLines.Add(new EInvoiceModel.Invoiceline
           {
              parmItemId = data[i].invoiceLines[i].parmItemId
           }
        );
}

This way you assign a new (empty) list once (you can skip this when invoiceLines already contains an empty list, after you created a new Class1).

And then, in the loop, you don't assign a new list, but just add a new item to that existing list. At the end, you get a list with as many items as there are in your input data.

By the way, this assumes that you really need to make a list of data[i].invoiceLines[i].parmItemId. I find it curious that for data[3] you need an invoiceLines[3] and for data[7] an invoiceLines[7]. I would expect one loop through all data and then an inner loop over all its invoiceLines. But you know your data best.

Apparently, you do need to loop over the inner objects. So modify that code like this:

EInvoiceModel.Class1 ds = new EInvoiceModel.Class1();
ds.invoiceLines = new List<EInvoiceModel.Invoiceline>(); // create a list once

// loop over all "data" items
for (int i = 0; i < data.Count; i++)
{
    // then loop over the invoiceLines inside the current data item
    for (int j = 0; j < data[i].invoiceLines.Count(); j++)
    {
        // add one item to that list
        ds.invoiceLines.Add(new EInvoiceModel.Invoiceline
           {
              parmItemId = data[i].invoiceLines[j].parmItemId
           }
        );
    }
}

Note that I still use index i in data[i] from the outer loop, but now use index j in invoiceLines[j] from the inner loop.


问:
Streamsets pipeline didn't finish if kafka consumer having 0 messages in topic
I have developed a streamsets pipeline which using KAFKA consumer as origin.My pipeline is working fine if Kafka consumer having message in it.But kafka consumer have 0 message in it the my pipeline went into loop and running contineously and didn't finish.

I need to finish my pipeline if kafka consumer having zero messages in his topic.

答: By default it is streaming application's nature to keep checking for messages. But a similar approach to what you want to achieve has been answered-here.</p>


问:
How to cause a job to finish with warning in Gitlab
I mean to get this status:

I can finish my job with failure, by "exit 1" , but can't do the same with warning

答:
This is possible since 13.8:</p>
```<code>test_job:
  script:
    - execute_script_that_will_fail
  # if the script exit code is 137 or 255 the job will allow to be
  # failed and the pipeline will continue to run
  allow_failure:
    exit_codes: # User defined exit code
      - 137
      - 255
</code>```

Body:
This is possible since 13.8:

test_job:
  script:
    - execute_script_that_will_fail
  # if the script exit code is 137 or 255 the job will allow to be
  # failed and the pipeline will continue to run
  allow_failure:
    exit_codes: # User defined exit code
      - 137
      - 255


问:
Parse HTML with jquery
suppose in a variable html is saved like

```<code>var vhtm="<div><div id='test'>zebra</div><div id='foo'>here is my many other html content</div></div>";
</code>```

i want to parse the above html stored in variable with the help of jquery.
i need to extract a particular div by id and including its content. the return result would like

```<code><div id='foo'>here is my many other html content</div>
</code>```

so i need to find div by id like id='foo'

please help me how to parse the above like jquery.

答:
This should do it:

http://jsfiddle.net/HenryGarle/Vpa3q/

```<code>var vhtml="<div><div id='test'>zebra</div><div id='foo'>here is my many other html content</div></div>";

var foo = $(vhtml).find('#foo').html();

alert(foo);
</code>```

Title: Parse HTML with jquery

Body:
suppose in a variable html is saved like

var vhtm="

zebra

here is my many other html content

";

i want to parse the above html stored in variable with the help of jquery.
i need to extract a particular div by id and including its content. the return result would like

here is my many other html content

so i need to find div by id like id='foo'

please help me how to parse the above like jquery.

Body:
This should do it:

http://jsfiddle.net/HenryGarle/Vpa3q/

var vhtml="<div><div id='test'>zebra</div><div id='foo'>here is my many other html content</div></div>";

var foo = $(vhtml).find('#foo').html();

alert(foo);


问:
Quick question about ports on a web address
I got a little confused about sockets.

In an address like:

https://localhost:5000/

...where I am running a web server during development, I know that the HTTPS translates to the local port 443, so the question is, what is the 5000 port number in that address?

答:
when you request localhost:5000, the browser will go to the webserver on the localhost, but on port 5000, this means that if your webserver is setup to work on port 5000 or one of it's virtual hosts are setup to work on port 5000 you will get a response,

Read this line very carefully thrice, the browser will go to the webserver on the localhost, but on port 5000,
so , answer to the question what is the 5000 port number in that address? is that the webserver will try to find a response from port number 5000 , it will not go and find response on any other location .
read more about port numbers here
I hope it makes sense to you !
Thanks !


问:
Javascript function not triggering on html page load/ refresh
I want a javascript function to give me the results as soon as the page loads in. It is returning the list of folder names. I am not a developer so this is something I am making to demo my research to a client and therefore I am running into small issues.
In my index.html I have incorporated a js function inside the  tag and I call that function in my <p> tag via a ID like this:</p>
```<code><script>
    var list_dir = function(){
      const path = require('path');
      const fs = require('fs');
      //joining path of directory
      const directoryPath = path.join(__dirname, 'Images');
      //passsing directoryPath and callback function
      fs.readdir(directoryPath, function (err, files) {
        //listing all files using forEach
        files.forEach(function (file) {
          // Do whatever you want to do with the file
          //let names=file
          console.log(file);
        });
      });
    }
    </script>
<p id="list_dir>list of folders:</p>

</code>```

答: You are using client-side javascript and not node.js. Therefore, you can't use require(), path, fs, etc.

Body:
I want a javascript function to give me the results as soon as the page loads in. It is returning the list of folder names. I am not a developer so this is something I am making to demo my research to a client and therefore I am running into small issues.
In my index.html I have incorporated a js function inside the  tag and I call that function in my
 tag via a ID like this:

list of folders:


问:
Aggregate timeline between overlapping date rows in SQL
We are creating an data set that looks at customer usage of company's products and where there is an overlap between usage of different products, create a time range that shows the entire period which shows the usage of any product. Where is a gap between end of usage of product and a new start of purchase, that is to be shown as different journey. Sample source data below

The required output at customer Level:

Rules: 1) Since the customer 1001 have started using P11 product before the end date of P10, those should be a continuous journey and the start date should be of row 1 and end date should be of row2.

There is a gap between end date of row 2 and 3, i.e customer 1001 in using any product and this has to be shown as separate journey
Basically to create aggregation at customer level per continuous acquisition time period

How can we achieve this using plain SQL. Any pointers would highly helpful.

答:
This is a simple task for a Teradata extension to Standard SQL: NORMALIZE.

```<code>with cte as
 (
   select NORMALIZE -- combine overlapping periods
      customer_id
     ,period(start_date, end_date) as pd
   from mytable
 )
select
   customer_id
  ,trim(customer_id) || '-'
   || trim(row_number() over (partition by customer_id order by pd)
  ,begin(pd) -- split the period
  ,end(pd)   -- back into individual columns
from cte
</code>```

As NORMALIZE works on periods only, you need to create one using period(start_date, end_date). Periods include the start, but exclude the end, if your logic is different, you might have to switch to period(start_date, end_date+1) and last(pd) instead of end(pd).

Body:
This is a simple task for a Teradata extension to Standard SQL: NORMALIZE.

with cte as
 (
   select NORMALIZE -- combine overlapping periods
      customer_id
     ,period(start_date, end_date) as pd
   from mytable
 )
select
   customer_id
  ,trim(customer_id) || '-'
   || trim(row_number() over (partition by customer_id order by pd)
  ,begin(pd) -- split the period
  ,end(pd)   -- back into individual columns
from cte

As NORMALIZE works on periods only, you need to create one using period(start_date, end_date). Periods include the start, but exclude the end, if your logic is different, you might have to switch to period(start_date, end_date+1) and last(pd) instead of end(pd).


问:
PAGE_FAULT_IN_NONPAGED_AREA - Pytorch
The BSOD follows the opening of a VRAM-intensive application while training runs on the GPU. I've opened such applications regularly in the past without problems, with even bigger models, and the applications would utilize shared memory if they didn't have enough (which training cannot do) - no clue what's different now.

Training runs in __main__ under try-except, and the dump file informs (as here),

Typically, the referenced address is in freed memory or is simply invalid. This cannot be protected by a try - except handler -- it can only be protected by a probe or similar programming techniques.

If I replace with try-finally, it's nearly the same message, except it does say try-finally instead, despite there being numerous try-excepts leading in non-__main__ code. I've yet to try running without try in __main__.

Training runs via PyTorch Lightning, AMP16, no multiprocessing. It's not easily reproduced, and the dump file doesn't seem to point to Python code. How can this be debugged?

Env info: Windows 10 x64, RTX 2080 Super, AMD Ryzen 5 3600, BIOS 4602, latest drivers

Python 3.8.12, pytorch 1.10.0, pytorch-lightning 1.5.7

Dump summary:

```<code>************* Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*
Symbol search path is: srv*
Executable search path is:
Windows 10 Kernel Version 19041 MP (12 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS Personal
Edition build lab: 19041.1.amd64fre.vb_release.191206-1406
Machine Name:
Kernel base = 0xfffff803`80e00000 PsLoadedModuleList = 0xfffff803`81a2a2b0
Debug session time: Fri Jan 21 19:46:53.513 2022 (UTC + 4:00)
System Uptime: 0 days 0:57:47.148
Loading Kernel Symbols
...............................................................
................................................................
................................................................
..........................
Loading User Symbols
PEB is paged out (Peb.Ldr = 00000099`5954d018).  Type ".hh dbgerr001" for details
Loading unloaded module list
............
For analysis of this file, run !analyze -v
nt!KeBugCheckEx:
fffff803`811f72e0 48894c2408      mov     qword ptr [rsp+8],rcx ss:0018:ffffd48c`001d3c10=0000000000000050
0: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced.  This cannot be protected by try-except.
Typically the address is just plain bad or it is pointing at freed memory.
Arguments:
Arg1: ffff9b84f54fe000, memory referenced.
Arg2: 0000000000000002, value 0 = read operation, 1 = write operation.
Arg3: fffff803966bd413, If non-zero, the instruction address which referenced the bad memory
    address.
Arg4: 0000000000000000, (reserved)

Debugging Details:
------------------

KEY_VALUES_STRING: 1

    Key  : AV.Type
    Value: Write

    Key  : Analysis.CPU.mSec
    Value: 4937

    Key  : Analysis.DebugAnalysisManager
    Value: Create

    Key  : Analysis.Elapsed.mSec
    Value: 7978

    Key  : Analysis.Init.CPU.mSec
    Value: 734

    Key  : Analysis.Init.Elapsed.mSec
    Value: 7797

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 85

    Key  : WER.OS.Branch
    Value: vb_release

    Key  : WER.OS.Timestamp
    Value: 2019-12-06T14:06:00Z

    Key  : WER.OS.Version
    Value: 10.0.19041.1

FILE_IN_CAB:  MEMORY.DMP

BUGCHECK_CODE:  50

BUGCHECK_P1: ffff9b84f54fe000

BUGCHECK_P2: 2

BUGCHECK_P3: fffff803966bd413

BUGCHECK_P4: 0

READ_ADDRESS:  ffff9b84f54fe000 Paged pool

MM_INTERNAL_CODE:  0

IMAGE_NAME:  nvlddmkm.sys

MODULE_NAME: nvlddmkm

FAULTING_MODULE: fffff80395f30000 nvlddmkm

BLACKBOXBSD: 1 (!blackboxbsd)

BLACKBOXNTFS: 1 (!blackboxntfs)

BLACKBOXPNP: 1 (!blackboxpnp)

BLACKBOXWINLOGON: 1

PROCESS_NAME:  python.exe

TRAP_FRAME:  ffffd48c001d3eb0 -- (.trap 0xffffd48c001d3eb0)
NOTE: The trap frame does not contain all registers.
Some register values may be zeroed or incorrect.
rax=ffff9b84f54fd278 rbx=0000000000000000 rcx=ffff9b84f54fe010
rdx=00005c7ea1422a48 rsi=0000000000000000 rdi=0000000000000000
rip=fffff803966bd413 rsp=ffffd48c001d4048 rbp=ffff9b84f54e2000
 r8=0000000000000000  r9=0000000000000012 r10=0000000000000000
r11=fffff80396920ed8 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei pl nz na po nc
nvlddmkm+0x78d413:
fffff803`966bd413 0f2941f0        movaps  xmmword ptr [rcx-10h],xmm0 ds:ffff9b84`f54fe000=????????????????????????????????
Resetting default scope

STACK_TEXT:
ffffd48c`001d3c08 fffff803`8124a81f     : 00000000`00000050 ffff9b84`f54fe000 00000000`00000002 ffffd48c`001d3eb0 : nt!KeBugCheckEx
ffffd48c`001d3c10 fffff803`8109f4d0     : 00000001`00000000 00000000`00000002 ffffd48c`001d3f30 00000000`00000000 : nt!MiSystemFault+0x18d32f
ffffd48c`001d3d10 fffff803`8120545e     : 00000000`00000000 00000000`00000001 fffff803`81a50bc0 ffff9b84`f54fd000 : nt!MmAccessFault+0x400
ffffd48c`001d3eb0 fffff803`966bd413     : fffff803`96c589ad fffff803`968dee68 00000000`00000000 00000000`00000000 : nt!KiPageFault+0x35e
ffffd48c`001d4048 fffff803`96c589ad     : fffff803`968dee68 00000000`00000000 00000000`00000000 00000000`00000000 : nvlddmkm+0x78d413
ffffd48c`001d4050 fffff803`96c70d46     : 00000000`00000000 ffffd48c`001d4100 ffff8b06`09f02000 ffff9b84`f54e2000 : nvlddmkm!nvDumpConfig+0x3e750d
ffffd48c`001d4090 fffff803`96d03f47     : ffffd48c`001d4260 fffff803`81a4f0c0 00000000`00000001 ffffd48c`001d46b8 : nvlddmkm!nvDumpConfig+0x3ff8a6
ffffd48c`001d4140 fffff803`96d05607     : 00000000`c000000d ffffd48c`001d4280 00000000`00000001 ffff8b06`09f02000 : nvlddmkm!nvDumpConfig+0x492aa7
ffffd48c`001d4180 fffff803`96c8b9a3     : 00000000`c000000d ffffd48c`001d4469 ffffd48c`001d46b8 00000000`c000000d : nvlddmkm!nvDumpConfig+0x494167
ffffd48c`001d43e0 fffff803`90e1afba     : 00000000`00000000 ffff8b06`744ad300 00000000`00000000 00000000`4e562a2a : nvlddmkm!nvDumpConfig+0x41a503
ffffd48c`001d44d0 fffff803`90cf9c39     : ffff8b06`0f21b868 ffffd48c`00000000 ffff8b06`0f21b868 ffffffff`ffffffff : dxgkrnl!TdrIsEnabled+0x821ca
ffffd48c`001d4580 fffff803`81208cb8     : 00000206`40efb900 ffff8b06`1d426080 00000000`00000000 ffff8b06`00000000 : dxgkrnl!NtGdiDdDDIEscape+0x1879
ffffd48c`001d4b00 00007fff`b2bf4be4     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nt!KiSystemServiceCopyEnd+0x28
00000099`5b30def8 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : 0x00007fff`b2bf4be4

SYMBOL_NAME:  nvlddmkm+78d413

STACK_COMMAND:  .cxr; .ecxr ; kb

BUCKET_ID_FUNC_OFFSET:  78d413

FAILURE_BUCKET_ID:  AV_W_(null)_nvlddmkm!unknown_function

OS_VERSION:  10.0.19041.1

BUILDLAB_STR:  vb_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

FAILURE_ID_HASH:  {838100fa-f28b-2ef7-d702-e31713cb338c}

Followup:     MachineOwner
---------
</code>```

Full dump (~5GB uncompressed)

答:
I had the same issue. PAGE_FAULT_IN_NONPAGED_AREA, nvlddmkm.sys, python.exe running pytorch. I was able to reproduce it consistently.

The solution was to use DDU to nuke the NVIDIA drivers, then let Windows Update install their version of the NVIDIA drivers (which tend to be more stable).

Title: PAGE_FAULT_IN_NONPAGED_AREA - Pytorch

Body:
The BSOD follows the opening of a VRAM-intensive application while training runs on the GPU. I've opened such applications regularly in the past without problems, with even bigger models, and the applications would utilize shared memory if they didn't have enough (which training cannot do) - no clue what's different now.

Training runs in __main__ under try-except, and the dump file informs (as here),

Typically, the referenced address is in freed memory or is simply invalid. This cannot be protected by a try - except handler -- it can only be protected by a probe or similar programming techniques.

If I replace with try-finally, it's nearly the same message, except it does say try-finally instead, despite there being numerous try-excepts leading in non-__main__ code. I've yet to try running without try in __main__.

Training runs via PyTorch Lightning, AMP16, no multiprocessing. It's not easily reproduced, and the dump file doesn't seem to point to Python code. How can this be debugged?

Env info: Windows 10 x64, RTX 2080 Super, AMD Ryzen 5 3600, BIOS 4602, latest drivers

Python 3.8.12, pytorch 1.10.0, pytorch-lightning 1.5.7

Dump summary:

************* Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*
Symbol search path is: srv*
Executable search path is:
Windows 10 Kernel Version 19041 MP (12 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS Personal
Edition build lab: 19041.1.amd64fre.vb_release.191206-1406
Machine Name:
Kernel base = 0xfffff803`80e00000 PsLoadedModuleList = 0xfffff803`81a2a2b0
Debug session time: Fri Jan 21 19:46:53.513 2022 (UTC + 4:00)
System Uptime: 0 days 0:57:47.148
Loading Kernel Symbols
...............................................................
................................................................
................................................................
..........................
Loading User Symbols
PEB is paged out (Peb.Ldr = 00000099`5954d018).  Type ".hh dbgerr001" for details
Loading unloaded module list
............
For analysis of this file, run !analyze -v
nt!KeBugCheckEx:
fffff803`811f72e0 48894c2408      mov     qword ptr [rsp+8],rcx ss:0018:ffffd48c`001d3c10=0000000000000050
0: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced.  This cannot be protected by try-except.
Typically the address is just plain bad or it is pointing at freed memory.
Arguments:
Arg1: ffff9b84f54fe000, memory referenced.
Arg2: 0000000000000002, value 0 = read operation, 1 = write operation.
Arg3: fffff803966bd413, If non-zero, the instruction address which referenced the bad memory
    address.
Arg4: 0000000000000000, (reserved)

Debugging Details:
------------------

KEY_VALUES_STRING: 1

    Key  : AV.Type
    Value: Write

    Key  : Analysis.CPU.mSec
    Value: 4937

    Key  : Analysis.DebugAnalysisManager
    Value: Create

    Key  : Analysis.Elapsed.mSec
    Value: 7978

    Key  : Analysis.Init.CPU.mSec
    Value: 734

    Key  : Analysis.Init.Elapsed.mSec
    Value: 7797

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 85

    Key  : WER.OS.Branch
    Value: vb_release

    Key  : WER.OS.Timestamp
    Value: 2019-12-06T14:06:00Z

    Key  : WER.OS.Version
    Value: 10.0.19041.1

FILE_IN_CAB:  MEMORY.DMP

BUGCHECK_CODE:  50

BUGCHECK_P1: ffff9b84f54fe000

BUGCHECK_P2: 2

BUGCHECK_P3: fffff803966bd413

BUGCHECK_P4: 0

READ_ADDRESS:  ffff9b84f54fe000 Paged pool

MM_INTERNAL_CODE:  0

IMAGE_NAME:  nvlddmkm.sys

MODULE_NAME: nvlddmkm

FAULTING_MODULE: fffff80395f30000 nvlddmkm

BLACKBOXBSD: 1 (!blackboxbsd)

BLACKBOXNTFS: 1 (!blackboxntfs)

BLACKBOXPNP: 1 (!blackboxpnp)

BLACKBOXWINLOGON: 1

PROCESS_NAME:  python.exe

TRAP_FRAME:  ffffd48c001d3eb0 -- (.trap 0xffffd48c001d3eb0)
NOTE: The trap frame does not contain all registers.
Some register values may be zeroed or incorrect.
rax=ffff9b84f54fd278 rbx=0000000000000000 rcx=ffff9b84f54fe010
rdx=00005c7ea1422a48 rsi=0000000000000000 rdi=0000000000000000
rip=fffff803966bd413 rsp=ffffd48c001d4048 rbp=ffff9b84f54e2000
 r8=0000000000000000  r9=0000000000000012 r10=0000000000000000
r11=fffff80396920ed8 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei pl nz na po nc
nvlddmkm+0x78d413:
fffff803`966bd413 0f2941f0        movaps  xmmword ptr [rcx-10h],xmm0 ds:ffff9b84`f54fe000=????????????????????????????????
Resetting default scope

STACK_TEXT:
ffffd48c`001d3c08 fffff803`8124a81f     : 00000000`00000050 ffff9b84`f54fe000 00000000`00000002 ffffd48c`001d3eb0 : nt!KeBugCheckEx
ffffd48c`001d3c10 fffff803`8109f4d0     : 00000001`00000000 00000000`00000002 ffffd48c`001d3f30 00000000`00000000 : nt!MiSystemFault+0x18d32f
ffffd48c`001d3d10 fffff803`8120545e     : 00000000`00000000 00000000`00000001 fffff803`81a50bc0 ffff9b84`f54fd000 : nt!MmAccessFault+0x400
ffffd48c`001d3eb0 fffff803`966bd413     : fffff803`96c589ad fffff803`968dee68 00000000`00000000 00000000`00000000 : nt!KiPageFault+0x35e
ffffd48c`001d4048 fffff803`96c589ad     : fffff803`968dee68 00000000`00000000 00000000`00000000 00000000`00000000 : nvlddmkm+0x78d413
ffffd48c`001d4050 fffff803`96c70d46     : 00000000`00000000 ffffd48c`001d4100 ffff8b06`09f02000 ffff9b84`f54e2000 : nvlddmkm!nvDumpConfig+0x3e750d
ffffd48c`001d4090 fffff803`96d03f47     : ffffd48c`001d4260 fffff803`81a4f0c0 00000000`00000001 ffffd48c`001d46b8 : nvlddmkm!nvDumpConfig+0x3ff8a6
ffffd48c`001d4140 fffff803`96d05607     : 00000000`c000000d ffffd48c`001d4280 00000000`00000001 ffff8b06`09f02000 : nvlddmkm!nvDumpConfig+0x492aa7
ffffd48c`001d4180 fffff803`96c8b9a3     : 00000000`c000000d ffffd48c`001d4469 ffffd48c`001d46b8 00000000`c000000d : nvlddmkm!nvDumpConfig+0x494167
ffffd48c`001d43e0 fffff803`90e1afba     : 00000000`00000000 ffff8b06`744ad300 00000000`00000000 00000000`4e562a2a : nvlddmkm!nvDumpConfig+0x41a503
ffffd48c`001d44d0 fffff803`90cf9c39     : ffff8b06`0f21b868 ffffd48c`00000000 ffff8b06`0f21b868 ffffffff`ffffffff : dxgkrnl!TdrIsEnabled+0x821ca
ffffd48c`001d4580 fffff803`81208cb8     : 00000206`40efb900 ffff8b06`1d426080 00000000`00000000 ffff8b06`00000000 : dxgkrnl!NtGdiDdDDIEscape+0x1879
ffffd48c`001d4b00 00007fff`b2bf4be4     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nt!KiSystemServiceCopyEnd+0x28
00000099`5b30def8 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : 0x00007fff`b2bf4be4

SYMBOL_NAME:  nvlddmkm+78d413

STACK_COMMAND:  .cxr; .ecxr ; kb

BUCKET_ID_FUNC_OFFSET:  78d413

FAILURE_BUCKET_ID:  AV_W_(null)_nvlddmkm!unknown_function

OS_VERSION:  10.0.19041.1

BUILDLAB_STR:  vb_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

FAILURE_ID_HASH:  {838100fa-f28b-2ef7-d702-e31713cb338c}

Followup:     MachineOwner
---------

Full dump (~5GB uncompressed)